Browse Source

1.string文件添加修改密码的提示语

2.修改密码前先请求设置。
20241218TB223FC(测试jar包)
wangwanlei 8 months ago
parent
commit
98bd34ffac

+ 25
- 13
app/src/main/java/com/xhly/manageapp/ui/main/activity/MainActivity.kt View File

422
                     updateAppRv()
422
                     updateAppRv()
423
                     if (it.fromNetWorkType==1){
423
                     if (it.fromNetWorkType==1){
424
                         quitAccount(it)
424
                         quitAccount(it)
425
+                    }else if (it.fromNetWorkType==2){
426
+                        changeCode(it)
425
                     }
427
                     }
426
                 }
428
                 }
427
             }
429
             }
643
     private fun getChangeCodeListener(): AppAdapter.ChangePwdListener {
645
     private fun getChangeCodeListener(): AppAdapter.ChangePwdListener {
644
         return object : AppAdapter.ChangePwdListener {
646
         return object : AppAdapter.ChangePwdListener {
645
             override fun changeCode() {
647
             override fun changeCode() {
646
-                val deviceSetBean = StrategyUtils.getSchoolDeviceSetBean(this@MainActivity)
647
-                var showFlag = true
648
-                if (deviceSetBean != null && deviceSetBean.changePwd == 0) {
649
-                    //学校设置是否禁止修改密码
650
-                    showFlag = false
651
-                }
652
-                if (showFlag) {
653
-                    showChangeCodeDialog()
648
+                userBean?.let {
649
+                    viewModel.getSchoolSetData(it.schoolid,2)
654
                 }
650
                 }
655
             }
651
             }
656
 
652
 
678
         }
674
         }
679
     }
675
     }
680
 
676
 
677
+    private fun changeCode(deviceSetBean:SchoolDeviceSetBean?){
678
+        //val deviceSetBean = StrategyUtils.getSchoolDeviceSetBean(this@MainActivity)
679
+        var showFlag = true
680
+        if (deviceSetBean != null && deviceSetBean.changePwd == 0) {
681
+            //学校设置是否禁止修改密码
682
+            showFlag = false
683
+        }
684
+        if (showFlag) {
685
+            showChangeCodeDialog()
686
+        }
687
+    }
688
+
681
     private fun showChangeCodeDialog() {
689
     private fun showChangeCodeDialog() {
682
         CustomDialog.build()
690
         CustomDialog.build()
683
             .setCustomView(object : OnBindView<CustomDialog>(R.layout.layout_changecode_dialog) {
691
             .setCustomView(object : OnBindView<CustomDialog>(R.layout.layout_changecode_dialog) {
694
                         val oldCode = oldCodeEt.text.toString()
702
                         val oldCode = oldCodeEt.text.toString()
695
                         val newCode = newCodeEt.text.toString()
703
                         val newCode = newCodeEt.text.toString()
696
                         if (!getTextFlag(enterCode) || !getTextFlag(oldCode) || !getTextFlag(newCode)) {
704
                         if (!getTextFlag(enterCode) || !getTextFlag(oldCode) || !getTextFlag(newCode)) {
697
-                            Toast("密码不符合规则")
705
+                            Toast(getString(R.string.codetips))
698
                             return@setOnClickListener
706
                             return@setOnClickListener
699
                         }
707
                         }
700
                         if (oldCode.equals(newCode)) {
708
                         if (oldCode.equals(newCode)) {
701
-                            Toast("新密码不能和旧密码一致")
709
+                            Toast(getString(R.string.codetipsold))
702
                             return@setOnClickListener
710
                             return@setOnClickListener
703
                         }
711
                         }
704
 
712
 
705
                         if (!newCode.equals(enterCode)) {
713
                         if (!newCode.equals(enterCode)) {
706
-                            Toast("两次输入的新密码不一致")
714
+                            Toast(getString(R.string.codetipsnew))
707
                             return@setOnClickListener
715
                             return@setOnClickListener
708
                         }
716
                         }
709
 
717
 
1642
 
1650
 
1643
                                 }
1651
                                 }
1644
                             }else{
1652
                             }else{
1645
-                                Toast("密码错误!")
1653
+                                if (code.isNullOrBlank()){
1654
+                                    Toast(getString(R.string.codenoempty))
1655
+                                }else{
1656
+                                    Toast(getString(R.string.codetips))
1657
+                                }
1646
                             }
1658
                             }
1647
                         }
1659
                         }
1648
                         cancelTv.setOnClickListener {
1660
                         cancelTv.setOnClickListener {
1687
                     val titleTv = v.findViewById<TextView>(R.id.dialog_title_tv)
1699
                     val titleTv = v.findViewById<TextView>(R.id.dialog_title_tv)
1688
                     val contentTv = v.findViewById<TextView>(R.id.dialog_content_tv)
1700
                     val contentTv = v.findViewById<TextView>(R.id.dialog_content_tv)
1689
                     contentTv.text=msg
1701
                     contentTv.text=msg
1690
-                    titleTv.text="通知"
1702
+                    titleTv.text=getString(R.string.notice)
1691
                     closeBtn.setOnClickListener {
1703
                     closeBtn.setOnClickListener {
1692
                         dialog.dismiss()
1704
                         dialog.dismiss()
1693
                     }
1705
                     }

+ 3
- 0
app/src/main/res/layout/layout_changecode_dialog.xml View File

53
                     android:hint="@string/oldcodetips"
53
                     android:hint="@string/oldcodetips"
54
                     android:singleLine="true"
54
                     android:singleLine="true"
55
                     android:maxLength="16"
55
                     android:maxLength="16"
56
+                    android:digits="@string/psw_style"
56
                     android:textColor="@color/black"
57
                     android:textColor="@color/black"
57
                     android:textColorHint="#FFB8C2D9"
58
                     android:textColorHint="#FFB8C2D9"
58
                     android:textSize="16sp" />
59
                     android:textSize="16sp" />
92
                     android:gravity="center_vertical"
93
                     android:gravity="center_vertical"
93
                     android:hint="@string/newcodetips"
94
                     android:hint="@string/newcodetips"
94
                     android:singleLine="true"
95
                     android:singleLine="true"
96
+                    android:digits="@string/psw_style"
95
                     android:maxLength="16"
97
                     android:maxLength="16"
96
                     android:textColor="@color/black"
98
                     android:textColor="@color/black"
97
                     android:textColorHint="#FFB8C2D9"
99
                     android:textColorHint="#FFB8C2D9"
133
                     android:hint="@string/enternewcodetips"
135
                     android:hint="@string/enternewcodetips"
134
                     android:singleLine="true"
136
                     android:singleLine="true"
135
                     android:maxLength="16"
137
                     android:maxLength="16"
138
+                    android:digits="@string/psw_style"
136
                     android:textColor="@color/black"
139
                     android:textColor="@color/black"
137
                     android:textColorHint="#FFB8C2D9"
140
                     android:textColorHint="#FFB8C2D9"
138
                     android:textSize="16sp" />
141
                     android:textSize="16sp" />

+ 3
- 0
app/src/main/res/values/strings.xml View File

49
     <string name="startapptips">应用正在安装,请稍后</string>
49
     <string name="startapptips">应用正在安装,请稍后</string>
50
     <string name="strategyupdatetips">请求过于频繁,请稍等</string>
50
     <string name="strategyupdatetips">请求过于频繁,请稍等</string>
51
     <string name="checknettips">请检查网络连接是否正常</string>
51
     <string name="checknettips">请检查网络连接是否正常</string>
52
+    <string name="notice">通知</string>
53
+    <string name="codetipsold">新密码不能和旧密码一致</string>
54
+    <string name="codetipsnew">两次输入的新密码不一致</string>
52
 </resources>
55
 </resources>

Loading…
Cancel
Save