pref: 修改自动备份文件

This commit is contained in:
HuanCheng65 2021-12-03 19:04:16 +08:00
parent c634f8550b
commit b6c4299398
4 changed files with 46 additions and 16 deletions

View File

@ -96,7 +96,7 @@ dependencies {
//AndroidX
implementation "androidx.appcompat:appcompat:1.3.1"
implementation "androidx.core:core-ktx:1.6.0"
implementation "androidx.annotation:annotation:1.2.0"
implementation "androidx.annotation:annotation:1.3.0"
implementation "androidx.constraintlayout:constraintlayout:2.1.1"
implementation "androidx.preference:preference-ktx:1.1.1"
implementation "androidx.gridlayout:gridlayout:1.0.0"
@ -138,7 +138,6 @@ dependencies {
implementation "com.zhihu.android:matisse:0.5.3-beta3"
implementation "com.yanzhenjie:permission:2.0.3"
implementation "com.gyf.immersionbar:immersionbar:3.0.0"
api "com.flurry.android:analytics:13.0.0"
implementation "com.github.yalantis:ucrop:2.2.7"
@ -150,4 +149,8 @@ dependencies {
implementation ("com.alibaba.android:vlayout:1.2.31@aar") {
transitive = true
}
def appCenterSdkVersion = '4.3.1'
implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}"
implementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}"
}

View File

@ -24,7 +24,6 @@ import android.widget.TextView
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatDelegate
import com.flurry.android.FlurryAgent
import com.huanchengfly.tieba.post.activities.BaseActivity
import com.huanchengfly.tieba.post.api.interfaces.CommonCallback
import com.huanchengfly.tieba.post.components.dialogs.LoadingDialog
@ -76,9 +75,6 @@ class BaseApplication : Application(), IApp {
ThemeUtils.init(ThemeDelegate)
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
LitePal.initialize(this)
FlurryAgent.Builder()
.withCaptureUncaughtExceptions(true)
.build(this, "ZMRX6W76WNF95ZHT857X")
registerActivityLifecycleCallbacks(object : ActivityLifecycleCallbacks {
private var clipBoardHash: Int = 0
private fun updateClipBoardHashCode() {

View File

@ -33,6 +33,9 @@ import com.huanchengfly.tieba.post.models.MyInfoBean
import com.huanchengfly.tieba.post.services.NotifyJobService
import com.huanchengfly.tieba.post.utils.*
import com.huanchengfly.tieba.post.widgets.MyViewPager
import com.microsoft.appcenter.AppCenter
import com.microsoft.appcenter.analytics.Analytics
import com.microsoft.appcenter.crashes.Crashes
open class MainActivity : BaseActivity(), BottomNavigationView.OnNavigationItemSelectedListener, OnNavigationItemReselectedListener {
var mAdapter: ViewPagerAdapter = ViewPagerAdapter(supportFragmentManager)
@ -151,15 +154,26 @@ open class MainActivity : BaseActivity(), BottomNavigationView.OnNavigationItemS
findView()
initView()
initListener()
if (!SharedPreferencesUtil.get(SharedPreferencesUtil.SP_APP_DATA).getBoolean("notice_dialog", false)) {
AppCenter.start(
getApplication(), "b56debcc-264b-4368-a2cd-8c20213f6433",
Analytics::class.java, Crashes::class.java
)
if (!SharedPreferencesUtil.get(SharedPreferencesUtil.SP_APP_DATA)
.getBoolean("notice_dialog", false)
) {
showDialog(DialogUtil.build(this)
.setTitle(R.string.title_dialog_notice)
.setMessage(R.string.message_dialog_notice)
.setPositiveButton(R.string.button_sure_default) { _, _ ->
SharedPreferencesUtil.put(this, SharedPreferencesUtil.SP_APP_DATA, "notice_dialog", true)
}
.setCancelable(false)
.create())
.setTitle(R.string.title_dialog_notice)
.setMessage(R.string.message_dialog_notice)
.setPositiveButton(R.string.button_sure_default) { _, _ ->
SharedPreferencesUtil.put(
this,
SharedPreferencesUtil.SP_APP_DATA,
"notice_dialog",
true
)
}
.setCancelable(false)
.create())
}
if (shouldShowSwitchSnackbar()) {
Util.createSnackbar(mViewPager, if (ThemeUtil.isNightMode(this)) R.string.snackbar_auto_switch_to_night else R.string.snackbar_auto_switch_from_night, Snackbar.LENGTH_SHORT)

View File

@ -1,6 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
<full-backup-content xmlns:tools="http://schemas.android.com/tools">
<exclude
domain="sharedpref"
path="crash.xml" />
</full-backup-content>
<exclude
domain="sharedpref"
path="AppCenter.xml" />
<exclude
domain="database"
path="com.microsoft.appcenter.persistence" />
<exclude
domain="database"
path="com.microsoft.appcenter.persistence-journal" />
<exclude
domain="file"
path="error"
tools:ignore="FullBackupContent" />
<exclude
domain="file"
path="appcenter"
tools:ignore="FullBackupContent" />
</full-backup-content>