Compare commits

..

12 Commits

13 changed files with 76 additions and 117 deletions

View File

@ -103,8 +103,6 @@ object DefaultUrlHandler {
}
"question" -> DirectUtils.directToQuestionDetail(context, id, entrance, "文章链接")
"real_name" -> DirectUtils.directToRealName(context)
"community" -> {
val community = CommunityEntity()
community.id = id

View File

@ -19,6 +19,7 @@ import com.gh.common.constant.Constants
import com.gh.common.exposure.ExposureEvent
import com.gh.common.exposure.ExposureEvent.Companion.createEvent
import com.gh.common.exposure.ExposureManager.log
import com.gh.common.exposure.ExposureSource
import com.gh.common.exposure.ExposureTraceUtils.appendTrace
import com.gh.common.exposure.ExposureType
import com.gh.common.util.EntranceUtils.*
@ -492,11 +493,6 @@ object DirectUtils {
context.startActivity(UserHomeActivity.getIntent(context, userId ?: "", entrance, path))
}
@JvmStatic
fun directToRealName(context: Context) {
context.startActivity(ShellActivity.getIntent(context, ShellActivity.Type.REAL_NAME_INFO, null))
}
/**
* 跳转至个人主页
* @param position 定位到某个tab 0游戏 1发布

View File

@ -77,7 +77,6 @@ public class EntranceUtils {
public static final String HOST_GAME = "game";
public static final String HOST_GAME_DOWNLOAD = "game_download";
public static final String HOST_GAME_NEWS = "game_news";
public static final String HOST_REAL_NAME = "real_name";
public static final String HOST_COLUMN = "column";
public static final String HOST_WEB = "web";
public static final String HOST_QQ = "qq";

View File

@ -369,9 +369,6 @@ public class SkipActivity extends BaseActivity {
toast(e.getMessage());
}
break;
case EntranceUtils.HOST_REAL_NAME:
DirectUtils.directToRealName(this);
break;
case EntranceUtils.HOST_GAME_NEWS:
DirectUtils.directToGameNews(
this,

View File

@ -7,7 +7,10 @@ import android.graphics.Bitmap
import android.graphics.Typeface
import android.os.Build
import android.os.Bundle
import android.view.*
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.AnimationUtils
import android.widget.TextView
import androidx.core.graphics.ColorUtils
@ -15,6 +18,7 @@ import androidx.core.os.bundleOf
import androidx.fragment.app.Fragment
import androidx.viewpager.widget.ViewPager
import com.gh.base.adapter.FragmentAdapter
import com.gh.base.fragment.BaseFragment_TabLayout
import com.gh.base.fragment.LazyFragment
import com.gh.common.dialog.TrackableDialog
import com.gh.common.util.*
@ -83,22 +87,18 @@ class CommunityHomeFragment : LazyFragment() {
showCommunityEditWindow()
}
topBg.viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener {
override fun onGlobalLayout() {
topBg.viewTreeObserver.removeOnGlobalLayoutListener(this)
if (topBg.width <= 0 || topBg.height <= 0) return
val bitmap = topBg.getBitmapFromView()
bitmap?.let {
mNavigationBitmap = Bitmap.createBitmap(
it,
0,
0,
it.width,
DisplayUtils.getStatusBarHeight(resources) + 52F.dip2px()
)
}
topBg.post {
val bitmap = topBg.getBitmapFromView()
bitmap?.let {
mNavigationBitmap = Bitmap.createBitmap(
it,
0,
0,
it.width,
DisplayUtils.getStatusBarHeight(resources) + 52f.dip2px()
)
}
})
}
}
}

View File

@ -17,7 +17,6 @@ class ForumBannerAdapter(
) : RecyclingPagerAdapter() {
private var countAndKey: Pair<Int, String>? = null
private var mIsInfiniteLoop = getDataSize() != 1
init {
var dataIds = ""
@ -27,6 +26,8 @@ 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) =
@ -63,8 +64,6 @@ class ForumBannerAdapter(
}
mList = update
mIsInfiniteLoop = getDataSize() != 1
if (countAndKey?.first != update.size || countAndKey?.second != dataIds) {
notifyDataSetChanged()
}

View File

@ -42,9 +42,8 @@ class ForumFragment: LazyFragment(), SwipeRefreshLayout.OnRefreshListener {
private var mHaveHotForum = false
private var mIsFirst = true
private var mIsAutoScroll = true
private var mIsBannerSizeMoreThanOne = false
private var isBannerSizeMoreThanOne = false
private var mIsLogin = CheckLoginUtils.isLogin()
private var mBanners = listOf<ForumBannerEntity>()
var translationY = 0
override fun getRealLayoutId(): Int {
@ -88,8 +87,7 @@ class ForumFragment: LazyFragment(), SwipeRefreshLayout.OnRefreshListener {
})
mViewModel?.banners?.observeNonNull(viewLifecycleOwner) {
mBanners = it
initBanners()
if (it.isNotEmpty()) initBanners(it)
}
mViewModel?.followForumsLiveData?.observe(viewLifecycleOwner, Observer {
@ -171,7 +169,7 @@ class ForumFragment: LazyFragment(), SwipeRefreshLayout.OnRefreshListener {
activity?.intent?.putExtra(BbsStayTimeHelper.IS_BBS_CONTENT_VISIBLE, true)
BbsStayTimeHelper.resumeTimeCount()
if (mIsBannerSizeMoreThanOne) {
if (isBannerSizeMoreThanOne) {
mIsAutoScroll = true
mBinding?.bannerViewPager?.startAutoScroll()
}
@ -185,7 +183,7 @@ class ForumFragment: LazyFragment(), SwipeRefreshLayout.OnRefreshListener {
activity?.intent?.putExtra(BbsStayTimeHelper.IS_BBS_CONTENT_VISIBLE, false)
BbsStayTimeHelper.pauseTimeCount()
if (mIsBannerSizeMoreThanOne) {
if (isBannerSizeMoreThanOne) {
mIsAutoScroll = false
mBinding?.bannerViewPager?.stopAutoScroll()
}
@ -211,17 +209,13 @@ class ForumFragment: LazyFragment(), SwipeRefreshLayout.OnRefreshListener {
}
@SuppressLint("ClickableViewAccessibility")
private fun initBanners() {
private fun initBanners(list: List<ForumBannerEntity>) {
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(mBanners)
(bannerViewPager.adapter as? ForumBannerAdapter)?.checkResetData(list)
} 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()
@ -229,73 +223,49 @@ class ForumFragment: LazyFragment(), SwipeRefreshLayout.OnRefreshListener {
viewPagerCardView.layoutParams = viewPagerCardView.layoutParams.apply {
height = rootWidth / 2
}
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 {
bannerViewPager.run {
adapter = ForumBannerAdapter(requireContext(), list)
changeBannerItem(list[0], 0)
if (isBannerSizeMoreThanOne) {
currentItem = list.size * 10
interval = 3000L
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
}
}
}
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++
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++
}
}
}
}

View File

@ -8,7 +8,7 @@
android:layout_alignParentBottom="true"
android:layout_marginTop="-7dp"
android:orientation="vertical"
android:background="@color/transparent"
android:background="@color/background"
android:visibility="gone"
tools:visibility="visible">

View File

@ -3,7 +3,8 @@
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:layout_height="match_parent"
android:background="@color/background">
<FrameLayout
android:id="@+id/skeleton"

View File

@ -2,7 +2,8 @@
<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:layout_height="match_parent"
android:background="@color/background">
<FrameLayout
android:id="@+id/list_skeleton"
@ -17,7 +18,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="54dp"
android:paddingBottom="58dp"
android:orientation="vertical">
<com.google.android.flexbox.FlexboxLayout

View File

@ -81,6 +81,7 @@
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" />

View File

@ -8,7 +8,6 @@ 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
@ -21,11 +20,9 @@ object TeaHelper {
AppLog.init(context, config)
AppLog.setOaidObserver {
if (!TextUtils.isEmpty(it.id)) {
HaloApp.getInstance().oaid = it.id
MetaUtil.refreshMeta()
}
HaloApp.getInstance().oaid = it.id
Utils.log("oaid is $it.id")
MetaUtil.refreshMeta()
}
// gameReportHelper ?!

View File

@ -7,8 +7,8 @@ ext {
targetSdkVersion = 28
// application info (每个大版本之间的 versionCode 增加 20)
versionCode = 536
versionName = "5.9.2"
versionCode = 532
versionName = "5.9.0"
applicationId = "com.gh.gamecenter"
// AndroidX