mirror of
https://github.com/rebelonion/Dantotsu.git
synced 2026-01-18 09:53:56 +00:00
Oled for LN
This commit is contained in:
@@ -351,6 +351,11 @@ class NovelReaderActivity : AppCompatActivity(), EbookReaderEventListener {
|
||||
saveData("${sanitizedBookId}_current_settings", settings.defaultLN)
|
||||
hideBars()
|
||||
|
||||
if(settings.defaultLN.useOledTheme) {
|
||||
themes.forEach { theme ->
|
||||
theme.darkBg = Color.parseColor("#000000")
|
||||
}
|
||||
}
|
||||
currentTheme =
|
||||
themes.first { it.name.equals(settings.defaultLN.currentThemeName, ignoreCase = true) }
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ class NovelReaderSettingsDialogFragment : BottomSheetDialogFragment() {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
val activity = requireActivity() as NovelReaderActivity
|
||||
val settings = activity.settings.defaultLN
|
||||
|
||||
val themeLabels = activity.themes.map { it.name }
|
||||
binding.themeSelect.adapter =
|
||||
NoPaddingArrayAdapter(activity, R.layout.item_dropdown, themeLabels)
|
||||
@@ -49,7 +48,11 @@ class NovelReaderSettingsDialogFragment : BottomSheetDialogFragment() {
|
||||
|
||||
override fun onNothingSelected(parent: AdapterView<*>?) {}
|
||||
}
|
||||
|
||||
binding.useOledTheme.isChecked = settings.useOledTheme
|
||||
binding.useOledTheme.setOnCheckedChangeListener { _, isChecked ->
|
||||
settings.useOledTheme = isChecked
|
||||
activity.applySettings()
|
||||
}
|
||||
val layoutList = listOf(
|
||||
binding.paged,
|
||||
binding.continuous
|
||||
|
||||
@@ -11,6 +11,7 @@ data class CurrentNovelReaderSettings(
|
||||
var justify: Boolean = true,
|
||||
var hyphenation: Boolean = true,
|
||||
var useDarkTheme: Boolean = false,
|
||||
var useOledTheme: Boolean = false,
|
||||
var invert: Boolean = false,
|
||||
var maxInlineSize: Int = 720,
|
||||
var maxBlockSize: Int = 1440,
|
||||
|
||||
@@ -334,6 +334,12 @@ class ReaderSettingsActivity : AppCompatActivity() {
|
||||
saveData(reader, settings)
|
||||
}
|
||||
|
||||
binding.LNuseOledTheme.isChecked = settings.defaultLN.useOledTheme
|
||||
binding.LNuseOledTheme.setOnCheckedChangeListener { _, isChecked ->
|
||||
settings.defaultLN.useOledTheme = isChecked
|
||||
saveData(reader, settings)
|
||||
}
|
||||
|
||||
binding.LNkeepScreenOn.isChecked = settings.defaultLN.keepScreenOn
|
||||
binding.LNkeepScreenOn.setOnCheckedChangeListener { _, isChecked ->
|
||||
settings.defaultLN.keepScreenOn = isChecked
|
||||
|
||||
@@ -1122,6 +1122,27 @@
|
||||
app:thumbTint="@color/button_switch_track"
|
||||
tools:ignore="TooManyViews,VisualLintButtonSize" />
|
||||
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@+id/LNuseOledTheme"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="false"
|
||||
android:drawableStart="@drawable/ic_round_brightness_4_24"
|
||||
android:drawablePadding="16dp"
|
||||
android:elegantTextHeight="true"
|
||||
android:fontFamily="@font/poppins_bold"
|
||||
android:minHeight="64dp"
|
||||
android:paddingStart="32dp"
|
||||
android:paddingEnd="32dp"
|
||||
android:text="Use OLED Theme"
|
||||
android:textAlignment="viewStart"
|
||||
android:textColor="?attr/colorOnBackground"
|
||||
app:cornerRadius="0dp"
|
||||
app:drawableTint="?attr/colorPrimary"
|
||||
app:showText="false"
|
||||
app:thumbTint="@color/button_switch_track"
|
||||
tools:ignore="VisualLintButtonSize" />
|
||||
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@+id/LNkeepScreenOn"
|
||||
android:layout_width="match_parent"
|
||||
@@ -1172,6 +1193,7 @@
|
||||
android:fontFamily="@font/poppins_bold"
|
||||
android:paddingStart="32dp"
|
||||
android:paddingEnd="32dp"
|
||||
android:paddingTop="20dp"
|
||||
android:text="@string/general"
|
||||
android:textColor="?attr/colorSecondary"
|
||||
tools:ignore="TextContrastCheck" />
|
||||
|
||||
@@ -512,6 +512,25 @@
|
||||
app:thumbTint="@color/button_switch_track"
|
||||
tools:ignore="VisualLintButtonSize" />
|
||||
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@+id/useOledTheme"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="false"
|
||||
android:drawableStart="@drawable/ic_round_brightness_4_24"
|
||||
android:drawablePadding="16dp"
|
||||
android:elegantTextHeight="true"
|
||||
android:fontFamily="@font/poppins_bold"
|
||||
android:minHeight="64dp"
|
||||
android:text="Use OLED Theme"
|
||||
android:textAlignment="viewStart"
|
||||
android:textColor="?attr/colorOnBackground"
|
||||
app:cornerRadius="0dp"
|
||||
app:drawableTint="?attr/colorPrimary"
|
||||
app:showText="false"
|
||||
app:thumbTint="@color/button_switch_track"
|
||||
tools:ignore="VisualLintButtonSize" />
|
||||
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@+id/keepScreenOn"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
Reference in New Issue
Block a user