修改游戏单广场布局

This commit is contained in:
leafwai
2021-12-13 19:26:10 +08:00
parent 91b9502d0b
commit 2c23f03cc4
3 changed files with 17 additions and 45 deletions

View File

@ -22,16 +22,7 @@ class StackRecyclerView : RecyclerView {
)
override fun dispatchTouchEvent(ev: MotionEvent): Boolean {
if (ev.action == MotionEvent.ACTION_DOWN) {
posX = ev.x
posY = ev.y
} else if (ev.action == MotionEvent.ACTION_MOVE) {
if (posY - ev.y > abs(posX - ev.x) || ev.y - posY > abs(posX - ev.x)) {
parent.requestDisallowInterceptTouchEvent(false)
} else {
parent.requestDisallowInterceptTouchEvent(true)
}
}
parent.requestDisallowInterceptTouchEvent(true)
return super.dispatchTouchEvent(ev)
}
}

View File

@ -50,7 +50,6 @@ class GameCollectionSquareFragment : LazyListFragment<GamesCollectionEntity, Gam
private var mForumName = ""
private var mGameCollectionTitle = ""
private var mGameCollectionId = ""
private var mIsOffset = false
override fun onCreate(savedInstanceState: Bundle?) {
mUseAlternativeLayout = arguments?.getBoolean(EntranceUtils.KEY_IS_HOME, false) ?: false
@ -166,20 +165,18 @@ class GameCollectionSquareFragment : LazyListFragment<GamesCollectionEntity, Gam
mDefaultBinding.collapsingToolbar.scrimShownAction = {
DisplayUtils.setLightStatusBar(requireActivity(), it)
if (it) {
setContainerOffset(false)
mDefaultBinding.titleTv.alpha = 1F
mDefaultBinding.titleTv.visibility = View.VISIBLE
mDefaultBinding.titleTv.setTextColor(R.color.black.toColor())
mDefaultBinding.toolbar.navigationIcon = R.drawable.ic_bar_back.toDrawable()
mDefaultBinding.tagFilterContainer.background = null
} else {
setContainerOffset(true)
mDefaultBinding.titleTv.visibility = View.GONE
mDefaultBinding.toolbar.navigationIcon = R.drawable.ic_bar_back_light.toDrawable()
mDefaultBinding.tagFilterContainer.background = R.drawable.bg_game_collection_square.toDrawable()
}
}
setContainerOffset(true, 0)
mDefaultBinding.titleTv.setOnClickListener {
if (ClickUtils.isFastDoubleClick(mDefaultBinding.titleTv.id, 300)) {
scrollToTop()
@ -237,21 +234,6 @@ class GameCollectionSquareFragment : LazyListFragment<GamesCollectionEntity, Gam
mListRefresh?.setProgressViewOffset(false, 0, 118F.dip2px() + DisplayUtils.getStatusBarHeight(requireContext().resources))
}
private fun setContainerOffset(offset: Boolean, dur: Long = 100) {
if (mIsOffset == offset) return
mDefaultBinding.container.startAnimation(
TranslateAnimation(
0F,
0F,
if (offset) 0F else -16F.dip2px().toFloat(),
if (offset) -16F.dip2px().toFloat() else 0F
).apply {
duration = dur
fillAfter = true
})
mIsOffset = offset
}
private fun initAlternativeLayout() {
if (parentFragment is HomeSearchToolWrapperFragment) {
val rootView = (parentFragment as HomeSearchToolWrapperFragment).view