mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-15 13:37:29 +01:00
Drop support for Android 5.x
This commit is contained in:
@@ -21,11 +21,9 @@ fun Router.popControllerWithTag(tag: String): Boolean {
|
||||
|
||||
fun Controller.requestPermissionsSafe(permissions: Array<String>, requestCode: Int) {
|
||||
val activity = activity ?: return
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
permissions.forEach { permission ->
|
||||
if (ContextCompat.checkSelfPermission(activity, permission) != PERMISSION_GRANTED) {
|
||||
requestPermissions(arrayOf(permission), requestCode)
|
||||
}
|
||||
permissions.forEach { permission ->
|
||||
if (ContextCompat.checkSelfPermission(activity, permission) != PERMISSION_GRANTED) {
|
||||
requestPermissions(arrayOf(permission), requestCode)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,23 +298,17 @@ class MangaController :
|
||||
fab.setOnClickListener {
|
||||
val item = presenter.getNextUnreadChapter()
|
||||
if (item != null) {
|
||||
// Create animation listener
|
||||
val revealAnimationListener: Animator.AnimatorListener = object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationStart(animation: Animator?) {
|
||||
openChapter(item.chapter, true)
|
||||
}
|
||||
}
|
||||
|
||||
// Get coordinates and start animation
|
||||
actionFab?.getCoordinates()?.let { coordinates ->
|
||||
if (!binding.revealView.showRevealEffect(
|
||||
coordinates.x,
|
||||
coordinates.y,
|
||||
revealAnimationListener
|
||||
)
|
||||
) {
|
||||
openChapter(item.chapter)
|
||||
}
|
||||
binding.revealView.showRevealEffect(
|
||||
coordinates.x,
|
||||
coordinates.y,
|
||||
object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationStart(animation: Animator?) {
|
||||
openChapter(item.chapter, true)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
} else {
|
||||
view?.context?.toast(R.string.no_next_chapter)
|
||||
|
||||
@@ -304,18 +304,6 @@ class MangaInfoHeaderAdapter(
|
||||
initialLoad = false
|
||||
}
|
||||
}
|
||||
|
||||
// backgroundTint attribute doesn't work properly on Android 5
|
||||
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP) {
|
||||
listOf(binding.backdropOverlay, binding.mangaInfoToggleMoreScrim)
|
||||
.forEach {
|
||||
@Suppress("DEPRECATION")
|
||||
it.background.setColorFilter(
|
||||
view.context.getResourceColor(android.R.attr.colorBackground),
|
||||
PorterDuff.Mode.SRC_ATOP
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showMangaInfo(visible: Boolean) {
|
||||
|
||||
@@ -67,27 +67,25 @@ class SettingsAdvancedController : SettingsController() {
|
||||
}
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
preference {
|
||||
key = "pref_disable_battery_optimization"
|
||||
titleRes = R.string.pref_disable_battery_optimization
|
||||
summaryRes = R.string.pref_disable_battery_optimization_summary
|
||||
preference {
|
||||
key = "pref_disable_battery_optimization"
|
||||
titleRes = R.string.pref_disable_battery_optimization
|
||||
summaryRes = R.string.pref_disable_battery_optimization_summary
|
||||
|
||||
onClick {
|
||||
val packageName: String = context.packageName
|
||||
if (!context.powerManager.isIgnoringBatteryOptimizations(packageName)) {
|
||||
try {
|
||||
val intent = Intent().apply {
|
||||
action = Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS
|
||||
data = "package:$packageName".toUri()
|
||||
}
|
||||
startActivity(intent)
|
||||
} catch (e: ActivityNotFoundException) {
|
||||
context.toast(R.string.battery_optimization_setting_activity_not_found)
|
||||
onClick {
|
||||
val packageName: String = context.packageName
|
||||
if (!context.powerManager.isIgnoringBatteryOptimizations(packageName)) {
|
||||
try {
|
||||
val intent = Intent().apply {
|
||||
action = Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS
|
||||
data = "package:$packageName".toUri()
|
||||
}
|
||||
} else {
|
||||
context.toast(R.string.battery_optimization_disabled)
|
||||
startActivity(intent)
|
||||
} catch (e: ActivityNotFoundException) {
|
||||
context.toast(R.string.battery_optimization_setting_activity_not_found)
|
||||
}
|
||||
} else {
|
||||
context.toast(R.string.battery_optimization_disabled)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user