mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
Remove Android M checks
since android M is already the minimum
This commit is contained in:
parent
03ce33e434
commit
3aa06c708f
2 changed files with 14 additions and 19 deletions
|
@ -4,7 +4,6 @@ import android.annotation.SuppressLint
|
|||
import android.app.Dialog
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.PowerManager
|
||||
import android.provider.Settings
|
||||
|
@ -76,24 +75,22 @@ class SettingsAdvancedController : SettingsController() {
|
|||
}
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
val pm = context.getSystemService(Context.POWER_SERVICE) as? PowerManager?
|
||||
if (pm != null) preference {
|
||||
key = "disable_batt_opt"
|
||||
titleRes = R.string.disable_battery_optimization
|
||||
summaryRes = R.string.disable_if_issues_with_updating
|
||||
val pm = context.getSystemService(Context.POWER_SERVICE) as? PowerManager?
|
||||
if (pm != null) preference {
|
||||
key = "disable_batt_opt"
|
||||
titleRes = R.string.disable_battery_optimization
|
||||
summaryRes = R.string.disable_if_issues_with_updating
|
||||
|
||||
onClick {
|
||||
val packageName: String = context.packageName
|
||||
if (!pm.isIgnoringBatteryOptimizations(packageName)) {
|
||||
val intent = Intent().apply {
|
||||
action = Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS
|
||||
data = "package:$packageName".toUri()
|
||||
}
|
||||
startActivity(intent)
|
||||
} else {
|
||||
context.toast(R.string.battery_optimization_disabled)
|
||||
onClick {
|
||||
val packageName: String = context.packageName
|
||||
if (!pm.isIgnoringBatteryOptimizations(packageName)) {
|
||||
val intent = Intent().apply {
|
||||
action = Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS
|
||||
data = "package:$packageName".toUri()
|
||||
}
|
||||
startActivity(intent)
|
||||
} else {
|
||||
context.toast(R.string.battery_optimization_disabled)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,6 @@ abstract class WebViewClientCompat : WebViewClient() {
|
|||
return shouldInterceptRequestCompat(view, url)
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.M)
|
||||
final override fun onReceivedError(
|
||||
view: WebView,
|
||||
request: WebResourceRequest,
|
||||
|
@ -78,7 +77,6 @@ abstract class WebViewClientCompat : WebViewClient() {
|
|||
onReceivedErrorCompat(view, errorCode, description, failingUrl, failingUrl == view.url)
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.M)
|
||||
final override fun onReceivedHttpError(
|
||||
view: WebView,
|
||||
request: WebResourceRequest,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue