Browse Source

1.usb监听增加限制,2秒内不算。

2.跳转wifi设置,增加flag防止跳回桌面。
3.修改注销弹窗密码提示。
3.锁定时隐藏各种弹窗。
20241218TB223FC(测试jar包)
wangwanlei 8 months ago
parent
commit
bb6d1009e3

+ 3
- 1
app/src/main/java/com/xhly/manageapp/AppAdapter.kt View File

@@ -73,7 +73,9 @@ class AppAdapter(var context: Context, var data: ArrayList<AppInfo>) :
73 73
                    Toaster.show(context.getString(R.string.checknettips))
74 74
                }
75 75
             }else if (appInfo.packageName.equals(Const.WIFISEETTINGPKG)){
76
-                context.startActivity(Intent(Settings.ACTION_WIFI_SETTINGS))
76
+                val intent = Intent(Settings.ACTION_WIFI_SETTINGS)
77
+                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
78
+                context.startActivity(intent)
77 79
             }else if (appInfo.packageName.equals(Const.STOREAPPPKG)){
78 80
                 //跳转应用商店
79 81
                 if (!AppUtils.isAppInstalled(context,appInfo.packageName)){

+ 7
- 1
app/src/main/java/com/xhly/manageapp/broadcastreceiver/USBReceiver.kt View File

@@ -15,7 +15,12 @@ class USBReceiver : BroadcastReceiver() {
15 15
         val booleanExtra3 = intent.getBooleanExtra(USB_FUNCTION_ADB, false)
16 16
         LogShow("USBReceiver获取权限成功:1.链接==$booleanExtra,mtp==$booleanExtra1,ptp==$booleanExtra2,adb==$booleanExtra3")
17 17
         if (booleanExtra){
18
-            UIEvent(Const.USB_CONNECTED).post()
18
+            val currentTimeMillis = System.currentTimeMillis()
19
+            //两秒以上再次收到消息才再次发送,否则认为监听连续触发不处理
20
+            if ((installLastTime ==0L||(currentTimeMillis -installLastTime >2000))){
21
+                installLastTime = currentTimeMillis
22
+                UIEvent(Const.USB_CONNECTED).post()
23
+            }
19 24
         }else{
20 25
             UIEvent(Const.USB_NOCONNECTED).post()
21 26
         }
@@ -27,5 +32,6 @@ class USBReceiver : BroadcastReceiver() {
27 32
         const val USB_FUNCTION_PTP = "ptp"
28 33
         const val USB_FUNCTION_ADB = "adb"
29 34
         const val USB_CONNECTED = "connected"
35
+        var installLastTime=0L
30 36
     }
31 37
 }

+ 3
- 1
app/src/main/java/com/xhly/manageapp/ui/login/activity/LoginActivity.kt View File

@@ -142,7 +142,9 @@ class LoginActivity : BaseActivity<LoginViewModel, ActivityLoginBinding>() {
142 142
             hiddenSoft(mBinding.accountEt)
143 143
         }
144 144
         mBinding.netsetLlayout.setOnClickListener {
145
-            startActivity(Intent(Settings.ACTION_WIFI_SETTINGS))
145
+            val intent = Intent(Settings.ACTION_WIFI_SETTINGS)
146
+            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
147
+            startActivity(intent)
146 148
         }
147 149
         mBinding.synctimeLlayout.setOnClickListener {
148 150
                syncTimeClickFlag=true

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

@@ -126,6 +126,9 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),Download
126 126
     private var autoAppFlag=true
127 127
 
128 128
     private var accountDialog:CustomDialog?=null
129
+    private var quitAccountDialog:CustomDialog?=null
130
+    private var changeCodeDialog:CustomDialog?=null
131
+
129 132
     private var tipsDialog:CustomDialog?=null
130 133
     //创建应用卸载集合,方便获得应用信息
131 134
     private val unInstallAppList= arrayListOf<AppInfo>()
@@ -627,7 +630,9 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),Download
627 630
             }
628 631
         }
629 632
         mBinding.netsetLlayout.setOnClickListener {
630
-            startActivity(Intent(Settings.ACTION_WIFI_SETTINGS))
633
+            val intent = Intent(Settings.ACTION_WIFI_SETTINGS)
634
+            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
635
+            startActivity(intent)
631 636
         }
632 637
         onBackPressedDispatcher.addCallback {
633 638
             //屏蔽返回键
@@ -699,7 +704,8 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),Download
699 704
     }
700 705
 
701 706
     private fun showChangeCodeDialog() {
702
-        CustomDialog.build()
707
+        changeCodeDialog=null
708
+        changeCodeDialog=CustomDialog.build()
703 709
             .setCustomView(object : OnBindView<CustomDialog>(R.layout.layout_changecode_dialog) {
704 710
                 override fun onBind(dialog: CustomDialog, v: View) {
705 711
                     //TODO 修改密码接口没有
@@ -1070,10 +1076,12 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),Download
1070 1076
             }
1071 1077
             val param = spUtils.getParam(Const.DISABLEPAD, false) as Boolean
1072 1078
             if (param || block) {
1073
-                mBinding.mainLlayout.visibility = View.GONE
1074
-                mBinding.lockLlayout.visibility = View.VISIBLE
1075 1079
                 //隐藏账号编辑弹窗
1076 1080
                 accountDialog?.dismiss()
1081
+                quitAccountDialog?.dismiss()
1082
+                changeCodeDialog?.dismiss()
1083
+                mBinding.mainLlayout.visibility = View.GONE
1084
+                mBinding.lockLlayout.visibility = View.VISIBLE
1077 1085
                 mainLockFlag=true
1078 1086
                 //锁定时可以点击
1079 1087
                 canClickFlag=true
@@ -1662,49 +1670,47 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),Download
1662 1670
     }
1663 1671
 
1664 1672
     private fun showEditDialog() {
1665
-        if (accountDialog==null){
1666
-            accountDialog = CustomDialog.build()
1667
-                .setCustomView(object : OnBindView<CustomDialog>(R.layout.layout_edit_dialog) {
1668
-                    override fun onBind(dialog: CustomDialog, v: View) {
1669
-                        var titleTv = v.findViewById<TextView>(R.id.dialog_title_tv)
1670
-                        val enterTv = v.findViewById<TextView>(R.id.dialog_enter_tv)
1671
-                        val cancelTv = v.findViewById<TextView>(R.id.dialog_cancel_tv)
1672
-                        val editText = v.findViewById<EditText>(R.id.dialog_et)
1673
-                        editText.hint = getString(R.string.inputcode)
1674
-                        titleTv.text = getString(R.string.exit)
1675
-                        enterTv.setOnClickListener {
1676
-                            val code = editText.text
1677
-                            if ((!code.isNullOrBlank()) && code.length >= 6 && code.length <= 16) {
1678
-                                dialog.dismiss()
1679
-                                try {
1680
-                                    val userBean = spUtils.getFromJson(
1681
-                                        Const.USERINFO, UserBean().javaClass
1682
-                                    ) as UserBean
1683
-                                    viewModel.loginOut(userBean.userid.toString(), code.toString())
1684
-                                } catch (e: Exception) {
1673
+        accountDialog =null
1674
+        accountDialog = CustomDialog.build()
1675
+            .setCustomView(object : OnBindView<CustomDialog>(R.layout.layout_edit_dialog) {
1676
+                override fun onBind(dialog: CustomDialog, v: View) {
1677
+                    var titleTv = v.findViewById<TextView>(R.id.dialog_title_tv)
1678
+                    val enterTv = v.findViewById<TextView>(R.id.dialog_enter_tv)
1679
+                    val cancelTv = v.findViewById<TextView>(R.id.dialog_cancel_tv)
1680
+                    val editText = v.findViewById<EditText>(R.id.dialog_et)
1681
+                    editText.hint = getString(R.string.inputcode)
1682
+                    titleTv.text = getString(R.string.exit)
1683
+                    enterTv.setOnClickListener {
1684
+                        val code = editText.text
1685
+                        if ((!code.isNullOrBlank()) && code.length >= 6 && code.length <= 16) {
1686
+                            dialog.dismiss()
1687
+                            try {
1688
+                                val userBean = spUtils.getFromJson(
1689
+                                    Const.USERINFO, UserBean().javaClass
1690
+                                ) as UserBean
1691
+                                viewModel.loginOut(userBean.userid.toString(), code.toString())
1692
+                            } catch (e: Exception) {
1685 1693
 
1686
-                                }
1694
+                            }
1695
+                        }else{
1696
+                            if (code.isNullOrBlank()){
1697
+                                Toast(getString(R.string.codenoempty))
1687 1698
                             }else{
1688
-                                if (code.isNullOrBlank()){
1689
-                                    Toast(getString(R.string.codenoempty))
1690
-                                }else{
1691
-                                    Toast(getString(R.string.codetips))
1692
-                                }
1699
+                                Toast(getString(R.string.quitcodetips))
1693 1700
                             }
1694 1701
                         }
1695
-                        cancelTv.setOnClickListener {
1696
-                            dialog.dismiss()
1697
-                        }
1698 1702
                     }
1699
-                }).setCancelable(false).setMaskColor(Color.parseColor("#66000000"))
1700
-                .setAlign(CustomDialog.ALIGN.CENTER).show()
1701
-        }else{
1702
-            accountDialog?.show()
1703
-        }
1703
+                    cancelTv.setOnClickListener {
1704
+                        dialog.dismiss()
1705
+                    }
1706
+                }
1707
+            }).setCancelable(false).setMaskColor(Color.parseColor("#66000000"))
1708
+            .setAlign(CustomDialog.ALIGN.CENTER).show()
1704 1709
     }
1705 1710
 
1706 1711
     private fun showTwoBtnDialog(title:String,content:String,onClickListener: OnClickListener) {
1707
-        CustomDialog.build()
1712
+        quitAccountDialog=null
1713
+        quitAccountDialog=CustomDialog.build()
1708 1714
             .setCustomView(object : OnBindView<CustomDialog>(R.layout.layout_twobtn_dialog) {
1709 1715
                 override fun onBind(dialog: CustomDialog, v: View) {
1710 1716
                     val closeBtn = v.findViewById<TextView>(R.id.dialog_cancel_tv)

+ 4
- 0
app/src/main/java/com/xhly/manageapp/utils/StrategyUtils.kt View File

@@ -261,6 +261,10 @@ object StrategyUtils {
261 261
                 if (schoolDeviceSetBean.camera == 1 && appinfo.packageName.equals(Const.ANDROIDCAMERA)) {
262 262
                     return@forEach
263 263
                 }
264
+                //是否隐藏相机:1是0否
265
+                if (schoolDeviceSetBean.camera == 1 && appinfo.packageName.equals(Const.ANDROIDCAMERA6)) {
266
+                    return@forEach
267
+                }
264 268
                 //是否隐藏相册:1是0否(505f)
265 269
                 if (schoolDeviceSetBean.gallery == 1 && appinfo.packageName.equals(Const.ANDROIDGALLERY)) {
266 270
                     return@forEach

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

@@ -28,6 +28,7 @@
28 28
     <string name="newcodetips">请输入新密码</string>
29 29
     <string name="enternewcodetips">请输入确认新密码</string>
30 30
     <string name="codetips">密码必须是6-16位的英文字母、数字组合</string>
31
+    <string name="quitcodetips">密码必须是6位数字</string>
31 32
     <string name="locktips">您的设备已违规或者被管理员锁定,请联系管理员</string>
32 33
     <string name="timelocktips">当前时间不可用,请在规定时间内使用</string>
33 34
     <string name="codeerror">密码不正确</string>

+ 7
- 1
corelib/src/main/java/com/xhly/corelib/Const.kt View File

@@ -259,10 +259,15 @@ object Const {
259 259
     const val ANDROIDDESKCLOCK = "com.android.deskclock"
260 260
 
261 261
     /**
262
-     * 联想相机相机
262
+     * 联想相机505f
263 263
      */
264 264
     const val ANDROIDCAMERA = "org.codeaurora.snapcam"
265 265
 
266
+    /**
267
+     * 联想相机6e6f
268
+     */
269
+    const val ANDROIDCAMERA6 = "com.dtab.camera"
270
+
266 271
     /**
267 272
      * 联想相册505f
268 273
      */
@@ -281,6 +286,7 @@ object Const {
281 286
         ANDROIDCALENDAR,
282 287
         ANDROIDDESKCLOCK,
283 288
         ANDROIDCAMERA,
289
+        ANDROIDCAMERA6,
284 290
         ANDROIDGALLERY,
285 291
         ANDROIDGALLERY6
286 292
     )

Loading…
Cancel
Save