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 { buildscript {
ext.kotlin_version = '1.2.71' ext.kotlin_version = '1.3.50'
repositories { repositories {
mavenCentral() mavenCentral()
} }

View File

@ -189,7 +189,7 @@ class BackupRestoreService : Service() {
return Observable.just(Unit) return Observable.just(Unit)
.map { .map {
val reader = JsonReader(contentResolver.openInputStream(uri).bufferedReader()) val reader = JsonReader(contentResolver.openInputStream(uri)!!.bufferedReader())
val json = JsonParser().parse(reader).asJsonObject val json = JsonParser().parse(reader).asJsonObject
// Get parser version // Get parser version

View File

@ -22,7 +22,7 @@ class LibraryUpdateJob : Job() {
val preferences = Injekt.get<PreferencesHelper>() val preferences = Injekt.get<PreferencesHelper>()
val interval = prefInterval ?: preferences.libraryUpdateInterval().getOrDefault() val interval = prefInterval ?: preferences.libraryUpdateInterval().getOrDefault()
if (interval > 0) { if (interval > 0) {
val restrictions = preferences.libraryUpdateRestriction() val restrictions = preferences.libraryUpdateRestriction()!!
val acRestriction = "ac" in restrictions val acRestriction = "ac" in restrictions
val wifiRestriction = if ("wifi" in restrictions) val wifiRestriction = if ("wifi" in restrictions)
JobRequest.NetworkType.UNMETERED 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> { 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>?) { override fun putStringSet(key: String?, values: MutableSet<String>?) {

View File

@ -39,7 +39,7 @@ class ExtensionInstallActivity : Activity() {
} }
private fun checkInstallationResult(resultCode: Int) { 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 success = resultCode == RESULT_OK
val extensionManager = Injekt.get<ExtensionManager>() val extensionManager = Injekt.get<ExtensionManager>()

View File

@ -121,7 +121,7 @@ internal object ExtensionLoader {
val classLoader = PathClassLoader(appInfo.sourceDir, null, context.classLoader) 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(";") .split(";")
.map { .map {
val sourceClass = it.trim() val sourceClass = it.trim()

View File

@ -13,7 +13,7 @@ class SourceDividerItemDecoration(context: Context) : RecyclerView.ItemDecoratio
init { init {
val a = context.obtainStyledAttributes(intArrayOf(android.R.attr.listDivider)) val a = context.obtainStyledAttributes(intArrayOf(android.R.attr.listDivider))
divider = a.getDrawable(0) divider = a.getDrawable(0)!!
a.recycle() a.recycle()
} }

View File

@ -38,7 +38,7 @@ class CatalogueSearchAdapter(val controller: CatalogueSearchController) :
override fun onRestoreInstanceState(savedInstanceState: Bundle) { override fun onRestoreInstanceState(savedInstanceState: Bundle) {
super.onRestoreInstanceState(savedInstanceState) 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 { override fun createPresenter(): ExtensionDetailsPresenter {
return ExtensionDetailsPresenter(args.getString(PKGNAME_KEY)) return ExtensionDetailsPresenter(args.getString(PKGNAME_KEY)!!)
} }
override fun getTitle(): String? { override fun getTitle(): String? {

View File

@ -13,7 +13,7 @@ class ExtensionDividerItemDecoration(context: Context) : RecyclerView.ItemDecora
init { init {
val a = context.obtainStyledAttributes(intArrayOf(android.R.attr.listDivider)) val a = context.obtainStyledAttributes(intArrayOf(android.R.attr.listDivider))
divider = a.getDrawable(0) divider = a.getDrawable(0)!!
a.recycle() a.recycle()
} }

View File

@ -24,10 +24,10 @@ class ExtensionTrustDialog<T>(bundle: Bundle? = null) : DialogController(bundle)
.positiveText(R.string.ext_trust) .positiveText(R.string.ext_trust)
.negativeText(R.string.ext_uninstall) .negativeText(R.string.ext_uninstall)
.onPositive { _, _ -> .onPositive { _, _ ->
(targetController as? Listener)?.trustSignature(args.getString(SIGNATURE_KEY)) (targetController as? Listener)?.trustSignature(args.getString(SIGNATURE_KEY)!!)
} }
.onNegative { _, _ -> .onNegative { _, _ ->
(targetController as? Listener)?.uninstallExtension(args.getString(PKGNAME_KEY)) (targetController as? Listener)?.uninstallExtension(args.getString(PKGNAME_KEY)!!)
} }
.build() .build()
} }

View File

@ -4,6 +4,7 @@ import android.app.Activity
import android.content.Intent import android.content.Intent
import android.content.res.Configuration import android.content.res.Configuration
import android.graphics.Color import android.graphics.Color
import android.net.Uri
import android.os.Bundle import android.os.Bundle
import android.support.design.widget.TabLayout import android.support.design.widget.TabLayout
import android.support.v4.graphics.drawable.DrawableCompat import android.support.v4.graphics.drawable.DrawableCompat
@ -512,9 +513,9 @@ class LibraryController(
try { try {
// Get the file's input stream from the incoming Intent // 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 // 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 // TODO refresh cover
} else { } else {
activity.toast(R.string.notification_cover_update_failed) activity.toast(R.string.notification_cover_update_failed)

View File

@ -521,7 +521,7 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
val view = view ?: return val view = view ?: return
val clipboard = activity.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager 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)), activity.toast(view.context.getString(R.string.copied_to_clipboard, content.truncateCenter(20)),
Toast.LENGTH_SHORT) Toast.LENGTH_SHORT)

View File

@ -19,7 +19,7 @@ class TrackSearchAdapter(context: Context)
override fun getView(position: Int, view: View?, parent: ViewGroup): View { override fun getView(position: Int, view: View?, parent: ViewGroup): View {
var v = view var v = view
// Get the data item for this position // 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 // Check if an existing view is being reused, otherwise inflate the view
val holder: TrackSearchHolder // view lookup cache stored in tag val holder: TrackSearchHolder // view lookup cache stored in tag
if (v == null) { if (v == null) {

View File

@ -122,8 +122,8 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
setContentView(R.layout.reader_activity) setContentView(R.layout.reader_activity)
if (presenter.needsInit()) { if (presenter.needsInit()) {
val manga = intent.extras.getLong("manga", -1) val manga = intent.extras!!.getLong("manga", -1)
val chapter = intent.extras.getLong("chapter", -1) val chapter = intent.extras!!.getLong("chapter", -1)
if (manga == -1L || chapter == -1L) { if (manga == -1L || chapter == -1L) {
finish() finish()

View File

@ -1,6 +1,7 @@
package eu.kanade.tachiyomi.ui.reader.loader package eu.kanade.tachiyomi.ui.reader.loader
import android.app.Application import android.app.Application
import android.net.Uri
import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.download.DownloadManager import eu.kanade.tachiyomi.data.download.DownloadManager
import eu.kanade.tachiyomi.source.Source 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 eu.kanade.tachiyomi.ui.reader.model.ReaderPage
import rx.Observable import rx.Observable
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
import java.io.InputStream
/** /**
* Loader used to load a chapter from the downloaded chapters. * Loader used to load a chapter from the downloaded chapters.
@ -33,7 +35,7 @@ class DownloadPageLoader(
.map { pages -> .map { pages ->
pages.map { page -> pages.map { page ->
ReaderPage(page.index, page.url, page.imageUrl, { ReaderPage(page.index, page.url, page.imageUrl, {
context.contentResolver.openInputStream(page.uri) context.contentResolver.openInputStream(page.uri ?: Uri.EMPTY)!!
}).apply { }).apply {
status = Page.READY status = Page.READY
} }

View File

@ -158,7 +158,7 @@ class SettingsBackupController : SettingsController() {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) {
val flags = Intent.FLAG_GRANT_READ_URI_PERMISSION or val flags = Intent.FLAG_GRANT_READ_URI_PERMISSION or
Intent.FLAG_GRANT_WRITE_URI_PERMISSION Intent.FLAG_GRANT_WRITE_URI_PERMISSION
if (uri != null)
activity.contentResolver.takePersistableUriPermission(uri, flags) activity.contentResolver.takePersistableUriPermission(uri, flags)
} }
@ -168,7 +168,7 @@ class SettingsBackupController : SettingsController() {
CODE_BACKUP_CREATE -> if (data != null && resultCode == Activity.RESULT_OK) { CODE_BACKUP_CREATE -> if (data != null && resultCode == Activity.RESULT_OK) {
val activity = activity ?: return val activity = activity ?: return
val uri = if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { 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()) val file = File(dir, Backup.getDefaultFilename())
Uri.fromFile(file) Uri.fromFile(file)
@ -177,6 +177,7 @@ class SettingsBackupController : SettingsController() {
val flags = Intent.FLAG_GRANT_READ_URI_PERMISSION or val flags = Intent.FLAG_GRANT_READ_URI_PERMISSION or
Intent.FLAG_GRANT_WRITE_URI_PERMISSION Intent.FLAG_GRANT_WRITE_URI_PERMISSION
if (uri != null)
activity.contentResolver.takePersistableUriPermission(uri, flags) activity.contentResolver.takePersistableUriPermission(uri, flags)
val file = UniFile.fromUri(activity, uri) val file = UniFile.fromUri(activity, uri)
@ -188,6 +189,7 @@ class SettingsBackupController : SettingsController() {
} }
CODE_BACKUP_RESTORE -> if (data != null && resultCode == Activity.RESULT_OK) { CODE_BACKUP_RESTORE -> if (data != null && resultCode == Activity.RESULT_OK) {
val uri = data.data val uri = data.data
if (uri != null)
RestoreBackupDialog(uri).showDialog(router) RestoreBackupDialog(uri).showDialog(router)
} }
} }
@ -311,7 +313,7 @@ class SettingsBackupController : SettingsController() {
val context = applicationContext val context = applicationContext
if (context != null) { if (context != null) {
RestoringBackupDialog().showDialog(router, TAG_RESTORING_BACKUP_DIALOG) RestoringBackupDialog().showDialog(router, TAG_RESTORING_BACKUP_DIALOG)
BackupRestoreService.start(context, args.getParcelable(KEY_URI)) BackupRestoreService.start(context, args.getParcelable(KEY_URI)!!)
} }
} }
.build() .build()
@ -385,7 +387,7 @@ class SettingsBackupController : SettingsController() {
.negativeText(R.string.action_open_log) .negativeText(R.string.action_open_log)
.onNegative { _, _ -> .onNegative { _, _ ->
val context = applicationContext ?: return@onNegative val context = applicationContext ?: return@onNegative
if (!path.isEmpty()) { if (!path!!.isEmpty()) {
val destFile = File(path, file) val destFile = File(path, file)
val uri = destFile.getUriCompat(context) val uri = destFile.getUriCompat(context)
val sendIntent = Intent(Intent.ACTION_VIEW).apply { 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?) { override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
when (requestCode) { when (requestCode) {
DOWNLOAD_DIR_PRE_L -> if (data != null && resultCode == Activity.RESULT_OK) { DOWNLOAD_DIR_PRE_L -> if (data != null && resultCode == Activity.RESULT_OK) {
val uri = Uri.fromFile(File(data.data.path)) val uri = Uri.fromFile(File(data.data?.path))
preferences.downloadsDirectory().set(uri.toString()) preferences.downloadsDirectory().set(uri?.toString() ?: "")
} }
DOWNLOAD_DIR_L -> if (data != null && resultCode == Activity.RESULT_OK) { DOWNLOAD_DIR_L -> if (data != null && resultCode == Activity.RESULT_OK) {
val context = applicationContext ?: return val context = applicationContext ?: return
@ -128,6 +128,7 @@ class SettingsDownloadController : SettingsController() {
Intent.FLAG_GRANT_WRITE_URI_PERMISSION Intent.FLAG_GRANT_WRITE_URI_PERMISSION
@Suppress("NewApi") @Suppress("NewApi")
if (uri != null)
context.contentResolver.takePersistableUriPermission(uri, flags) context.contentResolver.takePersistableUriPermission(uri, flags)
val file = UniFile.fromUri(context, uri) 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. * 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 * 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 { private fun updateConfigLocale(config: Configuration, locale: Locale): Configuration {
val newConfig = Configuration(config) val newConfig = Configuration(config)
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
newConfig.locale = locale newConfig.setLocale(locale)
} else { } else {
newConfig.locales = LocaleList(locale) newConfig.setLocales(LocaleList(locale))
} }
return newConfig return newConfig
} }

View File

@ -7,10 +7,10 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.2.1' classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.17.0' classpath 'com.github.ben-manes:gradle-versions-plugin:0.22.0'
classpath 'com.github.zellius:android-shortcut-gradle-plugin:0.1.2' 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 // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // 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 distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists 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