mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-09 19:25:10 +01:00
Fixes to the lower android versions
This commit is contained in:
parent
fa5b85e3b2
commit
f0f889e6bb
@ -15,6 +15,7 @@ import android.view.ViewGroup
|
||||
import android.webkit.WebView
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.content.res.AppCompatResources
|
||||
import androidx.appcompat.graphics.drawable.DrawerArrowDrawable
|
||||
import androidx.biometric.BiometricManager
|
||||
import androidx.core.graphics.ColorUtils
|
||||
@ -331,12 +332,9 @@ open class MainActivity : BaseActivity() {
|
||||
|
||||
fun updateRecentsIcon() {
|
||||
if (bottomNav) navigationView.menu.findItem(R.id.nav_drawer_recents).icon =
|
||||
VectorDrawableCompat.create(
|
||||
resources!!,
|
||||
AppCompatResources.getDrawable(this,
|
||||
if (preferences.showRecentUpdates().getOrDefault()) R.drawable.ic_update_black_24dp
|
||||
else R.drawable.ic_history_black_24dp,
|
||||
null
|
||||
)
|
||||
else R.drawable.ic_history_black_24dp)
|
||||
}
|
||||
|
||||
override fun startSupportActionMode(callback: androidx.appcompat.view.ActionMode.Callback): androidx.appcompat.view.ActionMode? {
|
||||
|
@ -14,6 +14,7 @@ import android.view.ViewGroup
|
||||
import android.webkit.WebChromeClient
|
||||
import android.webkit.WebView
|
||||
import android.widget.LinearLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.graphics.ColorUtils
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
@ -104,19 +105,22 @@ class WebViewActivity : BaseActivity() {
|
||||
}
|
||||
|
||||
content.setOnApplyWindowInsetsListener { v, insets ->
|
||||
window.statusBarColor = getResourceColor(R.attr.colorPrimary)
|
||||
window.navigationBarColor =
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
v.context.getResourceColor(android.R.attr.colorPrimary)
|
||||
}
|
||||
// if the android q+ device has gesture nav, transparent nav bar
|
||||
else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q
|
||||
&& (v.rootWindowInsets.systemWindowInsetBottom != v.rootWindowInsets
|
||||
.tappableElementInsets.bottom)) {
|
||||
getColor(android.R.color.transparent)
|
||||
} else {
|
||||
v.context.getResourceColor(android.R.attr.colorBackground)
|
||||
}
|
||||
// if pure white theme on a device that does not support dark status bar
|
||||
if (getResourceColor(android.R.attr.statusBarColor) != Color.TRANSPARENT)
|
||||
window.statusBarColor = Color.BLACK
|
||||
else window.statusBarColor = getResourceColor(R.attr.colorPrimary)
|
||||
window.navigationBarColor = if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
val colorPrimary = getResourceColor(android.R.attr.colorPrimary)
|
||||
if (colorPrimary == Color.WHITE) Color.BLACK
|
||||
else getResourceColor(android.R.attr.colorPrimary)
|
||||
}
|
||||
// if the android q+ device has gesture nav, transparent nav bar
|
||||
else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q &&
|
||||
(v.rootWindowInsets.systemWindowInsetBottom != v.rootWindowInsets.tappableElementInsets.bottom)) {
|
||||
getColor(android.R.color.transparent)
|
||||
} else {
|
||||
getResourceColor(android.R.attr.colorBackground)
|
||||
}
|
||||
v.setPadding(insets.systemWindowInsetLeft, insets.systemWindowInsetTop,
|
||||
insets.systemWindowInsetRight, 0)
|
||||
val currentNightMode = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
|
||||
|
14
app/src/main/res/values-v23/themes.xml
Normal file
14
app/src/main/res/values-v23/themes.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="Theme.Tachiyomi.MatWhite" parent="Theme.Tachiyomi">
|
||||
<item name="colorPrimary">@color/purePrimary</item>
|
||||
<item name="colorPrimaryDark">@color/purePrimary</item>
|
||||
<item name="colorOnPrimary">@color/colorPrimary</item>
|
||||
<item name="actionBarTintColor">@color/textColorPrimary</item>
|
||||
<item name="actionBarTheme">@style/ThemeOverlay.AppCompat.DayNight.ActionBar</item>
|
||||
<item name="tabBarIconColor">@color/colorPrimary</item>
|
||||
<item name="tabBarIconInactive">@color/colorPrimaryInactive</item>
|
||||
<item name="badgeColor">@color/colorAccent</item>
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
</style>
|
||||
</resources>
|
@ -134,15 +134,15 @@
|
||||
|
||||
<!-- General section -->
|
||||
<string name="pref_theme">App theme</string>
|
||||
<string name="light_theme">Light</string>
|
||||
<string name="light_theme">Light Blue</string>
|
||||
<string name="dark_theme">Dark</string>
|
||||
<string name="amoled_theme">AMOLED dark</string>
|
||||
<string name="darkblue_theme">Dark blue</string>
|
||||
<string name="system_theme">System default (Light + Dark)</string>
|
||||
<string name="white_theme">Pure White</string>
|
||||
<string name="sysyem_white_theme">System default (White + Dark)</string>
|
||||
<string name="system_amoled_theme">System default (Light + AMOLED dark)</string>
|
||||
<string name="system_darkblue_theme">System default (Light + Dark blue)</string>
|
||||
<string name="system_amoled_theme">System default (Light + AMOLED)</string>
|
||||
<string name="system_darkblue_theme">System default (All blue)</string>
|
||||
<string name="pref_start_screen">Start screen</string>
|
||||
<string name="pref_language">Language</string>
|
||||
<string name="system_default">System default</string>
|
||||
@ -549,12 +549,12 @@
|
||||
<item quantity="other">For %d titles</item>
|
||||
</plurals>
|
||||
<plurals name="notification_and_n_more">
|
||||
<item quantity="one">and %1$d more chapter.</item>
|
||||
<item quantity="other">and %1$d more chapters.</item>
|
||||
<item quantity="one">and %1$d more chapter</item>
|
||||
<item quantity="other">and %1$d more chapters</item>
|
||||
</plurals>
|
||||
<plurals name="notification_and_n_more_ext">
|
||||
<item quantity="one">and %1$d more extension.</item>
|
||||
<item quantity="other">and %1$d more extensions.</item>
|
||||
<item quantity="one">and %1$d more extension</item>
|
||||
<item quantity="other">and %1$d more extensions</item>
|
||||
</plurals>
|
||||
<string name="notification_cover_update_failed">Failed to update cover</string>
|
||||
<string name="notification_first_add_to_library">Please add the manga to your library before doing this</string>
|
||||
|
@ -67,6 +67,7 @@
|
||||
<item name="actionBarTheme">@style/ThemeOverlay.AppCompat.DayNight.ActionBar</item>
|
||||
<item name="tabBarIconColor">@color/colorPrimary</item>
|
||||
<item name="tabBarIconInactive">@color/colorPrimaryInactive</item>
|
||||
<item name="android:statusBarColor">@color/md_black_1000_54</item>
|
||||
<item name="badgeColor">@color/colorAccent</item>
|
||||
</style>
|
||||
<style name="Theme.Tachiyomi.DarkBlue" parent="Theme.Tachiyomi"/>
|
||||
|
Loading…
Reference in New Issue
Block a user