Skip to content

Commit 7443fc3

Browse files
committed
简单的消息公告,增加应用更新异常跳转到反馈, 修复应用下载的bug
1 parent cdd85ba commit 7443fc3

File tree

8 files changed

+96
-34
lines changed

8 files changed

+96
-34
lines changed

Application/src/main/java/com/bihe0832/android/app/AppFactoryInit.kt

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import android.app.ActivityManager
55
import android.content.Context
66
import android.os.Bundle
77
import com.bihe0832.android.app.leakcanary.LeakCanaryManager
8+
import com.bihe0832.android.app.message.AAFMessageManager
89
import com.bihe0832.android.app.router.RouterHelper
910
import com.bihe0832.android.common.network.NetworkChangeManager
1011
import com.bihe0832.android.framework.ZixieContext
@@ -46,25 +47,17 @@ object AppFactoryInit {
4647

4748
RouterHelper.initRouter()
4849
initPermission()
50+
AAFMessageManager.initModule(application)
4951
ThreadManager.getInstance().start {
5052
DownloadUtils.init(ctx, 10, ZixieContext.isDebug())
5153
}
5254

5355
ThreadManager.getInstance().start({
5456
ZLog.e("Application process initCore web start")
5557
WebViewHelper.init(ctx, null, Bundle().apply {
56-
putString(
57-
TbsPrivacyAccess.ConfigurablePrivacy.MODEL.name,
58-
ManufacturerUtil.MODEL
59-
)
60-
putString(
61-
TbsPrivacyAccess.ConfigurablePrivacy.ANDROID_ID.name,
62-
ZixieContext.deviceId
63-
)
64-
putString(
65-
TbsPrivacyAccess.ConfigurablePrivacy.SERIAL.name,
66-
ZixieContext.deviceId
67-
)
58+
putString(TbsPrivacyAccess.ConfigurablePrivacy.MODEL.name, ManufacturerUtil.MODEL)
59+
putString(TbsPrivacyAccess.ConfigurablePrivacy.ANDROID_ID.name, ZixieContext.deviceId)
60+
putString(TbsPrivacyAccess.ConfigurablePrivacy.SERIAL.name, ZixieContext.deviceId)
6861
}, true)
6962
}, 5)
7063
ZLog.d("Application process $processName initCore ManufacturerUtil:" + ManufacturerUtil.MODEL)
@@ -85,8 +78,7 @@ object AppFactoryInit {
8578
val am = application.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
8679
val runningApps = am.runningAppProcesses
8780
for (it in runningApps) {
88-
if (it.pid == android.os.Process.myPid() && it.processName != null &&
89-
it.processName.contains(application.getPackageName())) {
81+
if (it.pid == android.os.Process.myPid() && it.processName != null && it.processName.contains(application.getPackageName())) {
9082
ZLog.e("Application initCore process: name:" + it.processName + " and id:" + it.pid)
9183
val processName = it.processName
9284
initCore(application, processName)
@@ -102,19 +94,15 @@ object AppFactoryInit {
10294
}
10395

10496
private fun initPermission() {
105-
PermissionManager.addPermissionGroupDesc(
106-
HashMap<String, String>().apply {
107-
put(Manifest.permission.WRITE_EXTERNAL_STORAGE, "访问存储卡")
108-
put(Manifest.permission.READ_PHONE_STATE, "读取手机状态")
109-
}
110-
)
97+
PermissionManager.addPermissionGroupDesc(HashMap<String, String>().apply {
98+
put(Manifest.permission.WRITE_EXTERNAL_STORAGE, "访问存储卡")
99+
put(Manifest.permission.READ_PHONE_STATE, "读取手机状态")
100+
})
111101

112-
PermissionManager.addPermissionGroupScene(
113-
HashMap<String, String>().apply {
114-
put(Manifest.permission.WRITE_EXTERNAL_STORAGE, "获取应用信息")
115-
put(Manifest.permission.READ_PHONE_STATE, "获取应用安装时间等")
116-
}
117-
)
102+
PermissionManager.addPermissionGroupScene(HashMap<String, String>().apply {
103+
put(Manifest.permission.WRITE_EXTERNAL_STORAGE, "获取应用信息")
104+
put(Manifest.permission.READ_PHONE_STATE, "获取应用安装时间等")
105+
})
118106
}
119107

120108
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package com.bihe0832.android.app.message
2+
3+
import android.app.Activity
4+
import com.bihe0832.android.app.R
5+
import com.bihe0832.android.app.api.AAFNetWorkApi
6+
import com.bihe0832.android.common.message.base.MessageManager
7+
import com.bihe0832.android.common.message.data.MessageInfoItem
8+
import com.bihe0832.android.framework.ZixieContext
9+
import com.bihe0832.android.lib.thread.ThreadManager
10+
import com.bihe0832.android.lib.ui.dialog.OnDialogListener
11+
import com.bihe0832.android.lib.ui.dialog.blockdialog.DependenceBlockDialogManager
12+
13+
/**
14+
*
15+
* @author zixie code@bihe0832.com
16+
* Created on 2019-10-21.
17+
* Description: Description
18+
*
19+
*/
20+
object AAFMessageManager : MessageManager() {
21+
22+
private val mDependenceBlockDialogManager by lazy {
23+
DependenceBlockDialogManager(true)
24+
}
25+
26+
override fun fetchNewMsg() {
27+
fetchMessageByFile(AAFNetWorkApi.getCommonURL(ZixieContext.applicationContext?.getString(R.string.message_url)
28+
?: "", ""))
29+
}
30+
31+
fun showNotice(activity: Activity, messageInfoItem: MessageInfoItem, showFace: Boolean) {
32+
mDependenceBlockDialogManager.getDependentTaskManager().addTask(messageInfoItem.messageID, {
33+
ThreadManager.getInstance().runOnUIThread {
34+
showNotice(activity, messageInfoItem, showFace, object : OnDialogListener {
35+
override fun onPositiveClick() {
36+
mDependenceBlockDialogManager.getDependentTaskManager().finishTask(messageInfoItem.messageID)
37+
}
38+
39+
override fun onNegativeClick() {
40+
onPositiveClick()
41+
}
42+
43+
override fun onCancel() {
44+
onPositiveClick()
45+
}
46+
})
47+
}
48+
}, mutableListOf())
49+
}
50+
}

BaseAdbInput/src/main/java/com/bihe0832/android/base/adb/input/settings/InputSettingsActivity.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ package com.bihe0832.android.base.adb.input.settings
33
import android.content.Intent
44
import android.os.Bundle
55
import android.view.inputmethod.InputMethodManager
6+
import com.bihe0832.android.app.message.AAFMessageManager
67
import com.bihe0832.android.app.router.RouterConstants
78
import com.bihe0832.android.app.router.RouterHelper
89
import com.bihe0832.android.app.update.UpdateManager
910
import com.bihe0832.android.base.adb.input.R
11+
import com.bihe0832.android.base.adb.input.ZixieIME
12+
import com.bihe0832.android.base.adb.input.switcher.InputSwitchTools
1013
import com.bihe0832.android.framework.ui.BaseActivity
1114
import com.bihe0832.android.lib.log.ZLog
1215
import com.bihe0832.android.lib.router.annotation.Module
13-
import com.bihe0832.android.base.adb.input.ZixieIME
14-
import com.bihe0832.android.base.adb.input.switcher.InputSwitchTools
1516
import kotlinx.android.synthetic.main.activity_input_settings.*
1617

1718

@@ -30,6 +31,11 @@ class InputSettingsActivity : BaseActivity() {
3031
RouterHelper.openPageByRouter(RouterConstants.MODULE_NAME_BASE_ABOUT)
3132
}
3233
UpdateManager.checkUpdateAndShowDialog(this, false)
34+
AAFMessageManager.getMessageLiveData().observe(this) { t ->
35+
t?.filter { it.canShow(true) }?.forEach {
36+
AAFMessageManager.showNotice(this@InputSettingsActivity, it, true)
37+
}
38+
}
3339
}
3440

3541
override fun onNewIntent(intent: Intent?) {

PubGetAPKInfo/src/main/java/com/bihe0832/android/app/apk/MainActivity.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ import android.content.pm.ApplicationInfo
55
import android.content.pm.PackageManager
66
import android.os.Bundle
77
import androidx.core.content.ContextCompat
8+
import androidx.lifecycle.Observer
89
import androidx.recyclerview.widget.RecyclerView
910
import com.bihe0832.android.app.getapk.R
11+
import com.bihe0832.android.app.message.AAFMessageManager
1012
import com.bihe0832.android.app.router.RouterConstants
1113
import com.bihe0832.android.app.router.RouterHelper
1214
import com.bihe0832.android.app.update.UpdateManager
@@ -15,6 +17,7 @@ import com.bihe0832.android.base.card.tips.TipsData
1517
import com.bihe0832.android.common.list.CardItemForCommonList
1618
import com.bihe0832.android.common.list.CommonListLiveData
1719
import com.bihe0832.android.common.list.swiperefresh.CommonListActivity
20+
import com.bihe0832.android.common.message.data.MessageInfoItem
1821
import com.bihe0832.android.framework.ZixieContext
1922
import com.bihe0832.android.lib.adapter.CardBaseModule
2023
import com.bihe0832.android.lib.debug.DebugTools
@@ -72,6 +75,11 @@ class MainActivity : CommonListActivity() {
7275
initAdapter()
7376
showTips()
7477
UpdateManager.checkUpdateAndShowDialog(this, false)
78+
AAFMessageManager.getMessageLiveData().observe(this) { t ->
79+
t?.filter { it.canShow(true) }?.forEach {
80+
AAFMessageManager.showNotice(this@MainActivity, it, true)
81+
}
82+
}
7583
}
7684

7785
override fun getStatusBarColor(): Int {

PubM3U8/src/main/java/com/bihe0832/android/app/m3u8/MainActivity.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.bihe0832.android.app.m3u8
22

33
import android.os.Bundle
4-
import com.bihe0832.android.app.getapk.R
4+
import com.bihe0832.android.app.message.AAFMessageManager
55
import com.bihe0832.android.app.router.RouterConstants
66
import com.bihe0832.android.app.router.RouterHelper
77
import com.bihe0832.android.app.update.UpdateManager
@@ -26,7 +26,11 @@ class MainActivity : M3U8ListActivity() {
2626
}
2727
M3U8DBManager.init(this)
2828

29-
29+
AAFMessageManager.getMessageLiveData().observe(this) { t ->
30+
t?.filter { it.canShow(true) }?.forEach {
31+
AAFMessageManager.showNotice(this@MainActivity, it, true)
32+
}
33+
}
3034
}
3135

3236
}

PubPuzzleGame/src/main/java/com/bihe0832/android/app/puzzle/MainActivity.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.bihe0832.android.app.puzzle
33
import android.os.Bundle
44
import android.text.Html
55
import androidx.core.content.ContextCompat
6+
import com.bihe0832.android.app.message.AAFMessageManager
67
import com.bihe0832.android.app.router.RouterConstants
78
import com.bihe0832.android.app.router.RouterHelper
89
import com.bihe0832.android.app.update.UpdateManager
@@ -31,6 +32,11 @@ class MainActivity : BaseActivity() {
3132
" 1. <b><font color='#38ADFF'>点击</font>下方图标</b>,选择拼图的素材<BR>" +
3233
" 2. 选择图片后,进入<b><font color='#38ADFF'>拼图游戏</font>页面,可自由切换模式和难度</b>"
3334
)
35+
AAFMessageManager.getMessageLiveData().observe(this) { t ->
36+
t?.filter { it.canShow(true) }?.forEach {
37+
AAFMessageManager.showNotice(this@MainActivity, it, true)
38+
}
39+
}
3440
}
3541

3642
override fun getStatusBarColor(): Int {

config.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ext {
1212
//版本号,正式版本会由自动构建替换
1313
versionCode = 1
1414
//版本名,正式版本会由自动构建替换
15-
versionName = "1.2.0"
15+
versionName = "1.0.0"
1616
//Android 构建包时是否混淆代码
1717
minifyEnabled = true
1818

@@ -42,6 +42,6 @@ ext {
4242
//使用kotlin版本
4343
kotlin_version = '1.7.10'
4444

45-
aaf_test_version = '5.10.54'
46-
aaf_version = '5.10.54'
45+
aaf_test_version = '5.10.55'
46+
aaf_version = '5.10.55'
4747
}

dependencies.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ ext.moduleVersionName = "3.6.5"
3434
ext.moduleInfo = [
3535

3636
"APPTest" : [
37-
"apidependenciesList": ["",
37+
"apidependenciesList" : [ "",
3838
"Application", "BaseDebug"
3939
]
4040
],

0 commit comments

Comments
 (0)