From 71bf9dc828f1e046a003980a0261fa562d1b7f45 Mon Sep 17 00:00:00 2001 From: Jay Date: Sat, 26 Oct 2019 14:49:34 -0700 Subject: [PATCH] Updated gradle gms --- app/build.gradle | 2 +- .../tachiyomi/data/backup/BackupRestoreService.kt | 2 +- .../tachiyomi/data/library/LibraryUpdateJob.kt | 2 +- .../data/preference/SharedPreferencesDataStore.kt | 2 +- .../extension/util/ExtensionInstallActivity.kt | 2 +- .../tachiyomi/extension/util/ExtensionLoader.kt | 2 +- .../ui/catalogue/SourceDividerItemDecoration.kt | 2 +- .../global_search/CatalogueSearchAdapter.kt | 2 +- .../ui/extension/ExtensionDetailsController.kt | 2 +- .../ui/extension/ExtensionDividerItemDecoration.kt | 2 +- .../tachiyomi/ui/extension/ExtensionTrustDialog.kt | 4 ++-- .../kanade/tachiyomi/ui/library/LibraryController.kt | 5 +++-- .../tachiyomi/ui/manga/info/MangaInfoController.kt | 2 +- .../tachiyomi/ui/manga/track/TrackSearchAdapter.kt | 2 +- .../eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt | 4 ++-- .../tachiyomi/ui/reader/loader/DownloadPageLoader.kt | 4 +++- .../tachiyomi/ui/setting/SettingsBackupController.kt | 12 +++++++----- .../ui/setting/SettingsDownloadController.kt | 7 ++++--- .../java/eu/kanade/tachiyomi/util/LocaleHelper.kt | 6 +++--- build.gradle | 6 +++--- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 21 files changed, 41 insertions(+), 35 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 7771286ac1..c2875906b1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -234,7 +234,7 @@ dependencies { } buildscript { - ext.kotlin_version = '1.2.71' + ext.kotlin_version = '1.3.50' repositories { mavenCentral() } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupRestoreService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupRestoreService.kt index db6866e289..87701c20d9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupRestoreService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupRestoreService.kt @@ -189,7 +189,7 @@ class BackupRestoreService : Service() { return Observable.just(Unit) .map { - val reader = JsonReader(contentResolver.openInputStream(uri).bufferedReader()) + val reader = JsonReader(contentResolver.openInputStream(uri)!!.bufferedReader()) val json = JsonParser().parse(reader).asJsonObject // Get parser version diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateJob.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateJob.kt index ab386b1330..2fb2e5d83a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateJob.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateJob.kt @@ -22,7 +22,7 @@ class LibraryUpdateJob : Job() { val preferences = Injekt.get() val interval = prefInterval ?: preferences.libraryUpdateInterval().getOrDefault() if (interval > 0) { - val restrictions = preferences.libraryUpdateRestriction() + val restrictions = preferences.libraryUpdateRestriction()!! val acRestriction = "ac" in restrictions val wifiRestriction = if ("wifi" in restrictions) JobRequest.NetworkType.UNMETERED diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/SharedPreferencesDataStore.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/SharedPreferencesDataStore.kt index bb07bb0a52..8ac81e6b2b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/SharedPreferencesDataStore.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/SharedPreferencesDataStore.kt @@ -46,7 +46,7 @@ class SharedPreferencesDataStore(private val prefs: SharedPreferences) : Prefere } override fun getStringSet(key: String?, defValues: MutableSet?): MutableSet { - return prefs.getStringSet(key, defValues) + return prefs.getStringSet(key, defValues)!! } override fun putStringSet(key: String?, values: MutableSet?) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallActivity.kt index 421cfb191d..5dcd6bb126 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallActivity.kt @@ -39,7 +39,7 @@ class ExtensionInstallActivity : Activity() { } private fun checkInstallationResult(resultCode: Int) { - val downloadId = intent.extras.getLong(ExtensionInstaller.EXTRA_DOWNLOAD_ID) + val downloadId = intent.extras!!.getLong(ExtensionInstaller.EXTRA_DOWNLOAD_ID) val success = resultCode == RESULT_OK val extensionManager = Injekt.get() diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt index 805effe064..450eae3127 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt @@ -121,7 +121,7 @@ internal object ExtensionLoader { val classLoader = PathClassLoader(appInfo.sourceDir, null, context.classLoader) - val sources = appInfo.metaData.getString(METADATA_SOURCE_CLASS) + val sources = appInfo.metaData.getString(METADATA_SOURCE_CLASS)!! .split(";") .map { val sourceClass = it.trim() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/SourceDividerItemDecoration.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/SourceDividerItemDecoration.kt index a4c33beb75..e21b58124f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/SourceDividerItemDecoration.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/SourceDividerItemDecoration.kt @@ -13,7 +13,7 @@ class SourceDividerItemDecoration(context: Context) : RecyclerView.ItemDecoratio init { val a = context.obtainStyledAttributes(intArrayOf(android.R.attr.listDivider)) - divider = a.getDrawable(0) + divider = a.getDrawable(0)!! a.recycle() } 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 0eabb89810..430b6f5b67 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 @@ -38,7 +38,7 @@ class CatalogueSearchAdapter(val controller: CatalogueSearchController) : override fun onRestoreInstanceState(savedInstanceState: Bundle) { super.onRestoreInstanceState(savedInstanceState) - bundle = savedInstanceState.getBundle(HOLDER_BUNDLE_KEY) + bundle = savedInstanceState.getBundle(HOLDER_BUNDLE_KEY)!! } /** diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionDetailsController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionDetailsController.kt index 2005a93889..d0c457f3ec 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionDetailsController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionDetailsController.kt @@ -47,7 +47,7 @@ class ExtensionDetailsController(bundle: Bundle? = null) : } override fun createPresenter(): ExtensionDetailsPresenter { - return ExtensionDetailsPresenter(args.getString(PKGNAME_KEY)) + return ExtensionDetailsPresenter(args.getString(PKGNAME_KEY)!!) } override fun getTitle(): String? { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionDividerItemDecoration.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionDividerItemDecoration.kt index 40fe44505d..247206df7c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionDividerItemDecoration.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionDividerItemDecoration.kt @@ -13,7 +13,7 @@ class ExtensionDividerItemDecoration(context: Context) : RecyclerView.ItemDecora init { val a = context.obtainStyledAttributes(intArrayOf(android.R.attr.listDivider)) - divider = a.getDrawable(0) + divider = a.getDrawable(0)!! a.recycle() } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionTrustDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionTrustDialog.kt index 3094e90620..6c1f8bc0a0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionTrustDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionTrustDialog.kt @@ -24,10 +24,10 @@ class ExtensionTrustDialog(bundle: Bundle? = null) : DialogController(bundle) .positiveText(R.string.ext_trust) .negativeText(R.string.ext_uninstall) .onPositive { _, _ -> - (targetController as? Listener)?.trustSignature(args.getString(SIGNATURE_KEY)) + (targetController as? Listener)?.trustSignature(args.getString(SIGNATURE_KEY)!!) } .onNegative { _, _ -> - (targetController as? Listener)?.uninstallExtension(args.getString(PKGNAME_KEY)) + (targetController as? Listener)?.uninstallExtension(args.getString(PKGNAME_KEY)!!) } .build() } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt index 5eadbacf0a..a8bee9cdcc 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt @@ -4,6 +4,7 @@ import android.app.Activity import android.content.Intent import android.content.res.Configuration import android.graphics.Color +import android.net.Uri import android.os.Bundle import android.support.design.widget.TabLayout import android.support.v4.graphics.drawable.DrawableCompat @@ -512,9 +513,9 @@ class LibraryController( try { // Get the file's input stream from the incoming Intent - activity.contentResolver.openInputStream(data.data).use { + activity.contentResolver.openInputStream(data.data ?: Uri.EMPTY).use { // Update cover to selected file, show error if something went wrong - if (presenter.editCoverWithStream(it, manga)) { + if (it != null && presenter.editCoverWithStream(it, manga)) { // TODO refresh cover } else { activity.toast(R.string.notification_cover_update_failed) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt index 0589b8b086..6e018e3d23 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt @@ -521,7 +521,7 @@ class MangaInfoController : NucleusController(), val view = view ?: return val clipboard = activity.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager - clipboard.primaryClip = ClipData.newPlainText(label, content) + clipboard.setPrimaryClip(ClipData.newPlainText(label, content)) activity.toast(view.context.getString(R.string.copied_to_clipboard, content.truncateCenter(20)), Toast.LENGTH_SHORT) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackSearchAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackSearchAdapter.kt index c11a9bdd0a..a4ea105ef4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackSearchAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackSearchAdapter.kt @@ -19,7 +19,7 @@ class TrackSearchAdapter(context: Context) override fun getView(position: Int, view: View?, parent: ViewGroup): View { var v = view // Get the data item for this position - val track = getItem(position) + val track = getItem(position)!! // Check if an existing view is being reused, otherwise inflate the view val holder: TrackSearchHolder // view lookup cache stored in tag if (v == null) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt index 1d5ef8f265..1547b863fd 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt @@ -122,8 +122,8 @@ class ReaderActivity : BaseRxActivity() { setContentView(R.layout.reader_activity) if (presenter.needsInit()) { - val manga = intent.extras.getLong("manga", -1) - val chapter = intent.extras.getLong("chapter", -1) + val manga = intent.extras!!.getLong("manga", -1) + val chapter = intent.extras!!.getLong("chapter", -1) if (manga == -1L || chapter == -1L) { finish() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/DownloadPageLoader.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/DownloadPageLoader.kt index af7d969305..c64947a321 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/DownloadPageLoader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/DownloadPageLoader.kt @@ -1,6 +1,7 @@ package eu.kanade.tachiyomi.ui.reader.loader import android.app.Application +import android.net.Uri import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.download.DownloadManager import eu.kanade.tachiyomi.source.Source @@ -9,6 +10,7 @@ import eu.kanade.tachiyomi.ui.reader.model.ReaderChapter import eu.kanade.tachiyomi.ui.reader.model.ReaderPage import rx.Observable import uy.kohesive.injekt.injectLazy +import java.io.InputStream /** * Loader used to load a chapter from the downloaded chapters. @@ -33,7 +35,7 @@ class DownloadPageLoader( .map { pages -> pages.map { page -> ReaderPage(page.index, page.url, page.imageUrl, { - context.contentResolver.openInputStream(page.uri) + context.contentResolver.openInputStream(page.uri ?: Uri.EMPTY)!! }).apply { status = Page.READY } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsBackupController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsBackupController.kt index 597cc4eef2..804d097e59 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsBackupController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsBackupController.kt @@ -158,7 +158,7 @@ class SettingsBackupController : SettingsController() { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) { val flags = Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION - + if (uri != null) activity.contentResolver.takePersistableUriPermission(uri, flags) } @@ -168,7 +168,7 @@ class SettingsBackupController : SettingsController() { CODE_BACKUP_CREATE -> if (data != null && resultCode == Activity.RESULT_OK) { val activity = activity ?: return val uri = if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { - val dir = data.data.path + val dir = data.data?.path val file = File(dir, Backup.getDefaultFilename()) Uri.fromFile(file) @@ -177,6 +177,7 @@ class SettingsBackupController : SettingsController() { val flags = Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION + if (uri != null) activity.contentResolver.takePersistableUriPermission(uri, flags) val file = UniFile.fromUri(activity, uri) @@ -188,7 +189,8 @@ class SettingsBackupController : SettingsController() { } CODE_BACKUP_RESTORE -> if (data != null && resultCode == Activity.RESULT_OK) { val uri = data.data - RestoreBackupDialog(uri).showDialog(router) + if (uri != null) + RestoreBackupDialog(uri).showDialog(router) } } } @@ -311,7 +313,7 @@ class SettingsBackupController : SettingsController() { val context = applicationContext if (context != null) { RestoringBackupDialog().showDialog(router, TAG_RESTORING_BACKUP_DIALOG) - BackupRestoreService.start(context, args.getParcelable(KEY_URI)) + BackupRestoreService.start(context, args.getParcelable(KEY_URI)!!) } } .build() @@ -385,7 +387,7 @@ class SettingsBackupController : SettingsController() { .negativeText(R.string.action_open_log) .onNegative { _, _ -> val context = applicationContext ?: return@onNegative - if (!path.isEmpty()) { + if (!path!!.isEmpty()) { val destFile = File(path, file) val uri = destFile.getUriCompat(context) val sendIntent = Intent(Intent.ACTION_VIEW).apply { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadController.kt index 1b6119b13c..ae53eeabad 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadController.kt @@ -118,8 +118,8 @@ class SettingsDownloadController : SettingsController() { override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { when (requestCode) { DOWNLOAD_DIR_PRE_L -> if (data != null && resultCode == Activity.RESULT_OK) { - val uri = Uri.fromFile(File(data.data.path)) - preferences.downloadsDirectory().set(uri.toString()) + val uri = Uri.fromFile(File(data.data?.path)) + preferences.downloadsDirectory().set(uri?.toString() ?: "") } DOWNLOAD_DIR_L -> if (data != null && resultCode == Activity.RESULT_OK) { val context = applicationContext ?: return @@ -128,7 +128,8 @@ class SettingsDownloadController : SettingsController() { Intent.FLAG_GRANT_WRITE_URI_PERMISSION @Suppress("NewApi") - context.contentResolver.takePersistableUriPermission(uri, flags) + if (uri != null) + context.contentResolver.takePersistableUriPermission(uri, flags) val file = UniFile.fromUri(context, uri) preferences.downloadsDirectory().set(file.uri.toString()) diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/LocaleHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/util/LocaleHelper.kt index 14e6726e3a..0cb6715f75 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/LocaleHelper.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/LocaleHelper.kt @@ -30,7 +30,7 @@ object LocaleHelper { /** * The application's locale. When it's null, the system locale is used. */ - private var appLocale = getLocaleFromString(preferences.lang()) + private var appLocale = getLocaleFromString(preferences.lang() ?: "") /** * The currently applied locale. Used to avoid losing the selected language after a non locale @@ -136,9 +136,9 @@ object LocaleHelper { private fun updateConfigLocale(config: Configuration, locale: Locale): Configuration { val newConfig = Configuration(config) if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { - newConfig.locale = locale + newConfig.setLocale(locale) } else { - newConfig.locales = LocaleList(locale) + newConfig.setLocales(LocaleList(locale)) } return newConfig } diff --git a/build.gradle b/build.gradle index 2885a88fc1..f34faa7ebe 100644 --- a/build.gradle +++ b/build.gradle @@ -7,10 +7,10 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.2.1' - classpath 'com.github.ben-manes:gradle-versions-plugin:0.17.0' + classpath 'com.android.tools.build:gradle:3.5.1' + classpath 'com.github.ben-manes:gradle-versions-plugin:0.22.0' classpath 'com.github.zellius:android-shortcut-gradle-plugin:0.1.2' - classpath 'com.google.gms:google-services:3.2.0' + classpath 'com.google.gms:google-services:4.3.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index bccb59f891..56fac75514 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Tue Sep 25 08:47:56 CEST 2018 +#Sat Oct 26 14:20:49 PDT 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip