From 24214c5d6bdca87870ec005913f66c85aa43d750 Mon Sep 17 00:00:00 2001 From: lyr <15622190878@163.com> Date: Fri, 20 Nov 2020 09:13:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96"=E6=96=B0=E5=88=86=E7=B1=BB"?= =?UTF-8?q?=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/gh/gamecenter/Injection.java | 2 +- .../java/com/gh/common/util/DirectUtils.kt | 2 +- .../com/gh/common/view/CatalogFilterView.kt | 10 ++-- .../catalog/SpecialCatalogAdapter.kt | 48 ++++++++++++++++++- .../gamecenter/catalog/SubCatalogAdapter.kt | 1 + app/src/main/res/layout/catalog_item.xml | 1 - 6 files changed, 54 insertions(+), 10 deletions(-) diff --git a/app/src/debug/java/com/gh/gamecenter/Injection.java b/app/src/debug/java/com/gh/gamecenter/Injection.java index 86d42a1f0b..66aaa90296 100644 --- a/app/src/debug/java/com/gh/gamecenter/Injection.java +++ b/app/src/debug/java/com/gh/gamecenter/Injection.java @@ -28,7 +28,7 @@ public class Injection { public static OkHttpClient.Builder provideRetrofitBuilder() { OkHttpClient.Builder builder = new OkHttpClient.Builder(); HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(); - interceptor.setLevel(HttpLoggingInterceptor.Level.BODY); + interceptor.setLevel(HttpLoggingInterceptor.Level.BASIC); builder.addNetworkInterceptor(interceptor); builder.addNetworkInterceptor(new StethoInterceptor()); return builder; diff --git a/app/src/main/java/com/gh/common/util/DirectUtils.kt b/app/src/main/java/com/gh/common/util/DirectUtils.kt index d29399f28a..614d0f0e3a 100644 --- a/app/src/main/java/com/gh/common/util/DirectUtils.kt +++ b/app/src/main/java/com/gh/common/util/DirectUtils.kt @@ -899,7 +899,7 @@ object DirectUtils { fun directCatalog(context: Context, catalogId: String, catalogTitle: String, entrance: String? = null, path: String? = "") { if (catalogId.isEmpty()) return val bundle = Bundle() - bundle.putString(KEY_TO, CategoryDirectoryActivity::class.java.name) + bundle.putString(KEY_TO, CatalogActivity::class.java.name) bundle.putString(KEY_CATALOG_ID, catalogId) bundle.putString(KEY_CATALOG_TITLE, catalogTitle) bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER) diff --git a/app/src/main/java/com/gh/common/view/CatalogFilterView.kt b/app/src/main/java/com/gh/common/view/CatalogFilterView.kt index 431816db78..21e02d6ef4 100644 --- a/app/src/main/java/com/gh/common/view/CatalogFilterView.kt +++ b/app/src/main/java/com/gh/common/view/CatalogFilterView.kt @@ -298,11 +298,11 @@ class CatalogFilterView @JvmOverloads constructor(context: Context, attrs: Attri private fun getDefaultSizeFilterArray(): ArrayList { return arrayListOf().apply { add(SubjectSettingEntity.Size(min = -1, max = -1, text = "全部大小")) - add(SubjectSettingEntity.Size(min = -1, max = 20, text = "20M以下")) - add(SubjectSettingEntity.Size(min = 20, max = 50, text = "20-50M")) - add(SubjectSettingEntity.Size(min = 50, max = 100, text = "50-100M")) - add(SubjectSettingEntity.Size(min = 100, max = 500, text = "100-500M")) - add(SubjectSettingEntity.Size(min = 500, max = -1, text = "500M以上")) + add(SubjectSettingEntity.Size(min = -1, max = 100, text = "100M以下")) + add(SubjectSettingEntity.Size(min = 100, max = 300, text = "100-300M")) + add(SubjectSettingEntity.Size(min = 300, max = 500, text = "300-500M")) + add(SubjectSettingEntity.Size(min = 500, max = 1000, text = "100M-1G")) + add(SubjectSettingEntity.Size(min = 1000, max = -1, text = "1G以上")) } } diff --git a/app/src/main/java/com/gh/gamecenter/catalog/SpecialCatalogAdapter.kt b/app/src/main/java/com/gh/gamecenter/catalog/SpecialCatalogAdapter.kt index 5c828abd79..a945c52e5d 100644 --- a/app/src/main/java/com/gh/gamecenter/catalog/SpecialCatalogAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/catalog/SpecialCatalogAdapter.kt @@ -22,6 +22,52 @@ import com.gh.gamecenter.subject.SubjectActivity.Companion.startSubjectActivity class SpecialCatalogAdapter(context: Context) : ListAdapter(context) { + override fun getItemCount() = if (mEntityList.isNullOrEmpty()) 0 else mEntityList.size + FOOTER_ITEM_COUNT + + override fun areItemsTheSame(oldItem: SpecialCatalogItemData?, newItem: SpecialCatalogItemData?): Boolean { + return when { + oldItem?.header != null && newItem?.header != null -> { + oldItem.header.id == newItem.header.id + } + + oldItem?.bigImage != null && newItem?.bigImage != null -> { + oldItem.bigImage.id == newItem.bigImage.id + } + + oldItem?.subject != null && newItem?.subject != null -> { + oldItem.subject.id == newItem.subject.id + } + + oldItem?.subjectCollection != null && newItem?.subjectCollection != null -> { + oldItem.subjectCollection.id == newItem.subjectCollection.id + } + + else -> super.areItemsTheSame(oldItem, newItem) + } + } + + override fun areContentsTheSame(oldItem: SpecialCatalogItemData?, newItem: SpecialCatalogItemData?): Boolean { + return when { + oldItem?.header != null && newItem?.header != null -> { + oldItem.header.id == newItem.header.id + } + + oldItem?.bigImage != null && newItem?.bigImage != null -> { + oldItem.bigImage.id == newItem.bigImage.id + } + + oldItem?.subject != null && newItem?.subject != null -> { + oldItem.subject.id == newItem.subject.id + } + + oldItem?.subjectCollection != null && newItem?.subjectCollection != null -> { + oldItem.subjectCollection.id == newItem.subjectCollection.id + } + + else -> super.areItemsTheSame(oldItem, newItem) + } + } + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { val view: View return when (viewType) { @@ -98,8 +144,6 @@ class SpecialCatalogAdapter(context: Context) : ListAdapter(binding.root) class CatalogHeaderItemHolder(val binding: CatalogHeaderItemBinding) : BaseRecyclerViewHolder(binding.root) diff --git a/app/src/main/java/com/gh/gamecenter/catalog/SubCatalogAdapter.kt b/app/src/main/java/com/gh/gamecenter/catalog/SubCatalogAdapter.kt index 41a7c2ed3a..fed4d6a710 100644 --- a/app/src/main/java/com/gh/gamecenter/catalog/SubCatalogAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/catalog/SubCatalogAdapter.kt @@ -24,6 +24,7 @@ class SubCatalogAdapter(context: Context, private val mPrimaryCatalog: CatalogEn holder.binding.run { val catalogEntity = mList[position] entity = catalogEntity + executePendingBindings() root.setOnClickListener { root.context.startActivity(NewCatalogListActivity.getIntent(mContext, catalogEntity.name, mPrimaryCatalog, catalogEntity.name)) } diff --git a/app/src/main/res/layout/catalog_item.xml b/app/src/main/res/layout/catalog_item.xml index d043ce89f6..54f3309eb9 100644 --- a/app/src/main/res/layout/catalog_item.xml +++ b/app/src/main/res/layout/catalog_item.xml @@ -35,7 +35,6 @@