Update gradle and kotlin
This commit is contained in:
@@ -2,13 +2,15 @@ plugins {
|
||||
id 'com.android.application'
|
||||
id 'kotlin-android'
|
||||
id 'kotlin-kapt'
|
||||
id 'com.google.devtools.ksp'
|
||||
id 'kotlin-parcelize'
|
||||
id 'dagger.hilt.android.plugin'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdk = 33
|
||||
buildToolsVersion = '33.0.2'
|
||||
compileSdkExtension = 4
|
||||
buildToolsVersion = '34.0.0'
|
||||
namespace = 'org.koitharu.kotatsu'
|
||||
|
||||
defaultConfig {
|
||||
@@ -22,10 +24,8 @@ android {
|
||||
generatedDensities = []
|
||||
testInstrumentationRunner "org.koitharu.kotatsu.HiltTestRunner"
|
||||
|
||||
kapt {
|
||||
arguments {
|
||||
arg 'room.schemaLocation', "$projectDir/schemas".toString()
|
||||
}
|
||||
ksp {
|
||||
arg("room.schemaLocation", "$projectDir/schemas")
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
@@ -41,6 +41,7 @@ android {
|
||||
}
|
||||
buildFeatures {
|
||||
viewBinding true
|
||||
buildConfig true
|
||||
}
|
||||
sourceSets {
|
||||
androidTest.assets.srcDirs += files("$projectDir/schemas".toString())
|
||||
@@ -81,11 +82,11 @@ afterEvaluate {
|
||||
}
|
||||
dependencies {
|
||||
//noinspection GradleDependency
|
||||
implementation('com.github.KotatsuApp:kotatsu-parsers:03b4fc9f00') {
|
||||
implementation('com.github.KotatsuApp:kotatsu-parsers:08eb9552d6') {
|
||||
exclude group: 'org.json', module: 'json'
|
||||
}
|
||||
|
||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.8.22'
|
||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.9.0'
|
||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3'
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||
@@ -103,8 +104,7 @@ dependencies {
|
||||
implementation 'androidx.preference:preference-ktx:1.2.0'
|
||||
implementation 'androidx.biometric:biometric-ktx:1.2.0-alpha05'
|
||||
implementation 'com.google.android.material:material:1.9.0'
|
||||
//noinspection LifecycleAnnotationProcessorWithJava8
|
||||
kapt 'androidx.lifecycle:lifecycle-compiler:2.6.1'
|
||||
implementation 'androidx.lifecycle:lifecycle-common-java8:2.6.1'
|
||||
|
||||
// TODO https://issuetracker.google.com/issues/254846063
|
||||
implementation 'androidx.work:work-runtime-ktx:2.8.1'
|
||||
@@ -117,8 +117,7 @@ dependencies {
|
||||
|
||||
implementation 'androidx.room:room-runtime:2.5.2'
|
||||
implementation 'androidx.room:room-ktx:2.5.2'
|
||||
//noinspection KaptUsageInsteadOfKsp
|
||||
kapt 'androidx.room:room-compiler:2.5.2'
|
||||
ksp 'androidx.room:room-compiler:2.5.2'
|
||||
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.11.0'
|
||||
implementation 'com.squareup.okhttp3:okhttp-dnsoverhttps:4.11.0'
|
||||
|
||||
@@ -15,7 +15,7 @@ class Migration16To17(context: Context) : Migration(16, 17) {
|
||||
database.execSQL("CREATE INDEX `index_sources_sort_key` ON `sources` (`sort_key`)")
|
||||
val hiddenSources = prefs.getStringSet("sources_hidden", null).orEmpty()
|
||||
val order = prefs.getString("sources_order_2", null)?.split('|').orEmpty()
|
||||
val sources = MangaSource.values()
|
||||
val sources = MangaSource.entries
|
||||
for (source in sources) {
|
||||
if (source == MangaSource.LOCAL) {
|
||||
continue
|
||||
|
||||
@@ -10,7 +10,7 @@ fun MangaSource.getLocaleTitle(): String? {
|
||||
}
|
||||
|
||||
fun MangaSource(name: String): MangaSource {
|
||||
MangaSource.values().forEach {
|
||||
MangaSource.entries.forEach {
|
||||
if (it.name == name) return it
|
||||
}
|
||||
return MangaSource.DUMMY
|
||||
|
||||
@@ -4,6 +4,7 @@ import androidx.annotation.StringRes
|
||||
import androidx.annotation.StyleRes
|
||||
import com.google.android.material.color.DynamicColors
|
||||
import org.koitharu.kotatsu.R
|
||||
import org.koitharu.kotatsu.parsers.util.find
|
||||
|
||||
enum class ColorScheme(
|
||||
@StyleRes val styleResId: Int,
|
||||
@@ -31,7 +32,7 @@ enum class ColorScheme(
|
||||
}
|
||||
|
||||
fun getAvailableList(): List<ColorScheme> {
|
||||
val list = enumValues<ColorScheme>().toMutableList()
|
||||
val list = ColorScheme.entries.toMutableList()
|
||||
if (!DynamicColors.isDynamicColorAvailable()) {
|
||||
list.remove(MONET)
|
||||
}
|
||||
@@ -39,7 +40,7 @@ enum class ColorScheme(
|
||||
}
|
||||
|
||||
fun safeValueOf(name: String): ColorScheme? {
|
||||
return enumValues<ColorScheme>().find { it.name == name }
|
||||
return ColorScheme.entries.find(name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ enum class NetworkPolicy(
|
||||
|
||||
fun from(key: String?, default: NetworkPolicy): NetworkPolicy {
|
||||
val intKey = key?.toIntOrNull() ?: return default
|
||||
return enumValues<NetworkPolicy>().find { it.key == intKey } ?: default
|
||||
return NetworkPolicy.entries.find { it.key == intKey } ?: default
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -519,7 +519,7 @@ class FastScroller @JvmOverloads constructor(
|
||||
|
||||
private fun TypedArray.getBubbleSize(@StyleableRes index: Int, defaultValue: BubbleSize): BubbleSize {
|
||||
val ordinal = getInt(index, -1)
|
||||
return BubbleSize.values().getOrNull(ordinal) ?: defaultValue
|
||||
return BubbleSize.entries.getOrNull(ordinal) ?: defaultValue
|
||||
}
|
||||
|
||||
private fun findValidParent(view: View): ViewGroup? = view.parents.firstNotNullOfOrNull { p ->
|
||||
|
||||
@@ -88,7 +88,7 @@ class ScrobblingInfoSheet :
|
||||
viewModel.updateScrobbling(
|
||||
index = scrobblerIndex,
|
||||
rating = requireViewBinding().ratingBar.rating / requireViewBinding().ratingBar.numStars,
|
||||
status = enumValues<ScrobblingStatus>().getOrNull(position),
|
||||
status = ScrobblingStatus.entries.getOrNull(position),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ class ScrobblingInfoSheet :
|
||||
viewModel.updateScrobbling(
|
||||
index = scrobblerIndex,
|
||||
rating = rating / ratingBar.numStars,
|
||||
status = enumValues<ScrobblingStatus>().getOrNull(requireViewBinding().spinnerStatus.selectedItemPosition),
|
||||
status = ScrobblingStatus.entries.getOrNull(requireViewBinding().spinnerStatus.selectedItemPosition),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.koitharu.kotatsu.favourites.domain.model
|
||||
|
||||
import org.koitharu.kotatsu.parsers.model.MangaSource
|
||||
import org.koitharu.kotatsu.parsers.util.find
|
||||
|
||||
class Cover(
|
||||
val url: String,
|
||||
@@ -8,7 +9,7 @@ class Cover(
|
||||
) {
|
||||
|
||||
val mangaSource: MangaSource?
|
||||
get() = if (source.isEmpty()) null else MangaSource.values().find { it.name == source }
|
||||
get() = if (source.isEmpty()) null else MangaSource.entries.find(source)
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
|
||||
@@ -38,7 +38,7 @@ class FavouritesListMenuProvider(
|
||||
|
||||
override fun onMenuItemSelected(menuItem: MenuItem): Boolean {
|
||||
if (menuItem.groupId == R.id.group_order) {
|
||||
val order = enumValues<SortOrder>()[menuItem.order]
|
||||
val order = SortOrder.entries[menuItem.order]
|
||||
viewModel.setSortOrder(order)
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ class HistoryListMenuProvider(
|
||||
override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) {
|
||||
menuInflater.inflate(R.menu.opt_history, menu)
|
||||
val subMenu = menu.findItem(R.id.action_order)?.subMenu ?: return
|
||||
for (order in HistoryOrder.values()) {
|
||||
for (order in HistoryOrder.entries) {
|
||||
subMenu.add(R.id.group_order, Menu.NONE, order.ordinal, order.titleResId)
|
||||
}
|
||||
subMenu.setGroupCheckable(R.id.group_order, true, true)
|
||||
@@ -31,7 +31,7 @@ class HistoryListMenuProvider(
|
||||
|
||||
override fun onMenuItemSelected(menuItem: MenuItem): Boolean {
|
||||
if (menuItem.groupId == R.id.group_order) {
|
||||
val order = enumValues<HistoryOrder>()[menuItem.order]
|
||||
val order = HistoryOrder.entries[menuItem.order]
|
||||
viewModel.setSortOrder(order)
|
||||
return true
|
||||
}
|
||||
@@ -51,7 +51,7 @@ class HistoryListMenuProvider(
|
||||
}
|
||||
|
||||
override fun onPrepareMenu(menu: Menu) {
|
||||
val order = viewModel.sortOrder.value ?: return
|
||||
val order = viewModel.sortOrder.value
|
||||
menu.findItem(R.id.action_order)?.subMenu?.forEach { item ->
|
||||
if (item.order == order.ordinal) {
|
||||
item.isChecked = true
|
||||
|
||||
@@ -21,7 +21,7 @@ class TypedListSpacingDecoration(
|
||||
state: RecyclerView.State
|
||||
) {
|
||||
val itemType = parent.getChildViewHolder(view)?.itemViewType?.let {
|
||||
ListItemType.values().getOrNull(it)
|
||||
ListItemType.entries.getOrNull(it)
|
||||
}
|
||||
when (itemType) {
|
||||
ListItemType.FILTER_SORT,
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.koitharu.kotatsu.parsers.model.MangaChapter
|
||||
import org.koitharu.kotatsu.parsers.model.MangaSource
|
||||
import org.koitharu.kotatsu.parsers.model.MangaState
|
||||
import org.koitharu.kotatsu.parsers.model.MangaTag
|
||||
import org.koitharu.kotatsu.parsers.util.find
|
||||
import org.koitharu.kotatsu.parsers.util.json.getBooleanOrDefault
|
||||
import org.koitharu.kotatsu.parsers.util.json.getLongOrDefault
|
||||
import org.koitharu.kotatsu.parsers.util.json.getStringOrNull
|
||||
@@ -67,7 +68,7 @@ class MangaIndex(source: String?) {
|
||||
isNsfw = json.getBooleanOrDefault("nsfw", false),
|
||||
coverUrl = json.getString("cover"),
|
||||
state = json.getStringOrNull("state")?.let { stateString ->
|
||||
MangaState.values().find { it.name == stateString }
|
||||
MangaState.entries.find(stateString)
|
||||
},
|
||||
description = json.getStringOrNull("description"),
|
||||
tags = json.getJSONArray("tags").mapJSONToSet { x ->
|
||||
|
||||
@@ -84,7 +84,7 @@ class ScrobblerConfigViewModel @Inject constructor(
|
||||
)
|
||||
}
|
||||
val grouped = list.groupBy { it.status }
|
||||
val statuses = enumValues<ScrobblingStatus>()
|
||||
val statuses = ScrobblingStatus.entries
|
||||
val result = ArrayList<ListModel>(list.size + statuses.size)
|
||||
for (st in statuses) {
|
||||
val subList = grouped[st]
|
||||
@@ -102,7 +102,7 @@ class ScrobblerConfigViewModel @Inject constructor(
|
||||
): ScrobblerService {
|
||||
val serviceId = savedStateHandle.get<Int>(ScrobblerConfigActivity.EXTRA_SERVICE_ID) ?: 0
|
||||
if (serviceId != 0) {
|
||||
return enumValues<ScrobblerService>().first { it.id == serviceId }
|
||||
return ScrobblerService.entries.first { it.id == serviceId }
|
||||
}
|
||||
val uri = savedStateHandle.require<Uri>(BaseActivity.EXTRA_DATA)
|
||||
return when (uri.host) {
|
||||
|
||||
@@ -49,7 +49,7 @@ class AppearanceSettingsFragment :
|
||||
}
|
||||
}
|
||||
findPreference<ListPreference>(AppSettings.KEY_LIST_MODE)?.run {
|
||||
entryValues = ListMode.values().names()
|
||||
entryValues = ListMode.entries.names()
|
||||
setDefaultValueCompat(ListMode.GRID.name)
|
||||
}
|
||||
findPreference<ActivityListPreference>(AppSettings.KEY_APP_LOCALE)?.run {
|
||||
|
||||
@@ -29,12 +29,7 @@ class NetworkSettingsFragment :
|
||||
addPreferencesFromResource(R.xml.pref_network)
|
||||
findPreference<Preference>(AppSettings.KEY_PREFETCH_CONTENT)?.isVisible = contentCache.isCachingEnabled
|
||||
findPreference<ListPreference>(AppSettings.KEY_DOH)?.run {
|
||||
entryValues = arrayOf(
|
||||
DoHProvider.NONE,
|
||||
DoHProvider.GOOGLE,
|
||||
DoHProvider.CLOUDFLARE,
|
||||
DoHProvider.ADGUARD,
|
||||
).names()
|
||||
entryValues = DoHProvider.entries.names()
|
||||
setDefaultValueCompat(DoHProvider.NONE.name)
|
||||
}
|
||||
bindProxySummary()
|
||||
|
||||
@@ -25,18 +25,18 @@ class ReaderSettingsFragment :
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
addPreferencesFromResource(R.xml.pref_reader)
|
||||
findPreference<ListPreference>(AppSettings.KEY_READER_MODE)?.run {
|
||||
entryValues = ReaderMode.values().names()
|
||||
entryValues = ReaderMode.entries.names()
|
||||
setDefaultValueCompat(ReaderMode.STANDARD.name)
|
||||
}
|
||||
findPreference<ListPreference>(AppSettings.KEY_READER_BACKGROUND)?.run {
|
||||
entryValues = ReaderBackground.values().names()
|
||||
entryValues = ReaderBackground.entries.names()
|
||||
setDefaultValueCompat(ReaderBackground.DEFAULT.name)
|
||||
}
|
||||
findPreference<MultiSelectListPreference>(AppSettings.KEY_READER_SWITCHERS)?.run {
|
||||
summaryProvider = MultiSummaryProvider(R.string.gestures_only)
|
||||
}
|
||||
findPreference<ListPreference>(AppSettings.KEY_ZOOM_MODE)?.run {
|
||||
entryValues = ZoomMode.values().names()
|
||||
entryValues = ZoomMode.entries.names()
|
||||
setDefaultValueCompat(ZoomMode.FIT_CENTER.name)
|
||||
}
|
||||
updateReaderModeDependency()
|
||||
|
||||
@@ -43,7 +43,7 @@ class UserDataSettingsViewModel @Inject constructor(
|
||||
private var storageUsageJob: Job? = null
|
||||
|
||||
init {
|
||||
CacheDir.values().forEach {
|
||||
CacheDir.entries.forEach {
|
||||
cacheSizes[it] = MutableStateFlow(-1L)
|
||||
}
|
||||
launchJob(Dispatchers.Default) {
|
||||
@@ -52,7 +52,7 @@ class UserDataSettingsViewModel @Inject constructor(
|
||||
launchJob(Dispatchers.Default) {
|
||||
feedItemsCount.value = trackingRepository.getLogsCount()
|
||||
}
|
||||
CacheDir.values().forEach { cache ->
|
||||
CacheDir.entries.forEach { cache ->
|
||||
launchJob(Dispatchers.Default) {
|
||||
checkNotNull(cacheSizes[cache]).value = storageManager.computeCacheSize(cache)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user