浏览代码

## [1.0.18] version 18 - 2020-07-21
### Added
- 增加线控耳机挂断功能
### Changed
- 去掉桌面模式
- 优化系统信息界面
- 转接按键优化

allen 4 年之前
父节点
当前提交
0b4517664d

+ 2 - 2
app/src/main/AndroidManifest.xml

@@ -50,8 +50,8 @@
                 <category android:name="android.intent.category.LAUNCHER"/>
 
                 <!-- 设置成主题界面 -->
-                <category android:name="android.intent.category.HOME" />
-                <category android:name="android.intent.category.DEFAULT" />
+<!--                <category android:name="android.intent.category.HOME" />-->
+<!--                <category android:name="android.intent.category.DEFAULT" />-->
             </intent-filter>
         </activity>
 

+ 2 - 2
build.gradle

@@ -47,12 +47,12 @@ buildscript {
     /**
      * APP版本码
      */
-    ext.app_version_code = 17
+    ext.app_version_code = 18
 
     /**
      * APP版本号
      */
-    ext.app_version = "1.0.17"
+    ext.app_version = "1.0.18"
 
     /**
      * 项目依赖库

+ 13 - 13
common/src/main/code/com/wdkl/ncs/android/lib/base/BaseApplication.kt

@@ -45,8 +45,8 @@ open class BaseApplication : MultiDexApplication() {
      */
     override fun onCreate() {
         super.onCreate()
-        closeAndroidPDialog()
-        AppTool.SystemUI.initStatusBarHeight(applicationContext)
+//        closeAndroidPDialog()
+//        AppTool.SystemUI.initStatusBarHeight(applicationContext)
         /**Logger初始化*/
         LoggerFactory.create(baseContext)
                      .diskCache()
@@ -81,17 +81,17 @@ open class BaseApplication : MultiDexApplication() {
             e.printStackTrace()
         }
 
-        try {
-            val cls = Class.forName("android.app.ActivityThread")
-            val declaredMethod = cls.getDeclaredMethod("currentActivityThread")
-            declaredMethod.isAccessible = true
-            val activityThread = declaredMethod.invoke(null)
-            val mHiddenApiWarningShown = cls.getDeclaredField("mHiddenApiWarningShown")
-            mHiddenApiWarningShown.isAccessible = true
-            mHiddenApiWarningShown.setBoolean(activityThread, true)
-        } catch (e: Exception) {
-            e.printStackTrace()
-        }
+//        try {
+//            val cls = Class.forName("android.app.ActivityThread")
+//            val declaredMethod = cls.getDeclaredMethod("currentActivityThread")
+//            declaredMethod.isAccessible = true
+//            val activityThread = declaredMethod.invoke(null)
+//            val mHiddenApiWarningShown = cls.getDeclaredField("mHiddenApiWarningShown")
+//            mHiddenApiWarningShown.isAccessible = true
+//            mHiddenApiWarningShown.setBoolean(activityThread, true)
+//        } catch (e: Exception) {
+//            e.printStackTrace()
+//        }
 
     }
 

+ 5 - 3
home/src/main/code/com/wdkl/ncs/android/component/home/activity/WatchHome2Activity.kt

@@ -110,8 +110,8 @@ class WatchHome2Activity : BaseActivity<WatchHomeActivityPresenter, WatchActivit
         //保活守护进程
         DaemonEnv.init(this);
         //請求用戶忽略电池优化
-        val reason = "轨迹跟踪服务的持续运行"
-        DaemonEnv.whiteListMatters(this, reason)
+//        val reason = "轨迹跟踪服务的持续运行"
+//        DaemonEnv.whiteListMatters(this, reason)
         //启动work服务
         DaemonEnv.startServiceSafelyWithData(this, WdKeepAliveService::class.java)
 
@@ -213,7 +213,9 @@ class WatchHome2Activity : BaseActivity<WatchHomeActivityPresenter, WatchActivit
                 }
             }).start()
 
-            requestPermissions()
+            AppTool.Time.delay(1500) {
+                requestPermissions()
+            }
         }
     }
 

+ 13 - 106
home/src/main/code/com/wdkl/ncs/android/component/home/activity/WatchUserSettingActivity.java

@@ -36,56 +36,28 @@ import org.greenrobot.eventbus.ThreadMode;
 
 public class WatchUserSettingActivity extends Activity {
 
-    private TextView tvDeviceId;
-    private TextView tvDeviceMac;
-    private TextView tv_device_imei;
-    private TextView tvDeviceIp;
-    private TextView tvDeviceUser;
-    private TextView tv_device_user_role_name;
-    private Button btnChange;
-    private TextView countdown_time_tv;
-    private SeekBar countdown_time_seekb;
-    private TextView version_information_tv;
-    private TextView update_app_tv,reboot_tv,setting_tv;
+    private TextView tvAppVersion,tvDeviceId,tvDeviceImei,tvDeviceIp;
 
-    private static final int WRITE_EXTERNAL_STORAGE_REQUEST_CODE = 127;//这个值是自定义的一个int值,在申请多个权限时要
+    private Button btnChange,btnCheckUpdate,btnSystemSetting;
 
     @Override
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.user_setting_layout);
 
+        tvAppVersion = findViewById(R.id.tv_app_version);
         tvDeviceId = findViewById(R.id.tv_device_id);
-        tvDeviceMac = findViewById(R.id.tv_device_mac);
-        tv_device_imei = findViewById(R.id.tv_device_imei);
+        tvDeviceImei = findViewById(R.id.tv_device_imei);
         tvDeviceIp = findViewById(R.id.tv_device_ip);
-        tvDeviceUser = findViewById(R.id.tv_device_user_name);
-        tv_device_user_role_name = findViewById(R.id.tv_device_user_role_name);
-        btnChange = findViewById(R.id.btn_user_change);
-        countdown_time_tv = findViewById(R.id.countdown_time_tv);
-        countdown_time_seekb = findViewById(R.id.countdown_time_seekb);
-        version_information_tv = findViewById(R.id.version_information_tv);
-        update_app_tv = findViewById(R.id.update_app_tv);
-        reboot_tv = findViewById(R.id.reboot_tv);
-        setting_tv = findViewById(R.id.setting_tv);
-
 
-        tvDeviceId.setText("设备ID: " + Constants.Companion.getDeviceId());
-        tvDeviceMac.setText("设备MAC: " + Constants.Companion.getMac());
-        tv_device_imei.setText("设备IMEI: " + Constants.Companion.getImei());
-        tvDeviceIp.setText("设备IP: " + NetHelper.getInstance().getLocalIP());
-        tvDeviceUser.setText("当前用户: " + Constants.Companion.getUserName());
-        if (!Strings.isNullOrEmpty(Constants.Companion.getUserRoleName())) {
-            if (Constants.Companion.getUserRoleName().contains("腕表")) {
-                tv_device_user_role_name.setText("用户角色: " + Constants.Companion.getUserRoleName().substring(0, (Constants.Companion.getUserRoleName()).indexOf("腕表")));
-            } else {
-                tv_device_user_role_name.setText("用户角色: " + Constants.Companion.getUserRoleName());
-            }
-        }
+        btnChange = findViewById(R.id.btn_user_change);
+        btnCheckUpdate = findViewById(R.id.btn_check_update);
+        btnSystemSetting = findViewById(R.id.btn_system_setting);
 
-        //设置呼叫转接时间
-        countdown_time_tv.setText("转接时间: " + SettingConfig.getCountdownTime(this) + "秒");
-        countdown_time_seekb.setProgress(SettingConfig.getCountdownTime(this));
+        tvAppVersion.setText(BuildConfig.VERSION_NAME);
+        tvDeviceId.setText(Constants.Companion.getDeviceId());
+        tvDeviceImei.setText(Constants.Companion.getImei());
+        tvDeviceIp.setText(NetHelper.getInstance().getLocalIP());
 
         btnChange.setOnClickListener(new View.OnClickListener() {
             @Override
@@ -97,40 +69,8 @@ public class WatchUserSettingActivity extends Activity {
             }
         });
 
-        countdown_time_seekb.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
-            @Override
-            public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
-                countdown_time_tv.setText("转接时间: " + i + "秒");
-            }
-
-            @Override
-            public void onStartTrackingTouch(SeekBar seekBar) {
-
-            }
-
-            @Override
-            public void onStopTrackingTouch(SeekBar seekBar) {
-                SettingConfig.setCountdownTime(getApplication(), seekBar.getProgress());
-            }
-        });
-        version_information_tv.setText("App名称: " + getString(R.string.javashop_app_name) +
-                "\r\nAPP版本号: V" + BuildConfig.VERSION_NAME
-                + "\r\n发布日期:" + BuildConfig.BUILD_TIME
-                + "\r\nSDK版本: " + Build.VERSION.SDK_INT
-                + "\r\n平台: " + Build.PRODUCT);
-
-
-        int permissionCheck = ContextCompat.checkSelfPermission(this,
-                Manifest.permission.READ_PHONE_STATE);
-
-        if (permissionCheck != PackageManager.PERMISSION_GRANTED) {
-            ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_PHONE_STATE}, WRITE_EXTERNAL_STORAGE_REQUEST_CODE);
-        } else {
-            //TODO
-        }
-
         final Context _this = this;
-        update_app_tv.setOnClickListener(new View.OnClickListener() {
+        btnCheckUpdate.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
             if ((System.currentTimeMillis() / 1000) - TcpHandleService.instance.getUpdateLastTime() > 10) {
@@ -143,45 +83,12 @@ public class WatchUserSettingActivity extends Activity {
             }
             }
         });
-
-        reboot_tv.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View view) {
-
-            }
-        });
-        setting_tv.setOnClickListener(new View.OnClickListener() {
+        btnSystemSetting.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
                 Intent intent = new Intent(Settings.ACTION_SETTINGS);
                 startActivity(intent);
             }
         });
-
-
-    }
-
-
-
-
-    @Override
-    protected void onStart() {
-        super.onStart();
-        if(!EventBus.getDefault().isRegistered(this)) {
-            EventBus.getDefault().register(this);
-        }
-    }
-
-
-    @Override
-    protected void onDestroy() {
-        super.onDestroy();
-        EventBus.getDefault().unregister(this);
     }
-
-    @Subscribe(threadMode = ThreadMode.MAIN)
-    public void onMoonEvent(MessageEvent messageEvent) {
-
-    }
-
 }

+ 36 - 29
home/src/main/code/com/wdkl/ncs/android/component/home/activity/WebRTCVoipAudioActivity.kt

@@ -157,34 +157,7 @@ class WebRTCVoipAudioActivity : Activity(), View.OnClickListener {
     override fun onClick(p0: View?) {
         when (p0?.id) {
             R.id.hang_up_imagev -> {
-                if(!isClick)return
-
-                var interactionVO: InteractionVO? = null
-                if (tcpModel.data.javaClass.name == String::class.java.name) {
-                    interactionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
-                } else {
-                    interactionVO = tcpModel.data as InteractionVO
-                }
-                Log.i(TAG, "tcpModel" + interactionVO!!.id!!)
-                Log.i(TAG, "tcpModel" + tcpModel.toJson())
-
-                //给服务器发送挂断 tcp
-                if (tcpModel.type == TcpType.VOICE) {
-                    if (tcpModel.action === TcpAction.VoiceAction.SUCCESS) {
-                        val voiceUtilTcpModel = VoiceUtil.voiceHandoff(Integer.parseInt(Constants.deviceId), tcpModel.toId, interactionVO.id)
-                        TcpClient.getInstance().sendMsg(voiceUtilTcpModel.toJson())
-                    } else if (tcpModel.action === TcpAction.VoiceAction.CALL) {
-                        val voiceUtilTcpModel = VoiceUtil.voiceHandoff(Integer.parseInt(Constants.deviceId), tcpModel.fromId, interactionVO.id)
-                        TcpClient.getInstance().sendMsg(voiceUtilTcpModel.toJson())
-                    }
-
-                    //webrtc
-                    val session = gEngineKit?.getCurrentSession()
-                    if (session != null) {
-                        session.leave()
-                    }
-                    finish()
-                }
+                handOffCall()
             }
             R.id.hands_free_image -> {
                 Log.i(TAG,"声音切换点击")
@@ -205,8 +178,39 @@ class WebRTCVoipAudioActivity : Activity(), View.OnClickListener {
                 }
             }
         }
+    }
+
+    fun handOffCall(){
+        if(!isClick)return
+
+        var interactionVO: InteractionVO? = null
+        if (tcpModel.data.javaClass.name == String::class.java.name) {
+            interactionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
+        } else {
+            interactionVO = tcpModel.data as InteractionVO
+        }
+        Log.i(TAG, "tcpModel" + interactionVO!!.id!!)
+        Log.i(TAG, "tcpModel" + tcpModel.toJson())
 
+        //给服务器发送挂断 tcp
+        if (tcpModel.type == TcpType.VOICE) {
+            if (tcpModel.action === TcpAction.VoiceAction.SUCCESS) {
+                val voiceUtilTcpModel = VoiceUtil.voiceHandoff(Integer.parseInt(Constants.deviceId), tcpModel.toId, interactionVO.id)
+                TcpClient.getInstance().sendMsg(voiceUtilTcpModel.toJson())
+            } else if (tcpModel.action === TcpAction.VoiceAction.CALL) {
+                val voiceUtilTcpModel = VoiceUtil.voiceHandoff(Integer.parseInt(Constants.deviceId), tcpModel.fromId, interactionVO.id)
+                TcpClient.getInstance().sendMsg(voiceUtilTcpModel.toJson())
+            }
+
+            //webrtc
+            val session = gEngineKit?.getCurrentSession()
+            if (session != null) {
+                session.leave()
+            }
+            finish()
+        }
     }
+
     fun initCountDownTimer() {
         countDownTimer = object : CountDownTimer(CALL_TIMEOUT * 1000L, 1000) {
             override fun onTick(millisUntilFinished: Long) {
@@ -262,7 +266,10 @@ class WebRTCVoipAudioActivity : Activity(), View.OnClickListener {
     }
 
     override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
-        if (keyCode == KeyEvent.KEYCODE_BACK) {
+        Log.i(TAG, "keyup keyCode " + keyCode)
+        if (keyCode == KeyEvent.KEYCODE_HEADSETHOOK){
+            handOffCall()
+        } else if (keyCode == KeyEvent.KEYCODE_BACK) {
 //            Toast.makeText(this, "按下了back键   onKeyDown()", Toast.LENGTH_SHORT).show()
             return false
         }

+ 5 - 5
home/src/main/res/layout/activity_web_rtc_voip_audio_ringing.xml

@@ -70,18 +70,18 @@
             android:id="@+id/change_over_relayout"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_marginRight="28px"
+            android:layout_marginRight="28dp"
             android:layout_gravity="center" >
             <ImageView
                 android:id="@+id/change_over_image"
-                android:layout_width="60px"
-                android:layout_height="60px"
+                android:layout_width="45dp"
+                android:layout_height="45dp"
                 android:src="@drawable/yu_yin_wei_chu_li" />
             <TextView
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_centerInParent="true"
-                android:textSize="14px"
+                android:textSize="14dp"
                 android:textColor="#ffffff"
                 android:text="转接"/>
 
@@ -90,7 +90,7 @@
             android:id="@+id/hang_up_imagev"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_marginRight="28px"
+            android:layout_marginRight="28dp"
             android:src="@drawable/yu_yin_gua_duan"
             android:visibility="gone"/>
 

+ 131 - 112
home/src/main/res/layout/user_setting_layout.xml

@@ -12,138 +12,157 @@
             android:layout_height="match_parent"
             android:orientation="vertical">
 
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="vertical"
+                android:layout_marginTop="15dp"
+                android:gravity="center_horizontal">
+                <ImageView
+                    android:src="@mipmap/launcher"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"/>
+            </LinearLayout>
 
             <LinearLayout
-                android:layout_width="wrap_content"
+                android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:layout_marginLeft="20dp"
-                android:layout_marginTop="10dp"
+                android:padding="10dp"
                 android:orientation="vertical">
 
-                <TextView
-                    android:id="@+id/tv_device_id"
-                    android:layout_width="wrap_content"
+                <LinearLayout
+                    android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:text="设备ID: --"
-                    android:textSize="16dp" />
-
-                <TextView
-                    android:id="@+id/tv_device_mac"
-                    android:layout_width="wrap_content"
+                    android:orientation="horizontal">
+                    <TextView
+                        android:text="版本"
+                        android:textSize="14dp"
+                        android:textColor="@color/javashop_color_searcher_tv_gray"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"/>
+                    <LinearLayout
+                        android:layout_width="0dp"
+                        android:layout_height="wrap_content"
+                        android:layout_weight="1"
+                        android:gravity="right">
+                        <TextView
+                            android:id="@+id/tv_app_version"
+                            android:textSize="14dp"
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"/>
+                    </LinearLayout>
+                </LinearLayout>
+
+                <LinearLayout
+                    android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:text="设备MAC: --"
-                    android:textSize="16dp" />
-                <TextView
-                    android:id="@+id/tv_device_imei"
-                    android:layout_width="wrap_content"
+                    android:orientation="horizontal">
+                    <TextView
+                        android:text="设备ID"
+                        android:textSize="14dp"
+                        android:textColor="@color/javashop_color_searcher_tv_gray"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"/>
+                    <LinearLayout
+                        android:layout_width="0dp"
+                        android:layout_height="wrap_content"
+                        android:layout_weight="1"
+                        android:gravity="right">
+                        <TextView
+                            android:id="@+id/tv_device_id"
+                            android:textSize="14dp"
+                            android:textColor="@color/javashop_color_searcher_tv_gray"
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"/>
+                    </LinearLayout>
+                </LinearLayout>
+
+                <LinearLayout
+                    android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:text="设备识别码: --"
-                    android:textSize="16dp" />
-                <TextView
-                    android:id="@+id/tv_device_ip"
-                    android:layout_width="wrap_content"
+                    android:orientation="horizontal">
+                    <TextView
+                        android:text="设备标识码"
+                        android:textSize="14dp"
+                        android:textColor="@color/javashop_color_searcher_tv_gray"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"/>
+                    <LinearLayout
+                        android:layout_width="0dp"
+                        android:layout_height="wrap_content"
+                        android:layout_weight="1"
+                        android:gravity="right">
+                        <TextView
+                            android:id="@+id/tv_device_imei"
+                            android:textSize="14dp"
+                            android:textColor="@color/javashop_color_searcher_tv_gray"
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"/>
+                    </LinearLayout>
+                </LinearLayout>
+
+                <LinearLayout
+                    android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:text="设备IP: --"
-                    android:textSize="16dp" />
+                    android:orientation="horizontal">
+                    <TextView
+                        android:text="设备IP"
+                        android:textSize="14dp"
+                        android:textColor="@color/javashop_color_searcher_tv_gray"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"/>
+                    <LinearLayout
+                        android:layout_width="0dp"
+                        android:layout_height="wrap_content"
+                        android:layout_weight="1"
+                        android:gravity="right">
+                        <TextView
+                            android:id="@+id/tv_device_ip"
+                            android:textSize="14dp"
+                            android:textColor="@color/javashop_color_searcher_tv_gray"
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"/>
+                    </LinearLayout>
+                </LinearLayout>
 
-                <TextView
-                android:id="@+id/tv_device_user_name"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:text="当前用户: ---"
-                android:textSize="16dp" />
-                <TextView
-                    android:id="@+id/tv_device_user_role_name"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:text="用户角色: ---"
-                    android:textSize="16dp" />
             </LinearLayout>
 
-            <Button
-                android:id="@+id/btn_user_change"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="center_horizontal"
-                android:layout_marginTop="10dp"
-                android:background="#00B5DC"
-                android:text="换班"
-                android:textColor="@drawable/selector_button_text_color"
-                android:textSize="16dp" />
-
-
             <LinearLayout
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:layout_marginLeft="10px"
-                android:layout_marginTop="20px"
-                android:layout_marginRight="10px"
-                android:layout_marginBottom="30px"
-                android:orientation="vertical"
-                android:visibility="gone">
+                android:padding="10dp"
+                android:orientation="vertical">
 
-                <TextView
-                    android:id="@+id/countdown_time_tv"
+                <Button
+                    android:id="@+id/btn_user_change"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:layout_marginLeft="20px"
-                    android:text="转接时间:"
-                    android:textSize="16dp" />
-
-                <SeekBar
-                    android:id="@+id/countdown_time_seekb"
-                    android:layout_width="match_parent"
+                    android:layout_gravity="center_horizontal"
+                    android:background="@drawable/javashop_btn_balck_line_bg"
+                    android:text="换班"
+                    android:textSize="14dp" />
+
+                <Button
+                    android:id="@+id/btn_check_update"
+                    android:layout_marginTop="10dp"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="center_horizontal"
+                    android:background="@drawable/javashop_btn_balck_line_bg"
+                    android:text="检查升级"
+                    android:textSize="14dp" />
+
+                <Button
+                    android:id="@+id/btn_system_setting"
+                    android:layout_marginTop="10dp"
+                    android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:layout_marginTop="20px"
-                    android:max="25"
-                    android:maxHeight="2px"
-                    android:progress="15" />
+                    android:layout_gravity="center_horizontal"
+                    android:background="@drawable/javashop_btn_balck_line_bg"
+                    android:text="系统设置"
+                    android:textSize="14dp" />
+
             </LinearLayout>
-            <TextView
-                android:id="@+id/version_information_tv"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_marginLeft="20dp"
-                android:layout_marginRight="20dp"
-                android:textSize="16dp"
-                android:text="软件版本"
-                />
-
-            <TextView
-                android:id="@+id/update_app_tv"
-                android:layout_width="match_parent"
-                android:layout_marginRight="30dp"
-                android:layout_marginLeft="30dp"
-                android:layout_marginTop="20dp"
-                android:layout_height="40dp"
-                android:background="#ffffff"
-                android:gravity="center"
-                android:textSize="18dp"
-                android:text="检查升级"/>
-
-            <TextView
-                android:id="@+id/reboot_tv"
-                android:layout_width="match_parent"
-                android:layout_height="40dp"
-                android:layout_marginRight="30dp"
-                android:layout_marginLeft="30dp"
-                android:background="#ffffff"
-                android:layout_marginTop="10dp"
-                android:gravity="center"
-                android:textSize="18dp"
-                android:text="重启设备"/>
-            <TextView
-                android:id="@+id/setting_tv"
-                android:layout_width="match_parent"
-                android:layout_height="40dp"
-                android:layout_marginRight="30dp"
-                android:layout_marginLeft="30dp"
-                android:layout_marginTop="10dp"
-                android:layout_marginBottom="20dp"
-                android:background="#ffffff"
-                android:gravity="center"
-                android:textSize="18dp"
-                android:text="系统设置"/>
 
         </LinearLayout>
     </ScrollView>

+ 8 - 2
home/src/main/res/layout/watch_activity_register.xml

@@ -14,6 +14,12 @@
         android:layout_height="match_parent"
         android:orientation="vertical">
 
+        <TextView
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="20dp"
+            android:textSize="20dp"
+            android:text="服务器IP: "/>
     <TextView
         android:id="@+id/tv_server_ip"
         android:layout_width="match_parent"
@@ -27,7 +33,7 @@
         android:layout_height="wrap_content"
         android:layout_marginTop="20dp"
         android:textSize="20dp"
-        android:text="MAC地址: "/>
+        android:text="识别码: "/>
     <TextView
         android:id="@+id/tv_feedback_device_info"
         android:layout_width="match_parent"
@@ -45,7 +51,7 @@
         android:layout_height="40dp"
         android:background="#ffffff"
         android:gravity="center"
-        android:textSize="18px"
+        android:textSize="18dp"
         android:text="系统设置"/>
     </LinearLayout>
     </ScrollView>

+ 10 - 10
keepalive/src/main/java/com/wdkl/ncs/keepbackground/utils/ForegroundNotificationUtils.java

@@ -13,22 +13,22 @@ import com.wdkl.ncs.keepbackground.R;
 
 public class ForegroundNotificationUtils {
     // 通知渠道的id
-    private static final String CHANNEL_ID = "保活图腾";
+    private static final String CHANNEL_ID = "wdkl_main_channel";
     private static final int CHANNEL_POSITION = 1;
     public static void startForegroundNotification(Service service){
 
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){
             //启动前台服务而不显示通知的漏洞已在 API Level 25 修复
             NotificationManager manager = (NotificationManager)service.getSystemService(Context.NOTIFICATION_SERVICE);
-            NotificationChannel Channel = new NotificationChannel(CHANNEL_ID,"主服务",NotificationManager.IMPORTANCE_DEFAULT);
-            Channel.enableLights(true);//设置提示灯
-            Channel.setLightColor(Color.GREEN);//设置提示灯颜色
-            Channel.setShowBadge(true);//显示logo
-            Channel.setDescription("");//设置描述
-            Channel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC); //设置锁屏可见 VISIBILITY_PUBLIC=可见
-            Channel.enableVibration(false);
-            Channel.setSound(null,null);
-            manager.createNotificationChannel(Channel);
+            NotificationChannel channel = new NotificationChannel(CHANNEL_ID,"主服务",NotificationManager.IMPORTANCE_HIGH);
+            channel.enableLights(true);//设置提示灯
+            channel.setLightColor(Color.GREEN);//设置提示灯颜色
+            channel.setShowBadge(true);//显示logo
+            channel.setDescription("");//设置描述
+            channel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC); //设置锁屏可见 VISIBILITY_PUBLIC=可见
+            channel.enableVibration(false);
+            channel.setSound(null,null);
+            manager.createNotificationChannel(channel);
 
             Notification notification = new Notification.Builder(service,CHANNEL_ID)
                     .setContentTitle("主服务")//标题

+ 4 - 2
keepalive/src/main/java/com/wdkl/ncs/keepbackground/utils/SPUtils.java

@@ -28,8 +28,10 @@ public class SPUtils {
      */
     public SPUtils(String spName) {
         sp = DaemonEnv.app.getSharedPreferences(spName, Context.MODE_PRIVATE);
-        editor = sp.edit();
-        editor.apply();
+        if (sp!=null) {
+            editor = sp.edit();
+            editor.apply();
+        }
     }
 
     /**

+ 3 - 0
middleware/src/main/code/com/wdkl/ncs/android/middleware/tcp/TcpClient.java

@@ -48,6 +48,9 @@ public class TcpClient {
     public void init(String serverIP, Integer serverPort, Integer heartBeatSeconds) {
         final Integer hbSeconds = heartBeatSeconds;
         bootstrap = new Bootstrap();
+        if (workGroup==null){
+            workGroup = new NioEventLoopGroup();
+        }
         bootstrap.group(workGroup)
                 .channel(NioSocketChannel.class)
                 .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 15 * 1000)

+ 10 - 0
readme.md

@@ -26,6 +26,16 @@
 
 ---
 
+## [1.0.18] version 18 - 2020-07-21
+### Added
+- 增加线控耳机挂断功能
+### Changed
+- 去掉桌面模式
+- 优化系统信息界面
+- 转接按键优化
+
+---
+
 ## [1.0.17] version 17 - 2020-07-16
 ### Fixed
 - 断网亮屏崩溃解决