光环前端优化汇总(2021年5月)(第9-11点) https://git.ghzs.com/pm/halo-app-issues/-/issues/1260

This commit is contained in:
lyr
2021-06-24 17:58:04 +08:00
parent 37a2e3cc0e
commit d4ae878947
6 changed files with 71 additions and 3 deletions

View File

@ -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";

View File

@ -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)

View File

@ -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
}
}
}

View File

@ -104,11 +104,18 @@ class CategoryV2ListFragment : ListFragment<GameEntity, CategoryV2ListViewModel>
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