diff --git a/app/build.gradle b/app/build.gradle index cb180b858..15bcfdeaf 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -25,12 +25,12 @@ ext { } def includeUpdater() { - return hasProperty("include_updater"); + return hasProperty("include_updater") } android { compileSdkVersion 23 - buildToolsVersion "23.0.2" + buildToolsVersion "23.0.3" publishNonDefault true defaultConfig { @@ -88,7 +88,7 @@ kapt { } dependencies { - final SUPPORT_LIBRARY_VERSION = '23.2.1' + final SUPPORT_LIBRARY_VERSION = '23.3.0' final DAGGER_VERSION = '2.2' final OKHTTP_VERSION = '3.2.0' final RETROFIT_VERSION = '2.0.1' diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index 3ad54c68e..bea488f3c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -17,7 +17,7 @@ import eu.kanade.tachiyomi.ui.library.LibraryFragment import eu.kanade.tachiyomi.ui.recent.RecentChaptersFragment import eu.kanade.tachiyomi.ui.setting.SettingsActivity import eu.kanade.tachiyomi.util.getResourceColor -import eu.kanade.tachiyomi.util.setDrawableCompat +import eu.kanade.tachiyomi.util.setVectorCompat import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.toolbar.* @@ -57,7 +57,7 @@ class MainActivity : BaseActivity() { // Set behavior of Navigation drawer nav_view.setNavigationItemSelectedListener { item -> // Make information view invisible - image_view.setDrawableCompat(null) + image_view.setImageResource(android.R.color.transparent) text_label.text = "" when (item.itemId) { @@ -93,10 +93,10 @@ class MainActivity : BaseActivity() { fun updateEmptyView(show: Boolean, textResource: Int, drawable: Int) { if (show) { - image_view.setDrawableCompat(drawable) + image_view.setVectorCompat(drawable, theme.getResourceColor(android.R.attr.textColorHint)) text_label.text = getString(textResource) } else { - image_view.setDrawableCompat(null) + image_view.setImageResource(android.R.color.transparent) text_label.text = "" } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersFragment.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersFragment.kt index 572baa377..f94cbe022 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersFragment.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersFragment.kt @@ -77,9 +77,8 @@ class ChaptersFragment : BaseRxFragment(), ActionMode.Callbac val chapter = presenter.getNextUnreadChapter() if (chapter != null) { // Create animation listener - var revealAnimationListener: Animator.AnimatorListener = object : AnimatorListenerAdapter() { - override fun onAnimationEnd(animation: Animator) { - // On done open chapter + val revealAnimationListener: Animator.AnimatorListener = object : AnimatorListenerAdapter() { + override fun onAnimationStart(animation: Animator?) { openChapter(chapter, true) } } @@ -109,7 +108,7 @@ class ChaptersFragment : BaseRxFragment(), ActionMode.Callbac // Check if animation view is visible if (reveal_view.visibility == View.VISIBLE) { // Show the unReveal effect - var coordinates = fab.getCoordinates() + val coordinates = fab.getCoordinates() reveal_view.hideRevealEffect(coordinates.x, coordinates.y, 1920) } super.onResume() @@ -184,7 +183,7 @@ class ChaptersFragment : BaseRxFragment(), ActionMode.Callbac val isCatalogueManga: Boolean get() = (activity as MangaActivity).isCatalogueManga - protected fun openChapter(chapter: Chapter, hasAnimation: Boolean = false) { + fun openChapter(chapter: Chapter, hasAnimation: Boolean = false) { presenter.onOpenChapter(chapter) val intent = ReaderActivity.newIntent(activity) if (hasAnimation) { 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 0840e4b44..689fa20e8 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 @@ -8,7 +8,6 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.source.base.Source import eu.kanade.tachiyomi.ui.base.fragment.BaseRxFragment -import eu.kanade.tachiyomi.util.setDrawableCompat import kotlinx.android.synthetic.main.fragment_manga_info.* import nucleus.factory.RequiresPresenter @@ -137,7 +136,7 @@ class MangaInfoFragment : BaseRxFragment() { private fun setFavoriteDrawable(isFavorite: Boolean) { // Set the Favorite drawable to the correct one. // Border drawable if false, filled drawable if true. - fab_favorite.setDrawableCompat(if (isFavorite) + fab_favorite.setImageResource(if (isFavorite) R.drawable.ic_bookmark_white_24dp else R.drawable.ic_bookmark_border_white_24dp) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonReader.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonReader.kt index 76672abce..3d64bbcba 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonReader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonReader.kt @@ -110,7 +110,7 @@ class WebtoonReader : BaseReader() { } override fun onSaveInstanceState(outState: Bundle) { - val savedPosition = pages[layoutManager.findFirstVisibleItemPosition()].pageNumber + val savedPosition = pages.getOrNull(layoutManager.findFirstVisibleItemPosition())?.pageNumber ?: 0 outState.putInt(SAVED_POSITION, savedPosition) super.onSaveInstanceState(outState) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralFragment.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralFragment.kt index ec5862484..d99741fc8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralFragment.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralFragment.kt @@ -74,7 +74,7 @@ class SettingsGeneralFragment : SettingsNestedFragment() { if (preference === columnsPreference) { val fragment = LibraryColumnsDialog.newInstance(preference) fragment.setTargetFragment(this, 0) - fragment.show(childFragmentManager, null) + fragment.show(fragmentManagerCompat, null) } else { super.onDisplayPreferenceDialog(preference) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsNestedFragment.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsNestedFragment.kt index b2d44e135..ef4a69a6f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsNestedFragment.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsNestedFragment.kt @@ -1,5 +1,7 @@ package eu.kanade.tachiyomi.ui.setting +import android.app.FragmentManager +import android.os.Build import android.os.Bundle import android.support.v14.preference.PreferenceFragment import eu.kanade.tachiyomi.data.preference.PreferencesHelper @@ -40,4 +42,11 @@ open class SettingsNestedFragment : PreferenceFragment() { val preferences: PreferencesHelper get() = settingsActivity.preferences + + val fragmentManagerCompat: FragmentManager + get() = if (Build.VERSION.SDK_INT >= 17) { + childFragmentManager + } else { + fragmentManager + } } \ No newline at end of file diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsSourcesFragment.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsSourcesFragment.kt index a5b5615e7..d6c2f39bc 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsSourcesFragment.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsSourcesFragment.kt @@ -71,7 +71,7 @@ class SettingsSourcesFragment : SettingsNestedFragment() { setOnPreferenceClickListener { val fragment = SourceLoginDialog.newInstance(source) fragment.setTargetFragment(this@SettingsSourcesFragment, SOURCE_CHANGE_REQUEST) - fragment.show(childFragmentManager, null) + fragment.show(fragmentManagerCompat, null) true } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsSyncFragment.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsSyncFragment.kt index e6400f339..da2c244fe 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsSyncFragment.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsSyncFragment.kt @@ -33,7 +33,7 @@ class SettingsSyncFragment : SettingsNestedFragment() { setOnPreferenceClickListener { val fragment = MangaSyncLoginDialog.newInstance(sync) fragment.setTargetFragment(this@SettingsSyncFragment, SYNC_CHANGE_REQUEST) - fragment.show(childFragmentManager, null) + fragment.show(fragmentManagerCompat, null) true } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/ImageViewExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/ImageViewExtensions.kt index 518356f0e..179188870 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/ImageViewExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/ImageViewExtensions.kt @@ -1,21 +1,20 @@ package eu.kanade.tachiyomi.util import android.support.annotation.DrawableRes +import android.support.graphics.drawable.VectorDrawableCompat import android.support.v4.content.ContextCompat import android.support.v4.graphics.drawable.DrawableCompat import android.widget.ImageView /** - * Set a drawable on a [ImageView] using [ContextCompat] for backwards compatibility. + * Set a vector on a [ImageView]. * * @param drawable id of drawable resource */ -fun ImageView.setDrawableCompat(@DrawableRes drawable: Int?) { - if (drawable != null) { - var drawable = ContextCompat.getDrawable(context, drawable) - DrawableCompat.setTint(drawable,this.context.theme.getResourceColor(android.R.attr.textColorHint)) - setImageDrawable(drawable) - } else { - setImageResource(android.R.color.transparent) +fun ImageView.setVectorCompat(@DrawableRes drawable: Int, tint: Int? = null) { + val vector = VectorDrawableCompat.create(resources, drawable, context.theme) + if (tint != null) { + vector?.setTint(tint) } -} + setImageDrawable(vector) +} \ No newline at end of file diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/LoginPreference.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/LoginPreference.kt index c2889443c..e4068b9fb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/LoginPreference.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/LoginPreference.kt @@ -18,13 +18,10 @@ class LoginPreference @JvmOverloads constructor(context: Context, attrs: Attribu override fun onBindViewHolder(holder: PreferenceViewHolder) { super.onBindViewHolder(holder) - with(holder.itemView.image_view) { - if (getPersistedString("").isNullOrEmpty()) { - setImageResource(android.R.color.transparent) - } else { - setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_done_green_24dp)) - } - } + holder.itemView.image_view.setImageResource(if (getPersistedString("").isNullOrEmpty()) + android.R.color.transparent + else + R.drawable.ic_done_green_24dp) } override public fun notifyChanged() { diff --git a/app/src/main/res/drawable-hdpi/reader_background_checkbox_selected.png b/app/src/main/res/drawable-hdpi/reader_background_checkbox_selected.png new file mode 100644 index 000000000..9908433c0 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/reader_background_checkbox_selected.png differ diff --git a/app/src/main/res/drawable-hdpi/reader_background_checkbox_unselected.png b/app/src/main/res/drawable-hdpi/reader_background_checkbox_unselected.png new file mode 100644 index 000000000..195e875fb Binary files /dev/null and b/app/src/main/res/drawable-hdpi/reader_background_checkbox_unselected.png differ diff --git a/app/src/main/res/drawable-ldpi/reader_background_checkbox_selected.png b/app/src/main/res/drawable-ldpi/reader_background_checkbox_selected.png new file mode 100644 index 000000000..d06d87c95 Binary files /dev/null and b/app/src/main/res/drawable-ldpi/reader_background_checkbox_selected.png differ diff --git a/app/src/main/res/drawable-ldpi/reader_background_checkbox_unselected.png b/app/src/main/res/drawable-ldpi/reader_background_checkbox_unselected.png new file mode 100644 index 000000000..4899a16ff Binary files /dev/null and b/app/src/main/res/drawable-ldpi/reader_background_checkbox_unselected.png differ diff --git a/app/src/main/res/drawable-mdpi/reader_background_checkbox_selected.png b/app/src/main/res/drawable-mdpi/reader_background_checkbox_selected.png new file mode 100644 index 000000000..f0faf295f Binary files /dev/null and b/app/src/main/res/drawable-mdpi/reader_background_checkbox_selected.png differ diff --git a/app/src/main/res/drawable-mdpi/reader_background_checkbox_unselected.png b/app/src/main/res/drawable-mdpi/reader_background_checkbox_unselected.png new file mode 100644 index 000000000..69e1ee734 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/reader_background_checkbox_unselected.png differ diff --git a/app/src/main/res/drawable-xxhdpi/reader_background_checkbox_selected.png b/app/src/main/res/drawable-xxhdpi/reader_background_checkbox_selected.png new file mode 100644 index 000000000..287892b71 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/reader_background_checkbox_selected.png differ diff --git a/app/src/main/res/drawable-xxhdpi/reader_background_checkbox_unselected.png b/app/src/main/res/drawable-xxhdpi/reader_background_checkbox_unselected.png new file mode 100644 index 000000000..b279adbbd Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/reader_background_checkbox_unselected.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/reader_background_checkbox_selected.png b/app/src/main/res/drawable-xxxhdpi/reader_background_checkbox_selected.png new file mode 100644 index 000000000..90c1bd6f5 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/reader_background_checkbox_selected.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/reader_background_checkbox_unselected.png b/app/src/main/res/drawable-xxxhdpi/reader_background_checkbox_unselected.png new file mode 100644 index 000000000..5a3af58d6 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/reader_background_checkbox_unselected.png differ diff --git a/app/src/main/res/drawable/ic_reader_background_checkbox_black_24dp.xml b/app/src/main/res/drawable/ic_reader_background_checkbox_black_24dp.xml deleted file mode 100644 index f041ff22a..000000000 --- a/app/src/main/res/drawable/ic_reader_background_checkbox_black_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_reader_background_checkbox_white_24dp.xml b/app/src/main/res/drawable/ic_reader_background_checkbox_white_24dp.xml deleted file mode 100644 index 6ec88b717..000000000 --- a/app/src/main/res/drawable/ic_reader_background_checkbox_white_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/reader_background_checkbox.xml b/app/src/main/res/drawable/reader_background_checkbox.xml index 07dff0006..2ace26fce 100644 --- a/app/src/main/res/drawable/reader_background_checkbox.xml +++ b/app/src/main/res/drawable/reader_background_checkbox.xml @@ -1,5 +1,5 @@ - - + + \ No newline at end of file diff --git a/app/src/main/res/layout/reader_popup.xml b/app/src/main/res/layout/reader_popup.xml index d5205d517..b16dc33bf 100644 --- a/app/src/main/res/layout/reader_popup.xml +++ b/app/src/main/res/layout/reader_popup.xml @@ -39,10 +39,6 @@ android:layout_width="wrap_content" android:layout_height="36dp" android:gravity="center" - android:paddingLeft="4dp" - android:paddingRight="4dp" - android:layout_marginLeft="4dp" - android:layout_marginStart="4dp" android:text="@string/pref_reader_theme"/>