From b17717181dbdbe5652187f918df764ec15ca0542 Mon Sep 17 00:00:00 2001 From: Jay Date: Thu, 24 Oct 2019 02:47:41 -0700 Subject: [PATCH] android 28 sdk --- app/build.gradle | 8 ++++---- .../catalogue/browse/BrowseCatalogueController.kt | 2 +- .../global_search/CatalogueSearchAdapter.kt | 4 ++-- .../kanade/tachiyomi/ui/manga/MangaController.kt | 2 +- .../reader/viewer/webtoon/WebtoonRecyclerView.kt | 4 ++-- .../ui/reader/viewer/webtoon/WebtoonViewer.kt | 14 ++++++++------ .../ui/setting/SettingsAboutController.kt | 4 ++-- app/src/main/res/values-night/themes.xml | 12 +----------- app/src/main/res/values-v21/themes.xml | 2 +- 9 files changed, 22 insertions(+), 30 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 141e7ec695..c3e57db263 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -29,14 +29,14 @@ ext { } android { - compileSdkVersion 27 - buildToolsVersion '28.0.3' + compileSdkVersion 28 + buildToolsVersion '29.0.2' publishNonDefault true defaultConfig { applicationId "eu.kanade.tachiyomi" minSdkVersion 16 - targetSdkVersion 27 + targetSdkVersion 28 testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" versionCode 41 versionName "0.8.4" @@ -101,7 +101,7 @@ dependencies { implementation 'com.github.inorichi:junrar-android:634c1f5' // Android support library - final support_library_version = '27.0.2' + final support_library_version = '28.0.0' implementation "com.android.support:support-v4:$support_library_version" implementation "com.android.support:appcompat-v7:$support_library_version" implementation "com.android.support:cardview-v7:$support_library_version" diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCatalogueController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCatalogueController.kt index 97cfd76e16..de7e23ca26 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCatalogueController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/BrowseCatalogueController.kt @@ -201,7 +201,7 @@ open class BrowseCatalogueController(bundle: Bundle) : catalogue_view.addView(recycler, 1) if (oldPosition != RecyclerView.NO_POSITION) { - recycler.layoutManager.scrollToPosition(oldPosition) + recycler.layoutManager?.scrollToPosition(oldPosition) } this.recycler = recycler } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/global_search/CatalogueSearchAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/global_search/CatalogueSearchAdapter.kt index 0b1b822e0f..0eabb89810 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/global_search/CatalogueSearchAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/global_search/CatalogueSearchAdapter.kt @@ -19,8 +19,8 @@ class CatalogueSearchAdapter(val controller: CatalogueSearchController) : */ private var bundle = Bundle() - override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int, payloads: List?) { - super.onBindViewHolder(holder, position, payloads) + override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { + super.onBindViewHolder(holder, position) restoreHolderState(holder) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt index c56cc7541c..a57a2319b5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt @@ -187,7 +187,7 @@ class MangaController : RxController, TabbedController { const val CHAPTERS_CONTROLLER = 1 const val TRACK_CONTROLLER = 2 - private val tabField = TabLayout.Tab::class.java.getDeclaredField("mView") + private val tabField = TabLayout.Tab::class.java.getDeclaredField("view") .apply { isAccessible = true } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonRecyclerView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonRecyclerView.kt index eae782c931..5ae6b4dcb9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonRecyclerView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonRecyclerView.kt @@ -62,8 +62,8 @@ open class WebtoonRecyclerView @JvmOverloads constructor( override fun onScrollStateChanged(state: Int) { super.onScrollStateChanged(state) val layoutManager = layoutManager - val visibleItemCount = layoutManager.childCount - val totalItemCount = layoutManager.itemCount + val visibleItemCount = layoutManager?.childCount ?: 0 + val totalItemCount = layoutManager?.itemCount ?: 0 atLastPosition = visibleItemCount > 0 && lastVisibleItemPosition == totalItemCount - 1 atFirstPosition = firstVisibleItemPosition == 0 } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt index 6adee83c2f..51d8bd1213 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt @@ -67,7 +67,7 @@ class WebtoonViewer(val activity: ReaderActivity) : BaseViewer { recycler.layoutManager = layoutManager recycler.adapter = adapter recycler.addOnScrollListener(object : RecyclerView.OnScrollListener() { - override fun onScrolled(recyclerView: RecyclerView?, dx: Int, dy: Int) { + override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { val position = layoutManager.findLastEndVisibleItemPosition() val item = adapter.items.getOrNull(position) if (item != null && currentPage != item) { @@ -98,11 +98,13 @@ class WebtoonViewer(val activity: ReaderActivity) : BaseViewer { recycler.longTapListener = f@ { event -> if (activity.menuVisible || config.longTapEnabled) { val child = recycler.findChildViewUnder(event.x, event.y) - val position = recycler.getChildAdapterPosition(child) - val item = adapter.items.getOrNull(position) - if (item is ReaderPage) { - activity.onPageLongTap(item) - return@f true + if(child != null) { + val position = recycler.getChildAdapterPosition(child) + val item = adapter.items.getOrNull(position) + if (item is ReaderPage) { + activity.onPageLongTap(item) + return@f true + } } } false diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAboutController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAboutController.kt index a736da2a5e..7e96803e7b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAboutController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAboutController.kt @@ -151,14 +151,14 @@ class SettingsAboutController : SettingsController() { override fun onCreateDialog(savedViewState: Bundle?): Dialog { return MaterialDialog.Builder(activity!!) .title(R.string.update_check_title) - .content(args.getString(BODY_KEY)) + .content(args.getString(BODY_KEY) ?: "") .positiveText(R.string.update_check_confirm) .negativeText(R.string.update_check_ignore) .onPositive { _, _ -> val appContext = applicationContext if (appContext != null) { // Start download - val url = args.getString(URL_KEY) + val url = args.getString(URL_KEY) ?: "" UpdaterService.downloadUpdate(appContext, url) } } diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml index b80e9d0e3c..b543bf07dc 100644 --- a/app/src/main/res/values-night/themes.xml +++ b/app/src/main/res/values-night/themes.xml @@ -16,6 +16,7 @@ @drawable/line_divider_dark + true @style/ThemeOverlay.AppCompat.Dark.ActionBar @style/ThemeOverlay.AppCompat @style/PreferenceThemeOverlay.Material @@ -30,17 +31,6 @@ @color/textColorPrimaryDark @color/dialogDark @color/iconColorDark - - - @android:color/transparent - @color/colorDarkPrimaryDark - - -