Compare commits
12 Commits
feature-is
...
v5.9.2-535
| Author | SHA1 | Date | |
|---|---|---|---|
| 565c3ec8e2 | |||
| a03c673ae7 | |||
| 0e06f998f3 | |||
| 288e71d34c | |||
| e305a90748 | |||
| b752cdaeb8 | |||
| 5e5f0360dd | |||
| e0ed6da7ae | |||
| 2940d11943 | |||
| 3c18ed9a31 | |||
| f02621d564 | |||
| 8fb2b1c829 |
@ -17,6 +17,7 @@ class ForumBannerAdapter(
|
||||
) : RecyclingPagerAdapter() {
|
||||
|
||||
private var countAndKey: Pair<Int, String>? = null
|
||||
private var mIsInfiniteLoop = getDataSize() != 1
|
||||
|
||||
init {
|
||||
var dataIds = ""
|
||||
@ -26,8 +27,6 @@ class ForumBannerAdapter(
|
||||
if (dataIds.isNotEmpty()) countAndKey = Pair(mList.size, dataIds)
|
||||
}
|
||||
|
||||
private var mIsInfiniteLoop = getDataSize() != 1
|
||||
|
||||
private fun getDataSize() = mList.size
|
||||
|
||||
private fun getRealPosition(position: Int) =
|
||||
@ -64,6 +63,8 @@ class ForumBannerAdapter(
|
||||
}
|
||||
|
||||
mList = update
|
||||
mIsInfiniteLoop = getDataSize() != 1
|
||||
|
||||
if (countAndKey?.first != update.size || countAndKey?.second != dataIds) {
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
@ -42,8 +42,9 @@ class ForumFragment: LazyFragment(), SwipeRefreshLayout.OnRefreshListener {
|
||||
private var mHaveHotForum = false
|
||||
private var mIsFirst = true
|
||||
private var mIsAutoScroll = true
|
||||
private var isBannerSizeMoreThanOne = false
|
||||
private var mIsBannerSizeMoreThanOne = false
|
||||
private var mIsLogin = CheckLoginUtils.isLogin()
|
||||
private var mBanners = listOf<ForumBannerEntity>()
|
||||
var translationY = 0
|
||||
|
||||
override fun getRealLayoutId(): Int {
|
||||
@ -87,7 +88,8 @@ class ForumFragment: LazyFragment(), SwipeRefreshLayout.OnRefreshListener {
|
||||
})
|
||||
|
||||
mViewModel?.banners?.observeNonNull(viewLifecycleOwner) {
|
||||
if (it.isNotEmpty()) initBanners(it)
|
||||
mBanners = it
|
||||
initBanners()
|
||||
}
|
||||
|
||||
mViewModel?.followForumsLiveData?.observe(viewLifecycleOwner, Observer {
|
||||
@ -169,7 +171,7 @@ class ForumFragment: LazyFragment(), SwipeRefreshLayout.OnRefreshListener {
|
||||
activity?.intent?.putExtra(BbsStayTimeHelper.IS_BBS_CONTENT_VISIBLE, true)
|
||||
BbsStayTimeHelper.resumeTimeCount()
|
||||
|
||||
if (isBannerSizeMoreThanOne) {
|
||||
if (mIsBannerSizeMoreThanOne) {
|
||||
mIsAutoScroll = true
|
||||
mBinding?.bannerViewPager?.startAutoScroll()
|
||||
}
|
||||
@ -183,7 +185,7 @@ class ForumFragment: LazyFragment(), SwipeRefreshLayout.OnRefreshListener {
|
||||
activity?.intent?.putExtra(BbsStayTimeHelper.IS_BBS_CONTENT_VISIBLE, false)
|
||||
BbsStayTimeHelper.pauseTimeCount()
|
||||
|
||||
if (isBannerSizeMoreThanOne) {
|
||||
if (mIsBannerSizeMoreThanOne) {
|
||||
mIsAutoScroll = false
|
||||
mBinding?.bannerViewPager?.stopAutoScroll()
|
||||
}
|
||||
@ -209,13 +211,17 @@ class ForumFragment: LazyFragment(), SwipeRefreshLayout.OnRefreshListener {
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
private fun initBanners(list: List<ForumBannerEntity>) {
|
||||
private fun initBanners() {
|
||||
mBinding?.apply {
|
||||
if (mBanners.isEmpty()) {
|
||||
bannerContainer.visibility = View.GONE
|
||||
return
|
||||
}
|
||||
bannerContainer.visibility = View.VISIBLE
|
||||
mIsBannerSizeMoreThanOne = mBanners.size > 1
|
||||
if (bannerViewPager.adapter != null) {
|
||||
(bannerViewPager.adapter as? ForumBannerAdapter)?.checkResetData(list)
|
||||
(bannerViewPager.adapter as? ForumBannerAdapter)?.checkResetData(mBanners)
|
||||
} else {
|
||||
isBannerSizeMoreThanOne = list.size > 1
|
||||
val rootWidth = resources.displayMetrics.widthPixels - (16F + 16F).dip2px()
|
||||
bannerContainer.layoutParams = bannerContainer.layoutParams.apply {
|
||||
height = rootWidth / 2 + (38F + 8F + 8F).dip2px()
|
||||
@ -223,49 +229,73 @@ class ForumFragment: LazyFragment(), SwipeRefreshLayout.OnRefreshListener {
|
||||
viewPagerCardView.layoutParams = viewPagerCardView.layoutParams.apply {
|
||||
height = rootWidth / 2
|
||||
}
|
||||
bannerViewPager.run {
|
||||
adapter = ForumBannerAdapter(requireContext(), list)
|
||||
changeBannerItem(list[0], 0)
|
||||
if (isBannerSizeMoreThanOne) {
|
||||
currentItem = list.size * 10
|
||||
interval = 3000L
|
||||
|
||||
initBannerViewpager()
|
||||
}
|
||||
|
||||
if (indicatorContainer.childCount != mBanners.size) {
|
||||
updateViewpagerConfig()
|
||||
initBannerIndicator()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
private fun initBannerViewpager() {
|
||||
mBinding?.bannerViewPager?.run {
|
||||
adapter = ForumBannerAdapter(requireContext(), mBanners)
|
||||
doOnPageSelected {
|
||||
if (!mIsBannerSizeMoreThanOne) return@doOnPageSelected
|
||||
changeBannerItem(mBanners[it % mBanners.size], it % mBanners.size)
|
||||
}
|
||||
|
||||
setOnTouchListener { _, event ->
|
||||
if (mIsBannerSizeMoreThanOne && mIsAutoScroll) {
|
||||
if (event.action == MotionEvent.ACTION_DOWN || event.action == MotionEvent.ACTION_MOVE) {
|
||||
stopAutoScroll()
|
||||
} else {
|
||||
startAutoScroll()
|
||||
|
||||
doOnPageSelected {
|
||||
changeBannerItem(list[it % list.size], it % list.size)
|
||||
}
|
||||
}
|
||||
|
||||
setOnTouchListener { _, event ->
|
||||
if (list.isNotEmpty() && mIsAutoScroll) {
|
||||
if (event.action == MotionEvent.ACTION_DOWN || event.action == MotionEvent.ACTION_MOVE) {
|
||||
stopAutoScroll()
|
||||
} else {
|
||||
startAutoScroll()
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isBannerSizeMoreThanOne) {
|
||||
indicatorContainer.removeAllViews()
|
||||
var i = 0
|
||||
val size = list.size
|
||||
while (i < size) {
|
||||
val binding = ForumBannerIndicatorItemBinding.inflate(layoutInflater)
|
||||
binding.selectedIv.visibility = if (i == 0) View.VISIBLE else View.GONE
|
||||
binding.unSelectIv.visibility = if (i == 0) View.GONE else View.VISIBLE
|
||||
binding.root.layoutParams =
|
||||
LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
).apply {
|
||||
if (i != 0) leftMargin = 4F.dip2px() else 0F.dip2px()
|
||||
}
|
||||
indicatorContainer.addView(binding.root)
|
||||
i++
|
||||
}
|
||||
private fun updateViewpagerConfig() {
|
||||
mBinding?.bannerViewPager?.run {
|
||||
changeBannerItem(mBanners[0], 0)
|
||||
if (mIsBannerSizeMoreThanOne) {
|
||||
setCurrentItem(mBanners.size * 10, false)
|
||||
currentItem = mBanners.size * 10
|
||||
interval = 3000L
|
||||
startAutoScroll()
|
||||
} else {
|
||||
currentItem = 0
|
||||
stopAutoScroll()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun initBannerIndicator() {
|
||||
mBinding?.run {
|
||||
indicatorContainer.removeAllViews()
|
||||
if (mIsBannerSizeMoreThanOne) {
|
||||
var i = 0
|
||||
val size = mBanners.size
|
||||
while (i < size) {
|
||||
val binding = ForumBannerIndicatorItemBinding.inflate(layoutInflater)
|
||||
binding.selectedIv.visibility = if (i == 0) View.VISIBLE else View.GONE
|
||||
binding.unSelectIv.visibility = if (i == 0) View.GONE else View.VISIBLE
|
||||
binding.root.layoutParams =
|
||||
LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
).apply {
|
||||
if (i != 0) leftMargin = 4F.dip2px() else 0F.dip2px()
|
||||
}
|
||||
indicatorContainer.addView(binding.root)
|
||||
i++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginTop="-7dp"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/background"
|
||||
android:background="@color/transparent"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
|
||||
@ -3,8 +3,7 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/background">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/skeleton"
|
||||
|
||||
@ -2,8 +2,7 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/background">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/list_skeleton"
|
||||
@ -18,7 +17,7 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="58dp"
|
||||
android:paddingBottom="54dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.flexbox.FlexboxLayout
|
||||
|
||||
@ -81,7 +81,6 @@
|
||||
android:id="@+id/list_rv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/background"
|
||||
android:overScrollMode="never"
|
||||
android:paddingBottom="54dp"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />
|
||||
|
||||
@ -8,6 +8,7 @@ import com.bytedance.applog.util.UriConstants
|
||||
import com.gh.common.exposure.meta.MetaUtil
|
||||
import com.halo.assistant.HaloApp
|
||||
import com.lightgame.utils.Utils
|
||||
import android.text.TextUtils
|
||||
|
||||
object TeaHelper {
|
||||
@JvmStatic
|
||||
@ -20,9 +21,11 @@ object TeaHelper {
|
||||
AppLog.init(context, config)
|
||||
|
||||
AppLog.setOaidObserver {
|
||||
HaloApp.getInstance().oaid = it.id
|
||||
if (!TextUtils.isEmpty(it.id)) {
|
||||
HaloApp.getInstance().oaid = it.id
|
||||
MetaUtil.refreshMeta()
|
||||
}
|
||||
Utils.log("oaid is $it.id")
|
||||
MetaUtil.refreshMeta()
|
||||
}
|
||||
|
||||
// gameReportHelper ?!
|
||||
|
||||
@ -7,8 +7,8 @@ ext {
|
||||
targetSdkVersion = 28
|
||||
|
||||
// application info (每个大版本之间的 versionCode 增加 20)
|
||||
versionCode = 532
|
||||
versionName = "5.9.0"
|
||||
versionCode = 535
|
||||
versionName = "5.9.2"
|
||||
applicationId = "com.gh.gamecenter"
|
||||
|
||||
// AndroidX
|
||||
|
||||
Reference in New Issue
Block a user