pref: Target SDK 31
This commit is contained in:
parent
6b3ecf37da
commit
37aab60ddc
|
|
@ -27,7 +27,7 @@ android {
|
|||
applicationId "com.huanchengfly.tieba.post"
|
||||
minSdkVersion 21
|
||||
//noinspection OldTargetApi
|
||||
targetSdkVersion 30
|
||||
targetSdkVersion 31
|
||||
versionCode applicationVersionCode
|
||||
versionName applicationVersionName
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
|
@ -64,7 +64,6 @@ android {
|
|||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
useIR = true
|
||||
}
|
||||
packagingOptions {
|
||||
resources {
|
||||
|
|
@ -74,11 +73,11 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains:annotations:19.0.0"
|
||||
implementation 'org.jetbrains:annotations:23.0.0'
|
||||
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
api "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2"
|
||||
api "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2"
|
||||
api 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.2'
|
||||
api 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.2'
|
||||
|
||||
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
|
||||
|
||||
|
|
@ -126,13 +125,13 @@ dependencies {
|
|||
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
|
||||
implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
|
||||
|
||||
implementation "com.google.code.gson:gson:2.8.7"
|
||||
implementation 'com.google.code.gson:gson:2.9.0'
|
||||
implementation "cn.dreamtobe.kpswitch:library:1.6.2"
|
||||
implementation "org.litepal.android:kotlin:3.0.0"
|
||||
implementation "com.github.SheHuan:RecyclerViewAdapter:1.2.9"
|
||||
implementation "com.davemorrissey.labs:subsampling-scale-image-view-androidx:3.10.0"
|
||||
implementation "com.bm.photoview:library:2.0.7"
|
||||
implementation "cn.jzvd:jiaozivideoplayer:7.7.0"
|
||||
implementation 'cn.jzvd:jiaozivideoplayer:7.7.2.3300'
|
||||
implementation "com.jrummyapps:colorpicker:2.1.7"
|
||||
|
||||
implementation "com.scwang.smart:refresh-layout-kernel:2.0.1"
|
||||
|
|
@ -149,11 +148,11 @@ dependencies {
|
|||
implementation "com.jakewharton:butterknife:10.2.3"
|
||||
kapt "com.jakewharton:butterknife-compiler:10.2.3"
|
||||
|
||||
implementation ("com.alibaba.android:vlayout:1.2.31@aar") {
|
||||
implementation ('com.alibaba.android:vlayout:1.3.0@aar') {
|
||||
transitive = true
|
||||
}
|
||||
|
||||
def appCenterSdkVersion = '4.3.1'
|
||||
def appCenterSdkVersion = '4.4.3'
|
||||
implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}"
|
||||
implementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}"
|
||||
implementation "com.microsoft.appcenter:appcenter-distribute:${appCenterSdkVersion}"
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
<uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" />
|
||||
<uses-permission android:name="com.android.launcher.permission.READ_SETTINGS" />
|
||||
<uses-permission android:name="com.miui.personalassistant.permission.FAVORITE" />
|
||||
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
|
||||
|
||||
<queries>
|
||||
<package android:name="com.baidu.tieba" />
|
||||
|
|
@ -101,6 +102,7 @@
|
|||
android:configChanges="screenSize|screenLayout|orientation|smallestScreenSize|keyboardHidden"
|
||||
android:resizeableActivity="true"
|
||||
android:theme="@style/AppTheme.Splash"
|
||||
android:exported="true"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
|
@ -156,7 +158,9 @@
|
|||
android:name=".activities.AboutActivity"
|
||||
android:configChanges="screenSize|screenLayout|orientation|smallestScreenSize|keyboardHidden"
|
||||
android:windowSoftInputMode="adjustResize" />
|
||||
<activity android:name=".activities.DispatchActivity">
|
||||
<activity
|
||||
android:name=".activities.DispatchActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<data
|
||||
android:host="tieba.baidu.com"
|
||||
|
|
@ -198,6 +202,7 @@
|
|||
android:windowSoftInputMode="adjustPan" />
|
||||
|
||||
<service
|
||||
android:exported="true"
|
||||
android:name=".services.OKSignTileService"
|
||||
android:icon="@drawable/ic_oksign"
|
||||
android:label="@string/title_oksign"
|
||||
|
|
|
|||
|
|
@ -2,11 +2,13 @@ package com.huanchengfly.tieba.post
|
|||
|
||||
import android.animation.LayoutTransition
|
||||
import android.app.Activity
|
||||
import android.app.PendingIntent
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.res.ColorStateList
|
||||
import android.content.res.Configuration
|
||||
import android.content.res.Configuration.SCREENLAYOUT_SIZE_MASK
|
||||
import android.os.Build
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
|
|
@ -103,4 +105,20 @@ val Configuration.isTablet: Boolean
|
|||
get() = (screenLayout and SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE
|
||||
|
||||
val Context.isTablet: Boolean
|
||||
get() = resources.configuration.isTablet
|
||||
get() = resources.configuration.isTablet
|
||||
|
||||
fun pendingIntentFlagMutable(): Int {
|
||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
PendingIntent.FLAG_MUTABLE
|
||||
} else {
|
||||
0
|
||||
}
|
||||
}
|
||||
|
||||
fun pendingIntentFlagImmutable(): Int {
|
||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
PendingIntent.FLAG_IMMUTABLE
|
||||
} else {
|
||||
0
|
||||
}
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
package com.huanchengfly.tieba.post.components.workers
|
||||
|
||||
import android.content.Context
|
||||
import androidx.work.Worker
|
||||
import androidx.work.WorkerParameters
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlin.coroutines.CoroutineContext
|
||||
|
||||
class OKSignWorker(
|
||||
context: Context,
|
||||
workerParams: WorkerParameters
|
||||
) : Worker(context, workerParams), CoroutineScope {
|
||||
override fun doWork(): Result {
|
||||
return Result.success()
|
||||
}
|
||||
|
||||
val job = Job()
|
||||
|
||||
override val coroutineContext: CoroutineContext
|
||||
get() = Dispatchers.Main + job
|
||||
}
|
||||
|
|
@ -1,10 +1,14 @@
|
|||
package com.huanchengfly.tieba.post.fragments
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.DialogInterface
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.PowerManager
|
||||
import android.provider.Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
import androidx.core.content.ContextCompat
|
||||
|
|
@ -20,9 +24,9 @@ import com.huanchengfly.tieba.post.components.prefs.TimePickerPreference
|
|||
import com.huanchengfly.tieba.post.fragments.preference.PreferencesFragment
|
||||
import com.huanchengfly.tieba.post.models.database.Account
|
||||
import com.huanchengfly.tieba.post.models.database.Block
|
||||
import com.huanchengfly.tieba.post.toastShort
|
||||
import com.huanchengfly.tieba.post.ui.theme.utils.ThemeUtils
|
||||
import com.huanchengfly.tieba.post.utils.*
|
||||
import java.util.*
|
||||
|
||||
class SettingsFragment : PreferencesFragment() {
|
||||
private var loginInfo: Account? = null
|
||||
|
|
@ -31,6 +35,18 @@ class SettingsFragment : PreferencesFragment() {
|
|||
refresh()
|
||||
}
|
||||
|
||||
//忽略电池优化
|
||||
private fun ignoreBatteryOptimization() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
val powerManager = attachContext.getSystemService(Context.POWER_SERVICE) as PowerManager
|
||||
if (!powerManager.isIgnoringBatteryOptimizations(attachContext.packageName)) {
|
||||
val intent = Intent(ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS)
|
||||
intent.data = Uri.parse("package:${attachContext.packageName}")
|
||||
startActivity(intent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun refresh() {
|
||||
loginInfo = AccountUtil.getLoginInfo(attachContext)
|
||||
val accounts = AccountUtil.allAccounts
|
||||
|
|
@ -56,23 +72,62 @@ class SettingsFragment : PreferencesFragment() {
|
|||
preferenceManager.sharedPreferencesName = "settings"
|
||||
addPreferencesFromResource(R.xml.preferences)
|
||||
val accountsPreference = findPreference<ListPreference>("switch_account")
|
||||
accountsPreference!!.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _: Preference?, newValue: Any? ->
|
||||
if (AccountUtil.switchUser(attachContext, Integer.valueOf((newValue as String?)!!))) {
|
||||
refresh()
|
||||
Toast.makeText(attachContext, R.string.toast_switch_success, Toast.LENGTH_SHORT).show()
|
||||
accountsPreference!!.onPreferenceChangeListener =
|
||||
Preference.OnPreferenceChangeListener { _: Preference?, newValue: Any? ->
|
||||
if (AccountUtil.switchUser(
|
||||
attachContext,
|
||||
Integer.valueOf((newValue as String?)!!)
|
||||
)
|
||||
) {
|
||||
refresh()
|
||||
Toast.makeText(attachContext, R.string.toast_switch_success, Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
}
|
||||
false
|
||||
}
|
||||
false
|
||||
}
|
||||
findPreference<Preference>("copy_bduss")!!.onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
||||
val account = AccountUtil.getLoginInfo(attachContext)
|
||||
if (account != null) {
|
||||
TiebaUtil.copyText(attachContext, account.bduss)
|
||||
findPreference<Preference>("ignore_battery_optimization")?.let {
|
||||
val powerManager = attachContext.getSystemService(Context.POWER_SERVICE) as PowerManager
|
||||
it.onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (!powerManager.isIgnoringBatteryOptimizations(attachContext.packageName)) {
|
||||
ignoreBatteryOptimization()
|
||||
} else {
|
||||
attachContext.toastShort(R.string.toast_ignore_battery_optimization_already)
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
it.isEnabled =
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !powerManager.isIgnoringBatteryOptimizations(
|
||||
attachContext.packageName
|
||||
)
|
||||
it.setSummaryProvider {
|
||||
when {
|
||||
Build.VERSION.SDK_INT < Build.VERSION_CODES.M -> {
|
||||
attachContext.getString(R.string.summary_battery_optimization_old_android_version)
|
||||
}
|
||||
powerManager.isIgnoringBatteryOptimizations(attachContext.packageName) -> {
|
||||
attachContext.getString(R.string.summary_battery_optimization_ignored)
|
||||
}
|
||||
else -> {
|
||||
attachContext.getString(R.string.summary_ignore_battery_optimization)
|
||||
}
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
findPreference<Preference>("exit_account")!!.isEnabled = AccountUtil.isLoggedIn(attachContext)
|
||||
findPreference<Preference>("exit_account")!!.onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
||||
DialogUtil.build(attachContext)
|
||||
findPreference<Preference>("copy_bduss")!!.onPreferenceClickListener =
|
||||
Preference.OnPreferenceClickListener {
|
||||
val account = AccountUtil.getLoginInfo(attachContext)
|
||||
if (account != null) {
|
||||
TiebaUtil.copyText(attachContext, account.bduss)
|
||||
}
|
||||
true
|
||||
}
|
||||
findPreference<Preference>("exit_account")!!.isEnabled =
|
||||
AccountUtil.isLoggedIn(attachContext)
|
||||
findPreference<Preference>("exit_account")!!.onPreferenceClickListener =
|
||||
Preference.OnPreferenceClickListener {
|
||||
DialogUtil.build(attachContext)
|
||||
.setMessage(R.string.title_dialog_exit_account)
|
||||
.setPositiveButton(R.string.button_sure_default) { _: DialogInterface?, _: Int ->
|
||||
AccountUtil.exit(attachContext)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import android.app.PendingIntent
|
|||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import com.huanchengfly.tieba.post.pendingIntentFlagImmutable
|
||||
import com.huanchengfly.tieba.post.utils.TiebaUtil
|
||||
import com.huanchengfly.tieba.post.utils.Util
|
||||
import com.huanchengfly.tieba.post.utils.appPreferences
|
||||
|
|
@ -28,12 +28,12 @@ class BootCompleteSignReceiver : BroadcastReceiver() {
|
|||
val time = Util.time2Calendar(autoSignTimeStr).apply {
|
||||
add(Calendar.DAY_OF_MONTH, 1)
|
||||
}.timeInMillis
|
||||
val pendingIntent = PendingIntent.getBroadcast(context, 0, Intent(context, AutoSignAlarm::class.java),
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
PendingIntent.FLAG_IMMUTABLE
|
||||
} else {
|
||||
0
|
||||
})
|
||||
val pendingIntent = PendingIntent.getBroadcast(
|
||||
context,
|
||||
0,
|
||||
Intent(context, AutoSignAlarm::class.java),
|
||||
pendingIntentFlagImmutable()
|
||||
)
|
||||
alarmManager.setInexactRepeating(AlarmManager.RTC, time, AlarmManager.INTERVAL_DAY, pendingIntent)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import com.huanchengfly.tieba.post.activities.MessageActivity
|
|||
import com.huanchengfly.tieba.post.api.TiebaApi
|
||||
import com.huanchengfly.tieba.post.api.models.MsgBean
|
||||
import com.huanchengfly.tieba.post.fragments.MessageFragment
|
||||
import com.huanchengfly.tieba.post.pendingIntentFlagImmutable
|
||||
import com.huanchengfly.tieba.post.ui.theme.utils.ThemeUtils
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
|
|
@ -104,14 +105,10 @@ class NotifyJobService : JobService() {
|
|||
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
|
||||
.setContentIntent(
|
||||
PendingIntent.getActivity(
|
||||
this,
|
||||
0,
|
||||
intent,
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
PendingIntent.FLAG_IMMUTABLE
|
||||
} else {
|
||||
0
|
||||
}
|
||||
this,
|
||||
0,
|
||||
intent,
|
||||
pendingIntentFlagImmutable()
|
||||
)
|
||||
)
|
||||
.setColor(ThemeUtils.getColorByAttr(this, R.attr.colorPrimary))
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import android.app.NotificationManager
|
|||
import android.app.PendingIntent
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.*
|
||||
import android.os.Build
|
||||
import android.widget.Toast
|
||||
import androidx.core.app.NotificationCompat
|
||||
import com.huanchengfly.tieba.post.R
|
||||
|
|
@ -14,11 +14,17 @@ import com.huanchengfly.tieba.post.activities.LoginActivity
|
|||
import com.huanchengfly.tieba.post.activities.MainActivity
|
||||
import com.huanchengfly.tieba.post.api.models.SignResultBean
|
||||
import com.huanchengfly.tieba.post.models.SignDataBean
|
||||
import com.huanchengfly.tieba.post.pendingIntentFlagImmutable
|
||||
import com.huanchengfly.tieba.post.ui.theme.utils.ThemeUtils
|
||||
import com.huanchengfly.tieba.post.utils.*
|
||||
import kotlinx.coroutines.*
|
||||
import com.huanchengfly.tieba.post.utils.AccountUtil
|
||||
import com.huanchengfly.tieba.post.utils.ProgressListener
|
||||
import com.huanchengfly.tieba.post.utils.SingleAccountSigner
|
||||
import com.huanchengfly.tieba.post.utils.addFlag
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers.Main
|
||||
import java.util.*
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.cancel
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import kotlin.coroutines.CoroutineContext
|
||||
|
||||
class OKSignService : IntentService(TAG), CoroutineScope, ProgressListener {
|
||||
|
|
@ -54,13 +60,15 @@ class OKSignService : IntentService(TAG), CoroutineScope, ProgressListener {
|
|||
|
||||
private fun updateNotification(title: String, text: String, intent: Intent) {
|
||||
manager.notify(1,
|
||||
buildNotification(title, text)
|
||||
.setContentIntent(PendingIntent.getActivity(this, 0, intent,
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
PendingIntent.FLAG_IMMUTABLE
|
||||
} else {
|
||||
0
|
||||
}))
|
||||
buildNotification(title, text)
|
||||
.setContentIntent(
|
||||
PendingIntent.getActivity(
|
||||
this,
|
||||
0,
|
||||
intent,
|
||||
pendingIntentFlagImmutable()
|
||||
)
|
||||
)
|
||||
.build())
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.huanchengfly.tieba.post.utils;
|
||||
|
||||
import static com.huanchengfly.tieba.post.ExtensionsKt.pendingIntentFlagMutable;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.AlarmManager;
|
||||
import android.app.PendingIntent;
|
||||
|
|
@ -114,7 +116,7 @@ public class CrashUtil {
|
|||
context.getApplicationContext(),
|
||||
0,
|
||||
intent,
|
||||
0
|
||||
pendingIntentFlagMutable()
|
||||
);
|
||||
mAlarmManager.set(AlarmManager.RTC, System.currentTimeMillis() + 1000,
|
||||
restartIntent);
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ abstract class IOKSigner(
|
|||
|
||||
abstract suspend fun start(): Boolean
|
||||
|
||||
abstract suspend fun startSync(): Boolean
|
||||
|
||||
suspend fun sign(signDataBean: SignDataBean): ApiResult<SignResultBean> {
|
||||
return TiebaApi.getInstance()
|
||||
.signAsync(signDataBean.forumName, signDataBean.tbs)
|
||||
|
|
@ -98,12 +100,50 @@ class SingleAccountSigner(
|
|||
private var successCount = 0
|
||||
private var totalCount = 0
|
||||
|
||||
var lastFailure: Throwable? = null
|
||||
|
||||
private var mProgressListener: ProgressListener? = null
|
||||
|
||||
fun setProgressListener(listener: ProgressListener?) {
|
||||
mProgressListener = listener
|
||||
}
|
||||
|
||||
override suspend fun startSync(): Boolean {
|
||||
var result = false
|
||||
signData.clear()
|
||||
var userName: String by Delegates.notNull()
|
||||
var tbs: String by Delegates.notNull()
|
||||
AccountUtil.updateUserInfoAsync(coroutineScope, account.bduss)
|
||||
.await()
|
||||
.fetchIfSuccess {
|
||||
userName = it.data.name
|
||||
tbs = it.data.itbTbs
|
||||
TiebaApi.getInstance().forumRecommendAsync().getData()
|
||||
}
|
||||
.doIfSuccess { forumRecommend ->
|
||||
signData.addAll(forumRecommend.likeForum.filter { it.isSign != "1" }
|
||||
.map { SignDataBean(it.forumName, userName, tbs) })
|
||||
totalCount = signData.size
|
||||
mProgressListener?.onStart(totalCount)
|
||||
if (signData.isNotEmpty()) {
|
||||
result = sign(0)
|
||||
} else {
|
||||
mProgressListener?.onFinish(true, 0, 0)
|
||||
}
|
||||
}
|
||||
.doIfFailure {
|
||||
lastFailure = it
|
||||
mProgressListener?.onFailure(
|
||||
0,
|
||||
0,
|
||||
it.getErrorCode(),
|
||||
it.getErrorMessage()
|
||||
)
|
||||
throw it
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
override suspend fun start(): Boolean {
|
||||
var result = false
|
||||
signData.clear()
|
||||
|
|
@ -128,6 +168,7 @@ class SingleAccountSigner(
|
|||
}
|
||||
}
|
||||
.doIfFailure {
|
||||
lastFailure = it
|
||||
mProgressListener?.onFailure(
|
||||
0,
|
||||
0,
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import com.huanchengfly.tieba.post.activities.WebViewActivity
|
|||
import com.huanchengfly.tieba.post.api.TiebaApi
|
||||
import com.huanchengfly.tieba.post.api.models.CheckReportBean
|
||||
import com.huanchengfly.tieba.post.components.dialogs.LoadingDialog
|
||||
import com.huanchengfly.tieba.post.pendingIntentFlagImmutable
|
||||
import com.huanchengfly.tieba.post.receivers.AutoSignAlarm
|
||||
import com.huanchengfly.tieba.post.services.OKSignService
|
||||
import com.huanchengfly.tieba.post.toastShort
|
||||
|
|
@ -41,11 +42,7 @@ object TiebaUtil {
|
|||
context,
|
||||
0,
|
||||
Intent(context, AutoSignAlarm::class.java),
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
PendingIntent.FLAG_IMMUTABLE
|
||||
} else {
|
||||
0
|
||||
}
|
||||
pendingIntentFlagImmutable()
|
||||
)
|
||||
if (autoSign) {
|
||||
val autoSignTimeStr = context.appPreferences.autoSignTime!!
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M15.67,4L14,4L14,3c0,-0.55 -0.45,-1 -1,-1h-2c-0.55,0 -1,0.45 -1,1v1L8.33,4C7.6,4 7,4.6 7,5.33v15.33C7,21.4 7.6,22 8.34,22h7.32c0.74,0 1.34,-0.6 1.34,-1.33L17,5.33C17,4.6 16.4,4 15.67,4zM13,18h-2v-2h2v2zM13,13c0,0.55 -0.45,1 -1,1s-1,-0.45 -1,-1v-3c0,-0.55 0.45,-1 1,-1s1,0.45 1,1v3z" />
|
||||
</vector>
|
||||
|
|
@ -201,7 +201,7 @@
|
|||
<string name="summary_auto_sign">开启后,将每天定时运行一键签到</string>
|
||||
<string name="summary_auto_sign_on">自动签到已开启</string>
|
||||
<string name="summary_auto_sign_time">当前设置为 %1$s</string>
|
||||
<string name="tip_auto_sign">提示:请您允许贴吧 Lite 的自启动,否则可能无法正常唤醒签到。</string>
|
||||
<string name="tip_auto_sign">提示:请允许贴吧 Lite 的自启动,否则可能无法正常唤醒签到。\n若使用的是 MIUI 等国产定制 UI,你还需要在系统设置中进行相应修改。</string>
|
||||
<string name="update_tip_no_content">点击查看完整更新日志</string>
|
||||
<string name="title_forum">%1$s吧</string>
|
||||
<string name="menu_edit_info">编辑资料</string>
|
||||
|
|
@ -498,4 +498,9 @@
|
|||
<string name="toast_official_client_not_install">未安装官方版客户端</string>
|
||||
<string name="button_pc_web_post">使用 PC 网页版发贴</string>
|
||||
<string name="title_post_or_reply_warning">发贴回贴风险提示</string>
|
||||
<string name="summary_ignore_battery_optimization">请忽略“电池优化”以允许应用启动自动签到</string>
|
||||
<string name="title_ignore_battery_optimization">忽略“电池优化”</string>
|
||||
<string name="summary_battery_optimization_old_android_version">旧版 Android 无“电池优化”</string>
|
||||
<string name="summary_battery_optimization_ignored">“电池优化”已忽略</string>
|
||||
<string name="toast_ignore_battery_optimization_already">已忽略电池优化</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -228,6 +228,12 @@
|
|||
android:key="auto_sign_time"
|
||||
android:title="@string/title_auto_sign_time" />
|
||||
|
||||
<Preference
|
||||
android:icon="@drawable/ic_round_battery_alert"
|
||||
android:key="ignore_battery_optimization"
|
||||
android:summary="@string/summary_ignore_battery_optimization"
|
||||
android:title="@string/title_ignore_battery_optimization" />
|
||||
|
||||
<Preference
|
||||
android:layout="@layout/layout_preference_dense"
|
||||
android:summary="@string/tip_auto_sign" />
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
buildscript {
|
||||
ext {
|
||||
glide_version = "4.12.0"
|
||||
glide_version = '4.13.2'
|
||||
retrofit_version = "2.9.0"
|
||||
kotlin_version = '1.5.31'
|
||||
kotlin_version = '1.7.0'
|
||||
}
|
||||
repositories {
|
||||
google()
|
||||
|
|
|
|||
Loading…
Reference in New Issue