Address some build warnings

This commit is contained in:
arkon
2021-06-05 17:49:20 -04:00
parent 7c23212850
commit 71d225c562
19 changed files with 34 additions and 26 deletions

View File

@@ -86,6 +86,7 @@ class SearchController(
private val preferences: PreferencesHelper by injectLazy()
@Suppress("DEPRECATION")
override fun onCreateDialog(savedViewState: Bundle?): Dialog {
val prefValue = preferences.migrateFlags().get()

View File

@@ -188,6 +188,7 @@ class DownloadController :
onUpdateDownloadedPages(download)
}
Download.State.ERROR -> unsubscribeProgress(download)
else -> { /* unused */ }
}
}

View File

@@ -18,6 +18,7 @@ class ChangeMangaCoverDialog<T>(bundle: Bundle? = null) :
this.manga = manga
}
@Suppress("DEPRECATION")
override fun onCreateDialog(savedViewState: Bundle?): Dialog {
return MaterialDialog(activity!!)
.title(R.string.action_edit_cover)

View File

@@ -357,11 +357,12 @@ class MainActivity : BaseViewBindingActivity<MainActivityBinding>() {
return true
}
@Suppress("UNNECESSARY_SAFE_CALL")
override fun onDestroy() {
super.onDestroy()
// Binding sometimes isn't actually instantiated yet somehow
nav.setOnItemSelectedListener(null)
nav?.setOnItemSelectedListener(null)
binding?.toolbar.setNavigationOnClickListener(null)
}

View File

@@ -10,6 +10,7 @@ import eu.kanade.tachiyomi.ui.base.controller.openInBrowser
class WhatsNewDialogController(bundle: Bundle? = null) : DialogController(bundle) {
@Suppress("DEPRECATION")
override fun onCreateDialog(savedViewState: Bundle?): Dialog {
return MaterialDialog(activity!!)
.title(text = activity!!.getString(R.string.updated_version, BuildConfig.VERSION_NAME))

View File

@@ -40,6 +40,7 @@ class SetTrackReadingDatesDialog<T> : DialogController
dateToUpdate = ReadingDate.Start
}
@Suppress("DEPRECATION")
override fun onCreateDialog(savedViewState: Bundle?): Dialog {
return MaterialDialog(activity!!)
.title(
@@ -49,10 +50,10 @@ class SetTrackReadingDatesDialog<T> : DialogController
}
)
.datePicker(currentDate = getCurrentDate()) { _, date ->
listener?.setReadingDate(item, dateToUpdate, date.timeInMillis)
listener.setReadingDate(item, dateToUpdate, date.timeInMillis)
}
.neutralButton(R.string.action_remove) {
listener?.setReadingDate(item, dateToUpdate, 0L)
listener.setReadingDate(item, dateToUpdate, 0L)
}
}

View File

@@ -51,6 +51,7 @@ class TrackSearchDialog : DialogController {
service = Injekt.get<TrackManager>().getService(bundle.getInt(KEY_SERVICE))!!
}
@Suppress("DEPRECATION")
override fun onCreateDialog(savedViewState: Bundle?): Dialog {
binding = TrackSearchDialogBinding.inflate(LayoutInflater.from(activity!!))
val dialog = MaterialDialog(activity!!)

View File

@@ -19,9 +19,9 @@ class DirectoryPageLoader(val file: File) : PageLoader() {
*/
override fun getPages(): Observable<List<ReaderPage>> {
return file.listFiles()
.filter { !it.isDirectory && ImageUtil.isImage(it.name) { FileInputStream(it) } }
.sortedWith { f1, f2 -> f1.name.compareToCaseInsensitiveNaturalOrder(f2.name) }
.mapIndexed { i, file ->
?.filter { !it.isDirectory && ImageUtil.isImage(it.name) { FileInputStream(it) } }
?.sortedWith { f1, f2 -> f1.name.compareToCaseInsensitiveNaturalOrder(f2.name) }
?.mapIndexed { i, file ->
val streamFn = { FileInputStream(file) }
ReaderPage(i).apply {
stream = streamFn

View File

@@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.reader.viewer
import android.content.Context
import android.os.Handler
import android.os.Looper
import android.view.GestureDetector
import android.view.MotionEvent
import android.view.ViewConfiguration
@@ -16,7 +17,7 @@ open class GestureDetectorWithLongTap(
listener: Listener
) : GestureDetector(context, listener) {
private val handler = Handler()
private val handler = Handler(Looper.getMainLooper())
private val slop = ViewConfiguration.get(context).scaledTouchSlop
private val longTapTime = ViewConfiguration.getLongPressTimeout().toLong()
private val doubleTapTime = ViewConfiguration.getDoubleTapTimeout().toLong()

View File

@@ -2,8 +2,8 @@ package eu.kanade.tachiyomi.ui.setting
import android.app.Dialog
import android.os.Bundle
import android.os.Handler
import android.view.View
import androidx.core.content.ContextCompat
import androidx.core.text.buildSpannedString
import androidx.preference.PreferenceScreen
import com.afollestad.materialdialogs.MaterialDialog
@@ -171,7 +171,7 @@ class SettingsLibraryController : SettingsController() {
onChange {
// Post to event looper to allow the preference to be updated.
Handler().post { LibraryUpdateJob.setupTask(context) }
ContextCompat.getMainExecutor(context).execute { LibraryUpdateJob.setupTask(context) }
true
}

View File

@@ -138,6 +138,7 @@ class WebViewActivity : BaseViewBindingActivity<WebviewActivityBinding>() {
}
}
@Suppress("UNNECESSARY_SAFE_CALL")
override fun onDestroy() {
super.onDestroy()