mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
merge with upstream
This commit is contained in:
parent
6c586a2f9c
commit
ae3b67a5ba
2 changed files with 9 additions and 2 deletions
|
@ -27,7 +27,9 @@ import com.lagradost.cloudstream3.mvvm.logError
|
|||
import com.lagradost.cloudstream3.mvvm.normalSafeApiCall
|
||||
import com.lagradost.cloudstream3.network.initClient
|
||||
import com.lagradost.cloudstream3.ui.EasterEggMonke
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.PHONE
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.beneneCount
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.isLayout
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.getPref
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setPaddingBottom
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setToolBarScrollFlags
|
||||
|
@ -208,6 +210,10 @@ class SettingsGeneral : PreferenceFragmentCompat() {
|
|||
return@setOnPreferenceClickListener true
|
||||
}
|
||||
|
||||
// hide preference on tvs and emulators
|
||||
if (!isLayout(PHONE)) {
|
||||
getPref(R.string.battery_optimisation_key)?.isEnabled = false
|
||||
}
|
||||
getPref(R.string.battery_optimisation_key)?.setOnPreferenceClickListener {
|
||||
val ctx = context ?: return@setOnPreferenceClickListener false
|
||||
|
||||
|
|
|
@ -14,7 +14,8 @@ import androidx.preference.PreferenceManager
|
|||
import com.lagradost.cloudstream3.BuildConfig
|
||||
import com.lagradost.cloudstream3.CommonActivity.showToast
|
||||
import com.lagradost.cloudstream3.R
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTruePhone
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.PHONE
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.isLayout
|
||||
|
||||
const val packageName = BuildConfig.APPLICATION_ID
|
||||
const val TAG = "PowerManagerAPI"
|
||||
|
@ -64,7 +65,7 @@ object BatteryOptimizationChecker {
|
|||
val isRestricted = isAppRestricted(context)
|
||||
val isOptimizedShown = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
.getBoolean(context.getString(R.string.battery_optimisation_key), true)
|
||||
return isRestricted && isOptimizedShown && isTruePhone()
|
||||
return isRestricted && isOptimizedShown && isLayout(PHONE)
|
||||
}
|
||||
|
||||
fun intentOpenAppInfo(context: Context) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue