Allow AMOLED with Monet
This commit is contained in:
parent
4d0c3e5849
commit
d0fd62abf2
4 changed files with 40 additions and 4 deletions
|
@ -29,7 +29,7 @@ android {
|
|||
debug {
|
||||
applicationIdSuffix ".beta"
|
||||
manifestPlaceholders = [icon_placeholder: "@mipmap/ic_launcher_beta"]
|
||||
debuggable false
|
||||
debuggable true
|
||||
}
|
||||
release {
|
||||
manifestPlaceholders = [icon_placeholder: "@mipmap/ic_launcher"]
|
||||
|
|
|
@ -1,21 +1,29 @@
|
|||
package ani.dantotsu
|
||||
|
||||
import android.R
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.res.ColorStateList
|
||||
import android.content.res.Resources
|
||||
import android.os.Bundle
|
||||
import android.util.LongSparseArray
|
||||
import android.util.TypedValue
|
||||
import androidx.annotation.ColorInt
|
||||
import androidx.multidex.MultiDex
|
||||
import androidx.multidex.MultiDexApplication
|
||||
import ani.dantotsu.aniyomi.anime.custom.AppModule
|
||||
import ani.dantotsu.aniyomi.anime.custom.PreferenceModule
|
||||
import eu.kanade.tachiyomi.data.notification.Notifications
|
||||
import tachiyomi.core.util.system.logcat
|
||||
import ani.dantotsu.others.DisabledReports
|
||||
import ani.dantotsu.parsers.AnimeSources
|
||||
import ani.dantotsu.parsers.MangaSources
|
||||
import com.google.android.material.color.DynamicColors
|
||||
import com.google.android.material.color.HarmonizedColorAttributes
|
||||
import com.google.android.material.color.HarmonizedColors
|
||||
import com.google.android.material.color.HarmonizedColorsOptions
|
||||
import com.google.firebase.crashlytics.ktx.crashlytics
|
||||
import com.google.firebase.ktx.Firebase
|
||||
import eu.kanade.tachiyomi.data.notification.Notifications
|
||||
import eu.kanade.tachiyomi.extension.anime.AnimeExtensionManager
|
||||
import eu.kanade.tachiyomi.extension.manga.MangaExtensionManager
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
|
@ -25,9 +33,11 @@ import kotlinx.coroutines.launch
|
|||
import logcat.AndroidLogcatLogger
|
||||
import logcat.LogPriority
|
||||
import logcat.LogcatLogger
|
||||
import tachiyomi.core.util.system.logcat
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import java.util.Locale
|
||||
import java.lang.reflect.Field
|
||||
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
class App : MultiDexApplication() {
|
||||
|
@ -50,6 +60,7 @@ class App : MultiDexApplication() {
|
|||
val useMaterialYou = sharedPreferences.getBoolean("use_material_you", false)
|
||||
if(useMaterialYou) {
|
||||
DynamicColors.applyToActivitiesIfAvailable(this)
|
||||
//TODO: HarmonizedColors
|
||||
}
|
||||
registerActivityLifecycleCallbacks(mFTActivityLifecycleCallbacks)
|
||||
|
||||
|
@ -82,6 +93,7 @@ class App : MultiDexApplication() {
|
|||
|
||||
}
|
||||
|
||||
|
||||
private fun setupNotificationChannels() {
|
||||
try {
|
||||
Notifications.createChannels(this)
|
||||
|
|
|
@ -1,13 +1,29 @@
|
|||
package ani.dantotsu.themes
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.res.Configuration
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.logger
|
||||
import com.google.android.material.color.DynamicColors
|
||||
import com.google.android.material.color.DynamicColorsOptions
|
||||
|
||||
|
||||
class ThemeManager(private val context: Context) {
|
||||
fun applyTheme() {
|
||||
val useOLED = context.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).getBoolean("use_oled", false) && isDarkThemeActive(context)
|
||||
if(context.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).getBoolean("use_material_you", false)){
|
||||
if (useOLED) {
|
||||
val options = DynamicColorsOptions.Builder()
|
||||
.setThemeOverlay(R.style.AppTheme_Amoled)
|
||||
.build()
|
||||
//need activity from context
|
||||
val activity = context as Activity
|
||||
DynamicColors.applyToActivityIfAvailable(activity, options)
|
||||
} else {
|
||||
val activity = context as Activity
|
||||
DynamicColors.applyToActivityIfAvailable(activity)
|
||||
}
|
||||
return
|
||||
}
|
||||
val theme = context.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).getString("theme", "PURPLE")!!
|
||||
|
|
|
@ -7,6 +7,14 @@
|
|||
<item name="android:padding">2sp</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Amoled" parent="">
|
||||
<item name="android:colorBackground">@color/darkest_Black</item>
|
||||
<!-- set colorSurface to black -->
|
||||
<item name="colorSurface">@color/darkest_Black</item>
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<style name="Suffix">
|
||||
<item name="android:height">54dp</item>
|
||||
<item name="android:fontFamily">@font/poppins_bold</item>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue