mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
Update Kotlin to 1.9.10
Updated coil and compose as well
This commit is contained in:
parent
3b6456faa0
commit
0f2c02d565
27 changed files with 46 additions and 45 deletions
|
@ -112,7 +112,7 @@ android {
|
|||
}
|
||||
|
||||
composeOptions {
|
||||
kotlinCompilerExtensionVersion = "1.4.2"
|
||||
kotlinCompilerExtensionVersion = "1.5.3"
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
|
@ -240,7 +240,7 @@ dependencies {
|
|||
implementation("com.github.inorichi.injekt:injekt-core:65b0440")
|
||||
|
||||
// Image library
|
||||
val coilVersion = "2.3.0"
|
||||
val coilVersion = "2.4.0"
|
||||
implementation("io.coil-kt:coil:$coilVersion")
|
||||
implementation("io.coil-kt:coil-gif:$coilVersion")
|
||||
implementation("io.coil-kt:coil-svg:$coilVersion")
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
-keepclassmembers enum * {
|
||||
public static **[] values();
|
||||
public static **[] entries;
|
||||
public static ** valueOf(java.lang.String);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ val listOfStringsAdapter = object : ColumnAdapter<List<String>, String> {
|
|||
}
|
||||
|
||||
val updateStrategyAdapter = object : ColumnAdapter<UpdateStrategy, Int> {
|
||||
private val enumValues by lazy { UpdateStrategy.values() }
|
||||
private val enumValues by lazy { UpdateStrategy.entries }
|
||||
|
||||
override fun decode(databaseValue: Int): UpdateStrategy =
|
||||
enumValues.getOrElse(databaseValue) { UpdateStrategy.ALWAYS_UPDATE }
|
||||
|
|
|
@ -34,7 +34,7 @@ object PreferenceValues {
|
|||
;
|
||||
|
||||
companion object {
|
||||
fun fromValue(preference: Int) = values().find { it.value == preference } ?: Alphabetically
|
||||
fun fromValue(preference: Int) = entries.find { it.value == preference } ?: Alphabetically
|
||||
fun fromPreference(pref: PreferencesHelper) = fromValue(pref.migrationSourceOrder().get())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ enum class InstalledExtensionsOrder(val value: Int, @StringRes val nameRes: Int)
|
|||
;
|
||||
|
||||
companion object {
|
||||
fun fromValue(preference: Int) = values().find { it.value == preference } ?: Name
|
||||
fun fromValue(preference: Int) = entries.find { it.value == preference } ?: Name
|
||||
fun fromPreference(pref: PreferencesHelper) = fromValue(pref.installedExtensionsOrder().get())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -238,7 +238,7 @@ class ExtensionBottomSheet @JvmOverloads constructor(context: Context, attrs: At
|
|||
|
||||
override fun onExtSortClicked(view: TextView, position: Int) {
|
||||
view.popupMenu(
|
||||
InstalledExtensionsOrder.values().map { it.value to it.nameRes },
|
||||
InstalledExtensionsOrder.entries.map { it.value to it.nameRes },
|
||||
presenter.preferences.installedExtensionsOrder().get(),
|
||||
) {
|
||||
presenter.preferences.installedExtensionsOrder().set(itemId)
|
||||
|
|
|
@ -277,7 +277,7 @@ class LibraryHeaderHolder(val view: View, val adapter: LibraryCategoryAdapter) :
|
|||
val category =
|
||||
(adapter.getItem(flexibleAdapterPosition) as? LibraryHeaderItem)?.category ?: return
|
||||
adapter.controller?.activity?.let { activity ->
|
||||
val items = LibrarySort.values().map { it.menuSheetItem(category.isDynamic) }
|
||||
val items = LibrarySort.entries.map { it.menuSheetItem(category.isDynamic) }
|
||||
val sortingMode = category.sortingMode(true)
|
||||
val sheet = MaterialMenuSheet(
|
||||
activity,
|
||||
|
|
|
@ -56,7 +56,7 @@ enum class LibrarySort(
|
|||
}
|
||||
|
||||
companion object {
|
||||
fun valueOf(value: Int) = values().find { it.mainValue == value }
|
||||
fun valueOf(char: Char?) = values().find { it.categoryValue == char || it.categoryValueDescending == char }
|
||||
fun valueOf(value: Int) = entries.find { it.mainValue == value }
|
||||
fun valueOf(char: Char?) = entries.find { it.categoryValue == char || it.categoryValueDescending == char }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ class ExpandedFilterSheet(
|
|||
private fun openReorderSheet() {
|
||||
val recycler = RecyclerView(context)
|
||||
val filterOrder = preferences.filterOrder().get().toMutableList()
|
||||
FilterBottomSheet.Filters.values().forEach {
|
||||
FilterBottomSheet.Filters.entries.forEach {
|
||||
if (it.value !in filterOrder) {
|
||||
filterOrder.add(it.value)
|
||||
}
|
||||
|
|
|
@ -637,7 +637,7 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
|
|||
Tracked,
|
||||
).joinToString("") { it.value.toString() }
|
||||
|
||||
fun filterOf(char: Char) = values().find { it.value == char }
|
||||
fun filterOf(char: Char) = entries.find { it.value == char }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,9 +128,9 @@ class StatsDetailsController :
|
|||
?.setTitle(R.string.stat)
|
||||
?.setSingleChoiceItems(
|
||||
presenter.getStatsArray(),
|
||||
Stats.values().indexOf(presenter.selectedStat),
|
||||
Stats.entries.indexOf(presenter.selectedStat),
|
||||
) { dialog, which ->
|
||||
val newSelection = Stats.values()[which]
|
||||
val newSelection = Stats.entries[which]
|
||||
if (newSelection == presenter.selectedStat) return@setSingleChoiceItems
|
||||
chipStat.text = activity?.getString(newSelection.resourceId)
|
||||
presenter.selectedStat = newSelection
|
||||
|
@ -775,9 +775,9 @@ class StatsDetailsController :
|
|||
.setTitle(R.string.sort_by)
|
||||
.setSingleChoiceItems(
|
||||
presenter.getSortDataArray(),
|
||||
StatsSort.values().indexOf(presenter.selectedStatsSort),
|
||||
StatsSort.entries.indexOf(presenter.selectedStatsSort),
|
||||
) { dialog, which ->
|
||||
val newSelection = StatsSort.values()[which]
|
||||
val newSelection = StatsSort.entries[which]
|
||||
if (newSelection == presenter.selectedStatsSort) return@setSingleChoiceItems
|
||||
statsSortTextView?.text = activity?.getString(newSelection.resourceId)
|
||||
presenter.selectedStatsSort = newSelection
|
||||
|
|
|
@ -538,7 +538,7 @@ class StatsDetailsPresenter(
|
|||
}
|
||||
|
||||
fun getStatsArray(): Array<String> {
|
||||
return Stats.values().map { context.getString(it.resourceId) }.toTypedArray()
|
||||
return Stats.entries.map { context.getString(it.resourceId) }.toTypedArray()
|
||||
}
|
||||
|
||||
private fun getEnabledSources(): List<Source> {
|
||||
|
@ -547,7 +547,7 @@ class StatsDetailsPresenter(
|
|||
}
|
||||
|
||||
fun getSortDataArray(): Array<String> {
|
||||
return StatsSort.values().sortedArray().map { context.getString(it.resourceId) }.toTypedArray()
|
||||
return StatsSort.entries.sorted().map { context.getString(it.resourceId) }.toTypedArray()
|
||||
}
|
||||
|
||||
fun getTracks(manga: Manga): MutableList<Track> {
|
||||
|
|
|
@ -782,7 +782,7 @@ class ReaderActivity : BaseActivity<ReaderActivityBinding>() {
|
|||
|
||||
setOnClickListener {
|
||||
popupMenu(
|
||||
items = OrientationType.values().map { it.flagValue to it.stringRes },
|
||||
items = OrientationType.entries.map { it.flagValue to it.stringRes },
|
||||
selectedItemId = viewModel.manga?.orientationType
|
||||
?: preferences.defaultOrientationType().get(),
|
||||
) {
|
||||
|
@ -810,7 +810,7 @@ class ReaderActivity : BaseActivity<ReaderActivityBinding>() {
|
|||
|
||||
readingMode.setOnClickListener { readingMode ->
|
||||
readingMode.popupMenu(
|
||||
items = ReadingModeType.values().map { it.flagValue to it.stringRes },
|
||||
items = ReadingModeType.entries.map { it.flagValue to it.stringRes },
|
||||
selectedItemId = viewModel.manga?.readingModeType,
|
||||
) {
|
||||
viewModel.setMangaReadingMode(itemId)
|
||||
|
|
|
@ -22,8 +22,8 @@ enum class OrientationType(val prefValue: Int, val flag: Int, @StringRes val str
|
|||
const val MASK = 7 shl SHIFT
|
||||
|
||||
fun fromPreference(preference: Int): OrientationType =
|
||||
values().find { it.flagValue == preference } ?: FREE
|
||||
entries.find { it.flagValue == preference } ?: FREE
|
||||
|
||||
fun fromSpinner(position: Int?) = values().find { value -> value.prefValue == position } ?: DEFAULT
|
||||
fun fromSpinner(position: Int?) = entries.find { value -> value.prefValue == position } ?: DEFAULT
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,6 @@ enum class PageLayout(
|
|||
|
||||
companion object {
|
||||
fun fromPreference(preference: Int): PageLayout =
|
||||
values().find { it.value == preference } ?: SINGLE_PAGE
|
||||
entries.find { it.value == preference } ?: SINGLE_PAGE
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@ enum class ReaderBackgroundColor(val prefValue: Int, @StringRes val stringRes: I
|
|||
|
||||
val isSmartColor get() = this == SMART_PAGE || this == SMART_THEME
|
||||
companion object {
|
||||
fun indexFromPref(preference: Int) = values().indexOf(fromPreference(preference))
|
||||
fun indexFromPref(preference: Int) = entries.indexOf(fromPreference(preference))
|
||||
fun fromPreference(preference: Int): ReaderBackgroundColor =
|
||||
values().find { it.prefValue == preference } ?: SMART_PAGE
|
||||
entries.find { it.prefValue == preference } ?: SMART_PAGE
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,13 +40,13 @@ class ReaderGeneralView @JvmOverloads constructor(context: Context, attrs: Attri
|
|||
)
|
||||
|
||||
binding.backgroundColor.setEntries(
|
||||
ReaderBackgroundColor.values()
|
||||
ReaderBackgroundColor.entries
|
||||
.map { context.getString(it.stringRes) },
|
||||
)
|
||||
val selection = ReaderBackgroundColor.indexFromPref(preferences.readerTheme().get())
|
||||
binding.backgroundColor.setSelection(selection)
|
||||
binding.backgroundColor.onItemSelectedListener = { position ->
|
||||
val backgroundColor = ReaderBackgroundColor.values()[position]
|
||||
val backgroundColor = ReaderBackgroundColor.entries[position]
|
||||
preferences.readerTheme().set(backgroundColor.prefValue)
|
||||
}
|
||||
binding.showPageNumber.bindToPreference(preferences.showPageNumber())
|
||||
|
|
|
@ -18,7 +18,7 @@ enum class ReadingModeType(val prefValue: Int, @StringRes val stringRes: Int, @D
|
|||
val flagValue = prefValue shl ReadingModeType.SHIFT
|
||||
|
||||
companion object {
|
||||
fun fromPreference(preference: Int): ReadingModeType = values().find { it.flagValue == preference } ?: DEFAULT
|
||||
fun fromPreference(preference: Int): ReadingModeType = entries.find { it.flagValue == preference } ?: DEFAULT
|
||||
private const val SHIFT = 0x00000000
|
||||
const val MASK = 7 shl SHIFT
|
||||
|
||||
|
@ -37,6 +37,6 @@ enum class ReadingModeType(val prefValue: Int, @StringRes val stringRes: Int, @D
|
|||
return mode == WEBTOON || mode == CONTINUOUS_VERTICAL
|
||||
}
|
||||
|
||||
fun fromSpinner(position: Int?) = values().find { value -> value.prefValue == position } ?: DEFAULT
|
||||
fun fromSpinner(position: Int?) = entries.find { value -> value.prefValue == position } ?: DEFAULT
|
||||
}
|
||||
}
|
||||
|
|
|
@ -891,7 +891,7 @@ class RecentsController(bundle: Bundle? = null) :
|
|||
tabs.removeAllTabs()
|
||||
tabs.clearOnTabSelectedListeners()
|
||||
val selectedTab = presenter.viewType
|
||||
RecentsViewType.values().forEach { viewType ->
|
||||
RecentsViewType.entries.forEach { viewType ->
|
||||
tabs.addTab(
|
||||
tabs.newTab().setText(viewType.stringRes).also { tab ->
|
||||
tab.view.compatToolTipText = null
|
||||
|
|
|
@ -15,6 +15,6 @@ enum class RecentsViewType(val mainValue: Int, @StringRes val stringRes: Int) {
|
|||
val isUpdates get() = this == Updates
|
||||
|
||||
companion object {
|
||||
fun valueOf(value: Int?) = values().find { it.mainValue == value } ?: GroupedAll
|
||||
fun valueOf(value: Int?) = entries.find { it.mainValue == value } ?: GroupedAll
|
||||
}
|
||||
}
|
||||
|
|
|
@ -148,7 +148,7 @@ class SettingsAppearanceController : SettingsController() {
|
|||
intListPreference(activity) {
|
||||
key = Keys.sideNavMode
|
||||
titleRes = R.string.use_side_navigation
|
||||
val values = SideNavMode.values()
|
||||
val values = SideNavMode.entries
|
||||
entriesRes = values.map { it.stringRes }.toTypedArray()
|
||||
entryValues = values.map { it.prefValue }
|
||||
defaultValue = SideNavMode.DEFAULT.prefValue
|
||||
|
|
|
@ -31,9 +31,9 @@ class SettingsReaderController : SettingsController() {
|
|||
intListPreference(activity) {
|
||||
key = Keys.defaultReadingMode
|
||||
titleRes = R.string.default_reading_mode
|
||||
entriesRes = ReadingModeType.values().drop(1)
|
||||
entriesRes = ReadingModeType.entries.drop(1)
|
||||
.map { value -> value.stringRes }.toTypedArray()
|
||||
entryValues = ReadingModeType.values().drop(1)
|
||||
entryValues = ReadingModeType.entries.drop(1)
|
||||
.map { value -> value.flagValue }
|
||||
defaultValue = 2
|
||||
}
|
||||
|
@ -75,8 +75,8 @@ class SettingsReaderController : SettingsController() {
|
|||
multiSelectListPreferenceMat(activity) {
|
||||
key = Keys.readerBottomButtons
|
||||
titleRes = R.string.display_buttons_bottom_reader
|
||||
val enumConstants = ReaderBottomButton.values()
|
||||
entriesRes = ReaderBottomButton.values().map { it.stringRes }.toTypedArray()
|
||||
val enumConstants = ReaderBottomButton.entries
|
||||
entriesRes = ReaderBottomButton.entries.map { it.stringRes }.toTypedArray()
|
||||
entryValues = enumConstants.map { it.value }
|
||||
allSelectionRes = R.string.display_options
|
||||
allIsAlwaysSelected = true
|
||||
|
@ -96,7 +96,7 @@ class SettingsReaderController : SettingsController() {
|
|||
intListPreference(activity) {
|
||||
key = Keys.defaultOrientationType
|
||||
titleRes = R.string.default_orientation
|
||||
val enumConstants = OrientationType.values().drop(1)
|
||||
val enumConstants = OrientationType.entries.drop(1)
|
||||
entriesRes = enumConstants.map { it.stringRes }.toTypedArray()
|
||||
entryValues = enumConstants.map { value -> value.flagValue }
|
||||
defaultValue = OrientationType.FREE.flagValue
|
||||
|
@ -104,7 +104,7 @@ class SettingsReaderController : SettingsController() {
|
|||
intListPreference(activity) {
|
||||
key = Keys.readerTheme
|
||||
titleRes = R.string.background_color
|
||||
val enumConstants = ReaderBackgroundColor.values()
|
||||
val enumConstants = ReaderBackgroundColor.entries
|
||||
entriesRes = enumConstants.map { it.longStringRes ?: it.stringRes }.toTypedArray()
|
||||
entryValues = enumConstants.map { it.prefValue }
|
||||
defaultValue = ReaderBackgroundColor.SMART_PAGE.prefValue
|
||||
|
@ -271,7 +271,7 @@ class SettingsReaderController : SettingsController() {
|
|||
key = Keys.pageLayout
|
||||
title = context.getString(R.string.page_layout).addBetaTag(context)
|
||||
dialogTitleRes = R.string.page_layout
|
||||
val enumConstants = PageLayout.values()
|
||||
val enumConstants = PageLayout.entries
|
||||
entriesRes = enumConstants.map { it.fullStringRes }.toTypedArray()
|
||||
entryValues = enumConstants.map { it.value }
|
||||
defaultValue = PageLayout.AUTOMATIC.value
|
||||
|
@ -323,7 +323,7 @@ class SettingsReaderController : SettingsController() {
|
|||
listPreference(activity) {
|
||||
bindTo(preferences.webtoonReaderHideThreshold())
|
||||
titleRes = R.string.pref_hide_threshold
|
||||
val enumValues = PreferenceValues.ReaderHideThreshold.values()
|
||||
val enumValues = PreferenceValues.ReaderHideThreshold.entries
|
||||
entriesRes = enumValues.map { it.titleResId }.toTypedArray()
|
||||
entryValues = enumValues.map { it.name }
|
||||
}
|
||||
|
|
|
@ -55,8 +55,8 @@ class SettingsSecurityController : SettingsController() {
|
|||
listPreference(activity) {
|
||||
bindTo(preferences.secureScreen())
|
||||
titleRes = R.string.secure_screen
|
||||
entriesRes = PreferenceValues.SecureScreenMode.values().map { it.titleResId }.toTypedArray()
|
||||
entryValues = PreferenceValues.SecureScreenMode.values().map { it.name }
|
||||
entriesRes = PreferenceValues.SecureScreenMode.entries.map { it.titleResId }.toTypedArray()
|
||||
entryValues = PreferenceValues.SecureScreenMode.entries.map { it.name }
|
||||
|
||||
onChange {
|
||||
it as String
|
||||
|
|
|
@ -301,7 +301,7 @@ class SettingsSourcesController : SettingsController(), FloatingSearchInterface
|
|||
Alpha(0), Enabled(1);
|
||||
|
||||
companion object {
|
||||
fun from(i: Int): SourcesSort? = values().find { it.value == i }
|
||||
fun from(i: Int): SourcesSort? = entries.find { it.value == i }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ class ThemePreference @JvmOverloads constructor(context: Context, attrs: Attribu
|
|||
fastAdapterDark.setHasStableIds(true)
|
||||
selectExtensionLight = fastAdapterLight.getSelectExtension().setThemeListener(false)
|
||||
selectExtensionDark = fastAdapterDark.getSelectExtension().setThemeListener(true)
|
||||
val enumConstants = Themes.values()
|
||||
val enumConstants = Themes.entries
|
||||
val supportsDynamic = DynamicColors.isDynamicColorAvailable()
|
||||
itemAdapterLight.set(
|
||||
enumConstants
|
||||
|
|
|
@ -29,7 +29,7 @@ internal class TriStateMultiChoiceDialogAdapter(
|
|||
internal var listener: TriStateMultiChoiceListener?,
|
||||
) : RecyclerView.Adapter<TriStateMultiChoiceViewHolder>() {
|
||||
|
||||
private val states = TriStateCheckBox.State.values()
|
||||
private val states = TriStateCheckBox.State.entries
|
||||
private val defaultOrdinal
|
||||
get() = if (skipChecked) {
|
||||
TriStateCheckBox.State.IGNORE.ordinal
|
||||
|
|
|
@ -7,7 +7,7 @@ object AndroidVersions {
|
|||
const val versionCode = 105
|
||||
const val versionName = "1.7.0"
|
||||
const val ndk = "23.1.7779620"
|
||||
const val kotlin = "1.8.10"
|
||||
const val kotlin = "1.9.10"
|
||||
}
|
||||
|
||||
object Plugins {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue