release V119 master
authorSnickerSun <scy@incartech.cn>
Fri, 23 Jul 2021 16:55:13 +0000 (00:55 +0800)
committerSnickerSun <scy@incartech.cn>
Fri, 23 Jul 2021 16:55:13 +0000 (00:55 +0800)
提交落下的 陀螺仪测试 UI文件
添加W560支持

app/release/FactoryMode_V119_202107240052_release.apk [new file with mode: 0644]
app/release/output.json
app/src/main/java/mobile/miki/GyroScope.java [new file with mode: 0644]
app/src/main/java/mobile/miki/util/Config.java
app/src/main/java/mobile/miki/util/FTUtils.java
app/src/main/res/layout/gyroscope_layout.xml [new file with mode: 0644]
app/version_code.properties

diff --git a/app/release/FactoryMode_V119_202107240052_release.apk b/app/release/FactoryMode_V119_202107240052_release.apk
new file mode 100644 (file)
index 0000000..055a4d0
Binary files /dev/null and b/app/release/FactoryMode_V119_202107240052_release.apk differ
index 8df2398..e64b6da 100644 (file)
@@ -1 +1 @@
-[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":118,"versionName":"202107192107","enabled":true,"outputFile":"FactoryMode_V118_202107192107_release.apk","fullName":"release","baseName":"release"},"path":"FactoryMode_V118_202107192107_release.apk","properties":{}}]
\ No newline at end of file
+[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":119,"versionName":"202107240052","enabled":true,"outputFile":"FactoryMode_V119_202107240052_release.apk","fullName":"release","baseName":"release"},"path":"FactoryMode_V119_202107240052_release.apk","properties":{}}]
\ No newline at end of file
diff --git a/app/src/main/java/mobile/miki/GyroScope.java b/app/src/main/java/mobile/miki/GyroScope.java
new file mode 100644 (file)
index 0000000..fc704ac
--- /dev/null
@@ -0,0 +1,172 @@
+package mobile.miki;
+
+import android.content.Intent;
+import android.hardware.Sensor;
+import android.hardware.SensorEvent;
+import android.hardware.SensorEventListener;
+import android.hardware.SensorManager;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.preference.PreferenceManager;
+import android.util.Log;
+import android.view.View;
+import android.widget.TextView;
+
+import com.ic.jni.ICJniUtils;
+
+import java.util.Timer;
+import java.util.TimerTask;
+
+import mobile.miki.mainui.ButtonViewTwo;
+import mobile.miki.mainui.TestMainActivity;
+import mobile.miki.util.Config;
+import mobile.miki.util.FTUtils;
+
+public class GyroScope extends BaseActivity implements View.OnClickListener, SensorEventListener {
+
+    private ButtonViewTwo buttonView;
+    boolean running;
+    public static final int TYPE_HEART_RATE = 21;
+    Timer mTimer=null;
+
+    private TextView tv_x;
+    private TextView tv_y;
+    private TextView tv_z;
+
+    private SensorManager mSensorManager=null;
+    private Sensor mGyroScope=null;
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.gyroscope_layout);
+        initView();
+
+        Intent intent = getIntent();
+        running = false;
+        if (intent != null) {
+            running = intent.getBooleanExtra("running", false);
+        }
+
+
+        mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
+        mGyroScope = mSensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE);
+        boolean ret = mSensorManager.registerListener(this, mGyroScope, SensorManager.SENSOR_DELAY_NORMAL);
+        Log.i("dxc", " GyroScope opened ret :: " + ret);
+
+
+    }
+
+    Handler mhandler=new Handler(new Handler.Callback() {
+        @Override
+        public boolean handleMessage(Message message) {
+
+            switch(message.what)
+            {
+
+                case 1: {
+                    Bundle bdl = message.getData();
+                    String x = bdl.getString("X");
+                    String y = bdl.getString("Y");
+                    String z = bdl.getString("Z");
+                    if (!x.trim().isEmpty() && !y.trim().isEmpty()&& !z.trim().isEmpty()) {
+                        tv_x.setText(" " + x);
+                        tv_y.setText(" " + y);
+                        tv_z.setText(" " + z);
+                    } else {
+                        tv_x.setText(" " + GyroScope.this.getResources().getString(R.string.no_gyroscope));
+                        tv_y.setText("");
+                        tv_z.setText("");
+                    }
+                }
+                    break;
+
+            }
+
+            return false;
+        }
+    });
+    @Override
+    protected void onDestroy() {
+        super.onDestroy();
+
+        mSensorManager.unregisterListener(this);
+        Log.i("dxc", "GyroScope  closed");
+
+    }
+
+    @Override
+    protected void onPause() {
+        super.onPause();
+        Log.i( "dxc","GyroScope onPause");
+
+    }
+
+    private void initView() {
+        buttonView = (ButtonViewTwo) findViewById(R.id.btn_set);
+        buttonView.btn_left.setOnClickListener(this);
+        buttonView.btn_right.setOnClickListener(this);
+        buttonView.setSuccessColor();
+        buttonView.btn_left.setClickable(true);
+
+        tv_x=(TextView)findViewById(R.id.tv_gyro_xvalue);
+        tv_y=(TextView)findViewById(R.id.tv_gyro_yvalue);
+        tv_z=(TextView)findViewById(R.id.tv_gyro_zvalue);
+
+    }
+
+    @Override
+    public void onClick(View view) {
+        Intent intent =  Config.getNextTestIntent(this,this.getClass());//new Intent(this, SimDetectActivity.class);
+        intent.putExtra("running", true);
+        Intent intent1 = new Intent(this, TestMainActivity.class);
+        // TestResult testResult = (TestResult) getApplicationContext();
+        switch (view.getId()) {
+
+            case R.id.btn_two_left:
+                if (!running) {
+                    startActivity(intent1);
+                } else {
+                    startActivity(intent);
+                }
+                PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).edit().putString("gyroscope", "true").commit();
+                finish();
+                break;
+            case R.id.btn_two_right:
+                if (!running) {
+                    startActivity(intent1);
+                } else {
+                    startActivity(intent);
+                }
+                PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).edit().putString("gyroscope", "false").commit();
+                finish();
+                break;
+        }
+    }
+
+    @Override
+    public void onSensorChanged(SensorEvent sensorEvent) {
+        float values[]=sensorEvent.values;
+        int length = values.length;
+        Log.i( "dxc","onSensorChanged() is called "+length
+                +" X = "+values[0]
+                +", Y = "+values[1]
+                +", Z = "+values[2]
+        );
+
+        Message msg=new Message();
+        Bundle bdl=new Bundle();
+        msg.what=1;
+        bdl.putString("X", String.format("%.5f",values[0]));
+        bdl.putString("Y",String.format("%.5f",values[1]));
+        bdl.putString("Z",String.format("%.5f",values[2]));
+        msg.setData(bdl);
+        mhandler.sendMessage(msg);
+
+    }
+
+    @Override
+    public void onAccuracyChanged(Sensor sensor, int i) {
+        Log.i("dxc","onAccuracyChanged() is called "+sensor.getName()+" accuracy="+i);
+    }
+}
index aeb13ad..1b200a1 100644 (file)
@@ -276,6 +276,26 @@ public class Config {
             testResultList.add("bt");\r
             testResultList.add("vibrator");\r
             testResultList.add("Ultraviolet");\r
+        } else if (FTUtils.isW560()) {\r
+\r
+//            list.add(context.getString(R.string.bt));\r
+//            testResultList.add("bt");\r
+\r
+//            list.add(context.getString(R.string.dsp));\r
+//            testResultList.add("dsp");\r
+\r
+            list.add(context.getString(R.string.test_keypad));\r
+            testResultList.add("keys");\r
+\r
+            list.add(context.getString(R.string.shakeTest));\r
+            testResultList.add("vibrator");\r
+\r
+            list.add(context.getString(R.string.heartrate));\r
+            testResultList.add("heartrate");\r
+\r
+            list.add(context.getString(R.string.temperature));\r
+            testResultList.add("temperature");\r
+\r
         } else if (FTUtils.isV20()) {\r
             // s06 添加dsp测试\r
             list.add(context.getString(R.string.test_keypad));\r
index c3ef4c0..4f0cf67 100644 (file)
@@ -251,7 +251,13 @@ public class FTUtils {
         }\r
         return false;\r
     }\r
+    public static boolean isW560(){\r
+        if(SystemProperties.get("persist.sys.id_num","").equalsIgnoreCase("W560")) {\r
 \r
+            return true;\r
+        }\r
+        return false;\r
+    }\r
     public static boolean isGT09(){\r
         if(SystemProperties.get("persist.sys.id_num","").equalsIgnoreCase("GT09")\r
                 || SystemProperties.get("persist.sys.customname","").equalsIgnoreCase("GT09")\r
diff --git a/app/src/main/res/layout/gyroscope_layout.xml b/app/src/main/res/layout/gyroscope_layout.xml
new file mode 100644 (file)
index 0000000..13a1cb0
--- /dev/null
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
+    android:orientation="vertical" android:layout_width="match_parent"\r
+    android:layout_height="match_parent">\r
+\r
+    <LinearLayout\r
+        android:layout_width="match_parent"\r
+        android:layout_height="wrap_content"\r
+        android:orientation="vertical">\r
+\r
+        <LinearLayout\r
+            android:layout_width="match_parent"\r
+            android:layout_height="match_parent"\r
+            android:orientation="horizontal">\r
+\r
+            <TextView\r
+                android:id="@+id/tv_gyro_X"\r
+                android:layout_width="wrap_content"\r
+                android:layout_height="wrap_content"\r
+                android:text="X:"\r
+                android:textSize="36sp" />\r
+\r
+            <TextView\r
+                android:id="@+id/tv_gyro_xvalue"\r
+                android:layout_width="wrap_content"\r
+                android:layout_height="wrap_content"\r
+                android:text="0"\r
+                android:textSize="36sp" />\r
+        </LinearLayout>\r
+\r
+        <LinearLayout\r
+            android:layout_width="match_parent"\r
+            android:layout_height="match_parent"\r
+            android:orientation="horizontal">\r
+\r
+            <TextView\r
+                android:id="@+id/tv_gyro_Y"\r
+                android:layout_width="wrap_content"\r
+                android:layout_height="wrap_content"\r
+                android:text="Y:"\r
+                android:textSize="36sp" />\r
+\r
+            <TextView\r
+                android:id="@+id/tv_gyro_yvalue"\r
+                android:layout_width="wrap_content"\r
+                android:layout_height="wrap_content"\r
+                android:text="0"\r
+                android:textSize="36sp" />\r
+        </LinearLayout>\r
+        <LinearLayout\r
+            android:layout_width="match_parent"\r
+            android:layout_height="match_parent"\r
+            android:orientation="horizontal">\r
+\r
+            <TextView\r
+                android:id="@+id/tv_gyro_Z"\r
+                android:layout_width="wrap_content"\r
+                android:layout_height="wrap_content"\r
+                android:text="Z:"\r
+                android:textSize="36sp" />\r
+\r
+            <TextView\r
+                android:id="@+id/tv_gyro_zvalue"\r
+                android:layout_width="wrap_content"\r
+                android:layout_height="wrap_content"\r
+                android:text="0"\r
+                android:textSize="36sp" />\r
+        </LinearLayout>\r
+    </LinearLayout>\r
+\r
+    <mobile.miki.mainui.ButtonViewTwo\r
+        android:id="@+id/btn_set"\r
+        android:layout_width="match_parent"\r
+        android:layout_height="wrap_content"\r
+        android:layout_alignParentBottom="true"\r
+        android:layout_centerHorizontal="true" >\r
+    </mobile.miki.mainui.ButtonViewTwo>\r
+\r
+</RelativeLayout>
\ No newline at end of file
index 89ba990..7d88ae7 100644 (file)
@@ -1,2 +1,2 @@
-#Mon Jul 19 21:07:38 CST 2021\r
-VERSION_CODE=118\r
+#Sat Jul 24 00:52:51 CST 2021\r
+VERSION_CODE=119\r