From 612c522683bc082e351a02a9d8355898a9313b1c Mon Sep 17 00:00:00 2001 From: Vi Anh Date: Fri, 7 Jan 2022 22:34:31 +0700 Subject: [PATCH] Config page image and remove deprecated classes --- app/build.gradle | 4 ++-- .../blogtruyen/features/base/BaseViewHolder.kt | 11 ----------- .../blogtruyen/features/base/list/BaseVH.kt | 8 -------- .../blogtruyen/features/list/HomeFragment.kt | 8 ++++---- .../features/reader/SettingBottomSheet.kt | 18 ------------------ .../reader/type/pager/PagerItemViewHolder.kt | 2 +- .../reader/type/vertical/PageItemVH.kt | 2 -- .../reader/type/vertical/TransitionPageVH.kt | 2 +- .../reader/type/vertical/VerticalReader.kt | 6 +----- 9 files changed, 9 insertions(+), 52 deletions(-) delete mode 100644 app/src/main/java/com/vianh/blogtruyen/features/base/BaseViewHolder.kt delete mode 100644 app/src/main/java/com/vianh/blogtruyen/features/base/list/BaseVH.kt delete mode 100644 app/src/main/java/com/vianh/blogtruyen/features/reader/SettingBottomSheet.kt diff --git a/app/build.gradle b/app/build.gradle index 34e3d15..4ef950a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -13,8 +13,8 @@ android { applicationId "com.vianh.blogtruyen" minSdkVersion 21 targetSdkVersion 31 - versionCode 13 - versionName "0.13" + versionCode 14 + versionName "0.14" setArchivesBaseName("blogTruyen_$versionName") testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/app/src/main/java/com/vianh/blogtruyen/features/base/BaseViewHolder.kt b/app/src/main/java/com/vianh/blogtruyen/features/base/BaseViewHolder.kt deleted file mode 100644 index 7db77d7..0000000 --- a/app/src/main/java/com/vianh/blogtruyen/features/base/BaseViewHolder.kt +++ /dev/null @@ -1,11 +0,0 @@ -package com.vianh.blogtruyen.features.base - -import android.view.View -import androidx.recyclerview.widget.RecyclerView -import com.vianh.blogtruyen.features.base.list.items.ListItem - -@Deprecated(message = "Use abstract view holder", level = DeprecationLevel.WARNING) -abstract class BaseViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { - abstract fun onBind(item: ListItem) - open fun onRecycle() = Unit -} \ No newline at end of file diff --git a/app/src/main/java/com/vianh/blogtruyen/features/base/list/BaseVH.kt b/app/src/main/java/com/vianh/blogtruyen/features/base/list/BaseVH.kt deleted file mode 100644 index 1f23f95..0000000 --- a/app/src/main/java/com/vianh/blogtruyen/features/base/list/BaseVH.kt +++ /dev/null @@ -1,8 +0,0 @@ -package com.vianh.blogtruyen.features.base.list - -import androidx.viewbinding.ViewBinding -import com.vianh.blogtruyen.features.base.BaseViewHolder - -@Deprecated("Use abstract view holder", level = DeprecationLevel.WARNING) -abstract class BaseVH(val binding: B) : - BaseViewHolder(binding.root) \ No newline at end of file diff --git a/app/src/main/java/com/vianh/blogtruyen/features/list/HomeFragment.kt b/app/src/main/java/com/vianh/blogtruyen/features/list/HomeFragment.kt index 30c9d27..b5c9f1f 100644 --- a/app/src/main/java/com/vianh/blogtruyen/features/list/HomeFragment.kt +++ b/app/src/main/java/com/vianh/blogtruyen/features/list/HomeFragment.kt @@ -76,14 +76,14 @@ class HomeFragment: BaseFragment(), ItemClick { super.onScrolled(recyclerView, dx, dy) val newState = lastDy * dy lastDy = dy - if (newState >= 0) { + if (newState > 0) { return } - if (dy > 0) { - requireBinding.btnFilter.extend() - } else { + if (dy >= 0) { requireBinding.btnFilter.shrink() + } else { + requireBinding.btnFilter.extend() } } }) diff --git a/app/src/main/java/com/vianh/blogtruyen/features/reader/SettingBottomSheet.kt b/app/src/main/java/com/vianh/blogtruyen/features/reader/SettingBottomSheet.kt deleted file mode 100644 index 956598e..0000000 --- a/app/src/main/java/com/vianh/blogtruyen/features/reader/SettingBottomSheet.kt +++ /dev/null @@ -1,18 +0,0 @@ -package com.vianh.blogtruyen.features.reader - -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import com.google.android.material.bottomsheet.BottomSheetDialogFragment - -class SettingBottomSheet: BottomSheetDialogFragment() { - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - return super.onCreateView(inflater, container, savedInstanceState) - } - - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - super.onViewCreated(view, savedInstanceState) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/vianh/blogtruyen/features/reader/type/pager/PagerItemViewHolder.kt b/app/src/main/java/com/vianh/blogtruyen/features/reader/type/pager/PagerItemViewHolder.kt index a4546ed..e7c0d22 100644 --- a/app/src/main/java/com/vianh/blogtruyen/features/reader/type/pager/PagerItemViewHolder.kt +++ b/app/src/main/java/com/vianh/blogtruyen/features/reader/type/pager/PagerItemViewHolder.kt @@ -41,7 +41,7 @@ class PagerItemViewHolder(parent: ViewGroup, val requestManager: RequestManager) init { with(binding.page) { - setMaxTileSize(maxTileSize) + setMaxTileSize(getMaxTextureSize()) setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CENTER_INSIDE) } } diff --git a/app/src/main/java/com/vianh/blogtruyen/features/reader/type/vertical/PageItemVH.kt b/app/src/main/java/com/vianh/blogtruyen/features/reader/type/vertical/PageItemVH.kt index 0503841..4b07d7c 100644 --- a/app/src/main/java/com/vianh/blogtruyen/features/reader/type/vertical/PageItemVH.kt +++ b/app/src/main/java/com/vianh/blogtruyen/features/reader/type/vertical/PageItemVH.kt @@ -53,8 +53,6 @@ class PageItemVH( with(binding.page) { setMaxTileSize(tileSize) setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CUSTOM) - setMinimumDpi(90) - setMinimumTileDpi(180) } } diff --git a/app/src/main/java/com/vianh/blogtruyen/features/reader/type/vertical/TransitionPageVH.kt b/app/src/main/java/com/vianh/blogtruyen/features/reader/type/vertical/TransitionPageVH.kt index 043e1d1..e71aacc 100644 --- a/app/src/main/java/com/vianh/blogtruyen/features/reader/type/vertical/TransitionPageVH.kt +++ b/app/src/main/java/com/vianh/blogtruyen/features/reader/type/vertical/TransitionPageVH.kt @@ -44,7 +44,7 @@ class TransitionPageVH(val parent: ViewGroup, val viewModel: ReaderViewModel) : description.setText(R.string.next_chapter_guide) } else { canProcess = false - description.text = context.getString(R.string.pull_down_guild, boundData?.chapter?.number.toString()) + description.text = context.getString(R.string.pull_down_guild, boundData?.chapter?.name) } } } diff --git a/app/src/main/java/com/vianh/blogtruyen/features/reader/type/vertical/VerticalReader.kt b/app/src/main/java/com/vianh/blogtruyen/features/reader/type/vertical/VerticalReader.kt index db725dd..99c4041 100644 --- a/app/src/main/java/com/vianh/blogtruyen/features/reader/type/vertical/VerticalReader.kt +++ b/app/src/main/java/com/vianh/blogtruyen/features/reader/type/vertical/VerticalReader.kt @@ -7,13 +7,9 @@ import com.vianh.blogtruyen.R import com.vianh.blogtruyen.features.base.list.commonVH.ErrorItemVH import com.vianh.blogtruyen.features.reader.Reader import com.vianh.blogtruyen.features.reader.ReaderModel -import com.vianh.blogtruyen.utils.ItemPosScrollListener -import com.vianh.blogtruyen.utils.PreCacheLayoutManager -import com.vianh.blogtruyen.utils.SpaceDecorator -import com.vianh.blogtruyen.utils.maxTileSize +import com.vianh.blogtruyen.utils.* import com.vianh.blogtruyen.views.PinchRecyclerView import me.everything.android.ui.overscroll.OverScrollDecoratorHelper -import timber.log.Timber class VerticalReader: Reader(R.layout.vertical_reader_layout), ErrorItemVH.ErrorReloadClick {