Explorar el Código

拖拽选择优化;云知声集成

czq hace 2 años
padre
commit
4fb52b80da
Se han modificado 41 ficheros con 1758 adiciones y 22 borrados
  1. 2 0
      .idea/misc.xml
  2. 2 2
      app/build.gradle
  3. BIN
      app/libs/arm64-v8a/liblame.so
  4. BIN
      app/libs/arm64-v8a/libvadnn.so
  5. BIN
      app/libs/arm64-v8a/libyzs_usc.so
  6. BIN
      app/libs/armeabi-v7a/liblame.so
  7. BIN
      app/libs/armeabi-v7a/libvadnn.so
  8. BIN
      app/libs/armeabi-v7a/libyzs_usc.so
  9. BIN
      app/libs/armeabi/liblame.so
  10. BIN
      app/libs/armeabi/libvadnn.so
  11. BIN
      app/libs/armeabi/libyzs_usc.so
  12. BIN
      app/libs/mips/liblame.so
  13. BIN
      app/libs/mips/libvadnn.so
  14. BIN
      app/libs/mips/libyzs_usc.so
  15. BIN
      app/libs/mips64/liblame.so
  16. BIN
      app/libs/mips64/libvadnn.so
  17. BIN
      app/libs/mips64/libyzs_usc.so
  18. BIN
      app/libs/oraleval-android-sdk.jar
  19. BIN
      app/libs/x86/liblame.so
  20. BIN
      app/libs/x86/libvadnn.so
  21. BIN
      app/libs/x86/libyzs_usc.so
  22. BIN
      app/libs/x86_64/liblame.so
  23. BIN
      app/libs/x86_64/libvadnn.so
  24. BIN
      app/libs/x86_64/libyzs_usc.so
  25. 3 0
      app/src/main/AndroidManifest.xml
  26. 6 5
      app/src/main/java/com/xunao/effectdemo/activity/CountDownActivity.kt
  27. 163 13
      app/src/main/java/com/xunao/effectdemo/activity/DragSelectActivity.java
  28. 8 1
      app/src/main/java/com/xunao/effectdemo/activity/MainActivity.java
  29. 141 0
      app/src/main/java/com/xunao/effectdemo/yzs/ConfigBean.java
  30. 142 0
      app/src/main/java/com/xunao/effectdemo/yzs/YZSConfigActivity.java
  31. 610 0
      app/src/main/java/com/xunao/effectdemo/yzs/YZSDemoActivity.java
  32. 5 0
      app/src/main/res/drawable/check_box_bg.xml
  33. BIN
      app/src/main/res/drawable/check_disable.png
  34. BIN
      app/src/main/res/drawable/check_enable.png
  35. 6 0
      app/src/main/res/drawable/edit_bg.xml
  36. BIN
      app/src/main/res/drawable/icon.png
  37. 489 0
      app/src/main/res/layout/activity_config.xml
  38. 1 1
      app/src/main/res/layout/activity_count_down.xml
  39. 6 0
      app/src/main/res/layout/activity_main.xml
  40. 169 0
      app/src/main/res/layout/demo_activity.xml
  41. 5 0
      app/src/main/res/values/strings.xml

+ 2 - 0
.idea/misc.xml

@@ -3,6 +3,7 @@
   <component name="DesignSurface">
     <option name="filePathToZoomLevelMap">
       <map>
+        <entry key="..\:/Progect/gitee/EffectDemo/app/src/main/res/layout/activity_config.xml" value="0.18020833333333333" />
         <entry key="..\:/Progect/gitee/EffectDemo/app/src/main/res/layout/activity_congratulations.xml" value="0.1" />
         <entry key="..\:/Progect/gitee/EffectDemo/app/src/main/res/layout/activity_count_down.xml" value="0.25" />
         <entry key="..\:/Progect/gitee/EffectDemo/app/src/main/res/layout/activity_drag_select.xml" value="0.12708333333333333" />
@@ -20,6 +21,7 @@
         <entry key="..\:/Progect/gitee/EffectDemo/app/src/main/res/layout/activity_umeng_login.xml" value="0.1" />
         <entry key="..\:/Progect/gitee/EffectDemo/app/src/main/res/layout/activity_view.xml" value="0.25" />
         <entry key="..\:/Progect/gitee/EffectDemo/app/src/main/res/layout/activity_web.xml" value="0.1816123188405797" />
+        <entry key="..\:/Progect/gitee/EffectDemo/app/src/main/res/layout/demo_activity.xml" value="0.18020833333333333" />
       </map>
     </option>
   </component>

+ 2 - 2
app/build.gradle

@@ -89,12 +89,12 @@ repositories {
 
 
 dependencies {
-    implementation fileTree(dir: "libs", include: ["*.jar"])
     implementation 'androidx.appcompat:appcompat:1.3.0'
     implementation 'com.google.android.material:material:1.4.0'
     implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
     implementation 'androidx.navigation:navigation-fragment:2.3.5'
     implementation 'androidx.navigation:navigation-ui:2.3.5'
+    implementation files('libs\\oraleval-android-sdk.jar')
     testImplementation 'junit:junit:4.12'
     androidTestImplementation 'androidx.test.ext:junit:1.1.2'
     androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
@@ -119,5 +119,5 @@ dependencies {
     implementation  'com.umeng.umsdk:uverify-logger:2.1.4'// 必选
     implementation  'com.umeng.umsdk:uverify-crashshield:2.1.4'// 必选
 
-
+    implementation 'com.google.code.gson:gson:2.8.5'
 }

BIN
app/libs/arm64-v8a/liblame.so


BIN
app/libs/arm64-v8a/libvadnn.so


BIN
app/libs/arm64-v8a/libyzs_usc.so


BIN
app/libs/armeabi-v7a/liblame.so


BIN
app/libs/armeabi-v7a/libvadnn.so


BIN
app/libs/armeabi-v7a/libyzs_usc.so


BIN
app/libs/armeabi/liblame.so


BIN
app/libs/armeabi/libvadnn.so


BIN
app/libs/armeabi/libyzs_usc.so


BIN
app/libs/mips/liblame.so


BIN
app/libs/mips/libvadnn.so


BIN
app/libs/mips/libyzs_usc.so


BIN
app/libs/mips64/liblame.so


BIN
app/libs/mips64/libvadnn.so


BIN
app/libs/mips64/libyzs_usc.so


BIN
app/libs/oraleval-android-sdk.jar


BIN
app/libs/x86/liblame.so


BIN
app/libs/x86/libvadnn.so


BIN
app/libs/x86/libyzs_usc.so


BIN
app/libs/x86_64/liblame.so


BIN
app/libs/x86_64/libvadnn.so


BIN
app/libs/x86_64/libyzs_usc.so


+ 3 - 0
app/src/main/AndroidManifest.xml

@@ -104,6 +104,9 @@
         <activity
             android:name=".activity.SequentialDragActivity"
             android:screenOrientation="landscape" />
+        <activity android:name=".yzs.YZSConfigActivity"/>
+        <activity android:name=".yzs.YZSDemoActivity"/>
+
     </application>
 
 </manifest>

+ 6 - 5
app/src/main/java/com/xunao/effectdemo/activity/CountDownActivity.kt

@@ -25,10 +25,10 @@ class CountDownActivity: Activity() {
             super.handleMessage(msg)
             when (msg.what) {
                 101 -> {
-                    hpv_language.progress = 100*currentProgress/600.toFloat()
+                    hpv_language.progress = 100*currentProgress/allProgress.toFloat()
 
                     dial_progress.setValue(currentProgress/10.toFloat())
-                    if (currentProgress == 300){
+                    if (currentProgress == 50){
                         hpv_language.setEndColor(getColor(R.color.xui_config_color_red))
                         hpv_language.setStartColor(getColor(R.color.xui_config_color_red))
                         dial_progress.setProgressColor( getColor(R.color.xui_config_color_red))
@@ -40,13 +40,14 @@ class CountDownActivity: Activity() {
 
     }
 
-    var currentProgress =600
+    var allProgress =100
+    var currentProgress =100
     var isLoop = true
 
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
         setContentView(R.layout.activity_count_down)
-        hpv_language.setEndProgress(60f)
+        hpv_language.setEndProgress(10f)
         hpv_language.setAnimateType(LINEAR_INTERPOLATOR)
         btn_start.setOnClickListener{v->
 
@@ -60,7 +61,7 @@ class CountDownActivity: Activity() {
         try {
             while (isLoop) {
                 if (currentProgress <= 0) {
-                    currentProgress = 600
+                    currentProgress = allProgress
                     isLoop = false
                 }
                 Thread.sleep(100)

+ 163 - 13
app/src/main/java/com/xunao/effectdemo/activity/DragSelectActivity.java

@@ -1,6 +1,10 @@
 package com.xunao.effectdemo.activity;
 
+import android.animation.Animator;
+import android.animation.TypeEvaluator;
+import android.animation.ValueAnimator;
 import android.app.Activity;
+import android.graphics.PointF;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
@@ -8,7 +12,10 @@ import android.util.Log;
 import android.view.MotionEvent;
 import android.view.View;
 import android.view.animation.Animation;
+import android.view.animation.DecelerateInterpolator;
+import android.view.animation.RotateAnimation;
 import android.view.animation.ScaleAnimation;
+import android.view.animation.TranslateAnimation;
 import android.widget.ImageView;
 import android.widget.SeekBar;
 
@@ -31,18 +38,23 @@ public class DragSelectActivity extends Activity {
 
 	private float downX;
 	private float downY;
+	private float inX;
+	private float inY;
 	private long downTime;
 	private long delay;
 	private boolean isMove;
 	private boolean canDrag;
-	private int left;
-	private int top;
+	private float left;
+	private float top;
+	private int lestLeft,lestTop;
 	RadiusImageView imv1,imv2;
 	private float setAlpha;
 	ScaleAnimation scaleAnim;
 	private SeekBar seek;
 	private float scale,toScale;
-	private boolean leftDrag,rightDrag;
+	private RotateAnimation leftAnim,rightAnim;
+	private boolean isLeft,isRight;
+	private Animation returnAnim;
 
 	Handler handler = new Handler(new Handler.Callback() {
 		@Override
@@ -64,6 +76,18 @@ public class DragSelectActivity extends Activity {
 	}
 
 	void init(){
+		leftAnim = new RotateAnimation(0f,-30f,Animation.ABSOLUTE,0.5f,Animation.ABSOLUTE,0.5f);
+		leftAnim.setDuration(300);
+		leftAnim.setRepeatCount(0);
+		leftAnim.setFillAfter(true);
+		rightAnim = new RotateAnimation(0f,30f,Animation.ABSOLUTE,0.5f,Animation.ABSOLUTE,0.5f);
+		rightAnim.setDuration(300);
+		rightAnim.setRepeatCount(0);
+		rightAnim.setFillAfter(true);
+
+
+
+
 		view = findViewById(R.id.view);
 		imv1 = findViewById(R.id.imv_1);
 		seek = findViewById(R.id.seek);
@@ -88,6 +112,8 @@ public class DragSelectActivity extends Activity {
 						left = v.getLeft();
 						v.bringToFront();
 
+						inX = view.getX();
+						inY = view.getY();
 						break;
 					case MotionEvent.ACTION_MOVE:
 //
@@ -95,13 +121,13 @@ public class DragSelectActivity extends Activity {
 						final float yDistance = event.getY() - downY;
 						Log.e("MyTag","x:" + v.getLeft() + "  y:"+event.getY());
 						if (xDistance != 0 && yDistance != 0) {
-							int l = (int) (v.getLeft() + xDistance);
-							int r = (int) (l + v.getWidth());
-							int t = (int) (v.getTop() + yDistance);
-							int b = (int) (t + v.getHeight());
+							lestLeft = (int) (v.getLeft() + xDistance);
+							int r = (int) (lestLeft + v.getWidth());
+							lestTop = (int) (v.getTop() + yDistance);
+							int b = (int) (lestTop + v.getHeight());
 //                        v.layout(l, t, r, b);
-							v.setLeft(l);
-							v.setTop(t);
+							v.setLeft(lestLeft);
+							v.setTop(lestTop);
 							v.setRight(r);
 							v.setBottom(b);
 							isMove = true;
@@ -111,16 +137,20 @@ public class DragSelectActivity extends Activity {
 						}
 						break;
 					case MotionEvent.ACTION_UP:
-
-						int l = left;
+						isLeft = false;
+						isRight = false;
+						view.clearAnimation();
+						int l = (int)left;
 						int r = (int) (l + v.getWidth());
-						int t = top;
+						int t = (int)top;
 						int b = (int) (t + v.getHeight());
 //                        v.layout(l, t, r, b);
 						v.setLeft(l);
 						v.setTop(t);
 						v.setRight(r);
 						v.setBottom(b);
+						setReturn(lestLeft,lestTop);
+//						moveToWord(view,left,top,500,l,r,t,b);
 						isMove = false;
 						imv1.setAlpha(0.3f);
 						imv1.clearAnimation();
@@ -136,10 +166,23 @@ public class DragSelectActivity extends Activity {
 		});
 	}
 
+	private void setReturn(float endLeft,float endTop){
+
+		returnAnim = new TranslateAnimation(endLeft-left,0,endTop-top,0);
+		returnAnim.setDuration(500);
+		view.startAnimation(returnAnim);
+
+	}
+
 	private void setAnim(int l){
 		if (left-l>0){
 			setAlpha = ((float)left-l)/left ;
-			Log.e("MyTag","设置透明度:"+setAlpha);
+			if (!isLeft){
+				isLeft = true;
+				isRight = false;
+				view.clearAnimation();
+				view.startAnimation(leftAnim);
+			}
 
 			if (setAlpha>0.3){
 				imv1.setAlpha(setAlpha);
@@ -153,6 +196,12 @@ public class DragSelectActivity extends Activity {
 			imv1.startAnimation(scaleAnim);
 
 		}else if(left-l<0){
+			if (!isRight){
+				isRight = true;
+				isLeft = false;
+				view.clearAnimation();
+				view.startAnimation(rightAnim);
+			}
 			setAlpha = ((float)l-left)/left ;
 			Log.e("MyTag","设置透明度:"+setAlpha);
 			if (setAlpha>0.3){
@@ -169,4 +218,105 @@ public class DragSelectActivity extends Activity {
 		}
 
 	}
+
+	private void moveToWord(View view ,float targetX, float targetY, int time,int l,int r,int t,int b) {
+		final float x = view.getX();
+		final float y = view.getY();
+
+//		final float targetX = targetView.getX();
+//		final float targetY = targetView.getY();
+		ValueAnimator valueAnimator = new ValueAnimator();
+		valueAnimator.setDuration(time);//600
+		valueAnimator.setObjectValues(new PointF(x, y));
+		valueAnimator.setInterpolator(new DecelerateInterpolator());
+		//首先判断 目标点在上还是在下
+		final boolean flagX = ((x - targetX) > 0) ? true : false;
+		final boolean flagY = ((y - targetY) > 0) ? true : false;
+
+		valueAnimator.setEvaluator(new TypeEvaluator<PointF>() {
+
+			@Override
+			public PointF evaluate(float fraction, PointF startValue,
+								   PointF endValue) {
+				//从0.0 --->>   1.0
+
+				PointF point = new PointF();
+				//这里是需要倒着来  最后要到达200 200 这个点
+
+				float fractionNeed = 1 - fraction;
+
+				if (flagX) {
+					float vX = x - targetX;
+					point.x = vX * fractionNeed + targetX;
+				} else {
+					float vX = targetX - x;
+					point.x = x + vX * fraction;
+				}
+
+				if (flagY) {
+					float vY = y - targetY;
+					point.y = vY * fractionNeed + targetY;
+				} else {
+					float vY = targetY - y;
+					point.y = y + vY * fraction;
+				}
+				return point;
+
+			}
+		});
+		valueAnimator.addListener(new Animator.AnimatorListener() {
+			@Override
+			public void onAnimationStart(Animator animator) {
+
+			}
+
+			@Override
+			public void onAnimationEnd(Animator animator) {
+//				view.setLeft(l);
+//				view.setTop(t);
+//				view.setRight(r);
+//				view.setBottom(b);
+			}
+
+			@Override
+			public void onAnimationCancel(Animator animator) {
+
+			}
+
+			@Override
+			public void onAnimationRepeat(Animator animator) {
+
+			}
+		});
+		valueAnimator.start();
+		valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
+			@Override
+			public void onAnimationUpdate(ValueAnimator animation) {
+				PointF point = (PointF) animation.getAnimatedValue();
+				float vX = point.x;
+				float vY = point.y;
+				//说明vx 最大值就是view原坐标
+				if (flagX) {
+					if (vX <= x && vX >= targetX) {
+						view.setX(vX);
+					}
+				} else {//说明vx 最小值就是view原坐标
+					if (vX >= x && vX <= targetX) {
+						view.setX(vX);
+					}
+				}
+
+				//说明vY 最大值就是view原坐标
+				if (flagY) {
+					if (vY <= y && vY >= targetY) {
+						view.setY(vY);
+					}
+				} else {//说明vx 最小值就是view原坐标
+					if (vY >= y && vY <= targetY) {
+						view.setY(vY);
+					}
+				}
+			}
+		});
+	}
 }

+ 8 - 1
app/src/main/java/com/xunao/effectdemo/activity/MainActivity.java

@@ -9,6 +9,7 @@ import androidx.annotation.Nullable;
 
 import com.umeng.analytics.MobclickAgent;
 import com.xunao.effectdemo.R;
+import com.xunao.effectdemo.yzs.YZSDemoActivity;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -23,7 +24,8 @@ import java.util.Map;
 public class MainActivity extends Activity {
 
 	Button btn1,btn2,btn3,btn4,btn5,btn6,btn7,btn8,
-			btn9,btn10,btn11,btn12,btn13, btn14,btn15,btn16;
+			btn9,btn10,btn11,btn12,btn13, btn14,btn15,btn16,
+			btn17;
 	Intent intent;
 
 	@Override
@@ -124,5 +126,10 @@ public class MainActivity extends Activity {
 			intent = new Intent(MainActivity.this,SequentialDragActivity.class);
 			startActivity(intent);
 		});
+		btn17 = findViewById(R.id.btn_17);
+		btn17.setOnClickListener(v->{
+			intent = new Intent(MainActivity.this, YZSDemoActivity.class);
+			startActivity(intent);
+		});
 	}
 }

+ 141 - 0
app/src/main/java/com/xunao/effectdemo/yzs/ConfigBean.java

@@ -0,0 +1,141 @@
+package com.xunao.effectdemo.yzs;
+
+import java.io.Serializable;
+
+public class ConfigBean implements Serializable {
+  /**
+   * 常用配置
+   */
+  private boolean isCN = false;//是否是中文还是英文评测模式
+  private boolean isVadEnable = true;//是否使用自动断句功能
+  private int vadAfterMs = 1000;//后置静音时长
+  private int vadBeforeMs = 1000;//前置静音时长
+  private String oralText;//评测文本
+  /**
+   * 不常用配置
+   */
+  private float _scoreAdjuest = 1.0f;//打分系数
+  private String serviceType = "E";//打分模式
+  private boolean mp3Audio = true;//返回数据是否为MP3数据或者pcm数据
+  private String uid = "";//用户唯一标识
+  /**
+   * 不建议修改或者很少使用配置
+   */
+  private String online_ip = "";//设置http评测地址
+  private String secret = "";//设置Secret
+  private int socket_timeout = 0;//超时时长,值为0时使用默认值,默认值是根据文字长度计算
+  private boolean setAsyncRecognize = false;//是否使用异步评测功能
+  private boolean bufferLog = false;//是否保存log
+
+  public String getOralText() {
+    return oralText;
+  }
+
+  public void setOralText(String oralText) {
+    this.oralText = oralText;
+  }
+
+  public float get_scoreAdjuest() {
+    return _scoreAdjuest;
+  }
+
+  public void set_scoreAdjuest(float _scoreAdjuest) {
+    this._scoreAdjuest = _scoreAdjuest;
+  }
+
+  public String getServiceType() {
+    return serviceType;
+  }
+
+  public void setServiceType(String serviceType) {
+    this.serviceType = serviceType;
+  }
+
+  public String getUid() {
+    return uid;
+  }
+
+  public void setUid(String uid) {
+    this.uid = uid;
+  }
+
+  public String getOnline_ip() {
+    return online_ip;
+  }
+
+  public void setOnline_ip(String online_ip) {
+    this.online_ip = online_ip;
+  }
+
+  public String getSecret() {
+    return secret;
+  }
+
+  public void setSecret(String secret) {
+    this.secret = secret;
+  }
+
+  public int getSocket_timeout() {
+    return socket_timeout;
+  }
+
+  public void setSocket_timeout(int socket_timeout) {
+    this.socket_timeout = socket_timeout;
+  }
+
+  public boolean isSetAsyncRecognize() {
+    return setAsyncRecognize;
+  }
+
+  public void setSetAsyncRecognize(boolean setAsyncRecognize) {
+    this.setAsyncRecognize = setAsyncRecognize;
+  }
+
+  public boolean isMp3Audio() {
+    return mp3Audio;
+  }
+
+  public void setMp3Audio(boolean mp3Audio) {
+    this.mp3Audio = mp3Audio;
+  }
+
+  public boolean isCN() {
+    return isCN;
+  }
+
+  public void setCN(boolean CN) {
+    isCN = CN;
+  }
+
+  public boolean isVadEnable() {
+    return isVadEnable;
+  }
+
+  public void setVadEnable(boolean vadEnable) {
+    isVadEnable = vadEnable;
+  }
+
+  public int getVadAfterMs() {
+    return vadAfterMs;
+  }
+
+  public void setVadAfterMs(int vadAfterMs) {
+    this.vadAfterMs = vadAfterMs;
+  }
+
+  public int getVadBeforeMs() {
+    return vadBeforeMs;
+  }
+
+  public void setVadBeforeMs(int vadBeforeMs) {
+    this.vadBeforeMs = vadBeforeMs;
+  }
+
+  public boolean isBufferLog() {
+    return bufferLog;
+  }
+
+  public void setBufferLog(boolean bufferLog) {
+    this.bufferLog = bufferLog;
+  }
+}

+ 142 - 0
app/src/main/java/com/xunao/effectdemo/yzs/YZSConfigActivity.java

@@ -0,0 +1,142 @@
+package com.xunao.effectdemo.yzs;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.view.View;
+import android.widget.CheckBox;
+import android.widget.EditText;
+import android.widget.TextView;
+
+import com.xunao.effectdemo.R;
+
+public class YZSConfigActivity extends Activity implements View.OnClickListener {
+  private ConfigBean configBean;
+  private CheckBox stOralEvalMode;
+  private CheckBox tvVadEnable;
+  private CheckBox tvMP3Audio;
+  private CheckBox tvAsyncRecognize;
+  private CheckBox tvBufferLog;
+  private EditText etVadBeforeMs;
+  private EditText etVadAfterMs;
+  private EditText etScoreAdjuest;
+  private EditText etUid;
+  private EditText etOnlineIp;
+  private EditText etSecret;
+  private EditText etSocketTimeout;
+  private TextView tvServiceType;
+
+  @Override protected void onCreate(Bundle savedInstanceState) {
+    super.onCreate(savedInstanceState);
+    setContentView(R.layout.activity_config);
+    configBean = (ConfigBean) getIntent().getSerializableExtra(YZSDemoActivity.CONFIG);
+    stOralEvalMode = (CheckBox) findViewById(R.id.stOralEvalMode);
+    tvVadEnable = (CheckBox) findViewById(R.id.tvVadEnable);
+    tvMP3Audio = (CheckBox) findViewById(R.id.tvMP3Audio);
+    tvAsyncRecognize = (CheckBox) findViewById(R.id.tvAsyncRecognize);
+    tvBufferLog = (CheckBox) findViewById(R.id.tvBufferLog);
+    etVadBeforeMs = (EditText) findViewById(R.id.etVadBeforeMs);
+    etVadAfterMs = (EditText) findViewById(R.id.etVadAfterMs);
+    etScoreAdjuest = (EditText) findViewById(R.id.etScoreAdjuest);
+    etUid = (EditText) findViewById(R.id.etUid);
+    etOnlineIp = (EditText) findViewById(R.id.etOnlineIp);
+    etSecret = (EditText) findViewById(R.id.etSecret);
+    etSocketTimeout = (EditText) findViewById(R.id.etSocketTimeout);
+    tvServiceType = (TextView) findViewById(R.id.tvServiceType);
+    tvServiceType.setOnClickListener(this);
+    findViewById(R.id.tvBack).setOnClickListener(this);
+    updateView();
+  }
+
+  private void updateView() {
+    if (configBean == null) {
+      configBean = new ConfigBean();
+    }
+    stOralEvalMode.setChecked(!configBean.isCN());
+    tvVadEnable.setChecked(configBean.isVadEnable());
+    tvMP3Audio.setChecked(configBean.isMp3Audio());
+    tvAsyncRecognize.setChecked(configBean.isSetAsyncRecognize());
+    tvBufferLog.setChecked(configBean.isBufferLog());
+    etVadBeforeMs.setText(String.valueOf(configBean.getVadBeforeMs()));
+    etVadAfterMs.setText(String.valueOf(configBean.getVadAfterMs()));
+    etScoreAdjuest.setText(String.valueOf(configBean.get_scoreAdjuest()));
+    etUid.setText(String.valueOf(configBean.getUid()));
+    etOnlineIp.setText(String.valueOf(configBean.getOnline_ip()));
+    etSecret.setText(String.valueOf(configBean.getSecret()));
+    etSocketTimeout.setText(String.valueOf(configBean.getSocket_timeout()));
+    tvServiceType.setText(String.valueOf(configBean.getServiceType()));
+  }
+
+  private void setConfigBean() {
+    if (configBean == null) {
+      configBean = new ConfigBean();
+    }
+    configBean.setCN(!stOralEvalMode.isChecked());
+    configBean.setVadEnable(tvVadEnable.isChecked());
+    configBean.setMp3Audio(tvMP3Audio.isChecked());
+    configBean.setSetAsyncRecognize(tvAsyncRecognize.isChecked());
+    configBean.setBufferLog(tvBufferLog.isChecked());
+    if (TextUtils.isEmpty(etVadBeforeMs.getText().toString())) {
+      etVadBeforeMs.setText("1000");
+    }
+    configBean.setVadBeforeMs(Integer.parseInt(etVadBeforeMs.getText().toString()));
+    if (TextUtils.isEmpty(etVadAfterMs.getText().toString())) {
+      etVadAfterMs.setText("1000");
+    }
+    configBean.setVadAfterMs(Integer.parseInt(etVadAfterMs.getText().toString()));
+    if (TextUtils.isEmpty(etScoreAdjuest.getText().toString())) {
+      etScoreAdjuest.setText("1.0");
+    }
+    configBean.set_scoreAdjuest(Float.parseFloat(etScoreAdjuest.getText().toString()));
+    configBean.setUid(etUid.getText().toString());
+    configBean.setOnline_ip(etOnlineIp.getText().toString());
+    configBean.setSecret(etSecret.getText().toString());
+    if (TextUtils.isEmpty(etSocketTimeout.getText().toString())) {
+      etSocketTimeout.setText("0");
+    }
+    configBean.setSocket_timeout(Integer.parseInt(etSocketTimeout.getText().toString()));
+    configBean.setServiceType(tvServiceType.getText().toString());
+  }
+
+  @Override public void onClick(View v) {
+    switch (v.getId()) {
+      case R.id.tvBack:
+        setConfigBean();
+        Intent intent = new Intent();
+        intent.putExtra(YZSDemoActivity.CONFIG, configBean);
+        setResult(1001, intent);
+        finish();
+        break;
+      case R.id.tvServiceType:
+        newDialog();
+        break;
+      default:
+        break;
+    }
+  }
+
+  private void newDialog() {
+    final CharSequence[] items =
+        { "A", "B", "C", "D", "E", "enstar", "gzedunet", "gzedunet_answer" };
+    int index = 0;
+    for (int i = 0; i < items.length; i++) {
+      if (tvServiceType.getText().toString().equals(items[i])) {
+        index = i;
+      }
+    }
+    AlertDialog.Builder builder = new AlertDialog.Builder(YZSConfigActivity.this);
+    builder.setTitle("评测模式")
+        .setCancelable(false)
+        .setSingleChoiceItems(items, index, new DialogInterface.OnClickListener() {
+          @Override public void onClick(DialogInterface dialog, int which) {
+            tvServiceType.setText(String.valueOf(items[which]));
+            dialog.dismiss();
+          }
+        });
+    AlertDialog dlg = builder.create();
+    dlg.show();
+  }
+}

+ 610 - 0
app/src/main/java/com/xunao/effectdemo/yzs/YZSDemoActivity.java

@@ -0,0 +1,610 @@
+package com.xunao.effectdemo.yzs;
+
+import android.Manifest;
+import android.app.Activity;
+import android.app.ProgressDialog;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.graphics.Color;
+import android.media.MediaPlayer;
+import android.net.Uri;
+import android.os.Build;
+import android.os.Bundle;
+import android.os.Environment;
+
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.EditText;
+import android.widget.ProgressBar;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import androidx.annotation.NonNull;
+import androidx.core.app.ActivityCompat;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonParseException;
+import com.google.gson.JsonParser;
+import com.google.gson.stream.JsonWriter;
+import com.unisound.edu.oraleval.sdk.sep15.IOralEvalSDK;
+import com.unisound.edu.oraleval.sdk.sep15.OralEvalSDKFactory;
+import com.unisound.edu.oraleval.sdk.sep15.SDKError;
+import com.unisound.edu.oraleval.sdk.sep15.utils.OralEvalEnum;
+import com.xunao.effectdemo.R;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.StringWriter;
+
+public class YZSDemoActivity extends Activity
+    implements View.OnClickListener, IOralEvalSDK.ICallback {
+  private static final String TAG = "oraleval-demo";
+  public static final String CONFIG = "config";
+  static final boolean USE_OFFLINE_SDK_IF_FAIL_TO_SERVER = false;
+
+  private ConfigBean configBean = new ConfigBean();
+  private FileOutputStream audioFileOut;
+  private FileOutputStream opusFileOut;
+  private File files;
+  private final String audioName = "testAudio.mp3";  //音频文件名
+  private final String opusName = "testOpus";  //opus文件名
+
+  private EditText etOralEvalText;
+  private EditText et_url;
+  private EditText etAppKey;
+  private TextView tvResult;
+  private Button btStart;
+  private Button play_b;
+  private CheckBox cbDefaultConfig;
+  private ProgressBar progressBar;
+  IOralEvalSDK _oe;
+  ProgressDialog _pd;
+
+  //读写权限
+  private static String[] PERMISSIONS_STORAGE = {
+      Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE,
+      Manifest.permission.RECORD_AUDIO
+  };
+
+  //请求状态码
+  private static int REQUEST_PERMISSION_CODE = 1;
+
+  private void getCfg(OralEvalSDKFactory.StartConfig cfg) {
+    if (!cbDefaultConfig.isChecked()) {
+      //常用配置
+      if (!TextUtils.isEmpty(configBean.getOralText())) {
+        cfg.setOralText(configBean.getOralText());
+      }
+      if (configBean.isCN()) {
+        cfg.setOralEvalMode(OralEvalEnum.OnlineCH);
+      } else {
+        cfg.setOralEvalMode(OralEvalEnum.OnlineUS);
+      }
+      cfg.setVadEnable(configBean.isVadEnable());
+      cfg.setVadAfterMs(configBean.getVadAfterMs());
+      cfg.setVadBeforeMs(configBean.getVadBeforeMs());
+      //不常用配置
+      cfg.setScoreAdjuest(configBean.get_scoreAdjuest());
+      cfg.setServiceType(configBean.getServiceType());
+      cfg.setMp3Audio(configBean.isMp3Audio());
+      cfg.setUid(configBean.getUid());
+      //不建议修改或者很少使用配置
+      cfg.setOnline_ip(configBean.getOnline_ip());
+      cfg.setSecret(configBean.getSecret());
+      cfg.setSocket_timeout(configBean.getSocket_timeout());
+      cfg.setAsyncRecognize(configBean.isSetAsyncRecognize());
+      cfg.setBufferLog(configBean.isBufferLog());
+    }
+    if (USE_OFFLINE_SDK_IF_FAIL_TO_SERVER) {
+      cfg.set_useOfflineWhenFailedToConnectToServer(true);
+    }
+    cfg.setReTry(false);
+    cfg.setAppKey(etAppKey.getText().toString());
+  }
+
+  public void onCreate(Bundle savedInstanceState) {
+    super.onCreate(savedInstanceState);
+    setContentView(R.layout.demo_activity);
+    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
+      if (ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
+          != PackageManager.PERMISSION_GRANTED) {
+        ActivityCompat.requestPermissions(this, PERMISSIONS_STORAGE, REQUEST_PERMISSION_CODE);
+      }
+    }
+
+    files = new File(Environment.getExternalStorageDirectory() + "/yunzhisheng/");
+    if (!files.exists()) {
+      files.mkdirs();
+    }
+    initOfflineSDK();
+
+    etOralEvalText = (EditText) findViewById(R.id.etOralEvalText);
+    et_url = (EditText) findViewById(R.id.et_url);
+    etAppKey = (EditText) findViewById(R.id.etAppKey);
+    tvResult = (TextView) findViewById(R.id.tvResult);
+    btStart = (Button) findViewById(R.id.btStart);
+    btStart.setOnClickListener(this);
+    play_b = (Button) findViewById(R.id.play_b);
+    play_b.setOnClickListener(this);
+    progressBar = (ProgressBar) findViewById(R.id.progressBar);
+    cbDefaultConfig = (CheckBox) findViewById(R.id.cbDefaultConfig);
+    cbDefaultConfig.setChecked(true);
+    findViewById(R.id.cancel_b).setOnClickListener(this);
+    findViewById(R.id.retry_b).setOnClickListener(this);
+    findViewById(R.id.btConfig).setOnClickListener(this);
+    findViewById(R.id.btSelect).setOnClickListener(this);
+    progressBar.setMax(100);
+  }
+
+  private void initOfflineSDK() {
+    if (USE_OFFLINE_SDK_IF_FAIL_TO_SERVER) {
+      File filesdir = this.getFilesDir();
+      if (!filesdir.exists()) {
+        filesdir.mkdirs();
+      }
+      Log.i(TAG, "start init offline sdk");
+      IOralEvalSDK.OfflineSDKError err =
+          OralEvalSDKFactory.initOfflineSDK(YZSDemoActivity.this, filesdir.getAbsolutePath());
+      Log.i(TAG, "end init offline sdk");
+      if (err != IOralEvalSDK.OfflineSDKError.NOERROR) {
+        showToast("init sdk failed:" + err);
+      }
+    }
+  }
+
+  @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
+      @NonNull int[] grantResults) {
+    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
+    if (requestCode == REQUEST_PERMISSION_CODE) {
+      for (int i = 0; i < permissions.length; i++) {
+        Log.i(TAG, "申请的权限为:" + permissions[i] + ",申请结果:" + grantResults[i]);
+      }
+    }
+    files = new File(Environment.getExternalStorageDirectory() + "/yunzhisheng/");
+    if (!files.exists()) {
+      files.mkdirs();
+    }
+    initOfflineSDK();
+  }
+
+  private void showToast(String txt) {
+    if (!TextUtils.isEmpty(txt)) {
+      Toast.makeText(YZSDemoActivity.this, txt, Toast.LENGTH_LONG).show();
+    }
+  }
+
+  @Override public void onDestroy() {
+    super.onDestroy();
+    if (USE_OFFLINE_SDK_IF_FAIL_TO_SERVER) {
+      OralEvalSDKFactory.cleanupOfflineSDK(this);
+    }
+    if (_oe != null) {
+      _oe.cancel();
+    }
+  }
+
+  @Override public void onClick(View view) {
+    switch (view.getId()) {
+      case R.id.btSelect:
+        fileOralEval();
+        break;
+      case R.id.btStart:
+        start();
+        break;
+      case R.id.retry_b:
+        retry(opusName);
+        break;
+      case R.id.cancel_b:
+        btStart.setText(R.string.start);
+        showToast("取消评测");
+        if (_oe != null) {
+          _oe.cancel();
+        }
+        break;
+      case R.id.play_b:
+        showToast("开始播放");
+        play();
+        break;
+      case R.id.btConfig:
+        cbDefaultConfig.setChecked(false);
+        Intent intent = new Intent(this, YZSConfigActivity.class);
+        intent.putExtra(CONFIG, configBean);
+        startActivityForResult(intent, 1000);
+        break;
+      default:
+        break;
+    }
+  }
+
+  private void chooseAudio() {
+    Intent intent = new Intent();
+    intent.setType("audio/wav");
+    intent.setAction(Intent.ACTION_GET_CONTENT);
+    startActivityForResult(intent, 1);
+  }
+
+  @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+    super.onActivityResult(requestCode, resultCode, data);
+    if (data != null) {
+      if (data.getSerializableExtra(CONFIG) != null) {
+        configBean = (ConfigBean) data.getSerializableExtra(CONFIG);
+      }
+    }
+  }
+
+  private void start() {
+    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
+      if (ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
+          != PackageManager.PERMISSION_GRANTED) {
+        ActivityCompat.requestPermissions(this, PERMISSIONS_STORAGE, REQUEST_PERMISSION_CODE);
+        showToast("请打开录音和存储权限");
+        return;
+      }
+    }
+    if (_oe == null) {
+      String txt = etOralEvalText.getText().toString();
+      if (TextUtils.isEmpty(txt)) {
+        showToast("Empty Text!");
+        return;
+      }
+      OralEvalSDKFactory.StartConfig cfg = new OralEvalSDKFactory.StartConfig(txt);
+      if (cfg == null) {
+        return;
+      }
+      getCfg(cfg);
+      _oe = OralEvalSDKFactory.start(this, cfg, this);
+      btStart.setText(R.string.bt_stop);
+      if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
+        File audioFile = new File(files, audioName);
+        if (!audioFile.exists()) {
+          try {
+            audioFile.createNewFile();
+          } catch (IOException e) {
+            e.printStackTrace();
+          }
+        }
+        File opusFile = new File(files, opusName);
+        if (!opusFile.exists()) {
+          try {
+            opusFile.createNewFile();
+          } catch (IOException e) {
+            e.printStackTrace();
+          }
+        }
+        ;
+        updateFile("title.txt", txt);
+      } else {
+        showToast("没有SD卡");
+      }
+    } else {
+      _oe.stop();
+      Log.e("============", "stop");
+      btStart.setText(R.string.start);
+    }
+  }
+
+  private void play() {
+    try {
+      final MediaPlayer mp = MediaPlayer.create(this, Uri.fromFile(new File(files, audioName)));
+      mp.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
+        @Override public void onPrepared(MediaPlayer mediaPlayer) {
+          Log.d(TAG, "mp3 duration:" + mp.getDuration() + "ms");
+        }
+      });
+      mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
+        @Override public void onCompletion(MediaPlayer mediaPlayer) {
+          Log.d(TAG, "final pos:" + mp.getCurrentPosition());
+          mp.release();
+          play_b.setEnabled(true);
+          play_b.setBackgroundColor(Color.parseColor("#d6d7d7"));
+        }
+      });
+      mp.setOnErrorListener(new MediaPlayer.OnErrorListener() {
+        @Override public boolean onError(MediaPlayer mp, int what, int extra) {
+          mp.release();
+          play_b.setEnabled(true);
+          play_b.setBackgroundColor(Color.parseColor("#d6d7d7"));
+          return false;
+        }
+      });
+      mp.start();
+      play_b.setEnabled(false);
+      play_b.setBackgroundColor(Color.parseColor("#33d6d7d7"));
+    } catch (Exception ee) {
+      Log.e(TAG, "playing failed.", ee);
+    }
+  }
+
+  private void fileOralEval() {
+    File file = new File(files, "test.wav");
+    if (_oe != null) {
+      _oe.cancel();
+      btStart.setText(R.string.start);
+      showToast("上次评测正在进行中,现在已经取消");
+      return;
+    }
+    String txt = etOralEvalText.getText().toString();
+    if (TextUtils.isEmpty(txt)) {
+      showToast("Empty Text!");
+      return;
+    }
+    OralEvalSDKFactory.StartConfig cfg = null;
+    try {
+      cfg = new OralEvalSDKFactory.StartConfig(txt, file.getAbsolutePath());
+    } catch (IOException e) {
+      e.printStackTrace();
+      showToast("Opening " + file.getAbsolutePath() + " failed");
+      return;
+    }
+    showToast("正在进行文件评测");
+    if (cfg == null) {
+      return;
+    }
+    getCfg(cfg);
+    _oe = OralEvalSDKFactory.start(this, cfg, this);
+  }
+
+  private void retry(String file_name) {
+    if (_oe != null) {
+      _oe.cancel();
+      btStart.setText(R.string.start);
+      showToast("上次评测正在进行中,现在已经取消");
+      return;
+    }
+    String txt = etOralEvalText.getText().toString();
+    if (TextUtils.isEmpty(txt)) {
+      showToast("Empty Text!");
+      return;
+    }
+    File file = new File(files, file_name);
+    Log.e("file size =", file.length() + "");
+    OralEvalSDKFactory.StartConfig cfg = null;
+    if (file.exists()) {
+      try {
+        cfg = new OralEvalSDKFactory.StartConfig(txt, file.getAbsolutePath());
+      } catch (IOException e) {
+        e.printStackTrace();
+        showToast("Opening " + file.getAbsolutePath() + " failed");
+        return;
+      }
+      showToast("正在重试");
+    } else {
+      showToast("没有可使用音频");
+    }
+
+    if (cfg == null) {
+      return;
+    }
+    getCfg(cfg);
+    cfg.setReTry(true);
+    _oe = OralEvalSDKFactory.start(this, cfg, this);
+  }
+
+  /*
+   文件缓存
+   */
+  public void updateFile(String fileName, String data) {
+    File titleFile = new File(files, fileName);
+    if (!titleFile.exists()) {
+      try {
+        titleFile.createNewFile();
+      } catch (IOException e) {
+        e.printStackTrace();
+      }
+    }
+    OutputStream os = null;
+    try {
+      os = new FileOutputStream(titleFile);
+      os.write(data.getBytes());
+    } catch (Exception e) {
+      e.printStackTrace();
+    } finally {
+      if (os != null) {
+        try {
+          os.close();
+        } catch (IOException e) {
+          e.printStackTrace();
+        }
+      }
+    }
+  }
+
+  long audioLength = 0;
+
+  @Override public void onStart(IOralEvalSDK iOralEvalSDK, int audioId) {
+    Log.i(TAG, "onStart(), audioId=" + audioId);
+    this.runOnUiThread(new Runnable() {
+      @Override public void run() {
+        btStart.setEnabled(true);
+        btStart.setBackgroundColor(Color.parseColor("#d6d7d7"));
+      }
+    });
+    audioLength = 0;
+  }
+
+  @Override public void onCancel() {
+    Log.i(TAG, "onCancel()");
+    this.runOnUiThread(new Runnable() {
+      @Override public void run() {
+        _oe = null;
+        if (audioFileOut != null) {
+          try {
+            audioFileOut.close();
+          } catch (IOException e) {
+            e.printStackTrace();
+          }
+          audioFileOut = null;
+        }
+
+        if (opusFileOut != null) {
+          try {
+            opusFileOut.close();
+          } catch (IOException e) {
+            e.printStackTrace();
+          }
+          opusFileOut = null;
+        }
+        btStart.setText(R.string.start);
+      }
+    });
+  }
+
+  @Override public void onError(IOralEvalSDK iOralEvalSDK, SDKError error,
+      IOralEvalSDK.OfflineSDKError ofError) {
+    Log.i(TAG, "onError");
+    final SDKError err = error;
+    final IOralEvalSDK.OfflineSDKError ofe = ofError;
+    final String sdkLog = iOralEvalSDK.getLog();
+    this.runOnUiThread(new Runnable() {
+      @Override public void run() {
+        _oe = null;
+        updateFile("log.txt", sdkLog);
+        btStart.setText(R.string.start);
+        tvResult.setText("Error:" + err + "\n. offline error:" + ofe);
+        btStart.setEnabled(true);
+        btStart.setBackgroundColor(Color.parseColor("#d6d7d7"));
+        if (_pd != null) {
+          _pd.dismiss();
+          _pd = null;
+        }
+        if (audioFileOut != null) {
+          try {
+            audioFileOut.close();
+          } catch (IOException e) {
+            e.printStackTrace();
+          }
+          audioFileOut = null;
+        }
+
+        if (opusFileOut != null) {
+          try {
+            opusFileOut.close();
+          } catch (IOException e) {
+            e.printStackTrace();
+          }
+          opusFileOut = null;
+        }
+      }
+    });
+  }
+
+  @Override public void onStop(IOralEvalSDK iOralEvalSDK, String s, boolean offline, String str,
+      IOralEvalSDK.EndReason stoptype) {
+    Log.i(TAG, "onStop(), offline=" + offline + ", stoptype:" + stoptype);
+    Log.i(TAG, "result:" + s);
+    Log.i(TAG, "url:" + str);
+
+    final String sdkLog = iOralEvalSDK.getLog();
+
+    final String rst = s;
+    final String url = str;
+    if (audioFileOut != null) {
+      try {
+        audioFileOut.close();
+      } catch (IOException e) {
+        e.printStackTrace();
+      }
+      audioFileOut = null;
+    }
+
+    if (opusFileOut != null) {
+      try {
+        opusFileOut.close();
+      } catch (IOException e) {
+        e.printStackTrace();
+      }
+      opusFileOut = null;
+    }
+
+    this.runOnUiThread(new Runnable() {
+      @Override public void run() {
+        _oe = null;
+        btStart.setText(R.string.start);
+        tvResult.setText(formatResult(rst));
+        updateFile("result.txt", rst);
+        updateFile("log.txt", sdkLog);
+        btStart.setEnabled(true);
+        btStart.setBackgroundColor(Color.parseColor("#d6d7d7"));
+        et_url.setText(url);
+        File audioFile = new File(files, audioName);
+        if (audioFile.exists()) {
+          long size = audioFile.length();
+          if (size < 20000) {
+            showToast("说话时间过短");
+          }
+        }
+        showToast("length:" + audioLength + "-----fileLength:" + audioFile.length());
+        if (_pd != null) {
+          _pd.dismiss();
+          _pd = null;
+        }
+      }
+    });
+  }
+
+  private String formatResult(String str) {
+    JsonParser parser = new JsonParser();
+    Gson gson = new Gson();
+    JsonElement jo = null;
+    try {
+      jo = parser.parse(str);
+    } catch (JsonParseException jpe) {
+      return str;
+    }
+    StringWriter swr = new StringWriter();
+    JsonWriter jwr = new JsonWriter(swr);
+    jwr.setIndent("  ");
+    gson.toJson(jo, jwr);
+    try {
+      jwr.flush();
+      swr.flush();
+    } catch (Exception e) {
+    }
+    return swr.getBuffer().toString();
+  }
+
+  @Override public void onVolume(IOralEvalSDK who, final int value) {
+    this.runOnUiThread(new Runnable() {
+      @Override public void run() {
+        progressBar.setProgress(value);
+      }
+    });
+  }
+
+  @Override public void onStartOralEval() {
+    Log.e("StartOralEval", "StartOralEval");
+  }
+
+  @Override public void onAudioData(IOralEvalSDK iOralEvalSDK, byte[] bytes, int offset, int len) {
+    audioLength += bytes.length;
+    try {
+      if (audioFileOut == null) {
+        audioFileOut = new FileOutputStream(new File(files, audioName));
+      }
+      audioFileOut.write(bytes, offset, len);
+    } catch (IOException e) {
+      e.printStackTrace();
+    }
+  }
+
+  @Override public void onOpusData(IOralEvalSDK iOralEvalSDK, byte[] bytes, int offset, int len) {
+    try {
+      if (opusFileOut == null) {
+        opusFileOut = new FileOutputStream(new File(files, opusName));
+      }
+      opusFileOut.write(bytes, offset, len);
+    } catch (IOException e) {
+      e.printStackTrace();
+    }
+  }
+
+  @Override public void onAsyncResult(IOralEvalSDK who, String url) {
+    Log.i(TAG, "onAsyncResult url:" + url);
+  }
+}

+ 5 - 0
app/src/main/res/drawable/check_box_bg.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android" >
+    <item android:state_checked="true" android:drawable="@drawable/check_enable"></item>
+	  <item android:state_checked="false" android:drawable="@drawable/check_disable"></item>
+</selector>

BIN
app/src/main/res/drawable/check_disable.png


BIN
app/src/main/res/drawable/check_enable.png


+ 6 - 0
app/src/main/res/drawable/edit_bg.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+  <corners android:radius="25dp"></corners>
+  <stroke android:color="#FF51AAFF" android:width="1dp"></stroke>
+
+</shape>

BIN
app/src/main/res/drawable/icon.png


+ 489 - 0
app/src/main/res/layout/activity_config.xml

@@ -0,0 +1,489 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:singleLine="false"
+    android:background="#F7F9FB"
+    >
+  <LinearLayout
+      android:layout_width="match_parent"
+      android:layout_height="match_parent"
+      android:orientation="vertical"
+      >
+    <TextView
+        android:id="@+id/tvBack"
+        android:layout_gravity="right"
+        android:layout_width="80dp"
+        android:layout_height="50dp"
+        android:textSize="20sp"
+        android:gravity="center"
+        android:textColor="@android:color/black"
+        android:text="返回"
+        />
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="15dp"
+        android:layout_marginTop="15dp"
+        android:textSize="18sp"
+        android:textColor="@android:color/black"
+        android:text="常用配置"
+        />
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="50dp"
+        android:layout_marginTop="5dp"
+        android:orientation="horizontal"
+        >
+      <TextView
+          android:layout_width="match_parent"
+          android:layout_height="match_parent"
+          android:layout_weight="1"
+          android:singleLine="false"
+          android:gravity="center_vertical"
+          android:layout_marginLeft="20dp"
+          android:textSize="15sp"
+          android:textColor="#4A4A4A"
+          android:text="英文评测模式"
+          />
+      <RelativeLayout
+          android:layout_width="match_parent"
+          android:layout_height="match_parent"
+          android:layout_weight="1"
+          >
+        <CheckBox
+            android:id="@+id/stOralEvalMode"
+            android:layout_width="50dp"
+            android:layout_height="25dp"
+            android:layout_centerVertical="true"
+            android:background="@drawable/check_box_bg"
+            android:checked="true"
+            android:button="@null"
+            />
+      </RelativeLayout>
+    </LinearLayout>
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="50dp"
+        android:layout_marginTop="5dp"
+        android:orientation="horizontal"
+        >
+      <TextView
+          android:layout_width="match_parent"
+          android:layout_height="match_parent"
+          android:layout_weight="1"
+          android:singleLine="false"
+          android:textColor="#4A4A4A"
+          android:gravity="center_vertical"
+          android:layout_marginLeft="20dp"
+          android:textSize="15sp"
+          android:text="使用Vad"
+          />
+      <RelativeLayout
+          android:layout_width="match_parent"
+          android:layout_height="match_parent"
+          android:layout_weight="1"
+          >
+        <CheckBox
+            android:id="@+id/tvVadEnable"
+            android:layout_width="47dp"
+            android:layout_height="25dp"
+            android:layout_centerVertical="true"
+            android:background="@drawable/check_box_bg"
+            android:checked="true"
+            android:button="@null"
+            />
+      </RelativeLayout>
+    </LinearLayout>
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="50dp"
+        android:layout_marginTop="5dp"
+        android:orientation="horizontal"
+        >
+      <TextView
+          android:layout_width="match_parent"
+          android:layout_height="match_parent"
+          android:layout_weight="1"
+          android:singleLine="false"
+          android:gravity="center_vertical"
+          android:textColor="#4A4A4A"
+          android:layout_marginLeft="20dp"
+          android:textSize="15sp"
+          android:text="Vad前置静音时长"
+          />
+      <EditText
+          android:id="@+id/etVadBeforeMs"
+          android:layout_width="match_parent"
+          android:layout_height="match_parent"
+          android:gravity="center_vertical"
+          android:layout_weight="1"
+          android:inputType="number"
+          android:textColor="#4A4A4A"
+          android:maxLength="5"
+          tools:text="1000"
+          android:singleLine="false"
+          android:paddingLeft="15dp"
+          android:layout_marginTop="10dp"
+          android:layout_marginBottom="10dp"
+          android:layout_marginRight="10dp"
+          android:background="@drawable/edit_bg"
+          />
+    </LinearLayout>
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="50dp"
+        android:layout_marginTop="5dp"
+        android:orientation="horizontal"
+        >
+      <TextView
+          android:layout_width="match_parent"
+          android:layout_height="match_parent"
+          android:layout_weight="1"
+          android:singleLine="false"
+          android:gravity="center_vertical"
+          android:layout_marginLeft="20dp"
+          android:textColor="#4A4A4A"
+          android:textSize="15sp"
+          android:text="Vad后置静音时长"
+          />
+      <EditText
+          android:id="@+id/etVadAfterMs"
+          android:layout_width="match_parent"
+          android:layout_height="match_parent"
+          android:gravity="center_vertical"
+          android:layout_weight="1"
+          android:inputType="number"
+          android:maxLength="5"
+          android:textColor="#4A4A4A"
+          tools:text="1000"
+          android:singleLine="false"
+          android:paddingLeft="15dp"
+          android:layout_marginTop="10dp"
+          android:layout_marginBottom="10dp"
+          android:layout_marginRight="10dp"
+          android:background="@drawable/edit_bg"
+          />
+    </LinearLayout>
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="50dp"
+        android:layout_marginTop="5dp"
+        android:orientation="horizontal"
+        >
+      <TextView
+          android:layout_width="match_parent"
+          android:layout_height="match_parent"
+          android:layout_weight="1"
+          android:singleLine="false"
+          android:gravity="center_vertical"
+          android:layout_marginLeft="20dp"
+          android:textColor="#4A4A4A"
+          android:textSize="15sp"
+          android:text="设置Secret"
+          />
+      <EditText
+          android:id="@+id/etSecret"
+          android:layout_width="match_parent"
+          android:layout_height="match_parent"
+          android:gravity="center_vertical"
+          android:layout_weight="1"
+          android:textColor="#4A4A4A"
+          tools:text=""
+          android:singleLine="false"
+          android:paddingLeft="15dp"
+          android:layout_marginTop="10dp"
+          android:layout_marginBottom="10dp"
+          android:layout_marginRight="10dp"
+          android:background="@drawable/edit_bg"
+          />
+    </LinearLayout>
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="20dp"
+        android:layout_marginTop="15dp"
+        android:textSize="18sp"
+        android:textColor="@android:color/black"
+        android:text="不常用配置"
+        />
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="50dp"
+        android:layout_marginTop="5dp"
+        android:orientation="horizontal"
+        >
+      <TextView
+          android:layout_width="match_parent"
+          android:layout_height="match_parent"
+          android:layout_weight="1"
+          android:singleLine="false"
+          android:gravity="center_vertical"
+          android:layout_marginLeft="20dp"
+          android:textColor="#4A4A4A"
+          android:textSize="15sp"
+          android:text="打分系数"
+          />
+      <EditText
+          android:id="@+id/etScoreAdjuest"
+          android:layout_width="match_parent"
+          android:layout_height="match_parent"
+          android:gravity="center_vertical"
+          android:layout_weight="1"
+          android:textColor="#4A4A4A"
+          tools:text="1.0f"
+          android:maxLength="5"
+          android:inputType="number|numberDecimal"
+          android:singleLine="false"
+          android:paddingLeft="15dp"
+          android:layout_marginTop="10dp"
+          android:layout_marginBottom="10dp"
+          android:layout_marginRight="10dp"
+          android:background="@drawable/edit_bg"
+          />
+    </LinearLayout>
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="50dp"
+        android:layout_marginTop="5dp"
+        android:orientation="horizontal"
+        >
+      <TextView
+          android:layout_width="match_parent"
+          android:layout_height="match_parent"
+          android:layout_weight="1"
+          android:singleLine="false"
+          android:gravity="center_vertical"
+          android:layout_marginLeft="20dp"
+          android:textColor="#4A4A4A"
+          android:textSize="15sp"
+          android:text="打分模式"
+          />
+      <TextView
+          android:id="@+id/tvServiceType"
+          android:layout_width="match_parent"
+          android:layout_height="match_parent"
+          android:gravity="center_vertical"
+          android:layout_weight="1"
+          android:textColor="#4A4A4A"
+          tools:text="E"
+          android:singleLine="false"
+          android:paddingLeft="15dp"
+          android:layout_marginTop="10dp"
+          android:layout_marginBottom="10dp"
+          android:layout_marginRight="10dp"
+          android:background="@drawable/edit_bg"
+          />
+    </LinearLayout>
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="50dp"
+        android:layout_marginTop="5dp"
+        android:orientation="horizontal"
+        >
+      <TextView
+          android:layout_width="match_parent"
+          android:layout_height="match_parent"
+          android:layout_weight="1"
+          android:singleLine="false"
+          android:gravity="center_vertical"
+          android:textColor="#4A4A4A"
+          android:layout_marginLeft="20dp"
+          android:textSize="15sp"
+          android:text="返回数据为MP3"
+          />
+      <RelativeLayout
+          android:layout_width="match_parent"
+          android:layout_height="match_parent"
+          android:layout_weight="1"
+          >
+        <CheckBox
+            android:id="@+id/tvMP3Audio"
+            android:layout_width="50dp"
+            android:layout_height="25dp"
+            android:layout_centerVertical="true"
+            android:background="@drawable/check_box_bg"
+            android:checked="true"
+            android:button="@null"
+            />
+      </RelativeLayout>
+    </LinearLayout>
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="50dp"
+        android:layout_marginTop="5dp"
+        android:orientation="horizontal"
+        >
+      <TextView
+          android:layout_width="match_parent"
+          android:layout_height="match_parent"
+          android:layout_weight="1"
+          android:singleLine="false"
+          android:gravity="center_vertical"
+          android:layout_marginLeft="20dp"
+          android:textColor="#4A4A4A"
+          android:textSize="15sp"
+          android:text="用户唯一标识"
+          />
+      <EditText
+          android:id="@+id/etUid"
+          android:layout_width="match_parent"
+          android:layout_height="match_parent"
+          android:gravity="center_vertical"
+          android:layout_weight="1"
+          tools:text=""
+          android:textColor="#4A4A4A"
+          android:singleLine="false"
+          android:paddingLeft="15dp"
+          android:layout_marginTop="10dp"
+          android:layout_marginBottom="10dp"
+          android:layout_marginRight="10dp"
+          android:background="@drawable/edit_bg"
+          />
+    </LinearLayout>
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="20dp"
+        android:layout_marginTop="15dp"
+        android:textSize="18sp"
+        android:textColor="@android:color/black"
+        android:text="不建议修改或者很少使用配置"
+        />
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="50dp"
+        android:layout_marginTop="5dp"
+        android:orientation="horizontal"
+        >
+      <TextView
+          android:layout_width="match_parent"
+          android:layout_height="match_parent"
+          android:layout_weight="1"
+          android:singleLine="false"
+          android:gravity="center_vertical"
+          android:layout_marginLeft="20dp"
+          android:textColor="#4A4A4A"
+          android:textSize="15sp"
+          android:text="设置http评测地址"
+          />
+      <EditText
+          android:id="@+id/etOnlineIp"
+          android:layout_width="match_parent"
+          android:layout_height="match_parent"
+          android:gravity="center_vertical"
+          android:layout_weight="1"
+          android:textColor="#4A4A4A"
+          tools:text=""
+          android:singleLine="false"
+          android:paddingLeft="15dp"
+          android:layout_marginTop="10dp"
+          android:layout_marginBottom="10dp"
+          android:layout_marginRight="10dp"
+          android:background="@drawable/edit_bg"
+          />
+    </LinearLayout>
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="50dp"
+        android:layout_marginTop="5dp"
+        android:orientation="horizontal"
+        >
+      <TextView
+          android:layout_width="match_parent"
+          android:layout_height="match_parent"
+          android:layout_weight="1"
+          android:singleLine="false"
+          android:textColor="#4A4A4A"
+          android:gravity="center_vertical"
+          android:layout_marginLeft="20dp"
+          android:textSize="15sp"
+          android:text="超时时长"
+          />
+      <EditText
+          android:id="@+id/etSocketTimeout"
+          android:layout_width="match_parent"
+          android:layout_height="match_parent"
+          android:gravity="center_vertical"
+          android:layout_weight="1"
+          tools:text="0"
+          android:textColor="#4A4A4A"
+          android:inputType="number"
+          android:maxLength="5"
+          android:singleLine="false"
+          android:paddingLeft="15dp"
+          android:layout_marginTop="10dp"
+          android:layout_marginBottom="10dp"
+          android:layout_marginRight="10dp"
+          android:background="@drawable/edit_bg"
+          />
+    </LinearLayout>
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="50dp"
+        android:layout_marginTop="5dp"
+        android:orientation="horizontal"
+        >
+      <TextView
+          android:layout_width="match_parent"
+          android:layout_height="match_parent"
+          android:layout_weight="1"
+          android:singleLine="false"
+          android:gravity="center_vertical"
+          android:textColor="#4A4A4A"
+          android:layout_marginLeft="20dp"
+          android:textSize="15sp"
+          android:text="异步评测"
+          />
+      <RelativeLayout
+          android:layout_width="match_parent"
+          android:layout_height="match_parent"
+          android:layout_weight="1"
+          >
+        <CheckBox
+            android:id="@+id/tvAsyncRecognize"
+            android:layout_width="50dp"
+            android:layout_height="25dp"
+            android:layout_centerVertical="true"
+            android:background="@drawable/check_box_bg"
+            android:checked="false"
+            android:button="@null"
+            />
+      </RelativeLayout>
+    </LinearLayout>
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="50dp"
+        android:layout_marginTop="5dp"
+        android:orientation="horizontal"
+        >
+      <TextView
+          android:layout_width="match_parent"
+          android:layout_height="match_parent"
+          android:layout_weight="1"
+          android:singleLine="false"
+          android:gravity="center_vertical"
+          android:textColor="#4A4A4A"
+          android:layout_marginLeft="20dp"
+          android:textSize="15sp"
+          android:text="保存log"
+          />
+      <RelativeLayout
+          android:layout_width="match_parent"
+          android:layout_height="match_parent"
+          android:layout_weight="1"
+          >
+        <CheckBox
+            android:id="@+id/tvBufferLog"
+            android:layout_width="48dp"
+            android:layout_height="25dp"
+            android:layout_centerVertical="true"
+            android:background="@drawable/check_box_bg"
+            android:checked="false"
+            android:button="@null"
+            />
+      </RelativeLayout>
+    </LinearLayout>
+  </LinearLayout>
+</ScrollView>

+ 1 - 1
app/src/main/res/layout/activity_count_down.xml

@@ -26,7 +26,7 @@
             app:dialWidth="2dp"
             app:hint=""
             app:hintSize="10sp"
-            app:maxValue="60"
+            app:maxValue="10"
             app:startAngle="-90"
             app:sweepAngle="360"
             app:unit=""

+ 6 - 0
app/src/main/res/layout/activity_main.xml

@@ -102,6 +102,12 @@
             android:text="顺序拖拽"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"/>
+
+        <Button
+            android:id="@+id/btn_17"
+            android:text="云知声"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"/>
     </LinearLayout>
 
 </ScrollView>

+ 169 - 0
app/src/main/res/layout/demo_activity.xml

@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="#F7F9FB"
+    >
+  <LinearLayout
+      android:layout_width="match_parent"
+      android:layout_height="match_parent"
+      android:orientation="vertical"
+      >
+    <EditText
+        android:id="@+id/et_url"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:textColor="#4A4A4A"
+        />
+    <EditText
+        android:layout_width="match_parent"
+        android:layout_height="200dp"
+        android:text="Hello 3, I'm nice to meet you."
+        android:inputType="textMultiLine"
+        android:textColor="#4A4A4A"
+        android:ems="10"
+        android:layout_below="@+id/et_url"
+        android:id="@+id/etOralEvalText"
+        android:layout_centerHorizontal="true"
+        />
+    <EditText
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:text="rrippiqkzu56isoibebccqlqnthmq3lreralxtyy"
+        android:hint="appKey"
+        android:textColor="#4A4A4A"
+        android:id="@+id/etAppKey"
+        android:gravity="left"
+        />
+    <ProgressBar
+        android:layout_width="match_parent"
+        android:layout_height="20dp"
+        android:layout_marginTop="15dp"
+        android:layout_marginLeft="15dp"
+        android:layout_marginRight="15dp"
+        android:id="@+id/progressBar"
+        style="@android:style/Widget.ProgressBar.Horizontal"
+        />
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="15dp"
+        android:gravity="center_horizontal"
+        android:orientation="horizontal"
+        >
+      <Button
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:text="@string/start"
+          android:textColor="#4A4A4A"
+          android:background="#d6d7d7"
+          android:id="@+id/btStart"
+          />
+      <Button
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:text="Play"
+          android:textColor="#4A4A4A"
+          android:layout_marginLeft="5dp"
+          android:background="#d6d7d7"
+          android:id="@+id/play_b"
+          />
+      <Button
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:text="Cancel"
+          android:layout_marginLeft="5dp"
+          android:textColor="#4A4A4A"
+          android:background="#d6d7d7"
+          android:id="@+id/cancel_b"
+          />
+      <Button
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:text="Retry"
+          android:layout_marginLeft="5dp"
+          android:textColor="#4A4A4A"
+          android:background="#d6d7d7"
+          android:id="@+id/retry_b"
+          />
+    </LinearLayout>
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="50dp"
+        android:layout_marginTop="5dp"
+        android:orientation="horizontal"
+        >
+      <TextView
+          android:layout_width="match_parent"
+          android:layout_height="match_parent"
+          android:layout_weight="1"
+          android:singleLine="false"
+          android:textColor="#4A4A4A"
+          android:gravity="center"
+          android:textSize="15sp"
+          android:text="使用默认配置"
+          />
+      <RelativeLayout
+          android:layout_width="match_parent"
+          android:layout_height="match_parent"
+          android:layout_weight="1"
+          >
+        <CheckBox
+            android:id="@+id/cbDefaultConfig"
+            android:layout_width="47dp"
+            android:layout_height="25dp"
+            android:layout_centerInParent="true"
+            android:background="@drawable/check_box_bg"
+            android:checked="true"
+            android:button="@null"
+            />
+      </RelativeLayout>
+    </LinearLayout>
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="15dp"
+        android:layout_marginLeft="15dp"
+        android:layout_marginRight="15dp"
+        android:orientation="horizontal"
+        >
+      <Button
+          android:layout_width="match_parent"
+          android:layout_height="wrap_content"
+          android:layout_weight="1"
+          android:singleLine="false"
+          android:layout_marginLeft="15dp"
+          android:layout_marginRight="15dp"
+          android:textColor="@android:color/black"
+          android:background="#d6d7d7"
+          android:textSize="20sp"
+          android:gravity="center"
+          android:text="本地音频评测"
+          android:id="@+id/btSelect"
+          />
+      <Button
+          android:layout_width="match_parent"
+          android:layout_height="wrap_content"
+          android:layout_weight="1"
+          android:singleLine="false"
+          android:layout_marginLeft="15dp"
+          android:layout_marginRight="15dp"
+          android:textColor="@android:color/black"
+          android:background="#d6d7d7"
+          android:textSize="20sp"
+          android:gravity="center"
+          android:text="设置配置"
+          android:id="@+id/btConfig"
+          />
+    </LinearLayout>
+    <TextView
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:textColor="#4A4A4A"
+        android:layout_marginTop="10dp"
+        android:singleLine="false"
+        android:id="@+id/tvResult"
+        />
+  </LinearLayout>
+</ScrollView>

+ 5 - 0
app/src/main/res/values/strings.xml

@@ -9,4 +9,9 @@
 
     <string name="hello_first_fragment">Hello first fragment</string>
     <string name="hello_second_fragment">Hello second fragment. Arg: %1$s</string>
+
+    <string name="start">Start</string>
+    <string name="bt_stop">Stop</string>
+    <string name="action_settings">测评模式设置</string>
+    <string name="action_elastic">测评松紧设置</string>
 </resources>