|
@@ -7,6 +7,7 @@ import DownloadItem
|
7
|
7
|
import android.Manifest
|
8
|
8
|
import android.annotation.SuppressLint
|
9
|
9
|
import android.app.ActivityManager
|
|
10
|
+import android.app.AlertDialog
|
10
|
11
|
import android.content.ComponentName
|
11
|
12
|
import android.content.Context
|
12
|
13
|
import android.content.Intent
|
|
@@ -20,6 +21,7 @@ import android.os.Build
|
20
|
21
|
import android.provider.Settings
|
21
|
22
|
import android.view.MotionEvent
|
22
|
23
|
import android.view.View
|
|
24
|
+import android.view.WindowManager
|
23
|
25
|
import android.widget.Button
|
24
|
26
|
import android.widget.EditText
|
25
|
27
|
import android.widget.LinearLayout
|
|
@@ -57,7 +59,6 @@ import com.xhly.corelib.utils.ImageUtils
|
57
|
59
|
import com.xhly.corelib.utils.LogShow
|
58
|
60
|
import com.xhly.corelib.utils.ModelNameUtils
|
59
|
61
|
import com.xhly.corelib.utils.NetworkUtils
|
60
|
|
-import com.xhly.corelib.utils.SharedPreferencesUtils
|
61
|
62
|
import com.xhly.corelib.utils.SystemUtil
|
62
|
63
|
import com.xhly.manageapp.AppAdapter
|
63
|
64
|
import com.xhly.manageapp.ManageApplication
|
|
@@ -1094,7 +1095,19 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),Download
|
1094
|
1095
|
|
1095
|
1096
|
Const.CODE2001.toString() -> {
|
1096
|
1097
|
val message = uiEvent.message
|
1097
|
|
- showNoticeDialog(message)
|
|
1098
|
+ /*
|
|
1099
|
+ showNoticeDialog(message)*/
|
|
1100
|
+ //检查权限
|
|
1101
|
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
1102
|
+ if (!Settings.canDrawOverlays(this)) {
|
|
1103
|
+ //启动Activity让用户授权
|
|
1104
|
+ val intent = Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION)
|
|
1105
|
+ startActivity(intent)
|
|
1106
|
+ return
|
|
1107
|
+ }else{
|
|
1108
|
+ showSystemNoticeDialog(message)
|
|
1109
|
+ }
|
|
1110
|
+ }
|
1098
|
1111
|
}
|
1099
|
1112
|
|
1100
|
1113
|
Const.CODE2002.toString() -> {
|
|
@@ -1336,6 +1349,39 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),Download
|
1336
|
1349
|
}
|
1337
|
1350
|
}
|
1338
|
1351
|
|
|
1352
|
+ /**
|
|
1353
|
+ * 系统级别的通知
|
|
1354
|
+ */
|
|
1355
|
+ private fun showSystemNoticeDialog(msg: String) {
|
|
1356
|
+ val v=View.inflate(this,R.layout.layout_notice_dialog,null)
|
|
1357
|
+ val closeBtn = v.findViewById<Button>(R.id.dialog_close_btn)
|
|
1358
|
+ val titleTv = v.findViewById<TextView>(R.id.dialog_title_tv)
|
|
1359
|
+ val contentTv = v.findViewById<TextView>(R.id.dialog_content_tv)
|
|
1360
|
+ try {
|
|
1361
|
+ val msgBean = GsonUtils.parseJsonWithGson(
|
|
1362
|
+ msg, SocketMsgBean().javaClass
|
|
1363
|
+ ) as SocketMsgBean
|
|
1364
|
+ titleTv.text = msgBean.title
|
|
1365
|
+ contentTv.text = msgBean.content
|
|
1366
|
+ } catch (e: Exception) {
|
|
1367
|
+ LogShow("解析失败" + e.toString())
|
|
1368
|
+ }
|
|
1369
|
+
|
|
1370
|
+ val dialog =
|
|
1371
|
+ AlertDialog.Builder(this).create()
|
|
1372
|
+ dialog.setView(v)
|
|
1373
|
+ dialog.setCancelable(false)
|
|
1374
|
+ if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.O){
|
|
1375
|
+ dialog.window?.setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY)
|
|
1376
|
+ }else{
|
|
1377
|
+ dialog.window?.setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT)
|
|
1378
|
+ }
|
|
1379
|
+ dialog.show()
|
|
1380
|
+ closeBtn.setOnClickListener {
|
|
1381
|
+ dialog.dismiss()
|
|
1382
|
+ }
|
|
1383
|
+ }
|
|
1384
|
+
|
1339
|
1385
|
private fun getAppStoreList(){
|
1340
|
1386
|
try {
|
1341
|
1387
|
if (appStroeList.size==0){
|