mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 03:01:49 +01:00
Fix many compilation warnings
This commit is contained in:
parent
827792c4f0
commit
4ae00c80ca
@ -84,9 +84,6 @@ class BackupCreateService : IntentService(NAME) {
|
||||
// Create root object
|
||||
val root = JsonObject()
|
||||
|
||||
// Create information object
|
||||
val information = JsonObject()
|
||||
|
||||
// Create manga array
|
||||
val mangaEntries = JsonArray()
|
||||
|
||||
|
@ -317,8 +317,8 @@ class BackupRestoreService : Service() {
|
||||
manga
|
||||
}
|
||||
.filter { it.id != null }
|
||||
.flatMap { manga ->
|
||||
chapterFetchObservable(source, manga, chapters)
|
||||
.flatMap {
|
||||
chapterFetchObservable(source, it, chapters)
|
||||
// Convert to the manga that contains new chapters.
|
||||
.map { manga }
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ class DownloadService : Service() {
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({ state -> onNetworkStateChanged(state)
|
||||
}, { error ->
|
||||
}, { _ ->
|
||||
toast(R.string.download_queue_error)
|
||||
stopSelf()
|
||||
})
|
||||
|
@ -287,7 +287,7 @@ class Downloader(private val context: Context, private val provider: DownloadPro
|
||||
}
|
||||
|
||||
return pageListObservable
|
||||
.doOnNext { pages ->
|
||||
.doOnNext { _ ->
|
||||
// Delete all temporary (unfinished) files
|
||||
tmpDir.listFiles()
|
||||
?.filter { it.name!!.endsWith(".tmp") }
|
||||
@ -303,7 +303,7 @@ class Downloader(private val context: Context, private val provider: DownloadPro
|
||||
// Do when page is downloaded.
|
||||
.doOnNext { notifier.onProgressChange(download, queue) }
|
||||
.toList()
|
||||
.map { pages -> download }
|
||||
.map { _ -> download }
|
||||
// Do after download completes
|
||||
.doOnNext { ensureSuccessfulDownload(download, tmpDir, chapterDirname) }
|
||||
// If the page list threw, it will resume here
|
||||
|
@ -17,7 +17,7 @@ class PersistentCookieStore(context: Context) {
|
||||
val cookies = value as? Set<String>
|
||||
if (cookies != null) {
|
||||
try {
|
||||
val url = HttpUrl.parse("http://$key")
|
||||
val url = HttpUrl.parse("http://$key") ?: continue
|
||||
val nonExpiredCookies = cookies.mapNotNull { Cookie.parse(url, it) }
|
||||
.filter { !it.hasExpired() }
|
||||
cookieMap.put(key, nonExpiredCookies)
|
||||
|
@ -76,13 +76,13 @@ class LocalSource(private val context: Context) : CatalogueSource {
|
||||
val state = ((if (filters.isEmpty()) POPULAR_FILTERS else filters)[0] as OrderBy).state
|
||||
when (state?.index) {
|
||||
0 -> {
|
||||
if (state!!.ascending)
|
||||
if (state.ascending)
|
||||
mangaDirs = mangaDirs.sortedBy { it.name.toLowerCase(Locale.ENGLISH) }
|
||||
else
|
||||
mangaDirs = mangaDirs.sortedByDescending { it.name.toLowerCase(Locale.ENGLISH) }
|
||||
}
|
||||
1 -> {
|
||||
if (state!!.ascending)
|
||||
if (state.ascending)
|
||||
mangaDirs = mangaDirs.sortedBy(File::lastModified)
|
||||
else
|
||||
mangaDirs = mangaDirs.sortedByDescending(File::lastModified)
|
||||
|
@ -32,8 +32,8 @@ open class SelectItem(val filter: Filter.Select<*>) : AbstractFlexibleItem<Selec
|
||||
android.R.layout.simple_spinner_item, filter.values).apply {
|
||||
setDropDownViewResource(R.layout.common_spinner_item)
|
||||
}
|
||||
spinner.onItemSelectedListener = IgnoreFirstSpinnerListener { position ->
|
||||
filter.state = position
|
||||
spinner.onItemSelectedListener = IgnoreFirstSpinnerListener { pos ->
|
||||
filter.state = pos
|
||||
}
|
||||
spinner.setSelection(filter.state)
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ class DownloadPresenter : BasePresenter<DownloadController>() {
|
||||
downloadQueue.getUpdatedObservable()
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.map { ArrayList(it) }
|
||||
.subscribeLatestCache(DownloadController::onNextDownloads, { view, error ->
|
||||
.subscribeLatestCache(DownloadController::onNextDownloads, { _, error ->
|
||||
Timber.e(error)
|
||||
})
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ class TrackPresenter(
|
||||
.toList()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeFirst({ view, result -> view.onRefreshDone() },
|
||||
.subscribeFirst({ view, _ -> view.onRefreshDone() },
|
||||
TrackController::onRefreshError)
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ class TrackPresenter(
|
||||
.flatMap { db.insertTrack(track).asRxObservable() }
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeFirst({ view, result -> view.onRefreshDone() },
|
||||
.subscribeFirst({ view, _ -> view.onRefreshDone() },
|
||||
{ view, error ->
|
||||
view.onRefreshError(error)
|
||||
|
||||
|
@ -176,8 +176,8 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
|
||||
.content(getString(R.string.confirm_update_manga_sync, chapterToUpdate))
|
||||
.positiveText(android.R.string.yes)
|
||||
.negativeText(android.R.string.no)
|
||||
.onPositive { dialog, which -> presenter.updateTrackLastChapterRead(chapterToUpdate) }
|
||||
.onAny { dialog1, which1 -> super.onBackPressed() }
|
||||
.onPositive { _, _ -> presenter.updateTrackLastChapterRead(chapterToUpdate) }
|
||||
.onAny { _, _ -> super.onBackPressed() }
|
||||
.show()
|
||||
} else {
|
||||
presenter.updateTrackLastChapterRead(chapterToUpdate)
|
||||
@ -237,7 +237,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
|
||||
.title(getString(R.string.options))
|
||||
.items(R.array.reader_image_options)
|
||||
.itemsIds(R.array.reader_image_options_values)
|
||||
.itemsCallback { materialDialog, view, i, charSequence ->
|
||||
.itemsCallback { _, _, i, _ ->
|
||||
when (i) {
|
||||
0 -> setImageAsCover(page)
|
||||
1 -> shareImage(page)
|
||||
@ -378,7 +378,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
|
||||
|
||||
private fun initializeBottomMenu() {
|
||||
// Intercept all events in this layout
|
||||
reader_menu_bottom.setOnTouchListener { v, event -> true }
|
||||
reader_menu_bottom.setOnTouchListener { _, _ -> true }
|
||||
|
||||
page_seekbar.setOnSeekBarChangeListener(object : SimpleSeekBarListener() {
|
||||
override fun onProgressChanged(seekBar: SeekBar, value: Int, fromUser: Boolean) {
|
||||
@ -595,7 +595,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
|
||||
.content(getString(R.string.confirm_set_image_as_cover))
|
||||
.positiveText(android.R.string.yes)
|
||||
.negativeText(android.R.string.no)
|
||||
.onPositive { dialog, which -> presenter.setImageAsCover(page) }
|
||||
.onPositive { _, _ -> presenter.setImageAsCover(page) }
|
||||
.show()
|
||||
|
||||
}
|
||||
|
@ -106,12 +106,12 @@ class ReaderCustomFilterDialog : DialogFragment() {
|
||||
|
||||
// Set listeners
|
||||
switch_color_filter.isChecked = preferences.colorFilter().getOrDefault()
|
||||
switch_color_filter.setOnCheckedChangeListener { v, isChecked ->
|
||||
switch_color_filter.setOnCheckedChangeListener { _, isChecked ->
|
||||
preferences.colorFilter().set(isChecked)
|
||||
}
|
||||
|
||||
custom_brightness.isChecked = preferences.customBrightness().getOrDefault()
|
||||
custom_brightness.setOnCheckedChangeListener { v, isChecked ->
|
||||
custom_brightness.setOnCheckedChangeListener { _, isChecked ->
|
||||
preferences.customBrightness().set(isChecked)
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ class ReaderPresenter(
|
||||
|
||||
restartableLatestCache(LOAD_ACTIVE_CHAPTER,
|
||||
{ loadChapterObservable(chapter) },
|
||||
{ view, chapter -> view.onChapterReady(this.chapter) },
|
||||
{ view, _ -> view.onChapterReady(this.chapter) },
|
||||
{ view, error -> view.onChapterError(error) })
|
||||
|
||||
if (savedState == null) {
|
||||
@ -314,7 +314,7 @@ class ReaderPresenter(
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeLatestCache({ view, chapter ->
|
||||
view.onAppendChapter(chapter)
|
||||
}, { view, error ->
|
||||
}, { view, _ ->
|
||||
view.onChapterAppendError()
|
||||
})
|
||||
}
|
||||
|
@ -75,17 +75,17 @@ class ReaderSettingsDialog : DialogFragment() {
|
||||
background_color.setSelection(preferences.readerTheme().getOrDefault(), false)
|
||||
|
||||
show_page_number.isChecked = preferences.showPageNumber().getOrDefault()
|
||||
show_page_number.setOnCheckedChangeListener { v, isChecked ->
|
||||
show_page_number.setOnCheckedChangeListener { _, isChecked ->
|
||||
preferences.showPageNumber().set(isChecked)
|
||||
}
|
||||
|
||||
fullscreen.isChecked = preferences.fullscreen().getOrDefault()
|
||||
fullscreen.setOnCheckedChangeListener { v, isChecked ->
|
||||
fullscreen.setOnCheckedChangeListener { _, isChecked ->
|
||||
preferences.fullscreen().set(isChecked)
|
||||
}
|
||||
|
||||
crop_borders.isChecked = preferences.cropBorders().getOrDefault()
|
||||
crop_borders.setOnCheckedChangeListener { v, isChecked ->
|
||||
crop_borders.setOnCheckedChangeListener { _, isChecked ->
|
||||
preferences.cropBorders().set(isChecked)
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ class PageView @JvmOverloads constructor(context: Context, attrs: AttributeSet?
|
||||
setBitmapDecoderClass(reader.bitmapDecoderClass)
|
||||
setVerticalScrollingParent(reader is VerticalReader)
|
||||
setCropBorders(reader.cropBorders)
|
||||
setOnTouchListener { v, motionEvent -> reader.gestureDetector.onTouchEvent(motionEvent) }
|
||||
setOnTouchListener { _, motionEvent -> reader.gestureDetector.onTouchEvent(motionEvent) }
|
||||
setOnLongClickListener { reader.onLongClick(page) }
|
||||
setOnImageEventListener(object : SubsamplingScaleImageView.DefaultOnImageEventListener() {
|
||||
override fun onReady() {
|
||||
@ -83,7 +83,7 @@ class PageView @JvmOverloads constructor(context: Context, attrs: AttributeSet?
|
||||
})
|
||||
}
|
||||
|
||||
retry_button.setOnTouchListener { v, event ->
|
||||
retry_button.setOnTouchListener { _, event ->
|
||||
if (event.action == MotionEvent.ACTION_UP) {
|
||||
activity.presenter.retryPage(page)
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ class WebtoonAdapter(val fragment: WebtoonReader) : RecyclerView.Adapter<Webtoon
|
||||
/**
|
||||
* Touch listener for images in holders.
|
||||
*/
|
||||
val touchListener = View.OnTouchListener { v, ev -> fragment.imageGestureDetector.onTouchEvent(ev) }
|
||||
val touchListener = View.OnTouchListener { _, ev -> fragment.imageGestureDetector.onTouchEvent(ev) }
|
||||
|
||||
/**
|
||||
* Returns the number of pages.
|
||||
|
@ -30,7 +30,7 @@ class AnilistLoginActivity : AppCompatActivity() {
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({
|
||||
returnToSettings()
|
||||
}, { error ->
|
||||
}, { _ ->
|
||||
returnToSettings()
|
||||
})
|
||||
} else {
|
||||
|
@ -143,6 +143,7 @@ fun Context.unregisterLocalReceiver(receiver: BroadcastReceiver) {
|
||||
fun Context.isServiceRunning(serviceClass: Class<*>): Boolean {
|
||||
val className = serviceClass.name
|
||||
val manager = getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
|
||||
@Suppress("DEPRECATION")
|
||||
return manager.getRunningServices(Integer.MAX_VALUE)
|
||||
.any { className == it.service.className }
|
||||
}
|
@ -10,15 +10,16 @@ abstract class FABAnimationBase : FloatingActionButton.Behavior() {
|
||||
var isAnimatingOut = false
|
||||
|
||||
override fun onStartNestedScroll(coordinatorLayout: CoordinatorLayout, child: FloatingActionButton,
|
||||
directTargetChild: View, target: View, nestedScrollAxes: Int): Boolean {
|
||||
directTargetChild: View, target: View, axes: Int, type: Int): Boolean {
|
||||
// Ensure we react to vertical scrolling
|
||||
return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL ||
|
||||
super.onStartNestedScroll(coordinatorLayout, child, directTargetChild, target, nestedScrollAxes)
|
||||
return axes == ViewCompat.SCROLL_AXIS_VERTICAL ||
|
||||
super.onStartNestedScroll(coordinatorLayout, child, directTargetChild, target, axes, type)
|
||||
}
|
||||
|
||||
override fun onNestedScroll(coordinatorLayout: CoordinatorLayout, child: FloatingActionButton, target: View,
|
||||
dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int, dyUnconsumed: Int) {
|
||||
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed)
|
||||
override fun onNestedScroll(coordinatorLayout: CoordinatorLayout, child: FloatingActionButton,
|
||||
target: View, dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int,
|
||||
dyUnconsumed: Int, type: Int) {
|
||||
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, type)
|
||||
if (dyConsumed > 0 && !isAnimatingOut && child.visibility == View.VISIBLE) {
|
||||
// User scrolled down and the FAB is currently visible -> hide the FAB
|
||||
animateOut(child)
|
||||
|
@ -9,6 +9,7 @@ import android.view.animation.Animation
|
||||
import android.view.animation.AnimationUtils
|
||||
import eu.kanade.tachiyomi.R
|
||||
|
||||
@Suppress("unused", "UNUSED_PARAMETER")
|
||||
class FABAnimationUpDown @JvmOverloads constructor(ctx: Context, attrs: AttributeSet? = null) : FABAnimationBase() {
|
||||
|
||||
private val INTERPOLATOR = FastOutSlowInInterpolator()
|
||||
|
@ -48,6 +48,7 @@ open class SimpleNavigationView @JvmOverloads constructor(
|
||||
R.styleable.NavigationView_elevation, 0).toFloat())
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
ViewCompat.setFitsSystemWindows(this,
|
||||
a.getBoolean(R.styleable.NavigationView_android_fitsSystemWindows, false))
|
||||
|
||||
@ -61,6 +62,7 @@ open class SimpleNavigationView @JvmOverloads constructor(
|
||||
/**
|
||||
* Overriden to measure the width of the navigation view.
|
||||
*/
|
||||
@SuppressLint("SwitchIntDef")
|
||||
override fun onMeasure(widthSpec: Int, heightSpec: Int) {
|
||||
val width = when (MeasureSpec.getMode(widthSpec)) {
|
||||
MeasureSpec.AT_MOST -> MeasureSpec.makeMeasureSpec(
|
||||
|
@ -31,14 +31,14 @@ abstract class LoginDialogPreference(bundle: Bundle? = null) : DialogController(
|
||||
.negativeText(android.R.string.cancel)
|
||||
.build()
|
||||
|
||||
onViewCreated(dialog.view, savedState)
|
||||
onViewCreated(dialog.view)
|
||||
|
||||
return dialog
|
||||
}
|
||||
|
||||
fun onViewCreated(view: View, savedState: Bundle?) {
|
||||
fun onViewCreated(view: View) {
|
||||
v = view.apply {
|
||||
show_password.setOnCheckedChangeListener { v, isChecked ->
|
||||
show_password.setOnCheckedChangeListener { _, isChecked ->
|
||||
if (isChecked)
|
||||
password.transformationMethod = null
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user