Bump dependencies + compile SDK to 33 + linting

This commit is contained in:
arkon 2022-08-13 12:46:00 -04:00
parent be33a57d43
commit 3966a917ee
26 changed files with 128 additions and 114 deletions

View File

@ -18,6 +18,7 @@ shortcutHelper.setFilePath("./shortcuts.xml")
val SUPPORTED_ABIS = setOf("armeabi-v7a", "arm64-v8a", "x86")
android {
namespace = "eu.kanade.tachiyomi"
compileSdk = AndroidConfig.compileSdk
ndkVersion = AndroidConfig.ndk
@ -246,6 +247,7 @@ dependencies {
// For detecting memory leaks; see https://square.github.io/leakcanary/
// debugImplementation(libs.leakcanary.android)
implementation(libs.leakcanary.plumber)
}
tasks {
@ -259,19 +261,19 @@ tasks {
// See https://kotlinlang.org/docs/reference/experimental.html#experimental-status-of-experimental-api(-markers)
withType<KotlinCompile> {
kotlinOptions.freeCompilerArgs += listOf(
"-Xopt-in=kotlin.Experimental",
"-Xopt-in=kotlin.RequiresOptIn",
"-Xopt-in=kotlin.ExperimentalStdlibApi",
"-Xopt-in=kotlinx.coroutines.FlowPreview",
"-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-Xopt-in=kotlinx.coroutines.InternalCoroutinesApi",
"-Xopt-in=kotlinx.serialization.ExperimentalSerializationApi",
"-Xopt-in=coil.annotation.ExperimentalCoilApi",
"-opt-in=kotlin.Experimental",
"-opt-in=kotlin.RequiresOptIn",
"-opt-in=kotlin.ExperimentalStdlibApi",
"-opt-in=kotlinx.coroutines.FlowPreview",
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-opt-in=kotlinx.coroutines.InternalCoroutinesApi",
"-opt-in=kotlinx.serialization.ExperimentalSerializationApi",
"-opt-in=coil.annotation.ExperimentalCoilApi",
)
}
// Duplicating Hebrew string assets due to some locale code issues on different devices
val copyHebrewStrings = task("copyHebrewStrings", type = Copy::class) {
val copyHebrewStrings by registering(Copy::class) {
from("./src/main/res/values-he")
into("./src/main/res/values-iw")
include("**/*")

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="eu.kanade.tachiyomi">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Internet -->
<uses-permission android:name="android.permission.INTERNET" />

View File

@ -47,6 +47,7 @@ class AppUpdateChecker {
when (result) {
is AppUpdateResult.NewUpdate -> AppUpdateNotifier(context).promptUpdate(result.release)
is AppUpdateResult.NewUpdateFdroidInstallation -> AppUpdateNotifier(context).promptFdroidUpdate()
else -> {}
}
result

View File

@ -52,6 +52,7 @@ internal class ExtensionInstallReceiver(private val listener: Listener) :
when (val result = getExtensionFromIntent(context, intent)) {
is LoadResult.Success -> listener.onExtensionInstalled(result.extension)
is LoadResult.Untrusted -> listener.onExtensionUntrusted(result.extension)
else -> {}
}
}
}
@ -60,8 +61,8 @@ internal class ExtensionInstallReceiver(private val listener: Listener) :
when (val result = getExtensionFromIntent(context, intent)) {
is LoadResult.Success -> listener.onExtensionUpdated(result.extension)
// Not needed as a package can't be upgraded if the signature is different
is LoadResult.Untrusted -> {
}
is LoadResult.Untrusted -> {}
else -> {}
}
}
}

View File

@ -59,16 +59,17 @@ abstract class SearchableNucleusController<VB : ViewBinding, P : BasePresenter<*
val searchAutoComplete: SearchView.SearchAutoComplete = searchView.findViewById(
R.id.search_src_text,
)
searchAutoComplete.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
searchAutoComplete.addTextChangedListener(
object : TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {}
override fun afterTextChanged(editable: Editable) {
editable.getSpans(0, editable.length, CharacterStyle::class.java)
.forEach { editable.removeSpan(it) }
}
},
override fun afterTextChanged(editable: Editable) {
editable.getSpans(0, editable.length, CharacterStyle::class.java)
.forEach { editable.removeSpan(it) }
}
},
)
searchView.queryTextEvents()
@ -134,12 +135,12 @@ abstract class SearchableNucleusController<VB : ViewBinding, P : BasePresenter<*
searchItem.setOnActionExpandListener(
object : MenuItem.OnActionExpandListener {
override fun onMenuItemActionExpand(item: MenuItem?): Boolean {
override fun onMenuItemActionExpand(item: MenuItem): Boolean {
onSearchMenuItemActionExpand(item)
return true
}
override fun onMenuItemActionCollapse(item: MenuItem?): Boolean {
override fun onMenuItemActionCollapse(item: MenuItem): Boolean {
val localSearchView = searchItem.actionView as SearchView
// if it is blank the flow event won't trigger so we would stay in a COLLAPSING state

View File

@ -354,6 +354,7 @@ open class BrowseSourceController(bundle: Bundle) :
when (filter) {
is Filter.TriState -> filter.state = 1
is Filter.CheckBox -> filter.state = true
else -> {}
}
filterList = presenter.sourceFilters
break@filter

View File

@ -28,8 +28,7 @@ class DownloadHeaderHolder(view: View, adapter: FlexibleAdapter<*>) : Expandable
override fun onItemReleased(position: Int) {
super.onItemReleased(position)
binding.container.isDragged = false
mAdapter as DownloadAdapter
mAdapter.expandAll()
mAdapter.downloadItemListener.onItemReleased(position)
(mAdapter as DownloadAdapter).downloadItemListener.onItemReleased(position)
}
}

View File

@ -388,7 +388,7 @@ class LibraryController(
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
createOptionsMenu(menu, inflater, R.menu.library, R.id.action_search)
// Mutate the filter icon because it needs to be tinted and the resource is shared.
menu.findItem(R.id.action_filter).icon.mutate()
menu.findItem(R.id.action_filter).icon?.mutate()
}
fun search(query: String) {
@ -414,7 +414,7 @@ class LibraryController(
// Tint icon if there's a filter active
if (settingsSheet.filters.hasActiveFilters()) {
val filterColor = activity!!.getResourceColor(R.attr.colorFilterActive)
filterItem.icon.setTint(filterColor)
filterItem.icon?.setTint(filterColor)
}
}

View File

@ -394,6 +394,7 @@ class LibrarySettingsSheet(
unreadBadge -> preferences.unreadBadge().set((item.checked))
localBadge -> preferences.localBadge().set((item.checked))
languageBadge -> preferences.languageBadge().set((item.checked))
else -> {}
}
adapter.notifyItemChanged(item)
}
@ -418,6 +419,7 @@ class LibrarySettingsSheet(
when (item) {
showTabs -> preferences.categoryTabs().set(item.checked)
showNumberOfItems -> preferences.categoryNumberOfItems().set(item.checked)
else -> {}
}
adapter.notifyItemChanged(item)
}

View File

@ -466,7 +466,7 @@ class MainActivity : BaseActivity() {
// Binding sometimes isn't actually instantiated yet somehow
nav?.setOnItemSelectedListener(null)
binding?.toolbar.setNavigationOnClickListener(null)
binding?.toolbar?.setNavigationOnClickListener(null)
}
override fun onBackPressed() {

View File

@ -113,6 +113,7 @@ class ChaptersSettingsSheet(
downloaded -> presenter.setDownloadedFilter(newState)
unread -> presenter.setUnreadFilter(newState)
bookmarked -> presenter.setBookmarkedFilter(newState)
else -> {}
}
initModels()

View File

@ -360,15 +360,16 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
}
// Init listeners on bottom menu
binding.pageSlider.addOnSliderTouchListener(object : Slider.OnSliderTouchListener {
override fun onStartTrackingTouch(slider: Slider) {
isScrollingThroughPages = true
}
binding.pageSlider.addOnSliderTouchListener(
object : Slider.OnSliderTouchListener {
override fun onStartTrackingTouch(slider: Slider) {
isScrollingThroughPages = true
}
override fun onStopTrackingTouch(slider: Slider) {
isScrollingThroughPages = false
}
},
override fun onStopTrackingTouch(slider: Slider) {
isScrollingThroughPages = false
}
},
)
binding.pageSlider.addOnChangeListener { slider, value, fromUser ->
if (viewer != null && fromUser) {

View File

@ -10,9 +10,9 @@ data class ReaderChapter(val chapter: Chapter) {
var state: State =
State.Wait
set(value) {
field = value
stateRelay.call(value)
}
field = value
stateRelay.call(value)
}
private val stateRelay by lazy { BehaviorRelay.create(state) }

View File

@ -34,27 +34,28 @@ class ReaderSettingsSheet(
behavior.halfExpandedRatio = 0.25f
val filterTabIndex = getTabViews().indexOf(colorFilterSettings)
binding.tabs.addOnTabSelectedListener(object : SimpleTabSelectedListener() {
override fun onTabSelected(tab: TabLayout.Tab?) {
val isFilterTab = tab?.position == filterTabIndex
binding.tabs.addOnTabSelectedListener(
object : SimpleTabSelectedListener() {
override fun onTabSelected(tab: TabLayout.Tab?) {
val isFilterTab = tab?.position == filterTabIndex
// Remove dimmed backdrop so color filter changes can be previewed
backgroundDimAnimator.run {
if (isFilterTab) {
if (animatedFraction < 1f) {
start()
// Remove dimmed backdrop so color filter changes can be previewed
backgroundDimAnimator.run {
if (isFilterTab) {
if (animatedFraction < 1f) {
start()
}
} else if (animatedFraction > 0f) {
reverse()
}
} else if (animatedFraction > 0f) {
reverse()
}
// Hide toolbars
if (activity.menuVisible != !isFilterTab) {
activity.setMenuVisibility(!isFilterTab)
}
}
// Hide toolbars
if (activity.menuVisible != !isFilterTab) {
activity.setMenuVisibility(!isFilterTab)
}
}
},
},
)
if (showColorFilterSettings) {

View File

@ -249,6 +249,7 @@ open class ReaderPageImageView @JvmOverloads constructor(
ZoomStartPosition.LEFT -> setScaleAndCenter(scale, PointF(0F, 0F))
ZoomStartPosition.RIGHT -> setScaleAndCenter(scale, PointF(sWidth.toFloat(), 0F))
ZoomStartPosition.CENTER -> setScaleAndCenter(scale, center.also { it?.y = 0F })
else -> {}
}
}
@ -310,7 +311,7 @@ open class ReaderPageImageView @JvmOverloads constructor(
return true
}
override fun onSingleTapConfirmed(e: MotionEvent?): Boolean {
override fun onSingleTapConfirmed(e: MotionEvent): Boolean {
this@ReaderPageImageView.onViewClicked()
return super.onSingleTapConfirmed(e)
}

View File

@ -44,7 +44,7 @@ class WebtoonFrame(context: Context) : FrameLayout(context) {
* Scale listener used to delegate events to the recycler view.
*/
inner class ScaleListener : ScaleGestureDetector.SimpleOnScaleGestureListener() {
override fun onScaleBegin(detector: ScaleGestureDetector?): Boolean {
override fun onScaleBegin(detector: ScaleGestureDetector): Boolean {
recycler?.onScaleBegin()
return true
}
@ -63,13 +63,13 @@ class WebtoonFrame(context: Context) : FrameLayout(context) {
* Fling listener used to delegate events to the recycler view.
*/
inner class FlingListener : GestureDetector.SimpleOnGestureListener() {
override fun onDown(e: MotionEvent?): Boolean {
override fun onDown(e: MotionEvent): Boolean {
return true
}
override fun onFling(
e1: MotionEvent?,
e2: MotionEvent?,
e1: MotionEvent,
e2: MotionEvent,
velocityX: Float,
velocityY: Float,
): Boolean {

View File

@ -102,13 +102,13 @@ class SettingsMainController : SettingsController() {
searchItem.setOnActionExpandListener(
object : MenuItem.OnActionExpandListener {
override fun onMenuItemActionExpand(item: MenuItem?): Boolean {
override fun onMenuItemActionExpand(item: MenuItem): Boolean {
preferences.lastSearchQuerySearchSettings().set("") // reset saved search query
router.pushController(SettingsSearchController().withFadeTransaction())
return true
}
override fun onMenuItemActionCollapse(item: MenuItem?): Boolean {
override fun onMenuItemActionCollapse(item: MenuItem): Boolean {
return true
}
},

View File

@ -74,11 +74,11 @@ class SettingsSearchController :
searchItem.setOnActionExpandListener(
object : MenuItem.OnActionExpandListener {
override fun onMenuItemActionExpand(item: MenuItem?): Boolean {
override fun onMenuItemActionExpand(item: MenuItem): Boolean {
return true
}
override fun onMenuItemActionCollapse(item: MenuItem?): Boolean {
override fun onMenuItemActionCollapse(item: MenuItem): Boolean {
router.popCurrentController()
return false
}

View File

@ -166,12 +166,12 @@ class WebViewActivity : BaseActivity() {
menu.findItem(R.id.action_web_back).apply {
isEnabled = binding.webview.canGoBack()
icon.setTint(if (binding.webview.canGoBack()) iconTintColor else translucentIconTintColor)
icon?.setTint(if (binding.webview.canGoBack()) iconTintColor else translucentIconTintColor)
}
menu.findItem(R.id.action_web_forward).apply {
isEnabled = binding.webview.canGoForward()
icon.setTint(if (binding.webview.canGoForward()) iconTintColor else translucentIconTintColor)
icon?.setTint(if (binding.webview.canGoForward()) iconTintColor else translucentIconTintColor)
}
return super.onPrepareOptionsMenu(menu)

View File

@ -115,12 +115,13 @@ class TachiyomiBottomNavigationView @JvmOverloads constructor(
.setInterpolator(interpolator)
.setDuration(duration)
.applySystemAnimatorScale(context)
.setListener(object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator?) {
currentAnimator = null
postInvalidate()
}
},
.setListener(
object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator) {
currentAnimator = null
postInvalidate()
}
},
)
}

View File

@ -37,12 +37,13 @@ class ThemesPreference @JvmOverloads constructor(context: Context, attrs: Attrib
recycler?.adapter = adapter
// Retain scroll position on activity recreate after changing theme
recycler?.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
lastScrollPosition = recyclerView.computeHorizontalScrollOffset()
}
},
recycler?.addOnScrollListener(
object : RecyclerView.OnScrollListener() {
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
lastScrollPosition = recyclerView.computeHorizontalScrollOffset()
}
},
)
lastScrollPosition?.let { scrollToOffset(it) }
}

View File

@ -45,11 +45,12 @@ class BottomSheetViewPager @JvmOverloads constructor(
}
init {
addOnPageChangeListener(object : SimpleOnPageChangeListener() {
override fun onPageSelected(position: Int) {
requestLayout()
}
},
addOnPageChangeListener(
object : SimpleOnPageChangeListener() {
override fun onPageSelected(position: Int) {
requestLayout()
}
},
)
}
}

View File

@ -1,5 +1,5 @@
object AndroidConfig {
const val compileSdk = 32
const val compileSdk = 33
const val minSdk = 23
const val targetSdk = 29
const val ndk = "22.1.7171670"

View File

@ -1,6 +1,6 @@
[versions]
agp_version = "7.2.2"
lifecycle_version = "2.5.0"
lifecycle_version = "2.5.1"
[libraries]
annotation = "androidx.annotation:annotation:1.4.0"
@ -10,7 +10,7 @@ constraintlayout = "androidx.constraintlayout:constraintlayout:2.1.4"
coordinatorlayout = "androidx.coordinatorlayout:coordinatorlayout:1.2.0"
corektx = "androidx.core:core-ktx:1.8.0"
splashscreen = "androidx.core:core-splashscreen:1.0.0-alpha02"
recyclerview = "androidx.recyclerview:recyclerview:1.3.0-beta01"
recyclerview = "androidx.recyclerview:recyclerview:1.3.0-beta02"
swiperefreshlayout = "androidx.swiperefreshlayout:swiperefreshlayout:1.2.0-alpha01"
viewpager = "androidx.viewpager:viewpager:1.1.0-alpha01"
@ -27,4 +27,4 @@ workmanager = ["work-runtime", "guava"]
[plugins]
application = { id = "com.android.application", version.ref = "agp_version" }
library = { id = "com.android.library", version.ref = "agp_version" }
library = { id = "com.android.library", version.ref = "agp_version" }

View File

@ -1,7 +1,7 @@
[versions]
kotlin_version = "1.6.20"
coroutines_version = "1.6.1"
serialization_version = "1.3.2"
kotlin_version = "1.7.10"
coroutines_version = "1.6.4"
serialization_version = "1.3.3"
[libraries]
reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin_version" }
@ -12,12 +12,11 @@ coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-androi
serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "serialization_version" }
serialization-protobuf = { module = "org.jetbrains.kotlinx:kotlinx-serialization-protobuf", version.ref = "serialization_version" }
serialization-gradle = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin_version"}
serialization-gradle = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin_version" }
[bundles]
coroutines = ["coroutines-core", "coroutines-android"]
serialization = ["serialization-json","serialization-protobuf"]
serialization = ["serialization-json", "serialization-protobuf"]
[plugins]
android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin_version"}
android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin_version" }

View File

@ -2,14 +2,15 @@
aboutlib_version = "8.9.4"
okhttp_version = "4.10.0"
nucleus_version = "3.0.0"
coil_version = "2.0.0-rc03"
conductor_version = "3.1.5"
coil_version = "2.1.0"
conductor_version = "3.1.7"
flowbinding_version = "1.2.0"
shizuku_version = "12.1.0"
leakcanary = "2.9.1"
[libraries]
android-shortcut-gradle = "com.github.zellius:android-shortcut-gradle-plugin:0.1.2"
google-services-gradle = "com.google.gms:google-services:4.3.10"
google-services-gradle = "com.google.gms:google-services:4.3.13"
tachiyomi-api = "org.tachiyomi:source-api:1.1"
@ -33,13 +34,13 @@ jsoup = "org.jsoup:jsoup:1.14.3"
disklrucache = "com.jakewharton:disklrucache:2.0.2"
unifile = "com.github.tachiyomiorg:unifile:17bec43"
junrar = "com.github.junrar:junrar:7.5.2"
junrar = "com.github.junrar:junrar:7.5.3"
sqlitektx = "androidx.sqlite:sqlite-ktx:2.3.0-alpha02"
sqlitektx = "androidx.sqlite:sqlite-ktx:2.3.0-alpha03"
sqlite-android = "com.github.requery:sqlite-android:3.36.0"
preferencektx = "androidx.preference:preference-ktx:1.2.0"
flowpreferences = "com.fredporciuncula:flow-preferences:1.7.0"
flowpreferences = "com.fredporciuncula:flow-preferences:1.8.0"
nucleus-core = { module = "info.android15.nucleus:nucleus", version.ref = "nucleus_version" }
nucleus-supportv7 = { module = "info.android15.nucleus:nucleus-support-v7", version.ref = "nucleus_version" }
@ -77,8 +78,8 @@ flowbinding-viewpager = { module = "io.github.reactivecircus.flowbinding:flowbin
logcat = "com.squareup.logcat:logcat:0.1"
acra-http = "ch.acra:acra-http:5.9.5"
firebase-analytics = "com.google.firebase:firebase-analytics-ktx:21.0.0"
acra-http = "ch.acra:acra-http:5.9.6"
firebase-analytics = "com.google.firebase:firebase-analytics-ktx:21.1.0"
aboutlibraries-core = { module = "com.mikepenz:aboutlibraries-core", version.ref = "aboutlib_version" }
aboutlibraries-gradle = { module = "com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin", version.ref = "aboutlib_version" }
@ -86,21 +87,22 @@ aboutlibraries-gradle = { module = "com.mikepenz.aboutlibraries.plugin:aboutlibr
shizuku-api = { module = "dev.rikka.shizuku:api", version.ref = "shizuku_version" }
shizuku-provider = { module = "dev.rikka.shizuku:provider", version.ref = "shizuku_version" }
leakcanary-android = { module = "com.squareup.leakcanary:leakcanary-android", version.ref = "leakcanary" }
leakcanary-plumber = { module = "com.squareup.leakcanary:plumber-android", version.ref = "leakcanary" }
junit = "org.junit.jupiter:junit-jupiter:5.9.0"
leakcanary-android = "com.squareup.leakcanary:leakcanary-android:2.7"
[bundles]
reactivex = ["rxandroid","rxjava","rxrelay"]
okhttp = ["okhttp-core","okhttp-logging","okhttp-dnsoverhttps"]
reactivex = ["rxandroid", "rxjava", "rxrelay"]
okhttp = ["okhttp-core", "okhttp-logging", "okhttp-dnsoverhttps"]
js-engine = ["quickjs-android", "duktape-android"]
sqlite = ["sqlitektx", "sqlite-android"]
nucleus = ["nucleus-core","nucleus-supportv7"]
coil = ["coil-core","coil-gif",]
flowbinding = ["flowbinding-android","flowbinding-appcompat","flowbinding-recyclerview","flowbinding-swiperefreshlayout","flowbinding-viewpager"]
conductor = ["conductor-core","conductor-viewpager","conductor-support-preference"]
shizuku = ["shizuku-api","shizuku-provider"]
nucleus = ["nucleus-core", "nucleus-supportv7"]
coil = ["coil-core", "coil-gif"]
flowbinding = ["flowbinding-android", "flowbinding-appcompat", "flowbinding-recyclerview", "flowbinding-swiperefreshlayout", "flowbinding-viewpager"]
conductor = ["conductor-core", "conductor-viewpager", "conductor-support-preference"]
shizuku = ["shizuku-api", "shizuku-provider"]
[plugins]
kotlinter = { id = "org.jmailen.kotlinter", version = "3.10.0"}
versionsx = { id = "com.github.ben-manes.versions", version = "0.42.0"}
kotlinter = { id = "org.jmailen.kotlinter", version = "3.11.1" }
versionsx = { id = "com.github.ben-manes.versions", version = "0.42.0" }