|
@@ -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)
|