Ver código fonte

1.增加本地锁定密码校验后的通知接口

20241218TB223FC(测试jar包)
wangwanlei 10 meses atrás
pai
commit
f6fbb82cce

+ 1
- 1
app/src/main/java/com/xhly/manageapp/ui/login/netservice/LoginService.kt Ver arquivo

@@ -78,5 +78,5 @@ interface LoginService {
78 78
      *设备--解除锁定(锁定后,本地输入密码校验通过后调用) 参数sn
79 79
      */
80 80
     @POST(UriAdress.EDIT_UNLOCK)
81
-    suspend fun postEditLock(@Body map:HashMap<String,Any>):ResponseData<Any>
81
+    suspend fun postEditUnlock(@Body map:HashMap<String,Any>):ResponseData<Any>
82 82
 }

+ 33
- 25
app/src/main/java/com/xhly/manageapp/ui/main/activity/MainActivity.kt Ver arquivo

@@ -105,6 +105,8 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),Download
105 105
     private var updateStrategyFlag = false
106 106
     //标记当前是否锁定
107 107
     private var mainLockFlag=false
108
+
109
+    private var accountDialog:CustomDialog?=null
108 110
     override fun getBinding() = ActivityMainBinding.inflate(layoutInflater)
109 111
 
110 112
     @SuppressLint("CheckResult")
@@ -746,6 +748,8 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),Download
746 748
             if (param || block) {
747 749
                 mBinding.mainLlayout.visibility = View.GONE
748 750
                 mBinding.lockLlayout.visibility = View.VISIBLE
751
+                //隐藏账号编辑弹窗
752
+                accountDialog?.dismiss()
749 753
             } else {
750 754
                 mBinding.mainLlayout.visibility = View.VISIBLE
751 755
                 mBinding.lockLlayout.visibility = View.GONE
@@ -1124,35 +1128,39 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),Download
1124 1128
 
1125 1129
 
1126 1130
     private fun showEditDialog() {
1127
-        CustomDialog.build()
1128
-            .setCustomView(object : OnBindView<CustomDialog>(R.layout.layout_edit_dialog) {
1129
-                override fun onBind(dialog: CustomDialog, v: View) {
1130
-                    var titleTv = v.findViewById<TextView>(R.id.dialog_title_tv)
1131
-                    val enterTv = v.findViewById<TextView>(R.id.dialog_enter_tv)
1132
-                    val cancelTv = v.findViewById<TextView>(R.id.dialog_cancel_tv)
1133
-                    val editText = v.findViewById<EditText>(R.id.dialog_et)
1134
-                    editText.hint = getString(R.string.inputcode)
1135
-                    titleTv.text = getString(R.string.exit)
1136
-                    enterTv.setOnClickListener {
1137
-                        val code = editText.text
1138
-                        if ((!code.isNullOrBlank()) && code.length >= 6 && code.length <= 16) {
1139
-                            dialog.dismiss()
1140
-                            try {
1141
-                                val userBean = spUtils.getFromJson(
1142
-                                    Const.USERINFO, UserBean().javaClass
1143
-                                ) as UserBean
1144
-                                viewModel.loginOut(userBean.userid.toString(), code.toString())
1145
-                            } catch (e: Exception) {
1131
+        if (accountDialog==null){
1132
+            accountDialog = CustomDialog.build()
1133
+                .setCustomView(object : OnBindView<CustomDialog>(R.layout.layout_edit_dialog) {
1134
+                    override fun onBind(dialog: CustomDialog, v: View) {
1135
+                        var titleTv = v.findViewById<TextView>(R.id.dialog_title_tv)
1136
+                        val enterTv = v.findViewById<TextView>(R.id.dialog_enter_tv)
1137
+                        val cancelTv = v.findViewById<TextView>(R.id.dialog_cancel_tv)
1138
+                        val editText = v.findViewById<EditText>(R.id.dialog_et)
1139
+                        editText.hint = getString(R.string.inputcode)
1140
+                        titleTv.text = getString(R.string.exit)
1141
+                        enterTv.setOnClickListener {
1142
+                            val code = editText.text
1143
+                            if ((!code.isNullOrBlank()) && code.length >= 6 && code.length <= 16) {
1144
+                                dialog.dismiss()
1145
+                                try {
1146
+                                    val userBean = spUtils.getFromJson(
1147
+                                        Const.USERINFO, UserBean().javaClass
1148
+                                    ) as UserBean
1149
+                                    viewModel.loginOut(userBean.userid.toString(), code.toString())
1150
+                                } catch (e: Exception) {
1146 1151
 
1152
+                                }
1147 1153
                             }
1148 1154
                         }
1155
+                        cancelTv.setOnClickListener {
1156
+                            dialog.dismiss()
1157
+                        }
1149 1158
                     }
1150
-                    cancelTv.setOnClickListener {
1151
-                        dialog.dismiss()
1152
-                    }
1153
-                }
1154
-            }).setCancelable(false).setMaskColor(Color.parseColor("#66000000"))
1155
-            .setAlign(CustomDialog.ALIGN.CENTER).show()
1159
+                }).setCancelable(false).setMaskColor(Color.parseColor("#66000000"))
1160
+                .setAlign(CustomDialog.ALIGN.CENTER).show()
1161
+        }else{
1162
+            accountDialog?.show()
1163
+        }
1156 1164
     }
1157 1165
 
1158 1166
     private fun showNoticeDialog(msg: String) {

+ 1
- 1
app/src/main/java/com/xhly/manageapp/viewmodel/BaseViewModel.kt Ver arquivo

@@ -162,7 +162,7 @@ open class BaseViewModel : CommonBaseViewModel() {
162 162
         launchUI {
163 163
             val map=HashMap<String,Any>()
164 164
             map["sn"]=sn
165
-            var postExitLocked = loginService.postExitLocked(map)
165
+            var postExitLocked = loginService.postEditUnlock(map)
166 166
         }
167 167
     }
168 168
 }

Carregando…
Cancelar
Salvar