From 7b02207537d35bfa1714bf8beafc921f717d100a Mon Sep 17 00:00:00 2001
From: 单军华
Date: Wed, 11 Jul 2018 10:47:42 +0800
Subject: [PATCH] 首次上传

---
 screendisplay/Pods/EaseUI/EaseUI/EMUIKit/Views/conversation/MessageCellBubbleView/EaseBubbleView+Voice.m |  104 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 104 insertions(+), 0 deletions(-)

diff --git a/screendisplay/Pods/EaseUI/EaseUI/EMUIKit/Views/conversation/MessageCellBubbleView/EaseBubbleView+Voice.m b/screendisplay/Pods/EaseUI/EaseUI/EMUIKit/Views/conversation/MessageCellBubbleView/EaseBubbleView+Voice.m
new file mode 100755
index 0000000..81b3879
--- /dev/null
+++ b/screendisplay/Pods/EaseUI/EaseUI/EMUIKit/Views/conversation/MessageCellBubbleView/EaseBubbleView+Voice.m
@@ -0,0 +1,104 @@
+/************************************************************
+ *  * Hyphenate CONFIDENTIAL
+ * __________________
+ * Copyright (C) 2016 Hyphenate Inc. All rights reserved.
+ *
+ * NOTICE: All information contained herein is, and remains
+ * the property of Hyphenate Inc.
+ * Dissemination of this information or reproduction of this material
+ * is strictly forbidden unless prior written permission is obtained
+ * from Hyphenate Inc.
+ */
+
+#import "EaseBubbleView+Voice.h"
+
+#define ISREAD_VIEW_SIZE 10.f
+
+@implementation EaseBubbleView (Voice)
+
+#pragma mark - private
+
+- (void)_setupVoiceBubbleMarginConstraints
+{
+    [self.marginConstraints removeAllObjects];
+    
+    //image view
+    NSLayoutConstraint *imageWithMarginTopConstraint = [NSLayoutConstraint constraintWithItem:self.voiceImageView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.backgroundImageView attribute:NSLayoutAttributeTop multiplier:1.0 constant:self.margin.top];
+    NSLayoutConstraint *imageWithMarginBottomConstraint = [NSLayoutConstraint constraintWithItem:self.voiceImageView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.backgroundImageView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-self.margin.bottom];
+    [self.marginConstraints addObject:imageWithMarginTopConstraint];
+    [self.marginConstraints addObject:imageWithMarginBottomConstraint];
+
+    //duration label
+    NSLayoutConstraint *durationWithMarginTopConstraint = [NSLayoutConstraint constraintWithItem:self.voiceDurationLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.backgroundImageView attribute:NSLayoutAttributeTop multiplier:1.0 constant:self.margin.top];
+    NSLayoutConstraint *durationWithMarginBottomConstraint = [NSLayoutConstraint constraintWithItem:self.voiceDurationLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.backgroundImageView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-self.margin.bottom];
+    [self.marginConstraints addObject:durationWithMarginTopConstraint];
+    [self.marginConstraints addObject:durationWithMarginBottomConstraint];
+    
+    if(self.isSender){
+        NSLayoutConstraint *imageWithMarginRightConstraint = [NSLayoutConstraint constraintWithItem:self.voiceImageView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.backgroundImageView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-self.margin.right];
+        [self.marginConstraints addObject:imageWithMarginRightConstraint];
+        
+        NSLayoutConstraint *durationLeftConstraint = [NSLayoutConstraint constraintWithItem:self.voiceDurationLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.backgroundImageView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:self.margin.left];
+        [self.marginConstraints addObject:durationLeftConstraint];
+    }
+    else{
+        NSLayoutConstraint *imageWithMarginLeftConstraint = [NSLayoutConstraint constraintWithItem:self.voiceImageView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.backgroundImageView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:self.margin.left];
+        [self.marginConstraints addObject:imageWithMarginLeftConstraint];
+        
+        NSLayoutConstraint *durationRightConstraint = [NSLayoutConstraint constraintWithItem:self.voiceDurationLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.backgroundImageView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-self.margin.right];
+        [self.marginConstraints addObject:durationRightConstraint];
+        
+        [self.marginConstraints addObject:[NSLayoutConstraint constraintWithItem:self.isReadView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.backgroundImageView attribute:NSLayoutAttributeRight multiplier:1.0 constant:ISREAD_VIEW_SIZE/2]];
+        [self.marginConstraints addObject:[NSLayoutConstraint constraintWithItem:self.isReadView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.backgroundImageView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-ISREAD_VIEW_SIZE/2]];
+        [self.marginConstraints addObject:[NSLayoutConstraint constraintWithItem:self.isReadView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.backgroundImageView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0]];
+        [self.marginConstraints addObject:[NSLayoutConstraint constraintWithItem:self.isReadView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.backgroundImageView attribute:NSLayoutAttributeTop multiplier:1.0 constant:ISREAD_VIEW_SIZE]];
+    }
+    
+    [self addConstraints:self.marginConstraints];
+}
+
+- (void)_setupVoiceBubbleConstraints
+{
+    if (self.isSender) {
+        self.isReadView.hidden = YES;
+    }
+    [self _setupVoiceBubbleMarginConstraints];
+}
+
+#pragma mark - public
+
+- (void)setupVoiceBubbleView
+{
+    self.voiceImageView = [[UIImageView alloc] init];
+    self.voiceImageView.translatesAutoresizingMaskIntoConstraints = NO;
+    self.voiceImageView.backgroundColor = [UIColor clearColor];
+    self.voiceImageView.animationDuration = 1;
+    [self.backgroundImageView addSubview:self.voiceImageView];
+    
+    self.voiceDurationLabel = [[UILabel alloc] init];
+    self.voiceDurationLabel.translatesAutoresizingMaskIntoConstraints = NO;
+    self.voiceDurationLabel.backgroundColor = [UIColor clearColor];
+    [self.backgroundImageView addSubview:self.voiceDurationLabel];
+    
+    self.isReadView = [[UIImageView alloc] init];
+    self.isReadView.translatesAutoresizingMaskIntoConstraints = NO;
+    self.isReadView.layer.cornerRadius = ISREAD_VIEW_SIZE/2;
+    self.isReadView.clipsToBounds = YES;
+    self.isReadView.backgroundColor = [UIColor redColor];
+    [self.backgroundImageView addSubview:self.isReadView];
+    
+    [self _setupVoiceBubbleConstraints];
+}
+
+- (void)updateVoiceMargin:(UIEdgeInsets)margin
+{
+    if (_margin.top == margin.top && _margin.bottom == margin.bottom && _margin.left == margin.left && _margin.right == margin.right) {
+        return;
+    }
+    _margin = margin;
+    
+    [self removeConstraints:self.marginConstraints];
+    [self _setupVoiceBubbleMarginConstraints];
+}
+
+@end

--
Gitblit v1.8.0