From 11ac4df5d7d0d332c6ceedd006af2fe2d18de6be Mon Sep 17 00:00:00 2001 From: len Date: Thu, 29 Sep 2016 19:53:59 +0200 Subject: [PATCH] Bump dependencies, remove unused resources --- app/build.gradle | 16 ++++++++-------- .../data/network/CloudflareInterceptor.kt | 3 +-- .../kanade/tachiyomi/ui/backup/BackupFragment.kt | 2 ++ .../tachiyomi/ui/manga/info/MangaInfoFragment.kt | 10 ---------- .../tachiyomi/ui/setting/SettingsFragment.kt | 7 ++++--- .../eu/kanade/tachiyomi/util/ThemeExtensions.kt | 16 ++++++++++++---- app/src/main/res/values/strings.xml | 3 --- app/src/main/res/values/themes.xml | 4 ++++ 8 files changed, 31 insertions(+), 30 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 96386dc2f..44e353fe3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -91,7 +91,7 @@ dependencies { compile 'com.github.inorichi:ReactiveNetwork:69092ed' // Android support library - final support_library_version = '24.1.1' + final support_library_version = '24.2.1' compile "com.android.support:support-v4:$support_library_version" compile "com.android.support:appcompat-v7:$support_library_version" compile "com.android.support:cardview-v7:$support_library_version" @@ -104,7 +104,7 @@ dependencies { // ReactiveX compile 'io.reactivex:rxandroid:1.2.1' - compile 'io.reactivex:rxjava:1.1.10' + compile 'io.reactivex:rxjava:1.2.0' compile 'com.f2prateek.rx.preferences:rx-preferences:1.0.2' // Network client @@ -121,13 +121,13 @@ dependencies { // JSON compile 'com.google.code.gson:gson:2.7' - compile 'com.github.salomonbrys.kotson:kotson:2.3.0' + compile 'com.github.salomonbrys.kotson:kotson:2.4.0' // YAML compile 'com.github.bmoliveira:snake-yaml:v1.18-android' // JavaScript engine - compile 'com.squareup.duktape:duktape-android:0.9.5' + compile 'com.squareup.duktape:duktape-android:1.0.0' // Disk cache compile 'com.jakewharton:disklrucache:2.0.2' @@ -157,19 +157,19 @@ dependencies { compile 'jp.wasabeef:glide-transformations:2.0.1' // Logging - compile 'com.jakewharton.timber:timber:4.3.0' + compile 'com.jakewharton.timber:timber:4.3.1' // Crash reports compile 'ch.acra:acra:4.9.0' // UI - compile 'com.dmitrymalkovich.android:material-design-dimens:1.2' + compile 'com.dmitrymalkovich.android:material-design-dimens:1.4' compile 'com.github.dmytrodanylyk.android-process-button:library:1.0.4' compile 'eu.davidea:flexible-adapter:4.2.0' compile 'com.nononsenseapps:filepicker:2.5.2' compile 'com.github.amulyakhare:TextDrawable:558677e' - compile 'com.afollestad.material-dialogs:core:0.8.6.2' - compile 'net.xpece.android:support-preference:0.8.1' + compile 'com.afollestad.material-dialogs:core:0.9.0.2' + compile 'net.xpece.android:support-preference:1.0.3' compile 'me.zhanghai.android.systemuihelper:library:1.0.0' compile 'de.hdodenhof:circleimageview:2.1.0' diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/network/CloudflareInterceptor.kt b/app/src/main/java/eu/kanade/tachiyomi/data/network/CloudflareInterceptor.kt index 41b8a5aaf..503b779a3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/network/CloudflareInterceptor.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/network/CloudflareInterceptor.kt @@ -60,8 +60,7 @@ class CloudflareInterceptor(private val cookies: PersistentCookieStore) : Interc .replace(Regex("""\s{3,}[a-z](?: = |\.).+"""), "") .replace("\n", "") - // Duktape can only return strings, so the result has to be converted to string first - val result = duktape.evaluate("$js.toString()").toInt() + val result = (duktape.evaluate(js) as Double).toInt() val answer = "${result + domain.length}" diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/backup/BackupFragment.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/backup/BackupFragment.kt index 28d4c01c7..d17235478 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/backup/BackupFragment.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/backup/BackupFragment.kt @@ -41,6 +41,8 @@ class BackupFragment : BaseRxFragment() { } override fun onViewCreated(view: View, savedState: Bundle?) { + setToolbarTitle(getString(R.string.label_backup)) + (activity as ActivityMixin).requestPermissionsOnMarshmallow() subscriptions = SubscriptionList() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoFragment.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoFragment.kt index 6279466ce..675841c6d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoFragment.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoFragment.kt @@ -1,15 +1,10 @@ package eu.kanade.tachiyomi.ui.manga.info -import android.app.Activity import android.content.Intent import android.graphics.Bitmap -import android.graphics.BitmapFactory -import android.graphics.drawable.BitmapDrawable import android.net.Uri import android.os.Bundle import android.support.customtabs.CustomTabsIntent -import android.support.design.widget.Snackbar -import android.util.SparseArray import android.view.* import com.afollestad.materialdialogs.MaterialDialog import com.bumptech.glide.BitmapRequestBuilder @@ -22,7 +17,6 @@ import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.source.Source import eu.kanade.tachiyomi.data.source.online.OnlineSource import eu.kanade.tachiyomi.ui.base.fragment.BaseRxFragment -import eu.kanade.tachiyomi.ui.library.LibraryFragment import eu.kanade.tachiyomi.ui.manga.MangaActivity import eu.kanade.tachiyomi.util.getResourceColor import eu.kanade.tachiyomi.util.toast @@ -31,14 +25,10 @@ import jp.wasabeef.glide.transformations.CropSquareTransformation import jp.wasabeef.glide.transformations.MaskTransformation import jp.wasabeef.glide.transformations.RoundedCornersTransformation import kotlinx.android.synthetic.main.fragment_manga_info.* -import kotlinx.android.synthetic.main.item_download.* import nucleus.factory.RequiresPresenter import rx.Observable import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers -import timber.log.Timber -import java.io.IOException -import kotlin.concurrent.thread /** * Fragment that shows manga information. diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsFragment.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsFragment.kt index 8c74375c6..9fc116b76 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsFragment.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsFragment.kt @@ -7,9 +7,9 @@ import android.support.v4.content.ContextCompat import android.support.v7.preference.XpPreferenceFragment import android.view.View import eu.kanade.tachiyomi.R +import eu.kanade.tachiyomi.util.getResourceId import net.xpece.android.support.preference.PreferenceIconHelper import net.xpece.android.support.preference.PreferenceScreenNavigationStrategy -import net.xpece.android.support.preference.Util import rx.subscriptions.CompositeSubscription open class SettingsFragment : XpPreferenceFragment() { @@ -24,8 +24,8 @@ open class SettingsFragment : XpPreferenceFragment() { lateinit var subscriptions: CompositeSubscription - private val iconTint by lazy { ContextCompat.getColorStateList( - context, Util.resolveResourceId(context, R.attr.colorAccent, 0)) + private val iconTint by lazy { ContextCompat.getColorStateList(context, + context.theme.getResourceId(R.attr.colorAccent, 0)) } override final fun onCreatePreferences2(savedState: Bundle?, rootKey: String?) { @@ -59,6 +59,7 @@ open class SettingsFragment : XpPreferenceFragment() { @CallSuper override fun onViewCreated(view: View, savedState: Bundle?) { + super.onViewCreated(view, savedState) listView.isFocusable = false } diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/ThemeExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/ThemeExtensions.kt index 81c1988fe..da0f90282 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/ThemeExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/ThemeExtensions.kt @@ -2,18 +2,26 @@ package eu.kanade.tachiyomi.util import android.content.res.Resources import android.graphics.drawable.Drawable +import android.support.annotation.AttrRes import android.support.annotation.StringRes -fun Resources.Theme.getResourceColor(@StringRes resource: Int) : Int { - val typedArray = this.obtainStyledAttributes(intArrayOf(resource)) +fun Resources.Theme.getResourceColor(@StringRes resource: Int): Int { + val typedArray = obtainStyledAttributes(intArrayOf(resource)) val attrValue = typedArray.getColor(0, 0) typedArray.recycle() return attrValue } -fun Resources.Theme.getResourceDrawable(@StringRes resource: Int) : Drawable { - val typedArray = this.obtainStyledAttributes(intArrayOf(resource)) +fun Resources.Theme.getResourceDrawable(@StringRes resource: Int): Drawable { + val typedArray = obtainStyledAttributes(intArrayOf(resource)) val attrValue = typedArray.getDrawable(0) typedArray.recycle() return attrValue +} + +fun Resources.Theme.getResourceId(@AttrRes resource: Int, fallback: Int): Int { + val typedArray = obtainStyledAttributes(intArrayOf(resource)) + val attrValue = typedArray.getResourceId(0, fallback) + typedArray.recycle() + return attrValue } \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index cb2d60fef..f87bb505f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -226,9 +226,6 @@ Genres Share… Check out %1$s! at %2$s - Manga added to home screen - Icon type - Tachiyomi icon Circular icon Rounded icon Square icon diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index a38ec375f..bbf56979d 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -36,6 +36,8 @@ @drawable/line_divider_light @color/textColorPrimaryLight @color/dialogLight + ?colorAccent + ?colorAccent