|
@@ -22,6 +22,7 @@ import android.os.Build
|
22
|
22
|
import android.provider.Settings
|
23
|
23
|
import android.view.MotionEvent
|
24
|
24
|
import android.view.View
|
|
25
|
+import android.view.View.OnClickListener
|
25
|
26
|
import android.view.WindowManager
|
26
|
27
|
import android.widget.Button
|
27
|
28
|
import android.widget.EditText
|
|
@@ -419,6 +420,9 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),Download
|
419
|
420
|
initSchoolSet(it)
|
420
|
421
|
mBinding.rv.visibility=View.VISIBLE
|
421
|
422
|
updateAppRv()
|
|
423
|
+ if (it.fromNetWorkType==1){
|
|
424
|
+ quitAccount(it)
|
|
425
|
+ }
|
422
|
426
|
}
|
423
|
427
|
}
|
424
|
428
|
}
|
|
@@ -610,20 +614,8 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),Download
|
610
|
614
|
}
|
611
|
615
|
}
|
612
|
616
|
mBinding.loginoutLlayout.setOnClickListener {
|
613
|
|
- val schoolDeviceSetBean = StrategyUtils.getSchoolDeviceSetBean(this@MainActivity)
|
614
|
|
- //禁用注销则需要输入密码才能注销,不限制则直接注销登录
|
615
|
|
- if (schoolDeviceSetBean != null && schoolDeviceSetBean.logout == 1) {
|
616
|
|
- //禁用注销
|
617
|
|
- showEditDialog()
|
618
|
|
- } else {
|
619
|
|
- try {
|
620
|
|
- val userBean = spUtils.getFromJson(
|
621
|
|
- Const.USERINFO, UserBean().javaClass
|
622
|
|
- ) as UserBean
|
623
|
|
- viewModel.loginOut(userBean.userid.toString(), "")
|
624
|
|
- } catch (e: Exception) {
|
625
|
|
-
|
626
|
|
- }
|
|
617
|
+ userBean?.let {
|
|
618
|
+ viewModel.getSchoolSetData(it.schoolid)
|
627
|
619
|
}
|
628
|
620
|
}
|
629
|
621
|
mBinding.netsetLlayout.setOnClickListener {
|
|
@@ -665,6 +657,27 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),Download
|
665
|
657
|
}
|
666
|
658
|
}
|
667
|
659
|
|
|
660
|
+ private fun quitAccount(schoolDeviceSetBean:SchoolDeviceSetBean?){
|
|
661
|
+ /* val schoolDeviceSetBean = StrategyUtils.getSchoolDeviceSetBean(this@MainActivity)*/
|
|
662
|
+ //禁用注销则需要输入密码才能注销,不限制则直接注销登录
|
|
663
|
+ if (schoolDeviceSetBean != null && schoolDeviceSetBean.logout == 1) {
|
|
664
|
+ //禁用注销
|
|
665
|
+ showEditDialog()
|
|
666
|
+ } else {
|
|
667
|
+ showTwoBtnDialog(getString(R.string.loginout),getString(R.string.loginouttips)
|
|
668
|
+ ) {
|
|
669
|
+ try {
|
|
670
|
+ val userBean = spUtils.getFromJson(
|
|
671
|
+ Const.USERINFO, UserBean().javaClass
|
|
672
|
+ ) as UserBean
|
|
673
|
+ viewModel.loginOut(userBean.userid.toString(), "")
|
|
674
|
+ } catch (e: Exception) {
|
|
675
|
+
|
|
676
|
+ }
|
|
677
|
+ }
|
|
678
|
+ }
|
|
679
|
+ }
|
|
680
|
+
|
668
|
681
|
private fun showChangeCodeDialog() {
|
669
|
682
|
CustomDialog.build()
|
670
|
683
|
.setCustomView(object : OnBindView<CustomDialog>(R.layout.layout_changecode_dialog) {
|
|
@@ -1116,8 +1129,6 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),Download
|
1116
|
1129
|
|
1117
|
1130
|
Const.CODE2001.toString() -> {
|
1118
|
1131
|
val message = uiEvent.message
|
1119
|
|
- /*
|
1120
|
|
- showNoticeDialog(message)*/
|
1121
|
1132
|
//检查权限
|
1122
|
1133
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
1123
|
1134
|
if (!Settings.canDrawOverlays(this)) {
|
|
@@ -1645,25 +1656,23 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),Download
|
1645
|
1656
|
}
|
1646
|
1657
|
}
|
1647
|
1658
|
|
1648
|
|
- private fun showNoticeDialog(msg: String) {
|
|
1659
|
+ private fun showTwoBtnDialog(title:String,content:String,onClickListener: OnClickListener) {
|
1649
|
1660
|
CustomDialog.build()
|
1650
|
|
- .setCustomView(object : OnBindView<CustomDialog>(R.layout.layout_notice_dialog) {
|
|
1661
|
+ .setCustomView(object : OnBindView<CustomDialog>(R.layout.layout_twobtn_dialog) {
|
1651
|
1662
|
override fun onBind(dialog: CustomDialog, v: View) {
|
1652
|
|
- val closeBtn = v.findViewById<Button>(R.id.dialog_close_btn)
|
|
1663
|
+ val closeBtn = v.findViewById<TextView>(R.id.dialog_cancel_tv)
|
|
1664
|
+ val enterBtn = v.findViewById<TextView>(R.id.dialog_enter_tv)
|
1653
|
1665
|
val titleTv = v.findViewById<TextView>(R.id.dialog_title_tv)
|
1654
|
1666
|
val contentTv = v.findViewById<TextView>(R.id.dialog_content_tv)
|
1655
|
|
- try {
|
1656
|
|
- val msgBean = GsonUtils.parseJsonWithGson(
|
1657
|
|
- msg, SocketMsgBean().javaClass
|
1658
|
|
- ) as SocketMsgBean
|
1659
|
|
- titleTv.text = msgBean.title
|
1660
|
|
- contentTv.text = msgBean.content
|
1661
|
|
- } catch (e: Exception) {
|
1662
|
|
- LogShow("解析失败" + e.toString())
|
1663
|
|
- }
|
|
1667
|
+ titleTv.text=title
|
|
1668
|
+ contentTv.text=content
|
1664
|
1669
|
closeBtn.setOnClickListener {
|
1665
|
1670
|
dialog.dismiss()
|
1666
|
1671
|
}
|
|
1672
|
+ enterBtn.setOnClickListener {
|
|
1673
|
+ dialog.dismiss()
|
|
1674
|
+ onClickListener.onClick(it)
|
|
1675
|
+ }
|
1667
|
1676
|
}
|
1668
|
1677
|
}).setCancelable(false).setMaskColor(Color.parseColor("#66000000"))
|
1669
|
1678
|
.setAlign(CustomDialog.ALIGN.CENTER).show()
|