Procházet zdrojové kódy

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

2.修改密码前先请求设置。
20241218TB223FC(测试jar包)
wangwanlei před 8 měsíci
rodič
revize
98bd34ffac

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

@@ -422,6 +422,8 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),Download
422 422
                     updateAppRv()
423 423
                     if (it.fromNetWorkType==1){
424 424
                         quitAccount(it)
425
+                    }else if (it.fromNetWorkType==2){
426
+                        changeCode(it)
425 427
                     }
426 428
                 }
427 429
             }
@@ -643,14 +645,8 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),Download
643 645
     private fun getChangeCodeListener(): AppAdapter.ChangePwdListener {
644 646
         return object : AppAdapter.ChangePwdListener {
645 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,6 +674,18 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),Download
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 689
     private fun showChangeCodeDialog() {
682 690
         CustomDialog.build()
683 691
             .setCustomView(object : OnBindView<CustomDialog>(R.layout.layout_changecode_dialog) {
@@ -694,16 +702,16 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),Download
694 702
                         val oldCode = oldCodeEt.text.toString()
695 703
                         val newCode = newCodeEt.text.toString()
696 704
                         if (!getTextFlag(enterCode) || !getTextFlag(oldCode) || !getTextFlag(newCode)) {
697
-                            Toast("密码不符合规则")
705
+                            Toast(getString(R.string.codetips))
698 706
                             return@setOnClickListener
699 707
                         }
700 708
                         if (oldCode.equals(newCode)) {
701
-                            Toast("新密码不能和旧密码一致")
709
+                            Toast(getString(R.string.codetipsold))
702 710
                             return@setOnClickListener
703 711
                         }
704 712
 
705 713
                         if (!newCode.equals(enterCode)) {
706
-                            Toast("两次输入的新密码不一致")
714
+                            Toast(getString(R.string.codetipsnew))
707 715
                             return@setOnClickListener
708 716
                         }
709 717
 
@@ -1642,7 +1650,11 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),Download
1642 1650
 
1643 1651
                                 }
1644 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 1660
                         cancelTv.setOnClickListener {
@@ -1687,7 +1699,7 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),Download
1687 1699
                     val titleTv = v.findViewById<TextView>(R.id.dialog_title_tv)
1688 1700
                     val contentTv = v.findViewById<TextView>(R.id.dialog_content_tv)
1689 1701
                     contentTv.text=msg
1690
-                    titleTv.text="通知"
1702
+                    titleTv.text=getString(R.string.notice)
1691 1703
                     closeBtn.setOnClickListener {
1692 1704
                         dialog.dismiss()
1693 1705
                     }

+ 3
- 0
app/src/main/res/layout/layout_changecode_dialog.xml Zobrazit soubor

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

+ 3
- 0
app/src/main/res/values/strings.xml Zobrazit soubor

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

Načítá se…
Zrušit
Uložit