LF to CRLF

This commit is contained in:
tom5079
2021-07-03 09:01:56 +09:00
parent 2a92d287af
commit 32d49833d8
7 changed files with 47 additions and 26 deletions

View File

@@ -65,13 +65,13 @@ android {
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar", "*.aar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.10"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.20"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0-RC"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.0"
implementation "androidx.appcompat:appcompat:1.3.0"
implementation "androidx.activity:activity-ktx:1.3.0-beta01"
implementation "androidx.fragment:fragment-ktx:1.3.4"
implementation "androidx.activity:activity-ktx:1.3.0-rc01"
implementation "androidx.fragment:fragment-ktx:1.3.5"
implementation "androidx.preference:preference-ktx:1.1.1"
implementation "androidx.recyclerview:recyclerview:1.2.1"
implementation "androidx.constraintlayout:constraintlayout:2.0.4"
@@ -110,7 +110,7 @@ dependencies {
implementation "ru.noties.markwon:core:3.1.0"
implementation "xyz.quaver:libpupil:2.1.0"
implementation "xyz.quaver:libpupil:2.1.2"
implementation "xyz.quaver:documentfilex:0.6.1"
implementation "xyz.quaver:floatingsearchview:1.1.7"
@@ -119,8 +119,8 @@ dependencies {
debugImplementation "com.squareup.leakcanary:leakcanary-android:2.6"
testImplementation "junit:junit:4.13.1"
androidTestImplementation "androidx.test.ext:junit:1.1.2"
androidTestImplementation "androidx.test:rules:1.3.0"
androidTestImplementation "androidx.test:runner:1.3.0"
androidTestImplementation "androidx.test.espresso:espresso-core:3.3.0"
androidTestImplementation "androidx.test.ext:junit:1.1.3"
androidTestImplementation "androidx.test:rules:1.4.0"
androidTestImplementation "androidx.test:runner:1.4.0"
androidTestImplementation "androidx.test.espresso:espresso-core:3.4.0"
}

View File

@@ -25,15 +25,13 @@ import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.orhanobut.logger.Logger
import kotlinx.coroutines.*
import okhttp3.Headers
import okhttp3.Headers.Companion.toHeaders
import okhttp3.Request
import org.kodein.di.DIAware
import org.kodein.di.android.x.closestDI
import org.kodein.di.android.x.di
import org.kodein.di.instance
import xyz.quaver.io.FileX
import xyz.quaver.pupil.adapters.ReaderItem
import xyz.quaver.pupil.sources.AnySource
import xyz.quaver.pupil.util.ImageCache
@@ -85,19 +83,32 @@ class ReaderViewModel(app: Application) : AndroidViewModel(app), DIAware {
val channel = cache.channels[image] ?: error("Channel is null")
channel.invokeOnClose { e ->
viewModelScope.launch {
if (e == null) {
_readerItems.value!![index] = ReaderItem(_readerItems.value!![index].progress, Uri.fromFile(file))
_readerItems.notify()
if (channel.isClosedForReceive) {
_readerItems.value!![index] =
ReaderItem(_readerItems.value!![index].progress, Uri.fromFile(file))
_readerItems.notify()
} else {
channel.invokeOnClose { e ->
viewModelScope.launch {
if (e == null) {
_readerItems.value!![index] =
ReaderItem(_readerItems.value!![index].progress, Uri.fromFile(file))
_readerItems.notify()
} else {
Logger.e(index.toString())
Logger.e(e, e.message ?: "")
}
}
}
}
launch {
for (progress in channel) {
_readerItems.value!![index] = ReaderItem(progress, _readerItems.value!![index].image)
_readerItems.notify()
launch {
kotlin.runCatching {
for (progress in channel) {
_readerItems.value!![index] =
ReaderItem(progress, _readerItems.value!![index].image)
_readerItems.notify()
}
}
}
}
}