mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-07 03:07:25 +01:00
Drop support for Android 5.x
This commit is contained in:
parent
6aff438a16
commit
89619b7836
@ -114,10 +114,7 @@ class CloudflareInterceptor(private val context: Context) : Interceptor {
|
|||||||
latch.countDown()
|
latch.countDown()
|
||||||
}
|
}
|
||||||
|
|
||||||
// HTTP error codes are only received since M
|
if (url == origRequestUrl && !challengeFound) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
|
|
||||||
url == origRequestUrl && !challengeFound
|
|
||||||
) {
|
|
||||||
// The first request didn't return the challenge, abort.
|
// The first request didn't return the challenge, abort.
|
||||||
latch.countDown()
|
latch.countDown()
|
||||||
}
|
}
|
||||||
|
@ -21,14 +21,12 @@ fun Router.popControllerWithTag(tag: String): Boolean {
|
|||||||
|
|
||||||
fun Controller.requestPermissionsSafe(permissions: Array<String>, requestCode: Int) {
|
fun Controller.requestPermissionsSafe(permissions: Array<String>, requestCode: Int) {
|
||||||
val activity = activity ?: return
|
val activity = activity ?: return
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
||||||
permissions.forEach { permission ->
|
permissions.forEach { permission ->
|
||||||
if (ContextCompat.checkSelfPermission(activity, permission) != PERMISSION_GRANTED) {
|
if (ContextCompat.checkSelfPermission(activity, permission) != PERMISSION_GRANTED) {
|
||||||
requestPermissions(arrayOf(permission), requestCode)
|
requestPermissions(arrayOf(permission), requestCode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fun Controller.withFadeTransaction(): RouterTransaction {
|
fun Controller.withFadeTransaction(): RouterTransaction {
|
||||||
return RouterTransaction.with(this)
|
return RouterTransaction.with(this)
|
||||||
|
@ -298,23 +298,17 @@ class MangaController :
|
|||||||
fab.setOnClickListener {
|
fab.setOnClickListener {
|
||||||
val item = presenter.getNextUnreadChapter()
|
val item = presenter.getNextUnreadChapter()
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
// Create animation listener
|
// Get coordinates and start animation
|
||||||
val revealAnimationListener: Animator.AnimatorListener = object : AnimatorListenerAdapter() {
|
actionFab?.getCoordinates()?.let { coordinates ->
|
||||||
|
binding.revealView.showRevealEffect(
|
||||||
|
coordinates.x,
|
||||||
|
coordinates.y,
|
||||||
|
object : AnimatorListenerAdapter() {
|
||||||
override fun onAnimationStart(animation: Animator?) {
|
override fun onAnimationStart(animation: Animator?) {
|
||||||
openChapter(item.chapter, true)
|
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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
view?.context?.toast(R.string.no_next_chapter)
|
view?.context?.toast(R.string.no_next_chapter)
|
||||||
|
@ -304,18 +304,6 @@ class MangaInfoHeaderAdapter(
|
|||||||
initialLoad = false
|
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) {
|
private fun showMangaInfo(visible: Boolean) {
|
||||||
|
@ -67,7 +67,6 @@ class SettingsAdvancedController : SettingsController() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
||||||
preference {
|
preference {
|
||||||
key = "pref_disable_battery_optimization"
|
key = "pref_disable_battery_optimization"
|
||||||
titleRes = R.string.pref_disable_battery_optimization
|
titleRes = R.string.pref_disable_battery_optimization
|
||||||
@ -90,7 +89,6 @@ class SettingsAdvancedController : SettingsController() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
preferenceCategory {
|
preferenceCategory {
|
||||||
titleRes = R.string.label_data
|
titleRes = R.string.label_data
|
||||||
|
@ -33,7 +33,7 @@ object BiometricUtil {
|
|||||||
* Returns whether the device is secured with a PIN, pattern or password.
|
* Returns whether the device is secured with a PIN, pattern or password.
|
||||||
*/
|
*/
|
||||||
private fun isLegacySecured(context: Context): Boolean {
|
private fun isLegacySecured(context: Context): Boolean {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q) {
|
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q) {
|
||||||
if (context.keyguardManager.isDeviceSecure) {
|
if (context.keyguardManager.isDeviceSecure) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,6 @@ abstract class WebViewClientCompat : WebViewClient() {
|
|||||||
return shouldInterceptRequestCompat(view, url)
|
return shouldInterceptRequestCompat(view, url)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.M)
|
|
||||||
final override fun onReceivedError(
|
final override fun onReceivedError(
|
||||||
view: WebView,
|
view: WebView,
|
||||||
request: WebResourceRequest,
|
request: WebResourceRequest,
|
||||||
@ -78,7 +77,6 @@ abstract class WebViewClientCompat : WebViewClient() {
|
|||||||
onReceivedErrorCompat(view, errorCode, description, failingUrl, failingUrl == view.url)
|
onReceivedErrorCompat(view, errorCode, description, failingUrl, failingUrl == view.url)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.M)
|
|
||||||
final override fun onReceivedHttpError(
|
final override fun onReceivedHttpError(
|
||||||
view: WebView,
|
view: WebView,
|
||||||
request: WebResourceRequest,
|
request: WebResourceRequest,
|
||||||
|
@ -20,13 +20,8 @@ class ElevationAppBarLayout @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun enableElevation(liftOnScroll: Boolean) {
|
fun enableElevation(liftOnScroll: Boolean) {
|
||||||
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP) {
|
|
||||||
// Delay to avoid crash
|
|
||||||
post { setElevation(liftOnScroll) }
|
|
||||||
} else {
|
|
||||||
setElevation(liftOnScroll)
|
setElevation(liftOnScroll)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private fun setElevation(liftOnScroll: Boolean) {
|
private fun setElevation(liftOnScroll: Boolean) {
|
||||||
stateListAnimator = origStateAnimator
|
stateListAnimator = origStateAnimator
|
||||||
|
@ -49,10 +49,8 @@ class RevealAnimationView @JvmOverloads constructor(context: Context, attrs: Att
|
|||||||
* @param centerX x starting point
|
* @param centerX x starting point
|
||||||
* @param centerY y starting point
|
* @param centerY y starting point
|
||||||
* @param listener animation listener
|
* @param listener animation listener
|
||||||
*
|
|
||||||
* @return sdk version lower then 21
|
|
||||||
*/
|
*/
|
||||||
fun showRevealEffect(centerX: Int, centerY: Int, listener: Animator.AnimatorListener): Boolean {
|
fun showRevealEffect(centerX: Int, centerY: Int, listener: Animator.AnimatorListener) {
|
||||||
this.isVisible = true
|
this.isVisible = true
|
||||||
|
|
||||||
val height = this.height
|
val height = this.height
|
||||||
@ -71,6 +69,5 @@ class RevealAnimationView @JvmOverloads constructor(context: Context, attrs: Att
|
|||||||
|
|
||||||
anim.addListener(listener)
|
anim.addListener(listener)
|
||||||
anim.start()
|
anim.start()
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<style name="Base.V23.Theme.Tachiyomi.Light" parent="Base.Theme.Tachiyomi.Light">
|
|
||||||
<item name="android:statusBarColor">?attr/colorPrimary</item>
|
|
||||||
<item name="android:windowLightStatusBar">true</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="Theme.Tachiyomi.Light" parent="Base.V23.Theme.Tachiyomi.Light" />
|
|
||||||
</resources>
|
|
@ -91,7 +91,10 @@
|
|||||||
<!--===========-->
|
<!--===========-->
|
||||||
<!-- Main Theme-->
|
<!-- Main Theme-->
|
||||||
<!--===========-->
|
<!--===========-->
|
||||||
<style name="Base.Theme.Tachiyomi.Light" parent="Theme.Base" />
|
<style name="Base.Theme.Tachiyomi.Light" parent="Theme.Base">
|
||||||
|
<item name="android:statusBarColor">?attr/colorPrimary</item>
|
||||||
|
<item name="android:windowLightStatusBar">true</item>
|
||||||
|
</style>
|
||||||
<style name="Theme.Tachiyomi.Light" parent="Base.Theme.Tachiyomi.Light" />
|
<style name="Theme.Tachiyomi.Light" parent="Base.Theme.Tachiyomi.Light" />
|
||||||
|
|
||||||
<style name="Theme.Tachiyomi.Light.Blue">
|
<style name="Theme.Tachiyomi.Light.Blue">
|
||||||
|
@ -41,7 +41,7 @@ import uy.kohesive.injekt.api.addSingleton
|
|||||||
* Test class for the [LegacyBackupManager].
|
* Test class for the [LegacyBackupManager].
|
||||||
* Note that this does not include the backup create/restore services.
|
* Note that this does not include the backup create/restore services.
|
||||||
*/
|
*/
|
||||||
@Config(constants = BuildConfig::class, sdk = [Build.VERSION_CODES.LOLLIPOP])
|
@Config(constants = BuildConfig::class, sdk = [Build.VERSION_CODES.M])
|
||||||
@RunWith(CustomRobolectricGradleTestRunner::class)
|
@RunWith(CustomRobolectricGradleTestRunner::class)
|
||||||
class BackupTest {
|
class BackupTest {
|
||||||
// Create root object
|
// Create root object
|
||||||
|
@ -13,7 +13,7 @@ import org.junit.runner.RunWith
|
|||||||
import org.robolectric.RuntimeEnvironment
|
import org.robolectric.RuntimeEnvironment
|
||||||
import org.robolectric.annotation.Config
|
import org.robolectric.annotation.Config
|
||||||
|
|
||||||
@Config(constants = BuildConfig::class, sdk = [Build.VERSION_CODES.LOLLIPOP])
|
@Config(constants = BuildConfig::class, sdk = [Build.VERSION_CODES.M])
|
||||||
@RunWith(CustomRobolectricGradleTestRunner::class)
|
@RunWith(CustomRobolectricGradleTestRunner::class)
|
||||||
class CategoryTest {
|
class CategoryTest {
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ import uy.kohesive.injekt.api.InjektModule
|
|||||||
import uy.kohesive.injekt.api.InjektRegistrar
|
import uy.kohesive.injekt.api.InjektRegistrar
|
||||||
import uy.kohesive.injekt.api.addSingleton
|
import uy.kohesive.injekt.api.addSingleton
|
||||||
|
|
||||||
@Config(constants = BuildConfig::class, sdk = [Build.VERSION_CODES.LOLLIPOP])
|
@Config(constants = BuildConfig::class, sdk = [Build.VERSION_CODES.M])
|
||||||
@RunWith(CustomRobolectricGradleTestRunner::class)
|
@RunWith(CustomRobolectricGradleTestRunner::class)
|
||||||
class LibraryUpdateServiceTest {
|
class LibraryUpdateServiceTest {
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
object AndroidConfig {
|
object AndroidConfig {
|
||||||
const val compileSdk = 29
|
const val compileSdk = 29
|
||||||
const val minSdk = 21
|
const val minSdk = 23
|
||||||
const val targetSdk = 29
|
const val targetSdk = 29
|
||||||
const val buildTools = "30.0.3"
|
const val buildTools = "30.0.3"
|
||||||
const val ndk = "22.1.7171670"
|
const val ndk = "22.1.7171670"
|
||||||
|
Loading…
Reference in New Issue
Block a user