Fixes for older versions of android

This commit is contained in:
Jay 2019-10-26 21:42:49 -07:00
parent dd25736fb9
commit 1f6230c5a3
11 changed files with 36 additions and 55 deletions

View File

@ -139,8 +139,9 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
val container: ViewGroup = findViewById(R.id.reader_container)
val readerBHeight = reader_menu_bottom.layoutParams.height
container.doOnApplyWindowInsets { _, insets, padding ->
val bottomInset = insets.mandatorySystemGestureInsets.bottom - insets
.systemWindowInsetBottom
val bottomInset = if (Build.VERSION.SDK_INT >= 29)
(insets.mandatorySystemGestureInsets.bottom - insets.systemWindowInsetBottom)
else 0
reader_menu_bottom.updateLayoutParams<ViewGroup.MarginLayoutParams> {
height = readerBHeight + bottomInset
}

View File

@ -58,7 +58,7 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) : BottomSheetDia
viewer.setSelection(activity.presenter.manga?.viewer ?: 0, false)
rotation_mode.bindToPreference(preferences.rotation(), 1)
background_color.bindToPreference(preferences.readerTheme())
background_color.bindToPreference(preferences.readerTheme(), 0, true)
show_page_number.bindToPreference(preferences.showPageNumber())
fullscreen.bindToPreference(preferences.fullscreen())
keepscreen.bindToPreference(preferences.keepScreenOn())
@ -95,9 +95,13 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) : BottomSheetDia
/**
* Binds a spinner to an int preference with an optional offset for the value.
*/
private fun Spinner.bindToPreference(pref: Preference<Int>, offset: Int = 0) {
private fun Spinner.bindToPreference(pref: Preference<Int>, offset: Int = 0, shouldDismiss:
Boolean
= false) {
onItemSelectedListener = IgnoreFirstSpinnerListener { position ->
pref.set(position + offset)
if (shouldDismiss)
dismiss()
}
setSelection(pref.getOrDefault() - offset, false)
}

View File

@ -6,6 +6,7 @@ import android.graphics.BitmapFactory
import android.graphics.PointF
import android.graphics.drawable.Drawable
import android.net.Uri
import android.os.Build
import android.view.GestureDetector
import android.view.Gravity
import android.view.MotionEvent
@ -347,7 +348,8 @@ class PagerPageHolder(
})
}
addView(subsamplingImageView)
subsamplingImageView?.isForceDarkAllowed = false
if (Build.VERSION.SDK_INT >= 29)
subsamplingImageView?.isForceDarkAllowed = false
return subsamplingImageView!!
}

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="drawerHighlight">@color/md_grey_800</color>
<color name="drawerPrimary">@color/colorAccentDark</color>
<color name="oldNavBarBackground">#B3000000</color>
</resources>

View File

@ -25,7 +25,7 @@
<!-- Custom Attributes-->
<item name="navigation_view_theme">@style/Theme.Widget.NavigationView.Dark</item>
<item name="navigation_view_theme">@style/Theme.Widget.NavigationView</item>
<item name="selectable_list_drawable">@drawable/list_item_selector_dark</item>
<item name="selectable_library_drawable">@drawable/library_item_selector_dark</item>
<item name="text_color_primary">@color/textColorPrimaryDark</item>
@ -33,13 +33,13 @@
<item name="icon_color">@color/iconColorDark</item>
</style>
<style name="Theme.Base.Reader.Light" parent="Theme.Base">
<style name="Theme.Base.Reader.Light" parent="Theme.Tachiyomi">
<item name="colorPrimary">@color/colorDarkPrimary</item>
<item name="colorPrimaryDark">@color/colorDarkPrimaryDark</item>
<item name="android:colorBackground">@color/backgroundDark</item>
</style>
<style name="Theme.Tachiyomi.DarkBlue" parent="Theme.Base">
<style name="Theme.Tachiyomi.DarkBlue" parent="Theme.Tachiyomi">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
</style>
@ -47,7 +47,7 @@
<!--==============-->
<!-- Amoled Theme -->
<!--==============-->
<style name="Theme.Tachiyomi.Amoled" parent="Theme.Base">
<style name="Theme.Tachiyomi.Amoled" parent="Theme.Tachiyomi">
<item name="colorPrimary">@color/colorAmoledPrimary</item>
<item name="colorPrimaryDark">@color/colorAmoledPrimary</item>
<item name="android:colorBackground">@color/md_black_1000</item>

View File

@ -7,26 +7,7 @@
<!-- Attributes specific for SDK 21 and up -->
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@color/colorPrimary</item>
</style>
<style name="Theme.Tachiyomi.DarkBlue" parent="Theme.Base">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<!-- Attributes specific for SDK 21 and up -->
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@color/colorDarkPrimaryDark</item>
</style>
<!--==============-->
<!-- Amoled Theme -->
<!--==============-->
<style name="Theme.Tachiyomi.Amoled" parent="Theme.Base">
<!-- Attributes specific for SDK 21 and up -->
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@color/oldNavBarBackground</item>
</style>
<!--==============-->

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Base.Theme.AppCompat" parent="@style/Base.V26.Theme.AppCompat" />
<!--<style name="Base.Theme.AppCompat" parent="@style/Base.V26.Theme.AppCompat" />
<style name="Base.Theme.AppCompat.Light" parent="@style/Base.V26.Theme.AppCompat.Light" />
<style name="Base.Widget.AppCompat.Toolbar" parent="@style/Base.V26.Widget.AppCompat.Toolbar" />
<style name="Base.V26.Theme.AppCompat" parent="@style/Base.V23.Theme.AppCompat">
@ -15,5 +15,5 @@
<item name="android:touchscreenBlocksFocus">true</item>
<item name="android:keyboardNavigationCluster">true</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
</style>
</style> -->
</resources>

View File

@ -6,19 +6,4 @@
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
</style>
<style name="Theme.Tachiyomi.DarkBlue" parent="Theme.Base">
<!-- Attributes specific for SDK 21 and up -->
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
</style>
<!--==============-->
<!-- Amoled Theme -->
<!--==============-->
<style name="Theme.Tachiyomi.Amoled" parent="Theme.Base">
<!-- Attributes specific for SDK 21 and up -->
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
</style>
</resources>

View File

@ -3,6 +3,8 @@
<!-- Application Colors -->
<color name="colorPrimary">#54759E</color>
<color name="colorPrimaryDark">#54759E</color>
<color name="drawerHighlight">@color/md_black_1000_12</color>
<color name="drawerPrimary">@color/colorPrimary</color>
<!-- Dark Application Colors -->
<color name="colorDarkPrimary">#212121</color>
<color name="colorDarkPrimaryDark">#212121</color>
@ -15,6 +17,7 @@
<color name="textColorHintLight">@color/md_black_1000_38</color>
<color name="dividerLight">@color/md_black_1000_12</color>
<color name="rippleColorLight">@color/md_black_1000_12</color>
<color name="oldNavBarBackground">#B3FFFFFF</color>
<color name="preference_fallback_accent_color">@color/colorAccentLight</color>

View File

@ -35,13 +35,12 @@
<!--==============-->
<!--NavigationView-->
<!--==============-->
<style name="Theme.Widget.NavigationView" />
<style name="Theme.Widget.NavigationView.Dark">
<item name="colorControlHighlight">@color/md_grey_900</item>
<item name="colorPrimary">?colorAccent</item>
<style name="Theme.Widget.NavigationView">
<item name="colorControlHighlight">@color/drawerHighlight</item>
<item name="colorPrimary">@color/drawerPrimary</item>
</style>
<!--===============-->
<!--Text Appearance-->
<!--===============-->

View File

@ -32,6 +32,7 @@
<!-- Custom Attributes-->
<item name="navigation_view_theme">@style/Theme.Widget.NavigationView</item>
<item name="selectable_list_drawable">@drawable/list_item_selector_light</item>
<item name="selectable_library_drawable">@drawable/library_item_selector_light</item>
<item name="text_color_primary">@color/textColorPrimaryLight</item>
@ -39,10 +40,9 @@
<item name="icon_color">@color/iconColorLight</item>
</style>
<style name="Theme.Tachiyomi" parent="Theme.Base">
<!-- Attributes specific for SDK 16 to SDK 20 -->
</style>
<style name="Theme.Tachiyomi" parent="Theme.Base"/>
<style name="Theme.Tachiyomi.DarkBlue" parent="Theme.Tachiyomi"/>
<style name="Theme.Tachiyomi.Amoled" parent="Theme.Tachiyomi"/>
<!--==============-->
<!-- Reader Theme -->
<!--==============-->