Address some build warnings

pull/2707/head
arkon 5 years ago
parent b3daf7d760
commit a0dffcf51f

@ -4,7 +4,7 @@ import android.content.Context
import android.content.SharedPreferences import android.content.SharedPreferences
import android.net.Uri import android.net.Uri
import android.os.Environment import android.os.Environment
import android.preference.PreferenceManager import androidx.preference.PreferenceManager
import com.f2prateek.rx.preferences.Preference import com.f2prateek.rx.preferences.Preference
import com.f2prateek.rx.preferences.RxSharedPreferences import com.f2prateek.rx.preferences.RxSharedPreferences
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R

@ -138,12 +138,12 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
/** /**
* Called when the activity is created. Initializes the presenter and configuration. * Called when the activity is created. Initializes the presenter and configuration.
*/ */
override fun onCreate(savedState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
setTheme(when (preferences.readerTheme().getOrDefault()) { setTheme(when (preferences.readerTheme().getOrDefault()) {
0 -> R.style.Theme_Reader_Light 0 -> R.style.Theme_Reader_Light
else -> R.style.Theme_Reader else -> R.style.Theme_Reader
}) })
super.onCreate(savedState) super.onCreate(savedInstanceState)
setContentView(R.layout.reader_activity) setContentView(R.layout.reader_activity)
if (presenter.needsInit()) { if (presenter.needsInit()) {
@ -159,8 +159,8 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
else presenter.init(manga, chapterUrl) else presenter.init(manga, chapterUrl)
} }
if (savedState != null) { if (savedInstanceState != null) {
menuVisible = savedState.getBoolean(::menuVisible.name) menuVisible = savedInstanceState.getBoolean(::menuVisible.name)
} }
config = ReaderConfig() config = ReaderConfig()

@ -14,6 +14,6 @@ fun launchUI(block: suspend CoroutineScope.() -> Unit): Job =
fun launchIO(block: suspend CoroutineScope.() -> Unit): Job = fun launchIO(block: suspend CoroutineScope.() -> Unit): Job =
GlobalScope.launch(Dispatchers.IO, CoroutineStart.DEFAULT, block) GlobalScope.launch(Dispatchers.IO, CoroutineStart.DEFAULT, block)
@UseExperimental(ExperimentalCoroutinesApi::class) @OptIn(ExperimentalCoroutinesApi::class)
fun launchNow(block: suspend CoroutineScope.() -> Unit): Job = fun launchNow(block: suspend CoroutineScope.() -> Unit): Job =
GlobalScope.launch(Dispatchers.Main, CoroutineStart.UNDISPATCHED, block) GlobalScope.launch(Dispatchers.Main, CoroutineStart.UNDISPATCHED, block)

@ -44,7 +44,7 @@ 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.
*/ */
@UseExperimental(ExperimentalStdlibApi::class) @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…
Cancel
Save