【光环助手V5.9.0】新社区7期-论坛主页优化(0427UI测试 遗留问题)https://git.shanqu.cc/pm/halo-app-issues/-/issues/1792

This commit is contained in:
lyr
2022-05-05 10:11:37 +08:00
parent 53d8444c85
commit bb4878eab4
2 changed files with 37 additions and 28 deletions

View File

@ -95,7 +95,6 @@ class CommunityHomeFragment : LazyFragment() {
it.width,
DisplayUtils.getStatusBarHeight(resources) + 52f.dip2px()
)
changeNavigationBg()
}
}
}
@ -132,15 +131,15 @@ class CommunityHomeFragment : LazyFragment() {
mFragmentList.clear()
val tag = "android:switcher:${viewPager.id}:"
val forumArticleListFragment = childFragmentManager.findFragmentByTag("${tag}0")
?: ForumArticleListFragment().with(bundleOf(EntranceUtils.KEY_ENTRANCE to "社区", EntranceUtils.KEY_PATH to "推荐"))
?: ForumArticleListFragment().with(bundleOf(EntranceUtils.KEY_ENTRANCE to "社区", EntranceUtils.KEY_PATH to "推荐"))
mFragmentList.add(forumArticleListFragment)
val forumFragment = childFragmentManager.findFragmentByTag("${tag}1")
?: ForumFragment().with(bundleOf(EntranceUtils.KEY_ENTRANCE to "社区"))
?: ForumFragment().with(bundleOf(EntranceUtils.KEY_ENTRANCE to "社区"))
mFragmentList.add(forumFragment)
val activityFragment = childFragmentManager.findFragmentByTag("${tag}2")
?: ForumActivityFragment().with(bundleOf(EntranceUtils.KEY_ENTRANCE to "活动"))
?: ForumActivityFragment().with(bundleOf(EntranceUtils.KEY_ENTRANCE to "活动"))
mFragmentList.add(activityFragment)
viewPager.run {
@ -154,18 +153,27 @@ class CommunityHomeFragment : LazyFragment() {
doOnScroll(
onPageSelected = { position ->
communityEditBtn.goneIf(position != 0)
changeNavigationBg()
when (position) {
TAB_RECOMMEND_INDEX -> {
root.setBackgroundColor(R.color.background.toColor())
topBg.translationY = 0F
changeNavigationBg()
NewLogUtils.logCommunityHomeEvent("click_for_you_tab")
}
TAB_FORUM_INDEX -> {
topBg.translationY = -(mFragmentList[1] as ForumFragment).translationY.toFloat()
root.setBackgroundColor(R.color.white.toColor())
(mFragmentList[1] as ForumFragment).translationY.run {
topBg.translationY = -this.toFloat()
changeNavigationBg(this)
}
NewLogUtils.logCommunityHomeEvent("click_forum_tab")
}
TAB_ACTIVITY_INDEX -> {
topBg.translationY = -(mFragmentList[2] as ForumActivityFragment).translationY.toFloat()
root.setBackgroundColor(R.color.background.toColor())
(mFragmentList[2] as ForumActivityFragment).translationY.run {
topBg.translationY = -this.toFloat()
changeNavigationBg(this)
}
NewLogUtils.logCommunityHomeEvent("click_activity_tab")
FloatingBackViewManager.disableBackView()
FloatingBackViewManager.dismissBackView()
@ -318,14 +326,14 @@ class CommunityHomeFragment : LazyFragment() {
val contentView = LayoutInflater.from(context).inflate(R.layout.community_edit_window, null)
val params = ViewGroup.LayoutParams(resources.displayMetrics.widthPixels, ViewGroup.LayoutParams.WRAP_CONTENT)
val dialog = TrackableDialog(
requireContext(),
R.style.DialogWindowTransparent,
"社区",
UserManager.getInstance().community.name,
null,
"发布-空白",
"发布-返回",
false)
requireContext(),
R.style.DialogWindowTransparent,
"社区",
UserManager.getInstance().community.name,
null,
"发布-空白",
"发布-返回",
false)
val window = dialog.window
window?.setGravity(Gravity.BOTTOM)
window?.setWindowAnimations(R.style.community_publication_animation)
@ -363,12 +371,12 @@ class CommunityHomeFragment : LazyFragment() {
MtaHelper.onEvent("论坛首页", "发布", "发视频")
NewLogUtils.logPublishVideoEnter("推荐信息流", "", "")
startActivityForResult(
VideoPublishActivity.getIntent(
context = requireContext(),
type = "",
entrance = mEntrance,
path = "论坛首页"),
VIDEO_REQUEST_CODE)
VideoPublishActivity.getIntent(
context = requireContext(),
type = "",
entrance = mEntrance,
path = "论坛首页"),
VIDEO_REQUEST_CODE)
dialog.dismiss()
}
}
@ -397,7 +405,7 @@ class CommunityHomeFragment : LazyFragment() {
VIDEO_REQUEST_CODE -> {
val forumVideoEntity = data?.getParcelableExtra<ForumVideoEntity>(ForumVideoEntity::class.java.simpleName)
?: return
?: return
mViewModel?.getVideoDetail(forumVideoEntity.id)
}
}
@ -461,14 +469,15 @@ class CommunityHomeFragment : LazyFragment() {
}
fun translateTopBg(y: Int) {
mBinding?.topBg?.run {
translationY = -y.toFloat()
mBinding?.run {
topBg.translationY = -y.toFloat()
changeNavigationBg(y)
}
}
private fun changeNavigationBg() {
private fun changeNavigationBg(y: Int = 0) {
mBinding?.run {
if (viewPager.currentItem != TAB_RECOMMEND_INDEX) {
if (viewPager.currentItem != TAB_RECOMMEND_INDEX && y != 0) {
if (navigationBg.drawable == null) {
navigationBg.setBackgroundColor(R.color.white.toColor())
navigationBg.setImageBitmap(mNavigationBitmap)

View File

@ -348,8 +348,8 @@ class ForumFragment: LazyFragment(), SwipeRefreshLayout.OnRefreshListener {
welfareLists.run {
add(Triple(R.drawable.ic_forum_tool_box, "游戏工具箱", "TOOLS BOX"))
add(Triple(R.drawable.ic_forum_libao_center, "礼包中心", "GIFT CENTER"))
add(Triple(R.drawable.ic_forum_game_moment, "游戏动态", "DYNAMIC"))
add(Triple(R.drawable.ic_forum_news, "资讯中心", "INFORMATION"))
add(Triple(R.drawable.ic_forum_game_moment, "游戏动态", "INFORMATION"))
add(Triple(R.drawable.ic_forum_news, "资讯中心", "GAME NEWS"))
}
mBinding?.run {