2
0
Quellcode durchsuchen

语音页面UI修改

桂欢 vor 1 Jahr
Ursprung
Commit
cd02305e33
21 geänderte Dateien mit 97 neuen und 30 gelöschten Zeilen
  1. BIN
      SLAiELTS/SLAiELTS/Assets.xcassets/My/icon_mike_cancel_sel.imageset/icon_mike_cancel_sel@2x.png
  2. BIN
      SLAiELTS/SLAiELTS/Assets.xcassets/My/icon_mike_cancel_sel.imageset/icon_mike_cancel_sel@3x.png
  3. BIN
      SLAiELTS/SLAiELTS/Assets.xcassets/My/icon_mike_input_bg.imageset/icon_mike_input_bg@2x.png
  4. BIN
      SLAiELTS/SLAiELTS/Assets.xcassets/My/icon_mike_input_bg.imageset/icon_mike_input_bg@3x.png
  5. 0 0
      SLAiELTS/SLAiELTS/Assets.xcassets/other/icon_mike_cancel_sel.imageset/Contents.json
  6. BIN
      SLAiELTS/SLAiELTS/Assets.xcassets/other/icon_mike_cancel_sel.imageset/icon_mike_cancel_sel@2x.png
  7. BIN
      SLAiELTS/SLAiELTS/Assets.xcassets/other/icon_mike_cancel_sel.imageset/icon_mike_cancel_sel@3x.png
  8. 22 0
      SLAiELTS/SLAiELTS/Assets.xcassets/other/icon_mike_dh_bg.imageset/Contents.json
  9. BIN
      SLAiELTS/SLAiELTS/Assets.xcassets/other/icon_mike_dh_bg.imageset/icon_mike_dh_bg@2x.png
  10. BIN
      SLAiELTS/SLAiELTS/Assets.xcassets/other/icon_mike_dh_bg.imageset/icon_mike_dh_bg@3x.png
  11. 0 0
      SLAiELTS/SLAiELTS/Assets.xcassets/other/icon_mike_input_bg.imageset/Contents.json
  12. BIN
      SLAiELTS/SLAiELTS/Assets.xcassets/other/icon_mike_input_bg.imageset/icon_mike_input_bg@2x.png
  13. BIN
      SLAiELTS/SLAiELTS/Assets.xcassets/other/icon_mike_input_bg.imageset/icon_mike_input_bg@3x.png
  14. 22 0
      SLAiELTS/SLAiELTS/Assets.xcassets/other/icon_mike_input_bg_sel.imageset/Contents.json
  15. BIN
      SLAiELTS/SLAiELTS/Assets.xcassets/other/icon_mike_input_bg_sel.imageset/icon_mike_input_bg_sel@2x.png
  16. BIN
      SLAiELTS/SLAiELTS/Assets.xcassets/other/icon_mike_input_bg_sel.imageset/icon_mike_input_bg_sel@3x.png
  17. 3 3
      SLAiELTS/SLAiELTS/ViewControllers/FriendsVC/Views/SLRecomFriendsCell.xib
  18. 1 0
      SLAiELTS/SLAiELTS/ViewControllers/MessageVC/Views/SLMikeInputView.h
  19. 25 16
      SLAiELTS/SLAiELTS/ViewControllers/MessageVC/Views/SLMikeInputView.m
  20. 23 10
      SLAiELTS/SLAiELTS/ViewControllers/MessageVC/Views/SLMikeInputView.xib
  21. 1 1
      SLAiELTS/SLAiELTS/ViewControllers/RoleLabelVC/Models/SLNuiSpeechRecognizer.m

BIN
SLAiELTS/SLAiELTS/Assets.xcassets/My/icon_mike_cancel_sel.imageset/icon_mike_cancel_sel@2x.png


BIN
SLAiELTS/SLAiELTS/Assets.xcassets/My/icon_mike_cancel_sel.imageset/icon_mike_cancel_sel@3x.png


BIN
SLAiELTS/SLAiELTS/Assets.xcassets/My/icon_mike_input_bg.imageset/icon_mike_input_bg@2x.png


BIN
SLAiELTS/SLAiELTS/Assets.xcassets/My/icon_mike_input_bg.imageset/icon_mike_input_bg@3x.png


+ 0 - 0
SLAiELTS/SLAiELTS/Assets.xcassets/My/icon_mike_cancel_sel.imageset/Contents.json → SLAiELTS/SLAiELTS/Assets.xcassets/other/icon_mike_cancel_sel.imageset/Contents.json


BIN
SLAiELTS/SLAiELTS/Assets.xcassets/other/icon_mike_cancel_sel.imageset/icon_mike_cancel_sel@2x.png


BIN
SLAiELTS/SLAiELTS/Assets.xcassets/other/icon_mike_cancel_sel.imageset/icon_mike_cancel_sel@3x.png


+ 22 - 0
SLAiELTS/SLAiELTS/Assets.xcassets/other/icon_mike_dh_bg.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "icon_mike_dh_bg@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "icon_mike_dh_bg@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
SLAiELTS/SLAiELTS/Assets.xcassets/other/icon_mike_dh_bg.imageset/icon_mike_dh_bg@2x.png


BIN
SLAiELTS/SLAiELTS/Assets.xcassets/other/icon_mike_dh_bg.imageset/icon_mike_dh_bg@3x.png


+ 0 - 0
SLAiELTS/SLAiELTS/Assets.xcassets/My/icon_mike_input_bg.imageset/Contents.json → SLAiELTS/SLAiELTS/Assets.xcassets/other/icon_mike_input_bg.imageset/Contents.json


BIN
SLAiELTS/SLAiELTS/Assets.xcassets/other/icon_mike_input_bg.imageset/icon_mike_input_bg@2x.png


BIN
SLAiELTS/SLAiELTS/Assets.xcassets/other/icon_mike_input_bg.imageset/icon_mike_input_bg@3x.png


+ 22 - 0
SLAiELTS/SLAiELTS/Assets.xcassets/other/icon_mike_input_bg_sel.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "icon_mike_input_bg_sel@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "icon_mike_input_bg_sel@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
SLAiELTS/SLAiELTS/Assets.xcassets/other/icon_mike_input_bg_sel.imageset/icon_mike_input_bg_sel@2x.png


BIN
SLAiELTS/SLAiELTS/Assets.xcassets/other/icon_mike_input_bg_sel.imageset/icon_mike_input_bg_sel@3x.png


+ 3 - 3
SLAiELTS/SLAiELTS/ViewControllers/FriendsVC/Views/SLRecomFriendsCell.xib

@@ -42,7 +42,7 @@
                         <nil key="highlightedColor"/>
                     </label>
                     <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="025-jW-ZrE">
-                        <rect key="frame" x="306" y="43" width="56" height="28"/>
+                        <rect key="frame" x="306" y="38" width="56" height="28"/>
                         <color key="backgroundColor" red="0.086274509799999996" green="0.46666666670000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
                         <constraints>
                             <constraint firstAttribute="height" constant="28" id="3bc-2w-ZrQ"/>
@@ -61,7 +61,7 @@
                         </connections>
                     </button>
                     <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="zKX-M5-UHx">
-                        <rect key="frame" x="242" y="43" width="56" height="28"/>
+                        <rect key="frame" x="242" y="38" width="56" height="28"/>
                         <color key="backgroundColor" red="0.96078431372549022" green="0.97254901960784312" blue="0.96862745098039216" alpha="1" colorSpace="calibratedRGB"/>
                         <constraints>
                             <constraint firstAttribute="height" constant="28" id="cjP-fF-9Mx"/>
@@ -88,7 +88,7 @@
                     <constraint firstAttribute="trailing" secondItem="025-jW-ZrE" secondAttribute="trailing" constant="12" id="LLX-sG-vWX"/>
                     <constraint firstItem="XOL-Cc-SRD" firstAttribute="leading" secondItem="C25-qG-NjY" secondAttribute="leading" id="bdu-hA-7Ig"/>
                     <constraint firstItem="025-jW-ZrE" firstAttribute="leading" secondItem="zKX-M5-UHx" secondAttribute="trailing" constant="8" id="f9Y-Rz-WVY"/>
-                    <constraint firstItem="025-jW-ZrE" firstAttribute="centerY" secondItem="Kih-80-ush" secondAttribute="centerY" id="gDC-cA-frd"/>
+                    <constraint firstItem="025-jW-ZrE" firstAttribute="centerY" secondItem="Kih-80-ush" secondAttribute="centerY" constant="-5" id="gDC-cA-frd"/>
                     <constraint firstItem="Kih-80-ush" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="jN2-br-OTG"/>
                     <constraint firstItem="Kih-80-ush" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="jOy-j1-d4A"/>
                     <constraint firstItem="C25-qG-NjY" firstAttribute="centerY" secondItem="Kih-80-ush" secondAttribute="centerY" id="vKR-CJ-I7t"/>

+ 1 - 0
SLAiELTS/SLAiELTS/ViewControllers/MessageVC/Views/SLMikeInputView.h

@@ -13,6 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
 @interface SLMikeInputView : UIView
 
 @property (weak, nonatomic) IBOutlet UIImageView *mikeInputImageView;
+@property (weak, nonatomic) IBOutlet UILabel *mikeLabel;
 
 @property (strong, nonatomic) IBOutlet UIView *contentView;
 

+ 25 - 16
SLAiELTS/SLAiELTS/ViewControllers/MessageVC/Views/SLMikeInputView.m

@@ -40,31 +40,36 @@
     [self addGestureRecognizer:gesture];
 //    gesture.numberOfTouchesRequired = 1;
     UIImage *img = self.mikeInputImageView.image;
-    [img resizableImageWithCapInsets:UIEdgeInsetsMake(60, 0, 0, 0) resizingMode:UIImageResizingModeStretch];
+    [img resizableImageWithCapInsets:UIEdgeInsetsMake(90, 0, 0, 0) resizingMode:UIImageResizingModeStretch];
     self.mikeInputImageView.image = img;
-    CGFloat h = 143 / 750.0 * kSCREEN_WIDTH + kSafeAreaBottom;
+    CGFloat h = 110 + kSafeAreaBottom;
     self.imgHeightConst.constant = h;
     self.clipsToBounds = YES;
     self.contentView.hidden = YES;
     [self nuiSpeechRecognizer];
     
     WS(weakSelf);
+    __block CGFloat bSendTime = 0.0;
     self.nuiSpeechRecognizer.onVolumeChangedBlock = ^(CGFloat volume) {
-        NSInteger v = 0;
-        if (volume + 160 < 96) {
-            v = (volume + 160) / 4;
-            dispatch_async(dispatch_get_main_queue(), ^{
-                weakSelf.mikeTipImageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"音波_000%02ld.png",v]];
-            });
-        }else {
-            v = (volume + 60) / 6;
-            dispatch_async(dispatch_get_main_queue(), ^{
-                weakSelf.mikeTipImageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"音波3_000%02ld.png",v]];
-            });
+        CGFloat sendTime = [[NSDate date] timeIntervalSince1970];
+        if (sendTime * 1000 - bSendTime > 160) {
+            bSendTime = sendTime * 1000;
+            NSInteger v = 0;
+            if (volume + 160 < 96) {
+                v = (volume + 160) / 4;
+                dispatch_async(dispatch_get_main_queue(), ^{
+                    weakSelf.mikeTipImageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"音波_000%02ld.png",v]];
+                });
+            }else {
+                v = (volume + 60) / 6;
+                dispatch_async(dispatch_get_main_queue(), ^{
+                    weakSelf.mikeTipImageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"音波3_000%02ld.png",v]];
+                });
+            }
+    //        NSInteger v = MIN(36, (volume + 160) / 4);
+            NSLog(@"===%ld==%f-%@---%f",v,volume,[NSString stringWithFormat:@"音波_000%02ld",v],sendTime);
+            
         }
-//        NSInteger v = MIN(36, (volume + 160) / 4);
-        NSLog(@"===%ld==%f-%@",v,volume,[NSString stringWithFormat:@"音波_000%02ld",v]);
-        
     };
 }
 
@@ -79,11 +84,15 @@
     BOOL isContainCancelPath = CGPathContainsPoint(cancelViewPath.CGPath, NULL, point, NO);
     if (isContainCancelPath) {
         self.mikeCancelImageView.image = ImageName(@"icon_mike_cancel_sel");
+        self.mikeInputImageView.image = ImageName(@"icon_mike_input_bg_sel");
+        self.mikeLabel.text = @"松开 取消";
         if (paramSender.state == UIGestureRecognizerStateEnded){
             self.contentView.hidden = YES;
             self.frame = self.oldRect;
         }
     }else{
+        self.mikeLabel.text = @"松开 发送";
+        self.mikeInputImageView.image = ImageName(@"icon_mike_input_bg");
         self.mikeCancelImageView.image = ImageName(@"icon_mike_cancel_nor");
     }
     if (paramSender.state == UIGestureRecognizerStateBegan) {

+ 23 - 10
SLAiELTS/SLAiELTS/ViewControllers/MessageVC/Views/SLMikeInputView.xib

@@ -11,9 +11,10 @@
         <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="SLMikeInputView">
             <connections>
                 <outlet property="contentView" destination="iN0-l3-epB" id="kDk-Gs-7bu"/>
-                <outlet property="imgHeightConst" destination="yOO-x2-4Nl" id="ngH-Gj-dkn"/>
+                <outlet property="imgHeightConst" destination="FLw-wn-43p" id="NtP-3Q-YAB"/>
                 <outlet property="mikeCancelImageView" destination="OVz-mu-onH" id="z9K-48-rRF"/>
                 <outlet property="mikeInputImageView" destination="76w-rg-8wP" id="gaC-fG-EWv"/>
+                <outlet property="mikeLabel" destination="dkF-D7-cqe" id="l2f-4J-3LM"/>
                 <outlet property="mikeTipImageView" destination="ezu-uj-IG6" id="vRd-vF-6kh"/>
             </connections>
         </placeholder>
@@ -23,39 +24,50 @@
             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
             <subviews>
                 <imageView clipsSubviews="YES" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_mike_input_bg" translatesAutoresizingMaskIntoConstraints="NO" id="76w-rg-8wP">
-                    <rect key="frame" x="0.0" y="772.66666666666663" width="390" height="71.333333333333371"/>
+                    <rect key="frame" x="0.0" y="733.66666666666663" width="390" height="110.33333333333337"/>
                     <constraints>
-                        <constraint firstAttribute="height" constant="71.329999999999998" id="yOO-x2-4Nl"/>
+                        <constraint firstAttribute="height" constant="110.33" id="FLw-wn-43p"/>
                     </constraints>
                 </imageView>
                 <label opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="松开 发送" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dkF-D7-cqe">
-                    <rect key="frame" x="166.66666666666666" y="747" width="56.666666666666657" height="15.666666666666629"/>
+                    <rect key="frame" x="166.66666666666666" y="708" width="56.666666666666657" height="15.666666666666629"/>
                     <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                     <fontDescription key="fontDescription" type="system" pointSize="13"/>
                     <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                     <nil key="highlightedColor"/>
                 </label>
                 <imageView clipsSubviews="YES" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_mike_cancel_nor" translatesAutoresizingMaskIntoConstraints="NO" id="OVz-mu-onH">
-                    <rect key="frame" x="165" y="666.66666666666663" width="60.333333333333343" height="60.333333333333371"/>
+                    <rect key="frame" x="165" y="627.66666666666663" width="60.333333333333343" height="60.333333333333371"/>
+                </imageView>
+                <imageView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_mike_dh_bg" translatesAutoresizingMaskIntoConstraints="NO" id="Q8R-sJ-vZY">
+                    <rect key="frame" x="115" y="376.66666666666669" width="160" height="75"/>
+                    <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                    <constraints>
+                        <constraint firstAttribute="width" constant="160" id="3ze-XL-Hl9"/>
+                        <constraint firstAttribute="height" constant="75" id="QbY-l2-ldS"/>
+                    </constraints>
                 </imageView>
                 <imageView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="音波_00001.png" translatesAutoresizingMaskIntoConstraints="NO" id="ezu-uj-IG6">
-                    <rect key="frame" x="145" y="437.33333333333331" width="100" height="53.666666666666686"/>
+                    <rect key="frame" x="115" y="376.66666666666669" width="160" height="75"/>
                     <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                     <constraints>
-                        <constraint firstAttribute="width" constant="100" id="Tpm-h1-ctV"/>
-                        <constraint firstAttribute="width" secondItem="ezu-uj-IG6" secondAttribute="height" multiplier="740:399" id="bNt-ZA-kzL"/>
+                        <constraint firstAttribute="height" constant="75" id="Eq7-qS-3C9"/>
                     </constraints>
                 </imageView>
             </subviews>
             <color key="backgroundColor" systemColor="systemBackgroundColor"/>
             <constraints>
                 <constraint firstAttribute="trailing" secondItem="76w-rg-8wP" secondAttribute="trailing" id="7J6-R3-8hR"/>
+                <constraint firstItem="Q8R-sJ-vZY" firstAttribute="trailing" secondItem="ezu-uj-IG6" secondAttribute="trailing" id="8Su-PS-kcG"/>
                 <constraint firstItem="dkF-D7-cqe" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="9w2-p4-wvp"/>
                 <constraint firstItem="OVz-mu-onH" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="IQ4-8I-Kur"/>
                 <constraint firstAttribute="bottom" secondItem="76w-rg-8wP" secondAttribute="bottom" id="NiK-bs-NnZ"/>
+                <constraint firstItem="Q8R-sJ-vZY" firstAttribute="top" secondItem="ezu-uj-IG6" secondAttribute="top" id="Oo6-WI-Pn7"/>
+                <constraint firstItem="Q8R-sJ-vZY" firstAttribute="leading" secondItem="ezu-uj-IG6" secondAttribute="leading" id="Uqq-Hb-4Wd"/>
                 <constraint firstItem="dkF-D7-cqe" firstAttribute="top" secondItem="OVz-mu-onH" secondAttribute="bottom" constant="20" id="aww-J7-pkg"/>
+                <constraint firstItem="Q8R-sJ-vZY" firstAttribute="bottom" secondItem="ezu-uj-IG6" secondAttribute="bottom" id="bEN-Zj-ht7"/>
                 <constraint firstItem="76w-rg-8wP" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="cyf-Ug-7Gb"/>
-                <constraint firstItem="ezu-uj-IG6" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" multiplier="1.1" id="i1i-ge-PYP"/>
+                <constraint firstItem="ezu-uj-IG6" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" multiplier="1.1" constant="-50" id="i1i-ge-PYP"/>
                 <constraint firstItem="ezu-uj-IG6" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="pi2-Fd-xoc"/>
                 <constraint firstItem="76w-rg-8wP" firstAttribute="top" secondItem="dkF-D7-cqe" secondAttribute="bottom" constant="10" id="yR5-D6-eYy"/>
             </constraints>
@@ -65,7 +77,8 @@
     </objects>
     <resources>
         <image name="icon_mike_cancel_nor" width="60.333332061767578" height="60.333332061767578"/>
-        <image name="icon_mike_input_bg" width="375.33334350585938" height="71.333335876464844"/>
+        <image name="icon_mike_dh_bg" width="160.33332824707031" height="75.666664123535156"/>
+        <image name="icon_mike_input_bg" width="375.33334350585938" height="110.33333587646484"/>
         <image name="音波_00001.png" width="740" height="400"/>
         <systemColor name="systemBackgroundColor">
             <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>

+ 1 - 1
SLAiELTS/SLAiELTS/ViewControllers/RoleLabelVC/Models/SLNuiSpeechRecognizer.m

@@ -259,7 +259,7 @@ static BOOL save_wav = YES;
 }
 
 -(void)onNuiRmsChanged:(float)rms {
-    TLog(@"onNuiRmsChanged rms=%f", rms);
+//    TLog(@"onNuiRmsChanged rms=%f", rms);
     if (self.onVolumeChangedBlock) {
         self.onVolumeChangedBlock(rms);
     }