Updated gradle gms

This commit is contained in:
Jay 2019-10-26 14:49:34 -07:00
parent 3930345cbd
commit 71bf9dc828
21 changed files with 41 additions and 35 deletions

View File

@ -234,7 +234,7 @@ dependencies {
}
buildscript {
ext.kotlin_version = '1.2.71'
ext.kotlin_version = '1.3.50'
repositories {
mavenCentral()
}

View File

@ -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

View File

@ -22,7 +22,7 @@ class LibraryUpdateJob : Job() {
val preferences = Injekt.get<PreferencesHelper>()
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

View File

@ -46,7 +46,7 @@ class SharedPreferencesDataStore(private val prefs: SharedPreferences) : Prefere
}
override fun getStringSet(key: String?, defValues: MutableSet<String>?): MutableSet<String> {
return prefs.getStringSet(key, defValues)
return prefs.getStringSet(key, defValues)!!
}
override fun putStringSet(key: String?, values: MutableSet<String>?) {

View File

@ -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<ExtensionManager>()

View File

@ -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()

View File

@ -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()
}

View File

@ -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)!!
}
/**

View File

@ -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? {

View File

@ -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()
}

View File

@ -24,10 +24,10 @@ class ExtensionTrustDialog<T>(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()
}

View File

@ -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)

View File

@ -521,7 +521,7 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
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)

View File

@ -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) {

View File

@ -122,8 +122,8 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
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()

View File

@ -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
}

View File

@ -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,6 +189,7 @@ class SettingsBackupController : SettingsController() {
}
CODE_BACKUP_RESTORE -> if (data != null && resultCode == Activity.RESULT_OK) {
val uri = data.data
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 {

View File

@ -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,6 +128,7 @@ class SettingsDownloadController : SettingsController() {
Intent.FLAG_GRANT_WRITE_URI_PERMISSION
@Suppress("NewApi")
if (uri != null)
context.contentResolver.takePersistableUriPermission(uri, flags)
val file = UniFile.fromUri(context, uri)

View File

@ -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
}

View File

@ -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
}

View File

@ -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