mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-21 20:47:03 -05:00
Set preview/experimental compiler flags instead of using annotations
This commit is contained in:
parent
1140316d1b
commit
781971ee81
15 changed files with 8 additions and 35 deletions
|
@ -309,7 +309,14 @@ repositories {
|
||||||
|
|
||||||
// See https://kotlinlang.org/docs/reference/experimental.html#experimental-status-of-experimental-api-markers
|
// See https://kotlinlang.org/docs/reference/experimental.html#experimental-status-of-experimental-api-markers
|
||||||
tasks.withType(AbstractKotlinCompile).all {
|
tasks.withType(AbstractKotlinCompile).all {
|
||||||
kotlinOptions.freeCompilerArgs += ["-Xopt-in=kotlin.Experimental"]
|
kotlinOptions.freeCompilerArgs += [
|
||||||
|
"-Xopt-in=kotlin.Experimental",
|
||||||
|
"-Xopt-in=kotlin.RequiresOptIn",
|
||||||
|
"-Xuse-experimental=kotlin.ExperimentalStdlibApi",
|
||||||
|
"-Xuse-experimental=kotlinx.coroutines.FlowPreview",
|
||||||
|
"-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi",
|
||||||
|
"-Xuse-experimental=kotlinx.serialization.ExperimentalSerializationApi",
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
// Duplicating Hebrew string assets due to some locale code issues on different devices
|
// Duplicating Hebrew string assets due to some locale code issues on different devices
|
||||||
|
|
|
@ -1,13 +1,8 @@
|
||||||
package eu.kanade.tachiyomi.data.backup.full.models
|
package eu.kanade.tachiyomi.data.backup.full.models
|
||||||
|
|
||||||
import kotlinx.serialization.ExperimentalSerializationApi
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.protobuf.ProtoNumber
|
import kotlinx.serialization.protobuf.ProtoNumber
|
||||||
|
|
||||||
/**
|
|
||||||
* Backup json model
|
|
||||||
*/
|
|
||||||
@ExperimentalSerializationApi
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class Backup(
|
data class Backup(
|
||||||
@ProtoNumber(1) val backupManga: List<BackupManga>,
|
@ProtoNumber(1) val backupManga: List<BackupManga>,
|
||||||
|
|
|
@ -2,11 +2,9 @@ package eu.kanade.tachiyomi.data.backup.full.models
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.data.database.models.Category
|
import eu.kanade.tachiyomi.data.database.models.Category
|
||||||
import eu.kanade.tachiyomi.data.database.models.CategoryImpl
|
import eu.kanade.tachiyomi.data.database.models.CategoryImpl
|
||||||
import kotlinx.serialization.ExperimentalSerializationApi
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.protobuf.ProtoNumber
|
import kotlinx.serialization.protobuf.ProtoNumber
|
||||||
|
|
||||||
@ExperimentalSerializationApi
|
|
||||||
@Serializable
|
@Serializable
|
||||||
class BackupCategory(
|
class BackupCategory(
|
||||||
@ProtoNumber(1) var name: String,
|
@ProtoNumber(1) var name: String,
|
||||||
|
|
|
@ -2,11 +2,9 @@ package eu.kanade.tachiyomi.data.backup.full.models
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.data.database.models.Chapter
|
import eu.kanade.tachiyomi.data.database.models.Chapter
|
||||||
import eu.kanade.tachiyomi.data.database.models.ChapterImpl
|
import eu.kanade.tachiyomi.data.database.models.ChapterImpl
|
||||||
import kotlinx.serialization.ExperimentalSerializationApi
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.protobuf.ProtoNumber
|
import kotlinx.serialization.protobuf.ProtoNumber
|
||||||
|
|
||||||
@ExperimentalSerializationApi
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class BackupChapter(
|
data class BackupChapter(
|
||||||
// in 1.x some of these values have different names
|
// in 1.x some of these values have different names
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
package eu.kanade.tachiyomi.data.backup.full.models
|
package eu.kanade.tachiyomi.data.backup.full.models
|
||||||
|
|
||||||
import kotlinx.serialization.ExperimentalSerializationApi
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.protobuf.ProtoNumber
|
import kotlinx.serialization.protobuf.ProtoNumber
|
||||||
|
|
||||||
@ExperimentalSerializationApi
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class BackupHistory(
|
data class BackupHistory(
|
||||||
@ProtoNumber(0) var url: String,
|
@ProtoNumber(0) var url: String,
|
||||||
|
|
|
@ -4,11 +4,9 @@ import eu.kanade.tachiyomi.data.database.models.ChapterImpl
|
||||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||||
import eu.kanade.tachiyomi.data.database.models.MangaImpl
|
import eu.kanade.tachiyomi.data.database.models.MangaImpl
|
||||||
import eu.kanade.tachiyomi.data.database.models.TrackImpl
|
import eu.kanade.tachiyomi.data.database.models.TrackImpl
|
||||||
import kotlinx.serialization.ExperimentalSerializationApi
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.protobuf.ProtoNumber
|
import kotlinx.serialization.protobuf.ProtoNumber
|
||||||
|
|
||||||
@ExperimentalSerializationApi
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class BackupManga(
|
data class BackupManga(
|
||||||
// in 1.x some of these values have different names
|
// in 1.x some of these values have different names
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package eu.kanade.tachiyomi.data.backup.full.models
|
package eu.kanade.tachiyomi.data.backup.full.models
|
||||||
|
|
||||||
import kotlinx.serialization.ExperimentalSerializationApi
|
|
||||||
import kotlinx.serialization.Serializer
|
import kotlinx.serialization.Serializer
|
||||||
|
|
||||||
@ExperimentalSerializationApi
|
|
||||||
@Serializer(forClass = Backup::class)
|
@Serializer(forClass = Backup::class)
|
||||||
object BackupSerializer
|
object BackupSerializer
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
package eu.kanade.tachiyomi.data.backup.full.models
|
package eu.kanade.tachiyomi.data.backup.full.models
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.source.Source
|
import eu.kanade.tachiyomi.source.Source
|
||||||
import kotlinx.serialization.ExperimentalSerializationApi
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.protobuf.ProtoNumber
|
import kotlinx.serialization.protobuf.ProtoNumber
|
||||||
|
|
||||||
@ExperimentalSerializationApi
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class BackupSource(
|
data class BackupSource(
|
||||||
@ProtoNumber(0) var name: String = "",
|
@ProtoNumber(0) var name: String = "",
|
||||||
|
|
|
@ -2,11 +2,9 @@ package eu.kanade.tachiyomi.data.backup.full.models
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.data.database.models.Track
|
import eu.kanade.tachiyomi.data.database.models.Track
|
||||||
import eu.kanade.tachiyomi.data.database.models.TrackImpl
|
import eu.kanade.tachiyomi.data.database.models.TrackImpl
|
||||||
import kotlinx.serialization.ExperimentalSerializationApi
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.protobuf.ProtoNumber
|
import kotlinx.serialization.protobuf.ProtoNumber
|
||||||
|
|
||||||
@ExperimentalSerializationApi
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class BackupTracking(
|
data class BackupTracking(
|
||||||
// in 1.x some of these values have different types or names
|
// in 1.x some of these values have different types or names
|
||||||
|
|
|
@ -11,7 +11,6 @@ import eu.kanade.tachiyomi.ui.manga.MangaController
|
||||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.flow.launchIn
|
import kotlinx.coroutines.flow.launchIn
|
||||||
import kotlinx.coroutines.flow.merge
|
import kotlinx.coroutines.flow.merge
|
||||||
|
@ -53,7 +52,6 @@ class MangaChaptersHeaderAdapter(
|
||||||
}
|
}
|
||||||
|
|
||||||
inner class HeaderViewHolder(private val view: View) : RecyclerView.ViewHolder(view) {
|
inner class HeaderViewHolder(private val view: View) : RecyclerView.ViewHolder(view) {
|
||||||
@ExperimentalCoroutinesApi
|
|
||||||
fun bind() {
|
fun bind() {
|
||||||
binding.chaptersLabel.text = if (numChapters == null) {
|
binding.chaptersLabel.text = if (numChapters == null) {
|
||||||
view.context.getString(R.string.chapters)
|
view.context.getString(R.string.chapters)
|
||||||
|
|
|
@ -25,7 +25,6 @@ import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||||
import eu.kanade.tachiyomi.util.view.setChips
|
import eu.kanade.tachiyomi.util.view.setChips
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.flow.launchIn
|
import kotlinx.coroutines.flow.launchIn
|
||||||
import kotlinx.coroutines.flow.merge
|
import kotlinx.coroutines.flow.merge
|
||||||
|
@ -204,7 +203,6 @@ class MangaInfoHeaderAdapter(
|
||||||
* @param manga manga object containing information about manga.
|
* @param manga manga object containing information about manga.
|
||||||
* @param source the source of the manga.
|
* @param source the source of the manga.
|
||||||
*/
|
*/
|
||||||
@ExperimentalCoroutinesApi
|
|
||||||
private fun setMangaInfo(manga: Manga, source: Source?) {
|
private fun setMangaInfo(manga: Manga, source: Source?) {
|
||||||
// Update full title TextView.
|
// Update full title TextView.
|
||||||
binding.mangaFullTitle.text = if (manga.title.isBlank()) {
|
binding.mangaFullTitle.text = if (manga.title.isBlank()) {
|
||||||
|
|
|
@ -17,7 +17,6 @@ import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
||||||
import kotlinx.android.synthetic.main.track_search_dialog.view.progress
|
import kotlinx.android.synthetic.main.track_search_dialog.view.progress
|
||||||
import kotlinx.android.synthetic.main.track_search_dialog.view.track_search
|
import kotlinx.android.synthetic.main.track_search_dialog.view.track_search
|
||||||
import kotlinx.android.synthetic.main.track_search_dialog.view.track_search_list
|
import kotlinx.android.synthetic.main.track_search_dialog.view.track_search_list
|
||||||
import kotlinx.coroutines.FlowPreview
|
|
||||||
import kotlinx.coroutines.flow.debounce
|
import kotlinx.coroutines.flow.debounce
|
||||||
import kotlinx.coroutines.flow.filter
|
import kotlinx.coroutines.flow.filter
|
||||||
import kotlinx.coroutines.flow.launchIn
|
import kotlinx.coroutines.flow.launchIn
|
||||||
|
@ -95,7 +94,6 @@ class TrackSearchDialog : DialogController {
|
||||||
adapter = null
|
adapter = null
|
||||||
}
|
}
|
||||||
|
|
||||||
@FlowPreview
|
|
||||||
override fun onAttach(view: View) {
|
override fun onAttach(view: View) {
|
||||||
super.onAttach(view)
|
super.onAttach(view)
|
||||||
dialogView!!.track_search.textChanges()
|
dialogView!!.track_search.textChanges()
|
||||||
|
|
|
@ -57,7 +57,6 @@ import eu.kanade.tachiyomi.util.view.showBar
|
||||||
import eu.kanade.tachiyomi.util.view.snack
|
import eu.kanade.tachiyomi.util.view.snack
|
||||||
import eu.kanade.tachiyomi.widget.SimpleAnimationListener
|
import eu.kanade.tachiyomi.widget.SimpleAnimationListener
|
||||||
import eu.kanade.tachiyomi.widget.SimpleSeekBarListener
|
import eu.kanade.tachiyomi.widget.SimpleSeekBarListener
|
||||||
import kotlinx.coroutines.FlowPreview
|
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.flow.drop
|
import kotlinx.coroutines.flow.drop
|
||||||
import kotlinx.coroutines.flow.launchIn
|
import kotlinx.coroutines.flow.launchIn
|
||||||
|
@ -653,7 +652,6 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
||||||
/**
|
/**
|
||||||
* Class that handles the user preferences of the reader.
|
* Class that handles the user preferences of the reader.
|
||||||
*/
|
*/
|
||||||
@FlowPreview
|
|
||||||
private inner class ReaderConfig {
|
private inner class ReaderConfig {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -774,7 +772,6 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
||||||
/**
|
/**
|
||||||
* Sets the custom brightness overlay according to [enabled].
|
* Sets the custom brightness overlay according to [enabled].
|
||||||
*/
|
*/
|
||||||
@FlowPreview
|
|
||||||
private fun setCustomBrightness(enabled: Boolean) {
|
private fun setCustomBrightness(enabled: Boolean) {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
preferences.customBrightnessValue().asFlow()
|
preferences.customBrightnessValue().asFlow()
|
||||||
|
@ -789,7 +786,6 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
||||||
/**
|
/**
|
||||||
* Sets the color filter overlay according to [enabled].
|
* Sets the color filter overlay according to [enabled].
|
||||||
*/
|
*/
|
||||||
@FlowPreview
|
|
||||||
private fun setColorFilter(enabled: Boolean) {
|
private fun setColorFilter(enabled: Boolean) {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
preferences.colorFilterValue().asFlow()
|
preferences.colorFilterValue().asFlow()
|
||||||
|
|
|
@ -32,7 +32,6 @@ import kotlin.coroutines.resumeWithException
|
||||||
* Util functions for bridging RxJava and coroutines. Taken from TachiyomiEH/SY.
|
* Util functions for bridging RxJava and coroutines. Taken from TachiyomiEH/SY.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ExperimentalCoroutinesApi
|
|
||||||
suspend fun <T> Single<T>.await(subscribeOn: Scheduler? = null): T {
|
suspend fun <T> Single<T>.await(subscribeOn: Scheduler? = null): T {
|
||||||
return suspendCancellableCoroutine { continuation ->
|
return suspendCancellableCoroutine { continuation ->
|
||||||
val self = if (subscribeOn != null) subscribeOn(subscribeOn) else this
|
val self = if (subscribeOn != null) subscribeOn(subscribeOn) else this
|
||||||
|
@ -59,7 +58,6 @@ suspend fun <T> Single<T>.await(subscribeOn: Scheduler? = null): T {
|
||||||
suspend fun <T> PreparedOperation<T>.await(): T = asRxSingle().await()
|
suspend fun <T> PreparedOperation<T>.await(): T = asRxSingle().await()
|
||||||
suspend fun <T> PreparedGetObject<T>.await(): T? = asRxSingle().await()
|
suspend fun <T> PreparedGetObject<T>.await(): T? = asRxSingle().await()
|
||||||
|
|
||||||
@ExperimentalCoroutinesApi
|
|
||||||
suspend fun Completable.awaitSuspending(subscribeOn: Scheduler? = null) {
|
suspend fun Completable.awaitSuspending(subscribeOn: Scheduler? = null) {
|
||||||
return suspendCancellableCoroutine { continuation ->
|
return suspendCancellableCoroutine { continuation ->
|
||||||
val self = if (subscribeOn != null) subscribeOn(subscribeOn) else this
|
val self = if (subscribeOn != null) subscribeOn(subscribeOn) else this
|
||||||
|
@ -183,7 +181,6 @@ private suspend fun <T> Observable<T>.awaitOne(): T = suspendCancellableCoroutin
|
||||||
internal fun <T> CancellableContinuation<T>.unsubscribeOnCancellation(sub: Subscription) =
|
internal fun <T> CancellableContinuation<T>.unsubscribeOnCancellation(sub: Subscription) =
|
||||||
invokeOnCancellation { sub.unsubscribe() }
|
invokeOnCancellation { sub.unsubscribe() }
|
||||||
|
|
||||||
@ExperimentalCoroutinesApi
|
|
||||||
fun <T : Any> Observable<T>.asFlow(): Flow<T> = callbackFlow {
|
fun <T : Any> Observable<T>.asFlow(): Flow<T> = callbackFlow {
|
||||||
val observer = object : Observer<T> {
|
val observer = object : Observer<T> {
|
||||||
override fun onNext(t: T) {
|
override fun onNext(t: T) {
|
||||||
|
@ -202,7 +199,6 @@ fun <T : Any> Observable<T>.asFlow(): Flow<T> = callbackFlow {
|
||||||
awaitClose { subscription.unsubscribe() }
|
awaitClose { subscription.unsubscribe() }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExperimentalCoroutinesApi
|
|
||||||
fun <T : Any> Flow<T>.asObservable(backpressureMode: Emitter.BackpressureMode = Emitter.BackpressureMode.NONE): Observable<T> {
|
fun <T : Any> Flow<T>.asObservable(backpressureMode: Emitter.BackpressureMode = Emitter.BackpressureMode.NONE): Observable<T> {
|
||||||
return Observable.create(
|
return Observable.create(
|
||||||
{ emitter ->
|
{ emitter ->
|
||||||
|
|
|
@ -48,7 +48,6 @@ fun String.byteSize(): Int {
|
||||||
* Returns a string containing the first [n] bytes from this string, or the entire string if this
|
* Returns a string containing the first [n] bytes from this string, or the entire string if this
|
||||||
* string is shorter.
|
* string is shorter.
|
||||||
*/
|
*/
|
||||||
@OptIn(ExperimentalStdlibApi::class)
|
|
||||||
fun String.takeBytes(n: Int): String {
|
fun String.takeBytes(n: Int): String {
|
||||||
val bytes = toByteArray(Charsets.UTF_8)
|
val bytes = toByteArray(Charsets.UTF_8)
|
||||||
return if (bytes.size <= n) {
|
return if (bytes.size <= n) {
|
||||||
|
|
Loading…
Reference in a new issue