Remove legacy settings sheet
The per-series settings aren't quite functional yet, but they're also accessible outside of the sheet.
This commit is contained in:
parent
e40b8d537c
commit
28131ac135
19 changed files with 55 additions and 418 deletions
|
@ -2,13 +2,17 @@ package eu.kanade.presentation.reader.settings
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.ColumnScope
|
import androidx.compose.foundation.layout.ColumnScope
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.collectAsState
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import eu.kanade.presentation.util.collectAsState
|
import eu.kanade.presentation.util.collectAsState
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
|
import eu.kanade.tachiyomi.ui.reader.setting.OrientationType
|
||||||
import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences
|
import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences
|
||||||
import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel
|
import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel
|
||||||
|
import eu.kanade.tachiyomi.ui.reader.setting.ReadingModeType
|
||||||
|
import eu.kanade.tachiyomi.ui.reader.viewer.webtoon.WebtoonViewer
|
||||||
import eu.kanade.tachiyomi.util.system.isReleaseBuildType
|
import eu.kanade.tachiyomi.util.system.isReleaseBuildType
|
||||||
import tachiyomi.presentation.core.components.CheckboxItem
|
import tachiyomi.presentation.core.components.CheckboxItem
|
||||||
import tachiyomi.presentation.core.components.HeadingItem
|
import tachiyomi.presentation.core.components.HeadingItem
|
||||||
|
@ -22,16 +26,32 @@ internal fun ColumnScope.ReadingModePage(screenModel: ReaderSettingsScreenModel)
|
||||||
|
|
||||||
HeadingItem(R.string.pref_category_for_this_series)
|
HeadingItem(R.string.pref_category_for_this_series)
|
||||||
|
|
||||||
// TODO: Reading mode
|
|
||||||
HeadingItem(R.string.pref_category_reading_mode)
|
HeadingItem(R.string.pref_category_reading_mode)
|
||||||
|
ReadingModeType.values().map {
|
||||||
|
RadioItem(
|
||||||
|
label = stringResource(it.stringRes),
|
||||||
|
// TODO: Reading mode
|
||||||
|
selected = false,
|
||||||
|
onClick = { screenModel.onChangeReadingMode(it) },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Rotation type
|
|
||||||
HeadingItem(R.string.rotation_type)
|
HeadingItem(R.string.rotation_type)
|
||||||
|
OrientationType.values().map {
|
||||||
|
RadioItem(
|
||||||
|
label = stringResource(it.stringRes),
|
||||||
|
// TODO: Rotation type
|
||||||
|
selected = false,
|
||||||
|
onClick = { screenModel.onChangeOrientation(it) },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: if (pager)
|
val viewer by screenModel.viewerFlow.collectAsState()
|
||||||
PagerViewerSettings(screenModel)
|
if (viewer is WebtoonViewer) {
|
||||||
|
|
||||||
WebtoonViewerSettings(screenModel)
|
WebtoonViewerSettings(screenModel)
|
||||||
|
} else {
|
||||||
|
PagerViewerSettings(screenModel)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
|
@ -69,7 +69,6 @@ import eu.kanade.tachiyomi.ui.reader.model.ViewerChapters
|
||||||
import eu.kanade.tachiyomi.ui.reader.setting.OrientationType
|
import eu.kanade.tachiyomi.ui.reader.setting.OrientationType
|
||||||
import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences
|
import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences
|
||||||
import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel
|
import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel
|
||||||
import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsSheet
|
|
||||||
import eu.kanade.tachiyomi.ui.reader.setting.ReadingModeType
|
import eu.kanade.tachiyomi.ui.reader.setting.ReadingModeType
|
||||||
import eu.kanade.tachiyomi.ui.reader.viewer.ReaderProgressIndicator
|
import eu.kanade.tachiyomi.ui.reader.viewer.ReaderProgressIndicator
|
||||||
import eu.kanade.tachiyomi.ui.reader.viewer.pager.R2LPagerViewer
|
import eu.kanade.tachiyomi.ui.reader.viewer.pager.R2LPagerViewer
|
||||||
|
@ -391,7 +390,13 @@ class ReaderActivity : BaseActivity() {
|
||||||
|
|
||||||
binding.dialogRoot.setComposeContent {
|
binding.dialogRoot.setComposeContent {
|
||||||
val state by viewModel.state.collectAsState()
|
val state by viewModel.state.collectAsState()
|
||||||
val settingsScreenModel = remember { ReaderSettingsScreenModel() }
|
val settingsScreenModel = remember {
|
||||||
|
ReaderSettingsScreenModel(
|
||||||
|
readerState = viewModel.state,
|
||||||
|
onChangeReadingMode = viewModel::setMangaReadingMode,
|
||||||
|
onChangeOrientation = viewModel::setMangaOrientationType,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
val onDismissRequest = viewModel::closeDialog
|
val onDismissRequest = viewModel::closeDialog
|
||||||
when (state.dialog) {
|
when (state.dialog) {
|
||||||
|
@ -485,7 +490,7 @@ class ReaderActivity : BaseActivity() {
|
||||||
) {
|
) {
|
||||||
val newReadingMode = ReadingModeType.fromPreference(itemId)
|
val newReadingMode = ReadingModeType.fromPreference(itemId)
|
||||||
|
|
||||||
viewModel.setMangaReadingMode(newReadingMode.flagValue)
|
viewModel.setMangaReadingMode(newReadingMode)
|
||||||
|
|
||||||
menuToggleToast?.cancel()
|
menuToggleToast?.cancel()
|
||||||
if (!readerPreferences.showReadingMode().get()) {
|
if (!readerPreferences.showReadingMode().get()) {
|
||||||
|
@ -539,7 +544,7 @@ class ReaderActivity : BaseActivity() {
|
||||||
) {
|
) {
|
||||||
val newOrientation = OrientationType.fromPreference(itemId)
|
val newOrientation = OrientationType.fromPreference(itemId)
|
||||||
|
|
||||||
viewModel.setMangaOrientationType(newOrientation.flagValue)
|
viewModel.setMangaOrientationType(newOrientation)
|
||||||
|
|
||||||
menuToggleToast?.cancel()
|
menuToggleToast?.cancel()
|
||||||
menuToggleToast = toast(newOrientation.stringRes)
|
menuToggleToast = toast(newOrientation.stringRes)
|
||||||
|
@ -548,16 +553,6 @@ class ReaderActivity : BaseActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Settings sheet
|
// Settings sheet
|
||||||
with(binding.actionSettingsLegacy) {
|
|
||||||
setTooltip(R.string.action_settings)
|
|
||||||
|
|
||||||
var readerSettingSheet: ReaderSettingsSheet? = null
|
|
||||||
|
|
||||||
setOnClickListener {
|
|
||||||
if (readerSettingSheet?.isShowing == true) return@setOnClickListener
|
|
||||||
readerSettingSheet = ReaderSettingsSheet(this@ReaderActivity).apply { show() }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
with(binding.actionSettings) {
|
with(binding.actionSettings) {
|
||||||
setTooltip(R.string.action_settings)
|
setTooltip(R.string.action_settings)
|
||||||
|
|
||||||
|
|
|
@ -602,10 +602,10 @@ class ReaderViewModel(
|
||||||
/**
|
/**
|
||||||
* Updates the viewer position for the open manga.
|
* Updates the viewer position for the open manga.
|
||||||
*/
|
*/
|
||||||
fun setMangaReadingMode(readingModeType: Int) {
|
fun setMangaReadingMode(readingModeType: ReadingModeType) {
|
||||||
val manga = manga ?: return
|
val manga = manga ?: return
|
||||||
runBlocking(Dispatchers.IO) {
|
runBlocking(Dispatchers.IO) {
|
||||||
setMangaViewerFlags.awaitSetMangaReadingMode(manga.id, readingModeType.toLong())
|
setMangaViewerFlags.awaitSetMangaReadingMode(manga.id, readingModeType.flagValue.toLong())
|
||||||
val currChapters = state.value.viewerChapters
|
val currChapters = state.value.viewerChapters
|
||||||
if (currChapters != null) {
|
if (currChapters != null) {
|
||||||
// Save current page
|
// Save current page
|
||||||
|
@ -638,10 +638,10 @@ class ReaderViewModel(
|
||||||
/**
|
/**
|
||||||
* Updates the orientation type for the open manga.
|
* Updates the orientation type for the open manga.
|
||||||
*/
|
*/
|
||||||
fun setMangaOrientationType(rotationType: Int) {
|
fun setMangaOrientationType(rotationType: OrientationType) {
|
||||||
val manga = manga ?: return
|
val manga = manga ?: return
|
||||||
viewModelScope.launchIO {
|
viewModelScope.launchIO {
|
||||||
setMangaViewerFlags.awaitSetOrientationType(manga.id, rotationType.toLong())
|
setMangaViewerFlags.awaitSetOrientationType(manga.id, rotationType.flagValue.toLong())
|
||||||
val currChapters = state.value.viewerChapters
|
val currChapters = state.value.viewerChapters
|
||||||
if (currChapters != null) {
|
if (currChapters != null) {
|
||||||
// Save current page
|
// Save current page
|
||||||
|
|
|
@ -1,15 +1,30 @@
|
||||||
package eu.kanade.tachiyomi.ui.reader.setting
|
package eu.kanade.tachiyomi.ui.reader.setting
|
||||||
|
|
||||||
import cafe.adriel.voyager.core.model.ScreenModel
|
import cafe.adriel.voyager.core.model.ScreenModel
|
||||||
|
import eu.kanade.presentation.util.ioCoroutineScope
|
||||||
|
import eu.kanade.tachiyomi.ui.reader.ReaderViewModel
|
||||||
import eu.kanade.tachiyomi.util.preference.toggle
|
import eu.kanade.tachiyomi.util.preference.toggle
|
||||||
|
import kotlinx.coroutines.flow.SharingStarted
|
||||||
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
|
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||||
|
import kotlinx.coroutines.flow.map
|
||||||
|
import kotlinx.coroutines.flow.stateIn
|
||||||
import tachiyomi.core.preference.Preference
|
import tachiyomi.core.preference.Preference
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
|
|
||||||
class ReaderSettingsScreenModel(
|
class ReaderSettingsScreenModel(
|
||||||
|
readerState: StateFlow<ReaderViewModel.State>,
|
||||||
|
val onChangeReadingMode: (ReadingModeType) -> Unit,
|
||||||
|
val onChangeOrientation: (OrientationType) -> Unit,
|
||||||
val preferences: ReaderPreferences = Injekt.get(),
|
val preferences: ReaderPreferences = Injekt.get(),
|
||||||
) : ScreenModel {
|
) : ScreenModel {
|
||||||
|
|
||||||
|
val viewerFlow = readerState
|
||||||
|
.map { it.viewer }
|
||||||
|
.distinctUntilChanged()
|
||||||
|
.stateIn(ioCoroutineScope, SharingStarted.Lazily, null)
|
||||||
|
|
||||||
fun togglePreference(preference: (ReaderPreferences) -> Preference<Boolean>) {
|
fun togglePreference(preference: (ReaderPreferences) -> Preference<Boolean>) {
|
||||||
preference(preferences).toggle()
|
preference(preferences).toggle()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
package eu.kanade.tachiyomi.ui.reader.setting
|
|
||||||
|
|
||||||
import android.os.Bundle
|
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
|
||||||
import eu.kanade.domain.manga.model.orientationType
|
|
||||||
import eu.kanade.domain.manga.model.readingModeType
|
|
||||||
import eu.kanade.tachiyomi.databinding.ReaderReadingModeSettingsBinding
|
|
||||||
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
|
||||||
|
|
||||||
class ReaderSettingsSheet(
|
|
||||||
private val activity: ReaderActivity,
|
|
||||||
) : BottomSheetDialog(activity) {
|
|
||||||
|
|
||||||
private lateinit var binding: ReaderReadingModeSettingsBinding
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
|
||||||
super.onCreate(savedInstanceState)
|
|
||||||
|
|
||||||
binding = ReaderReadingModeSettingsBinding.inflate(activity.layoutInflater)
|
|
||||||
setContentView(binding.root)
|
|
||||||
|
|
||||||
initGeneralPreferences()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun initGeneralPreferences() {
|
|
||||||
binding.viewer.onItemSelectedListener = { position ->
|
|
||||||
val readingModeType = ReadingModeType.fromSpinner(position)
|
|
||||||
activity.viewModel.setMangaReadingMode(readingModeType.flagValue)
|
|
||||||
}
|
|
||||||
binding.viewer.setSelection(activity.viewModel.manga?.readingModeType?.let { ReadingModeType.fromPreference(it.toInt()).prefValue } ?: ReadingModeType.DEFAULT.prefValue)
|
|
||||||
|
|
||||||
binding.rotationMode.onItemSelectedListener = { position ->
|
|
||||||
val rotationType = OrientationType.fromSpinner(position)
|
|
||||||
activity.viewModel.setMangaOrientationType(rotationType.flagValue)
|
|
||||||
}
|
|
||||||
binding.rotationMode.setSelection(activity.viewModel.manga?.orientationType?.let { OrientationType.fromPreference(it.toInt()).prefValue } ?: OrientationType.DEFAULT.prefValue)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,16 +1,7 @@
|
||||||
package eu.kanade.tachiyomi.util.preference
|
package eu.kanade.tachiyomi.util.preference
|
||||||
|
|
||||||
import android.widget.CompoundButton
|
|
||||||
import tachiyomi.core.preference.Preference
|
import tachiyomi.core.preference.Preference
|
||||||
|
|
||||||
/**
|
|
||||||
* Binds a checkbox or switch view with a boolean preference.
|
|
||||||
*/
|
|
||||||
fun CompoundButton.bindToPreference(pref: Preference<Boolean>) {
|
|
||||||
isChecked = pref.get()
|
|
||||||
setOnCheckedChangeListener { _, isChecked -> pref.set(isChecked) }
|
|
||||||
}
|
|
||||||
|
|
||||||
operator fun <T> Preference<Set<T>>.plusAssign(item: T) {
|
operator fun <T> Preference<Set<T>>.plusAssign(item: T) {
|
||||||
set(get() + item)
|
set(get() + item)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
@file:Suppress("PackageDirectoryMismatch")
|
|
||||||
|
|
||||||
package com.google.android.material.bottomsheet
|
|
||||||
|
|
||||||
import android.view.View
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns package-private elevation value
|
|
||||||
*/
|
|
||||||
fun <T : View> BottomSheetBehavior<T>.getElevation(): Float {
|
|
||||||
return elevation.takeIf { it >= 0F } ?: 0F
|
|
||||||
}
|
|
|
@ -1,30 +1,7 @@
|
||||||
package eu.kanade.tachiyomi.util.view
|
package eu.kanade.tachiyomi.util.view
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.graphics.Color
|
|
||||||
import android.view.Window
|
import android.view.Window
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
import com.google.android.material.elevation.ElevationOverlayProvider
|
|
||||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
|
||||||
import eu.kanade.tachiyomi.util.system.isNavigationBarNeedsScrim
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets navigation bar color to transparent if system's config_navBarNeedsScrim is false,
|
|
||||||
* otherwise it will use the theme navigationBarColor with 70% opacity.
|
|
||||||
*
|
|
||||||
* @see isNavigationBarNeedsScrim
|
|
||||||
*/
|
|
||||||
fun Window.setNavigationBarTransparentCompat(context: Context, elevation: Float = 0F) {
|
|
||||||
navigationBarColor = if (context.isNavigationBarNeedsScrim()) {
|
|
||||||
// Set navbar scrim 70% of navigationBarColor
|
|
||||||
ElevationOverlayProvider(context).compositeOverlayIfNeeded(
|
|
||||||
context.getResourceColor(android.R.attr.navigationBarColor, 0.7F),
|
|
||||||
elevation,
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
Color.TRANSPARENT
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun Window.setSecureScreen(enabled: Boolean) {
|
fun Window.setSecureScreen(enabled: Boolean) {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
|
|
|
@ -1,117 +0,0 @@
|
||||||
package eu.kanade.tachiyomi.widget
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.content.Context
|
|
||||||
import android.util.AttributeSet
|
|
||||||
import android.view.Gravity
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.MenuItem
|
|
||||||
import android.widget.FrameLayout
|
|
||||||
import androidx.appcompat.content.res.AppCompatResources
|
|
||||||
import androidx.appcompat.view.menu.MenuBuilder
|
|
||||||
import androidx.appcompat.widget.PopupMenu
|
|
||||||
import androidx.core.content.withStyledAttributes
|
|
||||||
import androidx.core.view.forEach
|
|
||||||
import androidx.core.view.get
|
|
||||||
import androidx.core.view.size
|
|
||||||
import eu.kanade.tachiyomi.R
|
|
||||||
import eu.kanade.tachiyomi.databinding.PrefSpinnerBinding
|
|
||||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
|
||||||
import tachiyomi.core.preference.Preference
|
|
||||||
|
|
||||||
class MaterialSpinnerView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
|
|
||||||
FrameLayout(context, attrs) {
|
|
||||||
|
|
||||||
private var entries = emptyList<String>()
|
|
||||||
private var selectedPosition = 0
|
|
||||||
private var popup: PopupMenu? = null
|
|
||||||
|
|
||||||
var onItemSelectedListener: ((Int) -> Unit)? = null
|
|
||||||
set(value) {
|
|
||||||
field = value
|
|
||||||
if (value != null) {
|
|
||||||
popup = makeSettingsPopup()
|
|
||||||
setOnTouchListener(popup?.dragToOpenListener)
|
|
||||||
setOnClickListener {
|
|
||||||
popup?.show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private val emptyIcon by lazy {
|
|
||||||
AppCompatResources.getDrawable(context, R.drawable.ic_blank_24dp)
|
|
||||||
}
|
|
||||||
private val checkmarkIcon by lazy {
|
|
||||||
AppCompatResources.getDrawable(context, R.drawable.ic_check_24dp)?.mutate()?.apply {
|
|
||||||
setTint(context.getResourceColor(android.R.attr.textColorPrimary))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private val binding = PrefSpinnerBinding.inflate(LayoutInflater.from(context), this, false)
|
|
||||||
|
|
||||||
init {
|
|
||||||
addView(binding.root)
|
|
||||||
|
|
||||||
context.withStyledAttributes(set = attrs, attrs = R.styleable.MaterialSpinnerView) {
|
|
||||||
val title = getString(R.styleable.MaterialSpinnerView_title).orEmpty()
|
|
||||||
binding.title.text = title
|
|
||||||
|
|
||||||
val viewEntries = getTextArray(R.styleable.MaterialSpinnerView_android_entries)
|
|
||||||
.orEmpty()
|
|
||||||
.map { it.toString() }
|
|
||||||
entries = viewEntries
|
|
||||||
binding.details.text = viewEntries.firstOrNull().orEmpty()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setSelection(selection: Int) {
|
|
||||||
if (selectedPosition < (popup?.menu?.size ?: 0)) {
|
|
||||||
popup?.menu?.getItem(selectedPosition)?.let {
|
|
||||||
it.icon = emptyIcon
|
|
||||||
}
|
|
||||||
}
|
|
||||||
selectedPosition = selection
|
|
||||||
popup?.menu?.getItem(selectedPosition)?.let {
|
|
||||||
it.icon = checkmarkIcon
|
|
||||||
}
|
|
||||||
binding.details.text = entries.getOrNull(selection).orEmpty()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun makeSettingsPopup(preference: Preference<Int>, offset: Int = 0, block: ((Int) -> Unit)? = null): PopupMenu {
|
|
||||||
return createPopupMenu { pos ->
|
|
||||||
preference.set(pos + offset)
|
|
||||||
block?.invoke(pos)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun makeSettingsPopup(): PopupMenu {
|
|
||||||
return createPopupMenu { pos ->
|
|
||||||
onItemSelectedListener?.invoke(pos)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun menuClicked(menuItem: MenuItem): Int {
|
|
||||||
val pos = menuItem.itemId
|
|
||||||
setSelection(pos)
|
|
||||||
return pos
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("RestrictedApi")
|
|
||||||
fun createPopupMenu(onItemClick: (Int) -> Unit): PopupMenu {
|
|
||||||
val popup = PopupMenu(context, this, Gravity.END, R.attr.actionOverflowMenuStyle, 0)
|
|
||||||
entries.forEachIndexed { index, entry ->
|
|
||||||
popup.menu.add(0, index, 0, entry)
|
|
||||||
}
|
|
||||||
(popup.menu as? MenuBuilder)?.setOptionalIconsVisible(true)
|
|
||||||
popup.menu.forEach {
|
|
||||||
it.icon = emptyIcon
|
|
||||||
}
|
|
||||||
popup.menu[selectedPosition].icon = checkmarkIcon
|
|
||||||
popup.setOnMenuItemClickListener { menuItem ->
|
|
||||||
val pos = menuClicked(menuItem)
|
|
||||||
onItemClick(pos)
|
|
||||||
true
|
|
||||||
}
|
|
||||||
return popup
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:duration="300"
|
|
||||||
android:interpolator="@android:interpolator/fast_out_slow_in">
|
|
||||||
|
|
||||||
<translate
|
|
||||||
android:fromYDelta="100%p"
|
|
||||||
android:toYDelta="0" />
|
|
||||||
|
|
||||||
</set>
|
|
|
@ -1,10 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:duration="300"
|
|
||||||
android:interpolator="@android:interpolator/fast_out_slow_in">
|
|
||||||
|
|
||||||
<translate
|
|
||||||
android:fromYDelta="0"
|
|
||||||
android:toYDelta="100%p" />
|
|
||||||
|
|
||||||
</set>
|
|
|
@ -1,9 +0,0 @@
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportWidth="24"
|
|
||||||
android:viewportHeight="24">
|
|
||||||
<path
|
|
||||||
android:fillColor="@android:color/black"
|
|
||||||
android:pathData="M16.59,8.59L12,13.17 7.41,8.59 6,10l6,6 6,-6z" />
|
|
||||||
</vector>
|
|
|
@ -1,58 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="?attr/listPreferredItemHeightSmall"
|
|
||||||
android:background="?attr/selectableItemBackground"
|
|
||||||
android:paddingStart="16dp"
|
|
||||||
android:paddingEnd="16dp">
|
|
||||||
|
|
||||||
<com.google.android.material.textview.MaterialTextView
|
|
||||||
android:id="@+id/title"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:paddingEnd="8dp"
|
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toStartOf="@+id/center_guideline"
|
|
||||||
app:layout_constraintHorizontal_bias="0.0"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
tools:text="Title" />
|
|
||||||
|
|
||||||
<com.google.android.material.textview.MaterialTextView
|
|
||||||
android:id="@+id/details"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:textColor="?android:attr/textColorPrimary"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toStartOf="@+id/dropdown_caret"
|
|
||||||
app:layout_constraintHorizontal_bias="0.0"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/center_guideline"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
tools:text="Details" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/dropdown_caret"
|
|
||||||
android:layout_width="24dp"
|
|
||||||
android:layout_height="24dp"
|
|
||||||
android:layout_marginStart="1dp"
|
|
||||||
android:src="@drawable/ic_expand_more_24dp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@id/details"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/details"
|
|
||||||
app:tint="?android:attr/colorControlNormal"
|
|
||||||
tools:ignore="ContentDescription" />
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.Guideline
|
|
||||||
android:id="@+id/center_guideline"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
app:layout_constraintGuide_percent="0.5" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
|
@ -118,19 +118,6 @@
|
||||||
app:srcCompat="@drawable/ic_screen_rotation_24dp"
|
app:srcCompat="@drawable/ic_screen_rotation_24dp"
|
||||||
app:tint="?attr/colorOnSurface" />
|
app:tint="?attr/colorOnSurface" />
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/action_settings_legacy"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="?attr/selectableItemBackgroundBorderless"
|
|
||||||
android:contentDescription="@string/action_settings"
|
|
||||||
android:padding="@dimen/screen_edge_margin"
|
|
||||||
app:layout_constraintEnd_toStartOf="@+id/action_settings"
|
|
||||||
app:layout_constraintStart_toEndOf="@id/action_rotation"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:srcCompat="@drawable/ic_settings_24dp"
|
|
||||||
app:tint="?attr/colorOnSurface" />
|
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/action_settings"
|
android:id="@+id/action_settings"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -139,7 +126,7 @@
|
||||||
android:contentDescription="@string/action_settings"
|
android:contentDescription="@string/action_settings"
|
||||||
android:padding="@dimen/screen_edge_margin"
|
android:padding="@dimen/screen_edge_margin"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@id/action_settings_legacy"
|
app:layout_constraintStart_toEndOf="@id/action_rotation"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:srcCompat="@drawable/ic_settings_24dp"
|
app:srcCompat="@drawable/ic_settings_24dp"
|
||||||
app:tint="?attr/colorOnSurface" />
|
app:tint="?attr/colorOnSurface" />
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<eu.kanade.tachiyomi.widget.MaterialSpinnerView
|
|
||||||
android:id="@+id/viewer"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:entries="@array/viewers_selector"
|
|
||||||
app:title="@string/pref_category_reading_mode" />
|
|
||||||
|
|
||||||
<eu.kanade.tachiyomi.widget.MaterialSpinnerView
|
|
||||||
android:id="@+id/rotation_mode"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="24dp"
|
|
||||||
android:entries="@array/rotation_type"
|
|
||||||
app:title="@string/rotation_type" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</androidx.core.widget.NestedScrollView>
|
|
|
@ -1,10 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
|
|
||||||
<declare-styleable name="MaterialSpinnerView">
|
|
||||||
<attr name="title" format="reference|string"/>
|
|
||||||
<attr name="android:entries"/>
|
|
||||||
<attr name="summary" format="reference|string" />
|
|
||||||
</declare-styleable>
|
|
||||||
|
|
||||||
</resources>
|
|
|
@ -1,6 +1,4 @@
|
||||||
<resources>
|
<resources>
|
||||||
<dimen name="dialog_radius">8dp</dimen>
|
|
||||||
|
|
||||||
<dimen name="screen_edge_margin">16dp</dimen>
|
<dimen name="screen_edge_margin">16dp</dimen>
|
||||||
|
|
||||||
<dimen name="appwidget_background_radius">16dp</dimen>
|
<dimen name="appwidget_background_radius">16dp</dimen>
|
||||||
|
|
|
@ -20,33 +20,6 @@
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
<!--===========-->
|
|
||||||
<!--BottomSheet-->
|
|
||||||
<!--===========-->
|
|
||||||
|
|
||||||
<style name="ThemeOverlay.Tachiyomi.BottomSheetDialog" parent="ThemeOverlay.Material3.BottomSheetDialog">
|
|
||||||
<item name="bottomSheetStyle">@style/Widget.Tachiyomi.BottomSheet.Modal</item>
|
|
||||||
<item name="android:windowAnimationStyle">@style/Animation.Tachiyomi.BottomSheetDialog</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="Widget.Tachiyomi.BottomSheet.Modal" parent="Widget.Material3.BottomSheet.Modal">
|
|
||||||
<item name="shapeAppearanceOverlay">@style/ShapeAppearanceOverlay.Tachiyomi.BottomSheet</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="ShapeAppearanceOverlay.Tachiyomi.BottomSheet" parent="">
|
|
||||||
<item name="cornerFamily">rounded</item>
|
|
||||||
<item name="cornerSizeTopRight">@dimen/dialog_radius</item>
|
|
||||||
<item name="cornerSizeTopLeft">@dimen/dialog_radius</item>
|
|
||||||
<item name="cornerSizeBottomRight">0dp</item>
|
|
||||||
<item name="cornerSizeBottomLeft">0dp</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="Animation.Tachiyomi.BottomSheetDialog" parent="Animation.AppCompat.Dialog">
|
|
||||||
<item name="android:windowEnterAnimation">@anim/bottom_sheet_slide_in</item>
|
|
||||||
<item name="android:windowExitAnimation">@anim/bottom_sheet_slide_out</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
|
|
||||||
<!--===============-->
|
<!--===============-->
|
||||||
<!--Text Appearance-->
|
<!--Text Appearance-->
|
||||||
<!--===============-->
|
<!--===============-->
|
||||||
|
@ -71,18 +44,6 @@
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
<!--=================-->
|
|
||||||
<!--Widgets.TabLayout-->
|
|
||||||
<!--=================-->
|
|
||||||
<style name="Widget.Tachiyomi.TabLayout" parent="Widget.Material3.TabLayout">
|
|
||||||
<item name="tabGravity">center</item>
|
|
||||||
<item name="tabInlineLabel">true</item>
|
|
||||||
<item name="tabMinWidth">75dp</item>
|
|
||||||
<item name="tabMode">scrollable</item>
|
|
||||||
<item name="tabRippleColor">@color/ripple_toolbar_fainter</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
|
|
||||||
<!--==============-->
|
<!--==============-->
|
||||||
<!--Widgets.Switch-->
|
<!--Widgets.Switch-->
|
||||||
<!--==============-->
|
<!--==============-->
|
||||||
|
@ -94,16 +55,6 @@
|
||||||
<item name="elevationOverlayEnabled">@bool/elevationOverlayEnabled</item>
|
<item name="elevationOverlayEnabled">@bool/elevationOverlayEnabled</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<!--==============-->
|
|
||||||
<!--Widgets.Slider-->
|
|
||||||
<!--==============-->
|
|
||||||
<style name="Widget.Tachiyomi.Slider" parent="Widget.Material3.Slider">
|
|
||||||
<item name="labelBehavior">gone</item>
|
|
||||||
<item name="tickVisible">false</item>
|
|
||||||
<item name="trackColorInactive">@color/slider_inactive_track</item>
|
|
||||||
<item name="trackColorActive">@color/slider_active_track</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
|
|
||||||
<!--============-->
|
<!--============-->
|
||||||
<!--FastScroller-->
|
<!--FastScroller-->
|
||||||
|
|
|
@ -64,17 +64,13 @@
|
||||||
<item name="android:backgroundDimAmount">0.32</item>
|
<item name="android:backgroundDimAmount">0.32</item>
|
||||||
<item name="windowActionModeOverlay">true</item>
|
<item name="windowActionModeOverlay">true</item>
|
||||||
<item name="actionOverflowButtonStyle">@style/Theme.Tachiyomi.ActionButton.Overflow</item>
|
<item name="actionOverflowButtonStyle">@style/Theme.Tachiyomi.ActionButton.Overflow</item>
|
||||||
<item name="actionModeCloseDrawable">@drawable/ic_close_24dp</item>
|
|
||||||
<item name="preferenceTheme">@style/PreferenceThemeOverlay.Tachiyomi</item>
|
<item name="preferenceTheme">@style/PreferenceThemeOverlay.Tachiyomi</item>
|
||||||
<item name="bottomSheetDialogTheme">@style/ThemeOverlay.Tachiyomi.BottomSheetDialog</item>
|
|
||||||
<item name="textInputStyle">@style/Widget.Material3.TextInputLayout.OutlinedBox</item>
|
<item name="textInputStyle">@style/Widget.Material3.TextInputLayout.OutlinedBox</item>
|
||||||
<item name="appBarLayoutStyle">@style/Widget.Material3.AppBarLayout</item>
|
<item name="appBarLayoutStyle">@style/Widget.Material3.AppBarLayout</item>
|
||||||
<item name="toolbarStyle">@style/Widget.Material3.Toolbar.Surface</item>
|
<item name="toolbarStyle">@style/Widget.Material3.Toolbar.Surface</item>
|
||||||
<item name="tabStyle">@style/Widget.Tachiyomi.TabLayout</item>
|
|
||||||
<item name="switchStyle">@style/Widget.Tachiyomi.Switch</item>
|
<item name="switchStyle">@style/Widget.Tachiyomi.Switch</item>
|
||||||
<item name="materialSwitchStyle">@style/Widget.Material3.CompoundButton.MaterialSwitch</item>
|
<item name="materialSwitchStyle">@style/Widget.Material3.CompoundButton.MaterialSwitch</item>
|
||||||
<item name="switchPreferenceCompatStyle">@style/Widget.Tachiyomi.Switch</item>
|
<item name="switchPreferenceCompatStyle">@style/Widget.Tachiyomi.Switch</item>
|
||||||
<item name="sliderStyle">@style/Widget.Tachiyomi.Slider</item>
|
|
||||||
<item name="materialCardViewStyle">@style/Widget.Material3.CardView.Elevated</item>
|
<item name="materialCardViewStyle">@style/Widget.Material3.CardView.Elevated</item>
|
||||||
|
|
||||||
<!-- Preference text appearance -->
|
<!-- Preference text appearance -->
|
||||||
|
|
Reference in a new issue