|
@@ -10,7 +10,9 @@ import android.content.IntentFilter
|
10
|
10
|
import android.content.pm.PackageManager
|
11
|
11
|
import android.graphics.Color
|
12
|
12
|
import android.graphics.drawable.Drawable
|
|
13
|
+import android.os.Build
|
13
|
14
|
import android.provider.Settings
|
|
15
|
+import android.text.TextUtils
|
14
|
16
|
import android.view.View
|
15
|
17
|
import android.widget.Button
|
16
|
18
|
import android.widget.EditText
|
|
@@ -44,9 +46,9 @@ import com.xhly.manageapp.AppAdapter
|
44
|
46
|
import com.xhly.manageapp.ManageApplication
|
45
|
47
|
import com.xhly.manageapp.bean.EventLog
|
46
|
48
|
import com.xhly.manageapp.bean.SocketMsgBean
|
47
|
|
-import com.xhly.manageapp.bean.log.UpdateBean
|
48
|
49
|
import com.xhly.manageapp.bean.log.LogPushBean
|
49
|
50
|
import com.xhly.manageapp.bean.log.LogdOperateBean
|
|
51
|
+import com.xhly.manageapp.bean.log.UpdateBean
|
50
|
52
|
import com.xhly.manageapp.bean.school.SchoolDeviceSetBean
|
51
|
53
|
import com.xhly.manageapp.bean.strategy.StrategyBean
|
52
|
54
|
import com.xhly.manageapp.bean.user.UserBean
|
|
@@ -74,8 +76,8 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {
|
74
|
76
|
private var mMyInstallReceiver: AppInstallReceiver? = null
|
75
|
77
|
private var dataList: ArrayList<AppInfo> = arrayListOf()
|
76
|
78
|
private var userBean: UserBean? = null
|
77
|
|
- private var timer: Timer?=null
|
78
|
|
- private val currentSpUtils by lazy { CurrentAppSharedPreferencesUtils.getInstance(this) }
|
|
79
|
+ private var timer: Timer? = null
|
|
80
|
+ private val currentSpUtils by lazy { CurrentAppSharedPreferencesUtils.getInstance(this) }
|
79
|
81
|
override fun getBinding() = ActivityMainBinding.inflate(layoutInflater)
|
80
|
82
|
|
81
|
83
|
override fun initData() {
|
|
@@ -88,7 +90,7 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {
|
88
|
90
|
}
|
89
|
91
|
adapter = AppAdapter(this, dataList)
|
90
|
92
|
mBinding.rv.layoutManager = GridLayoutManager(this, 6, GridLayoutManager.VERTICAL, false)
|
91
|
|
- adapter?.changePwdListener=getChangeCodeListener()
|
|
93
|
+ adapter?.changePwdListener = getChangeCodeListener()
|
92
|
94
|
mBinding.rv.adapter = adapter
|
93
|
95
|
updateAppRv()
|
94
|
96
|
// checkAccessibility(this)
|
|
@@ -103,29 +105,37 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {
|
103
|
105
|
|
104
|
106
|
viewModel.listAppData.observe(this) { modelList ->
|
105
|
107
|
//存储商店应用包名到本地
|
106
|
|
- val appNameList= arrayListOf<String>()
|
|
108
|
+ val appNameList = arrayListOf<String>()
|
|
109
|
+ val whiteList= arrayListOf<String>()
|
107
|
110
|
modelList.forEach {
|
108
|
111
|
appNameList.add(it.appPackage)
|
|
112
|
+ if (it.whited==1){
|
|
113
|
+ whiteList.add(it.appPackage)
|
|
114
|
+ }
|
109
|
115
|
}
|
110
|
|
- spUtils.saveJson(Const.APPSTOREKEY,appNameList)
|
|
116
|
+ ManageApplication.addAppWhiteRule(whiteList)
|
|
117
|
+ spUtils.saveJson(Const.APPSTOREKEY, appNameList)
|
111
|
118
|
//获得应用集合,必装应用和推荐应用,再加上预装应用,其余应用需要静默卸载,必装应用需要进行静默下载和安装。安装应用从forceapp接口获取
|
112
|
119
|
val appList = AppUtils.GetAppList(this)
|
113
|
|
- val firstAppList= arrayListOf<String>()
|
|
120
|
+ val firstAppList = arrayListOf<String>()
|
114
|
121
|
try {
|
115
|
122
|
//获得预装应用的包名
|
116
|
123
|
val currentList =
|
117
|
|
- currentSpUtils.getFromJson(Const.FIRSTAPPLIST, ArrayList<String>().javaClass) as ArrayList<String>
|
|
124
|
+ currentSpUtils.getFromJson(
|
|
125
|
+ Const.FIRSTAPPLIST,
|
|
126
|
+ ArrayList<String>().javaClass
|
|
127
|
+ ) as ArrayList<String>
|
118
|
128
|
firstAppList.addAll(currentList)
|
119
|
|
- }catch (e:Exception){
|
120
|
|
- LogShow("冻结失败"+e.toString())
|
|
129
|
+ } catch (e: Exception) {
|
|
130
|
+ LogShow("冻结失败" + e.toString())
|
121
|
131
|
}
|
122
|
132
|
appList.forEach { app ->
|
123
|
133
|
val filter = modelList.filter { it.appPackage.equals(app.packageName) }
|
124
|
134
|
val appInfos = firstAppList.filter { app.packageName.equals(it) }
|
125
|
135
|
//接口列表以及初始化列表中不存在则将应用冻结或者卸载,目前是冻结
|
126
|
|
- LogShow("${app.name},被冻结"+(filter.isEmpty() && appInfos.isEmpty()))
|
127
|
|
- if (filter.isEmpty() && appInfos.isEmpty()){
|
128
|
|
- ManageApplication.setPackageEnabled(app.packageName, (filter.isNotEmpty()))
|
|
136
|
+ LogShow("${app.name},被冻结" + (filter.isEmpty() && appInfos.isEmpty()))
|
|
137
|
+ if (filter.isEmpty() && appInfos.isEmpty()) {
|
|
138
|
+ ManageApplication.setPackageEnabled(app.packageName, (filter.isNotEmpty()))
|
129
|
139
|
}
|
130
|
140
|
}
|
131
|
141
|
}
|
|
@@ -176,7 +186,7 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {
|
176
|
186
|
viewModel.loginOutData.observe(this) {
|
177
|
187
|
if (it) {
|
178
|
188
|
loginOut()
|
179
|
|
- }else{
|
|
189
|
+ } else {
|
180
|
190
|
Toast(getString(R.string.codeerror))
|
181
|
191
|
}
|
182
|
192
|
}
|
|
@@ -191,37 +201,39 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {
|
191
|
201
|
initSchoolSet(it)
|
192
|
202
|
updateAppRv()
|
193
|
203
|
}
|
194
|
|
- viewModel.wallpaperData.observe(this){
|
195
|
|
- if (!it.hpath.isNullOrBlank()){
|
196
|
|
- Glide.with(this).load(Const.URL1+it.hpath).placeholder(R.drawable.main_bg).error(R.drawable.main_bg).into(object:CustomViewTarget<LinearLayout,Drawable>(mBinding.root){
|
197
|
|
- override fun onLoadFailed(errorDrawable: Drawable?) {
|
198
|
|
- errorDrawable?.let {drawble->
|
199
|
|
- mBinding.root.background=drawble
|
|
204
|
+ viewModel.wallpaperData.observe(this) {
|
|
205
|
+ if (!it.hpath.isNullOrBlank()) {
|
|
206
|
+ Glide.with(this).load(Const.URL1 + it.hpath).placeholder(R.drawable.main_bg)
|
|
207
|
+ .error(R.drawable.main_bg)
|
|
208
|
+ .into(object : CustomViewTarget<LinearLayout, Drawable>(mBinding.root) {
|
|
209
|
+ override fun onLoadFailed(errorDrawable: Drawable?) {
|
|
210
|
+ errorDrawable?.let { drawble ->
|
|
211
|
+ mBinding.root.background = drawble
|
|
212
|
+ }
|
200
|
213
|
}
|
201
|
|
- }
|
202
|
214
|
|
203
|
|
- override fun onResourceCleared(placeholder: Drawable?) {
|
204
|
|
- placeholder?.let {drawble->
|
205
|
|
- mBinding.root.background=drawble
|
|
215
|
+ override fun onResourceCleared(placeholder: Drawable?) {
|
|
216
|
+ placeholder?.let { drawble ->
|
|
217
|
+ mBinding.root.background = drawble
|
|
218
|
+ }
|
206
|
219
|
}
|
207
|
|
- }
|
208
|
220
|
|
209
|
|
- override fun onResourceReady(
|
210
|
|
- resource: Drawable,
|
211
|
|
- transition: Transition<in Drawable>?
|
212
|
|
- ) {
|
213
|
|
- mBinding.root.background=resource
|
214
|
|
- }
|
215
|
|
- })
|
|
221
|
+ override fun onResourceReady(
|
|
222
|
+ resource: Drawable,
|
|
223
|
+ transition: Transition<in Drawable>?
|
|
224
|
+ ) {
|
|
225
|
+ mBinding.root.background = resource
|
|
226
|
+ }
|
|
227
|
+ })
|
216
|
228
|
}
|
217
|
229
|
}
|
218
|
|
- viewModel.netWhiteListData.observe(this){
|
219
|
|
- StrategyUtils.setNetWhiteList(it)
|
|
230
|
+ viewModel.netWhiteListData.observe(this) {
|
|
231
|
+ StrategyUtils.setNetWhiteList(it)
|
220
|
232
|
}
|
221
|
|
- viewModel.pwdResultData.observe(this){
|
222
|
|
- if (it){
|
|
233
|
+ viewModel.pwdResultData.observe(this) {
|
|
234
|
+ if (it) {
|
223
|
235
|
unBindBlock()
|
224
|
|
- }else{
|
|
236
|
+ } else {
|
225
|
237
|
Toast(getString(R.string.codeerror))
|
226
|
238
|
}
|
227
|
239
|
}
|
|
@@ -240,26 +252,26 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {
|
240
|
252
|
}
|
241
|
253
|
mBinding.loginoutIv.setOnClickListener {
|
242
|
254
|
val schoolDeviceSetBean = StrategyUtils.getSchoolDeviceSetBean(this@MainActivity)
|
243
|
|
- if (schoolDeviceSetBean !=null&&schoolDeviceSetBean.logout==1){
|
|
255
|
+ if (schoolDeviceSetBean != null && schoolDeviceSetBean.logout == 1) {
|
244
|
256
|
//禁用注销
|
245
|
257
|
return@setOnClickListener
|
246
|
|
- }else{
|
|
258
|
+ } else {
|
247
|
259
|
showEditDialog()
|
248
|
260
|
}
|
249
|
261
|
}
|
250
|
262
|
mBinding.codeenterCv.setOnClickListener {
|
251
|
263
|
//如果密码一致,则解锁
|
252
|
264
|
val code = mBinding.lockEt.text.toString()
|
253
|
|
- if (code.isNullOrBlank()){
|
|
265
|
+ if (code.isNullOrBlank()) {
|
254
|
266
|
return@setOnClickListener
|
255
|
267
|
}
|
256
|
268
|
ManageApplication.getDeviceInfo()?.let {
|
257
|
|
- viewModel.postPwdDetail(code,it)
|
|
269
|
+ viewModel.postPwdDetail(code, it)
|
258
|
270
|
}
|
259
|
271
|
}
|
260
|
272
|
onBackPressedDispatcher.addCallback {
|
261
|
273
|
//屏蔽返回键
|
262
|
|
- getLocation()
|
|
274
|
+ getLocation()
|
263
|
275
|
}
|
264
|
276
|
}
|
265
|
277
|
|
|
@@ -272,16 +284,16 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {
|
272
|
284
|
}
|
273
|
285
|
}
|
274
|
286
|
|
275
|
|
- private fun getChangeCodeListener():AppAdapter.ChangePwdListener{
|
276
|
|
- return object :AppAdapter.ChangePwdListener{
|
|
287
|
+ private fun getChangeCodeListener(): AppAdapter.ChangePwdListener {
|
|
288
|
+ return object : AppAdapter.ChangePwdListener {
|
277
|
289
|
override fun changeCode() {
|
278
|
290
|
val deviceSetBean = StrategyUtils.getSchoolDeviceSetBean(this@MainActivity)
|
279
|
|
- var showFlag=true
|
280
|
|
- if (deviceSetBean!=null&&deviceSetBean.changePwd==0){
|
|
291
|
+ var showFlag = true
|
|
292
|
+ if (deviceSetBean != null && deviceSetBean.changePwd == 0) {
|
281
|
293
|
//学校设置是否禁止修改密码
|
282
|
|
- showFlag=false
|
|
294
|
+ showFlag = false
|
283
|
295
|
}
|
284
|
|
- if (showFlag){
|
|
296
|
+ if (showFlag) {
|
285
|
297
|
showChangeCodeDialog()
|
286
|
298
|
}
|
287
|
299
|
}
|
|
@@ -298,22 +310,22 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {
|
298
|
310
|
val enterTv = v.findViewById<TextView>(R.id.dialog_enter_tv)
|
299
|
311
|
val cancelTv = v.findViewById<TextView>(R.id.dialog_cancel_tv)
|
300
|
312
|
val editText = v.findViewById<EditText>(R.id.dialog_et)
|
301
|
|
- val oldCodeEt=v.findViewById<EditText>(R.id.dialog_oldcode_et)
|
302
|
|
- val newCodeEt=v.findViewById<EditText>(R.id.dialog_newcode_et)
|
|
313
|
+ val oldCodeEt = v.findViewById<EditText>(R.id.dialog_oldcode_et)
|
|
314
|
+ val newCodeEt = v.findViewById<EditText>(R.id.dialog_newcode_et)
|
303
|
315
|
enterTv.setOnClickListener {
|
304
|
316
|
val enterCode = editText.text.toString()
|
305
|
317
|
val oldCode = oldCodeEt.text.toString()
|
306
|
318
|
val newCode = newCodeEt.text.toString()
|
307
|
|
- if (!getTextFlag(enterCode)||!getTextFlag(oldCode)||!getTextFlag(newCode)){
|
|
319
|
+ if (!getTextFlag(enterCode) || !getTextFlag(oldCode) || !getTextFlag(newCode)) {
|
308
|
320
|
Toast("密码不符合规则")
|
309
|
321
|
return@setOnClickListener
|
310
|
322
|
}
|
311
|
|
- if (oldCode.equals(newCode)){
|
|
323
|
+ if (oldCode.equals(newCode)) {
|
312
|
324
|
Toast("新密码不能和旧密码一致。")
|
313
|
325
|
return@setOnClickListener
|
314
|
326
|
}
|
315
|
327
|
|
316
|
|
- if (!newCode.equals(enterCode)){
|
|
328
|
+ if (!newCode.equals(enterCode)) {
|
317
|
329
|
Toast("两次输入的新密码不一致。")
|
318
|
330
|
return@setOnClickListener
|
319
|
331
|
}
|
|
@@ -323,7 +335,7 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {
|
323
|
335
|
val userBean = spUtils.getFromJson(
|
324
|
336
|
Const.USERINFO, UserBean().javaClass
|
325
|
337
|
) as UserBean
|
326
|
|
- viewModel.postEditPwd(userBean.userid,newCode,oldCode)
|
|
338
|
+ viewModel.postEditPwd(userBean.userid, newCode, oldCode)
|
327
|
339
|
} catch (e: Exception) {
|
328
|
340
|
|
329
|
341
|
}
|
|
@@ -336,10 +348,10 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {
|
336
|
348
|
.setAlign(CustomDialog.ALIGN.CENTER).show()
|
337
|
349
|
}
|
338
|
350
|
|
339
|
|
- private fun getTextFlag(code:String?):Boolean{
|
|
351
|
+ private fun getTextFlag(code: String?): Boolean {
|
340
|
352
|
try {
|
341
|
|
- return (!code.isNullOrBlank())&&code.length>=6&&code.length<=16
|
342
|
|
- }catch (e:Exception){
|
|
353
|
+ return (!code.isNullOrBlank()) && code.length >= 6 && code.length <= 16
|
|
354
|
+ } catch (e: Exception) {
|
343
|
355
|
return false
|
344
|
356
|
}
|
345
|
357
|
}
|
|
@@ -347,9 +359,17 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {
|
347
|
359
|
override fun onResume() {
|
348
|
360
|
super.onResume()
|
349
|
361
|
userBean?.let {
|
350
|
|
- Const.USERID=it.userid
|
351
|
|
- Const.USERNAME=it.username.toString()
|
|
362
|
+ Const.USERID = it.userid
|
|
363
|
+ Const.USERNAME = it.username.toString()
|
352
|
364
|
viewModel.postDevicesetDetail(it.schoolid)
|
|
365
|
+ val name=StringBuffer()
|
|
366
|
+ if (!it.schoolName.isNullOrBlank()){
|
|
367
|
+ name.append(it.schoolName)
|
|
368
|
+ }
|
|
369
|
+ if (!it.classname.isNullOrBlank()){
|
|
370
|
+ name.append(it.classname)
|
|
371
|
+ }
|
|
372
|
+ mBinding.userschoolTv.text =name.toString()
|
353
|
373
|
}
|
354
|
374
|
viewModel.postWallpaperPad()
|
355
|
375
|
viewModel.updateStrategy()
|
|
@@ -427,12 +447,19 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {
|
427
|
447
|
@SuppressLint("CheckResult")
|
428
|
448
|
private fun getLocation() {
|
429
|
449
|
val rxPermissions = RxPermissions(this)
|
|
450
|
+ // Manifest.permission.ACCESS_LOCATION_EXTRA_COMMANDS
|
430
|
451
|
rxPermissions.request(
|
431
|
|
- Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION,
|
432
|
|
- Manifest.permission.ACCESS_LOCATION_EXTRA_COMMANDS
|
|
452
|
+ Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION
|
433
|
453
|
).subscribe({
|
434
|
454
|
if (it) {
|
435
|
|
- SystemUtil.getLocation(this)
|
|
455
|
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
|
456
|
+ rxPermissions.request(Manifest.permission.ACCESS_BACKGROUND_LOCATION)
|
|
457
|
+ .subscribe {
|
|
458
|
+ SystemUtil.getLocation(this)
|
|
459
|
+ }
|
|
460
|
+ } else {
|
|
461
|
+ SystemUtil.getLocation(this)
|
|
462
|
+ }
|
436
|
463
|
} else {
|
437
|
464
|
LogShow("没有权限")
|
438
|
465
|
}
|
|
@@ -478,7 +505,7 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {
|
478
|
505
|
}
|
479
|
506
|
|
480
|
507
|
private fun initSchoolSet(schoolDeviceSetBean: SchoolDeviceSetBean? = null) {
|
481
|
|
- schoolDeviceSetBean?.let {bean->
|
|
508
|
+ schoolDeviceSetBean?.let { bean ->
|
482
|
509
|
//是否启用截屏:1是0否
|
483
|
510
|
ManageApplication.enableCaptureScreen(schoolDeviceSetBean.screenshots == 1)
|
484
|
511
|
if (bean.forceBind == 1) {
|
|
@@ -496,28 +523,28 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {
|
496
|
523
|
}
|
497
|
524
|
|
498
|
525
|
private fun startTimeTask(bean: SchoolDeviceSetBean) {
|
499
|
|
- if (bean.remindDuration==1&&bean.duration>0){
|
|
526
|
+ if (bean.remindDuration == 1 && bean.duration > 0) {
|
500
|
527
|
//如果设置的有时间则执行任务
|
501
|
528
|
try {
|
502
|
529
|
timer?.cancel()
|
503
|
|
- timer= Timer()
|
504
|
|
- }catch (e:Exception){
|
|
530
|
+ timer = Timer()
|
|
531
|
+ } catch (e: Exception) {
|
505
|
532
|
|
506
|
533
|
}
|
507
|
534
|
timer?.let {
|
508
|
|
- timer?.schedule( object : TimerTask() {
|
|
535
|
+ timer?.schedule(object : TimerTask() {
|
509
|
536
|
override fun run() {
|
510
|
537
|
// 在这里编写您的定时任务代码
|
511
|
|
- Toast(getString(R.string.durationtips)+"|||"+bean.duration)
|
|
538
|
+ Toast(getString(R.string.durationtips) + "|||" + bean.duration)
|
512
|
539
|
}
|
513
|
|
- },bean.duration*60*1000L,bean.duration*60*1000L)
|
|
540
|
+ }, bean.duration * 60 * 1000L, bean.duration * 60 * 1000L)
|
514
|
541
|
}
|
515
|
542
|
}
|
516
|
543
|
//如果设置的有时间则取消所有任务
|
517
|
|
- if (bean.remindDuration!=1){
|
518
|
|
- if (timer!=null){
|
|
544
|
+ if (bean.remindDuration != 1) {
|
|
545
|
+ if (timer != null) {
|
519
|
546
|
timer?.cancel()
|
520
|
|
- timer=null
|
|
547
|
+ timer = null
|
521
|
548
|
}
|
522
|
549
|
}
|
523
|
550
|
}
|
|
@@ -674,21 +701,22 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {
|
674
|
701
|
data.doEvent = EventLog.USBDISCONNECTEVENT
|
675
|
702
|
viewModel.eventLog(data)
|
676
|
703
|
}
|
677
|
|
- Const.ACCOUNTLOGINOUT->{
|
|
704
|
+
|
|
705
|
+ Const.ACCOUNTLOGINOUT -> {
|
678
|
706
|
loginOut()
|
679
|
707
|
}
|
680
|
708
|
}
|
681
|
709
|
}
|
682
|
710
|
|
683
|
|
- private fun postLogPush(pushType:Int){
|
684
|
|
- val pushBean= LogPushBean()
|
685
|
|
- pushBean.pushType=pushType
|
686
|
|
- pushBean.pushObjid=Const.SCHOOLID
|
|
711
|
+ private fun postLogPush(pushType: Int) {
|
|
712
|
+ val pushBean = LogPushBean()
|
|
713
|
+ pushBean.pushType = pushType
|
|
714
|
+ pushBean.pushObjid = Const.SCHOOLID
|
687
|
715
|
Const.USERID?.let {
|
688
|
|
- pushBean.userids= longArrayOf(it)
|
|
716
|
+ pushBean.userids = longArrayOf(it)
|
689
|
717
|
}
|
690
|
718
|
Const.USERNAME?.let {
|
691
|
|
- pushBean.pushObjname=it
|
|
719
|
+ pushBean.pushObjname = it
|
692
|
720
|
}
|
693
|
721
|
viewModel.postLogPushAdd(pushBean)
|
694
|
722
|
}
|
|
@@ -706,7 +734,7 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {
|
706
|
734
|
dataList.addAll(appList)
|
707
|
735
|
if (adapter == null) {
|
708
|
736
|
adapter = AppAdapter(this, dataList)
|
709
|
|
- adapter?.changePwdListener=getChangeCodeListener()
|
|
737
|
+ adapter?.changePwdListener = getChangeCodeListener()
|
710
|
738
|
mBinding.rv.adapter = adapter
|
711
|
739
|
}
|
712
|
740
|
adapter?.let {
|
|
@@ -769,7 +797,7 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {
|
769
|
797
|
titleTv.text = getString(R.string.exit)
|
770
|
798
|
enterTv.setOnClickListener {
|
771
|
799
|
val code = editText.text
|
772
|
|
- if ((!code.isNullOrBlank())&&code.length>=6&&code.length<=16) {
|
|
800
|
+ if ((!code.isNullOrBlank()) && code.length >= 6 && code.length <= 16) {
|
773
|
801
|
dialog.dismiss()
|
774
|
802
|
try {
|
775
|
803
|
val userBean = spUtils.getFromJson(
|
|
@@ -803,7 +831,7 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {
|
803
|
831
|
titleTv.text = msgBean.title
|
804
|
832
|
contentTv.text = msgBean.content
|
805
|
833
|
} catch (e: Exception) {
|
806
|
|
- LogShow("解析失败"+e.toString())
|
|
834
|
+ LogShow("解析失败" + e.toString())
|
807
|
835
|
}
|
808
|
836
|
closeBtn.setOnClickListener {
|
809
|
837
|
dialog.dismiss()
|
|
@@ -823,8 +851,8 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {
|
823
|
851
|
viewModel.eventLog(data)
|
824
|
852
|
WorkManager.getInstance(this).cancelAllWork()
|
825
|
853
|
deleteSharedPreferences(SharedPreferencesUtils.SP_FILE_NAME)
|
826
|
|
- Const.USERID=null
|
827
|
|
- Const.USERNAME=""
|
|
854
|
+ Const.USERID = null
|
|
855
|
+ Const.USERNAME = ""
|
828
|
856
|
startIntentActivity(LoginActivity().javaClass)
|
829
|
857
|
finish()
|
830
|
858
|
}
|
|
@@ -832,9 +860,9 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {
|
832
|
860
|
|
833
|
861
|
override fun onDestroy() {
|
834
|
862
|
super.onDestroy()
|
835
|
|
- if (timer!=null){
|
|
863
|
+ if (timer != null) {
|
836
|
864
|
timer?.cancel()
|
837
|
|
- timer=null
|
|
865
|
+ timer = null
|
838
|
866
|
}
|
839
|
867
|
mMyInstallReceiver?.let {
|
840
|
868
|
unregisterReceiver(it)
|