diff --git a/app/src/main/java/com/gh/common/constant/Constants.java b/app/src/main/java/com/gh/common/constant/Constants.java index 79a994615f..17fd64e4c6 100644 --- a/app/src/main/java/com/gh/common/constant/Constants.java +++ b/app/src/main/java/com/gh/common/constant/Constants.java @@ -202,6 +202,9 @@ public class Constants { // 是否显示更换背景提示 public static final String SP_SHOW_CHANGE_BG_TIPS = "show_change_bg_tips" + TimeUtils.getStartTimeOfToday(); + // 新分类2.0引导 + public static final String SP_SHOW_CATEGORY_GUIDE = "show_category_guide"; + // 内容视频播放选项 public static final String SP_CONTENT_VIDEO_OPTION = "content_video_option"; diff --git a/app/src/main/java/com/gh/common/view/CategoryFilterView.kt b/app/src/main/java/com/gh/common/view/CategoryFilterView.kt index 3dbcd2d084..4343bfb056 100644 --- a/app/src/main/java/com/gh/common/view/CategoryFilterView.kt +++ b/app/src/main/java/com/gh/common/view/CategoryFilterView.kt @@ -59,6 +59,10 @@ class CategoryFilterView @JvmOverloads constructor(context: Context, attrs: Attr mOnCategoryFilterSetupListener = onCategoryFilterSetupListener } + fun resetSortSize() { + mSizeTv.text = "全部大小" + } + private fun toggleHighlightedTextView(targetTextView: TextView, highlightIt: Boolean) { if (highlightIt) { targetTextView.background = ContextCompat.getDrawable(targetTextView.context, R.drawable.bg_tag_text) diff --git a/app/src/main/java/com/gh/gamecenter/category2/CategoryV2Fragment.kt b/app/src/main/java/com/gh/gamecenter/category2/CategoryV2Fragment.kt index a7d072f65e..102f3e957c 100644 --- a/app/src/main/java/com/gh/gamecenter/category2/CategoryV2Fragment.kt +++ b/app/src/main/java/com/gh/gamecenter/category2/CategoryV2Fragment.kt @@ -64,6 +64,21 @@ class CategoryV2Fragment : LazyFragment() { drawerLayout.setScrimColor(R.color.black_alpha_30.toColor()) // 关闭手势滑动 drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED) + drawerLayout.addDrawerListener(object : DrawerLayout.DrawerListener { + override fun onDrawerStateChanged(newState: Int) { + } + + override fun onDrawerSlide(drawerView: View, slideOffset: Float) { + } + + override fun onDrawerClosed(drawerView: View) { + showGuide() + } + + override fun onDrawerOpened(drawerView: View) { + } + + }) directoryContainer.layoutParams.width = width directoryRv.layoutParams.width = width @@ -132,6 +147,27 @@ class CategoryV2Fragment : LazyFragment() { }) } + private fun showGuide() { + mBinding?.run { + val isShow = SPUtils.getBoolean(Constants.SP_SHOW_CATEGORY_GUIDE) + if (isShow) return + guideContainer.visibility = View.VISIBLE + guideContainer.setOnClickListener { + guideContainer.visibility = View.GONE + SPUtils.setBoolean(Constants.SP_SHOW_CATEGORY_GUIDE, true) + } + + countDownTimer(3) { finish, _ -> + tryCatchInRelease { + if (finish) { + guideContainer.visibility = View.GONE + SPUtils.setBoolean(Constants.SP_SHOW_CATEGORY_GUIDE, true) + } + } + } + } + } + override fun onMenuItemClick(menuItem: MenuItem?) { menuItem?.run { if (itemId == R.id.menu_search) { @@ -223,7 +259,7 @@ class CategoryV2Fragment : LazyFragment() { if (SPUtils.getBoolean(Constants.SP_FIRST_ENTER_CATEGORY_V2, true)) { SPUtils.setBoolean(Constants.SP_FIRST_ENTER_CATEGORY_V2, false) mBinding?.drawerLayout?.postDelayed({ - openDrawer() + tryCatchInRelease { openDrawer() } }, 500L) } } @@ -277,7 +313,7 @@ class CategoryV2Fragment : LazyFragment() { if (position == 1 && SPUtils.getBoolean(Constants.SP_FIRST_ENTER_CATEGORY_V2, true)) { SPUtils.setBoolean(Constants.SP_FIRST_ENTER_CATEGORY_V2, false) mBinding?.drawerLayout?.postDelayed({ - openDrawer() + tryCatchInRelease { openDrawer() } }, 200L) } } else { @@ -308,6 +344,8 @@ class CategoryV2Fragment : LazyFragment() { } } } + } else if (sidebar.name == "全部" && selectedCategoryList.isNotEmpty()) { + i = selectedCategoryList[0].primaryIndex } } } diff --git a/app/src/main/java/com/gh/gamecenter/category2/CategoryV2ListFragment.kt b/app/src/main/java/com/gh/gamecenter/category2/CategoryV2ListFragment.kt index c603c0485c..b6340ca9fd 100644 --- a/app/src/main/java/com/gh/gamecenter/category2/CategoryV2ListFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/category2/CategoryV2ListFragment.kt @@ -104,11 +104,18 @@ class CategoryV2ListFragment : ListFragment logClickReset("游戏列表") resetDirectoryList() } + resetSortSize() changeCategoryTab() - openDirectoryLayout() +// openDirectoryLayout() } } + private fun resetSortSize() { + mBinding?.filterContainer?.resetSortSize() + mListViewModel?.sortSize = SubjectSettingEntity.Size(min = -1, max = -1, text = "全部大小") + + } + private fun initFilterView() { mBinding?.filterContainer?.run { visibility = View.VISIBLE diff --git a/app/src/main/res/drawable-xxxhdpi/pic_category_guide.webp b/app/src/main/res/drawable-xxxhdpi/pic_category_guide.webp new file mode 100644 index 0000000000..b229d64c55 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/pic_category_guide.webp differ diff --git a/app/src/main/res/layout/fragment_category.xml b/app/src/main/res/layout/fragment_category.xml index e96445d164..21e33e8ee4 100644 --- a/app/src/main/res/layout/fragment_category.xml +++ b/app/src/main/res/layout/fragment_category.xml @@ -1,6 +1,7 @@ @@ -46,6 +47,21 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" /> + + + + +