Merge branch 'feature-GHZS-1834' into 'dev-5.24.0'

feat:【光环助手】论坛子版块客户端相关优化 https://jira.shanqu.cc/browse/GHZS-1834

See merge request halo/android/assistant-android!873
This commit is contained in:
叶子维
2023-04-03 17:28:08 +08:00
3 changed files with 29 additions and 14 deletions

View File

@ -226,19 +226,24 @@ class ForumArticleAskListAdapter(
holder.binding.articleListHeadTv.setTextColor(R.color.text_title.toColor(mContext))
holder.binding.articleListHeadTv.text = "${articleListHead}列表"
holder.binding.orderSfv.run {
setContainerBackground(R.drawable.button_round_f5f5f5.toDrawable(mContext))
setIndicatorBackground(R.drawable.bg_game_collection_sfv_indicator.toDrawable(mContext))
setTextColor(
R.color.text_subtitle.toColor(mContext),
R.color.text_subtitleDesc.toColor(mContext)
)
if (path != "精华") {
holder.binding.orderSfv.run {
visibility = View.VISIBLE
setContainerBackground(R.drawable.button_round_f5f5f5.toDrawable(mContext))
setIndicatorBackground(R.drawable.bg_game_collection_sfv_indicator.toDrawable(mContext))
setTextColor(
R.color.text_subtitle.toColor(mContext),
R.color.text_subtitleDesc.toColor(mContext)
)
setItemList(if (path == "视频") mVideoOrderList else mDefOrderList, mFilterPosition)
setOnCheckedCallback { position ->
mFilterPosition = position
onCheckCallback.invoke((if (path == "视频") mVideoOrderList else mDefOrderList)[position])
setItemList(if (path == "视频") mVideoOrderList else mDefOrderList, mFilterPosition)
setOnCheckedCallback { position ->
mFilterPosition = position
onCheckCallback.invoke((if (path == "视频") mVideoOrderList else mDefOrderList)[position])
}
}
} else {
holder.binding.orderSfv.visibility = View.GONE
}
}
}

View File

@ -23,8 +23,8 @@ import androidx.appcompat.content.res.AppCompatResources
import androidx.core.content.ContextCompat
import androidx.core.graphics.ColorUtils
import androidx.core.os.bundleOf
import androidx.core.os.postDelayed
import androidx.core.view.ViewCompat
import androidx.core.view.isVisible
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.DefaultItemAnimator
@ -374,11 +374,12 @@ class ForumDetailFragment : BaseLazyTabFragment(), IScrollable {
}
private fun initSection() {
val sectionLayoutManager = LinearLayoutManager(requireContext(), RecyclerView.HORIZONTAL, false)
mForumSectionAdapter = ForumSectionAdapter(requireContext(), mViewModel!!) {
setSection(it)
}
mBinding.sectionRv.run {
layoutManager = LinearLayoutManager(requireContext(), RecyclerView.HORIZONTAL, false)
layoutManager = sectionLayoutManager
adapter = mForumSectionAdapter
(itemAnimator as DefaultItemAnimator).supportsChangeAnimations = false
addOnScrollListener(object : OnScrollListener() {
@ -406,6 +407,12 @@ class ForumDetailFragment : BaseLazyTabFragment(), IScrollable {
} else {
mForumSectionAdapter?.submitList(it)
}
mBinding.sectionRv.post {
mBinding.sectionMoreIv.isVisible =
sectionLayoutManager.findLastCompletelyVisibleItemPosition() != sectionLayoutManager.itemCount - 1
mBinding.sectionMoreBackground.isVisible =
sectionLayoutManager.findLastCompletelyVisibleItemPosition() != sectionLayoutManager.itemCount - 1
}
} else {
mShowSections = false
mBinding.sectionContainer.visibility = View.GONE

View File

@ -385,13 +385,15 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/sectionMoreBackground"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
app:layout_goneMarginEnd="0dp" />
<View
android:id="@+id/sectionMoreBackground"
android:layout_width="52dp"
android:layout_height="48dp"
android:background="@drawable/section_more_background"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@ -402,6 +404,7 @@
android:layout_marginTop="14dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/icon_section_more" />