Always hide battery optimization card on Android 5.x

This commit is contained in:
iKirby 2023-07-30 15:58:42 +08:00 committed by GitHub
parent 2e3950d997
commit af0046ce1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,6 +2,7 @@ package io.nekohasekai.sfa.ui.main
import android.content.Intent
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
@ -120,8 +121,11 @@ class SettingsFragment : Fragment() {
)
val appCenterEnabled = Settings.analyticsAllowed == Settings.ANALYSIS_ALLOWED
val checkUpdateEnabled = Settings.checkUpdateEnabled
val removeBackgroudPermissionPage =
val removeBackgroudPermissionPage = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
Application.powerManager.isIgnoringBatteryOptimizations(Application.application.packageName)
} else {
true
}
withContext(Dispatchers.Main) {
binding.dataSizeText.text = dataSize
binding.appCenterEnabled.text = EnabledType.from(appCenterEnabled).name