diff --git a/app/src/main/java/com/gh/base/GlobalActivityLifecycleObserver.kt b/app/src/main/java/com/gh/base/GlobalActivityLifecycleObserver.kt index 4c153831ed..2afc5f31a0 100644 --- a/app/src/main/java/com/gh/base/GlobalActivityLifecycleObserver.kt +++ b/app/src/main/java/com/gh/base/GlobalActivityLifecycleObserver.kt @@ -6,14 +6,9 @@ import android.os.Bundle import androidx.appcompat.app.AppCompatActivity import com.gh.common.util.FloatingBackViewManager import com.gh.download.DownloadManager -import com.gh.gamecenter.MainActivity +import com.gh.gamecenter.SingletonWebActivity import com.gh.gamecenter.SplashScreenActivity import com.gh.gamecenter.common.utils.PackageFlavorHelper -import com.gh.gamecenter.forum.detail.ForumDetailActivity -import com.gh.gamecenter.forum.list.ForumListActivity -import com.gh.gamecenter.qa.article.detail.ArticleDetailActivity -import com.gh.gamecenter.qa.questions.newdetail.NewQuestionDetailActivity -import com.gh.gamecenter.qa.video.detail.ForumVideoDetailActivity import com.gh.vspace.VHelper import com.halo.assistant.HaloApp @@ -35,7 +30,7 @@ class GlobalActivityLifecycleObserver : Application.ActivityLifecycleCallbacks { && FloatingBackViewManager.getType() == FloatingBackViewManager.TYPE_TASK ) { FloatingBackViewManager.disableBackView() - } else if (!shouldShowActivityBackView(activity) + } else if (activity is SingletonWebActivity && FloatingBackViewManager.getType() == FloatingBackViewManager.TYPE_ACTIVITY ) { FloatingBackViewManager.disableBackView() @@ -65,15 +60,6 @@ class GlobalActivityLifecycleObserver : Application.ActivityLifecycleCallbacks { } } - private fun shouldShowActivityBackView(activity: Activity): Boolean { - return (activity is MainActivity - || activity is ArticleDetailActivity - || activity is ForumVideoDetailActivity - || activity is ForumDetailActivity - || activity is ForumListActivity - || activity is NewQuestionDetailActivity) - } - override fun onActivityPaused(activity: Activity) { FloatingBackViewManager.dismissBackView() if (PackageFlavorHelper.IS_TEST_FLAVOR && activity is AppCompatActivity) { diff --git a/app/src/main/java/com/gh/common/DefaultJsApi.kt b/app/src/main/java/com/gh/common/DefaultJsApi.kt index e2f0a9328c..c6f54e9ae0 100644 --- a/app/src/main/java/com/gh/common/DefaultJsApi.kt +++ b/app/src/main/java/com/gh/common/DefaultJsApi.kt @@ -387,11 +387,6 @@ class DefaultJsApi(var context: Context, val entrance: String = "", private var FloatingBackViewManager.enableBackView(FloatingBackViewManager.TYPE_ACTIVITY, msg.toString()) } - @JavascriptInterface - fun startBBSStayTimeCount(msg: Any) { - BbsStayTimeHelper.enableStayTimeCount(msg.toString().toInt()) - } - @JavascriptInterface fun saveBase64ImageToGallery(msg: Any) { val base64StringData = msg.toString() @@ -431,15 +426,6 @@ class DefaultJsApi(var context: Context, val entrance: String = "", private var runOnUiThread { DirectUtils.directToFullScreenWebPage(context, url.toString(), true, entrance) } } - @JavascriptInterface - fun startGameCollectionSquareBrowseTask(event: Any) { - val browseTimeEvent = event.toString().toObject() ?: BrowseTaskEvent() - GameCollectionSquareBrowseTaskHelper.enableBrowseTimeCount( - browseTimeEvent.timeout.toInt(), - browseTimeEvent.isFinished == "true" - ) - } - @JavascriptInterface fun checkUpdateGhzs(msg: Any) { context.startActivity(SettingBridge.getAboutIntent(context, true)) @@ -656,9 +642,6 @@ class DefaultJsApi(var context: Context, val entrance: String = "", private var @Keep internal data class LogEvent(var jsonString: String = "", var logStore: String = "") - @Keep - internal data class BrowseTaskEvent(var timeout: String = "", var isFinished: String = "") - @Keep data class GameActivityEvent( var gameId: String = "", diff --git a/app/src/main/java/com/gh/common/util/BbsStayTimeHelper.kt b/app/src/main/java/com/gh/common/util/BbsStayTimeHelper.kt deleted file mode 100644 index 576333143b..0000000000 --- a/app/src/main/java/com/gh/common/util/BbsStayTimeHelper.kt +++ /dev/null @@ -1,131 +0,0 @@ -package com.gh.common.util - -import android.annotation.SuppressLint -import android.app.Activity -import android.app.Application -import android.os.Bundle -import com.gh.gamecenter.core.utils.CurrentActivityHolder -import com.gh.gamecenter.core.GHThreadFactory -import com.gh.gamecenter.MainActivity -import com.gh.gamecenter.core.utils.ToastUtils -import com.gh.gamecenter.common.utils.isPublishEnv -import com.gh.gamecenter.common.utils.tryWithDefaultCatch -import com.gh.gamecenter.forum.detail.ForumDetailActivity -import com.gh.gamecenter.qa.article.detail.ArticleDetailActivity -import com.gh.gamecenter.qa.comment.CommentActivity -import com.gh.gamecenter.qa.questions.newdetail.NewQuestionDetailActivity -import com.gh.gamecenter.qa.video.detail.ForumVideoDetailActivity -import com.gh.gamecenter.common.retrofit.BiResponse -import com.gh.gamecenter.retrofit.RetrofitManager -import com.halo.assistant.HaloApp -import io.reactivex.android.schedulers.AndroidSchedulers -import io.reactivex.schedulers.Schedulers -import okhttp3.ResponseBody -import java.util.concurrent.ExecutorService -import java.util.concurrent.Executors - -object BbsStayTimeHelper { - - private var mStayTimeCount = 0 - private var mIsStayTimeCountEnabled = false // 论坛停留时间统计是否开启 - private var mStayTimeTimeout = 30 - private var mIsStayTimeCountValid = false // 论坛停留时间统计是否有效 - - const val IS_BBS_CONTENT_VISIBLE = "is_bbs_content_visible" - - private val mThreadService: ExecutorService by lazy { - Executors.newSingleThreadExecutor(GHThreadFactory("STAY_TIME_THREAD")) - } - - private val mActivityLifecycleCallbacks by lazy { - object : Application.ActivityLifecycleCallbacks { - override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {} - override fun onActivityStopped(activity: Activity) {} - override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {} - override fun onActivityDestroyed(activity: Activity) {} - override fun onActivityStarted(activity: Activity) {} - - override fun onActivityResumed(activity: Activity) { - if (isTopActivityBbsRelated(activity) && mIsStayTimeCountEnabled) { - resumeTimeCount() - } - } - - override fun onActivityPaused(activity: Activity) { - if (isTopActivityBbsRelated(activity) && mIsStayTimeCountEnabled) { - pauseTimeCount() - } - } - } - } - - fun enableStayTimeCount(timeout: Int) { - mIsStayTimeCountEnabled = true - mStayTimeTimeout = timeout - - resumeTimeCount() - - HaloApp.getInstance().registerActivityLifecycleCallbacks(mActivityLifecycleCallbacks) - } - - fun disableStayTimeCount() { - mIsStayTimeCountEnabled = false - mStayTimeCount = 0 - - HaloApp.getInstance().unregisterActivityLifecycleCallbacks(mActivityLifecycleCallbacks) - } - - fun resumeTimeCount() { - if (!mIsStayTimeCountEnabled) return - - mIsStayTimeCountValid = true - - mThreadService.execute { - while (mIsStayTimeCountEnabled && mIsStayTimeCountValid) { - val topActivity = CurrentActivityHolder.getCurrentActivity() ?: continue - if (isTopActivityBbsRelated(topActivity)) { - tryWithDefaultCatch { - mStayTimeCount++ - if (mStayTimeCount >= mStayTimeTimeout) { - postExploreFinish() - } - } - } - Thread.sleep(1000) - } - } - } - - fun pauseTimeCount() { - if (!mIsStayTimeCountEnabled) return - - mIsStayTimeCountValid = false - } - - private fun isTopActivityBbsRelated(activity: Activity): Boolean { - return (activity is MainActivity && activity.intent.extras?.getBoolean(IS_BBS_CONTENT_VISIBLE) == true) - || activity is ForumDetailActivity - || activity is ArticleDetailActivity - || activity is ForumVideoDetailActivity - || activity is CommentActivity - || activity is NewQuestionDetailActivity - } - - @SuppressLint("CheckResult") - private fun postExploreFinish() { - RetrofitManager.getInstance() - .api - .postExplorerFinish() - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(object : BiResponse() { - override fun onSuccess(data: ResponseBody) { - if (!isPublishEnv()) { - ToastUtils.toast("完成了论坛停留任务(仅测试环境有这个 toast 不要慌)") - } - disableStayTimeCount() - } - }) - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/gh/common/util/FloatingBackViewManager.kt b/app/src/main/java/com/gh/common/util/FloatingBackViewManager.kt index 59b0fcfc84..7aaab6c5ae 100644 --- a/app/src/main/java/com/gh/common/util/FloatingBackViewManager.kt +++ b/app/src/main/java/com/gh/common/util/FloatingBackViewManager.kt @@ -113,8 +113,6 @@ object FloatingBackViewManager { /** * 停用返回小浮窗 - * @param type 类型 - * @param activityUrl 类型为活动的时候用的地址 */ @JvmStatic fun disableBackView() { diff --git a/app/src/main/java/com/gh/common/util/GameCollectionSquareBrowseTaskHelper.kt b/app/src/main/java/com/gh/common/util/GameCollectionSquareBrowseTaskHelper.kt deleted file mode 100644 index e4b0cba354..0000000000 --- a/app/src/main/java/com/gh/common/util/GameCollectionSquareBrowseTaskHelper.kt +++ /dev/null @@ -1,254 +0,0 @@ -package com.gh.common.util - -import android.annotation.SuppressLint -import android.app.Activity -import android.app.Application -import android.os.Build -import android.os.Bundle -import android.view.Gravity -import android.view.View -import android.widget.ImageView -import android.widget.ProgressBar -import com.gh.gamecenter.common.base.activity.ToolBarActivity -import com.gh.gamecenter.R -import com.gh.gamecenter.common.retrofit.BiResponse -import com.gh.gamecenter.common.utils.singleToMain -import com.gh.gamecenter.common.utils.tryWithDefaultCatch -import com.gh.gamecenter.core.GHThreadFactory -import com.gh.gamecenter.core.runOnUiThread -import com.gh.gamecenter.core.utils.CurrentActivityHolder -import com.gh.gamecenter.gamecollection.detail.GameCollectionDetailActivity -import com.gh.gamecenter.gamecollection.square.GameCollectionSquareActivity -import com.gh.gamecenter.retrofit.RetrofitManager -import com.halo.assistant.HaloApp -import com.lzf.easyfloat.EasyFloat -import com.lzf.easyfloat.enums.ShowPattern -import com.lzf.easyfloat.enums.SidePattern -import okhttp3.ResponseBody -import java.util.concurrent.ExecutorService -import java.util.concurrent.Executors - -/** - * 浏览游戏单广场任务辅助类 - */ -@SuppressLint("StaticFieldLeak") -object GameCollectionSquareBrowseTaskHelper { - - const val KEY_IS_FORM_BROWSE_TASK = "is_from_browse_task" - private const val FLOATING_SQUARE_BROWSE_TASK_VIEW = "floating_square_browse_task_view" - - private var mBrowseTimeCount = 0 - private var mIsBrowseTimeCountEnabled = false // 游戏单广场浏览时间统计是否开启 - private var mBrowseTimeTimeout = 15 - private var mIsBrowseTimeCountValid = false // 游戏单广场浏览时间统计是否有效 - private var mBrowsePro: ProgressBar? = null - private var mIsFinished = false - private var mNeedShowFloatView = false - private var mIsFirstEnterSquare = true - - private val mThreadService: ExecutorService by lazy { - Executors.newSingleThreadExecutor(GHThreadFactory("BROWSE_SQUARE_THREAD")) - } - - private val mActivityLifecycleCallbacks by lazy { - object : Application.ActivityLifecycleCallbacks { - override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {} - override fun onActivityStopped(activity: Activity) {} - override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {} - override fun onActivityStarted(activity: Activity) {} - - override fun onActivityResumed(activity: Activity) { - if (isTopActivityGameCollectionRelated(activity) && mIsBrowseTimeCountEnabled) { - resumeTimeCount() - } else if (isGameCollectionSquare(activity) && mNeedShowFloatView) { - showOrUpdateFloatView(activity, mBrowseTimeTimeout) - } - } - - override fun onActivityPaused(activity: Activity) { - if (isTopActivityGameCollectionRelated(activity) && mIsBrowseTimeCountEnabled) { - pauseTimeCount() - } - if (isGameCollectionSquare(activity)) { - dismissFloatView() - } - } - - override fun onActivityDestroyed(activity: Activity) { - if (isGameCollectionSquare(activity) && mIsBrowseTimeCountEnabled) { - disableBrowseTimeCount() - unregisterActivityLifecycleCallbacks() - } - } - } - } - - fun enableBrowseTimeCount(timeout: Int, isFinished: Boolean) { - mIsBrowseTimeCountEnabled = true - mBrowseTimeTimeout = timeout - mIsFinished = isFinished - mNeedShowFloatView = true - mIsFirstEnterSquare = true - - resumeTimeCount() - - HaloApp.getInstance().registerActivityLifecycleCallbacks(mActivityLifecycleCallbacks) - } - - fun disableBrowseTimeCount() { - mBrowseTimeCount = 0 - mIsBrowseTimeCountEnabled = false - mBrowsePro = null - mIsFinished = false - mIsFirstEnterSquare = true - } - - fun unregisterActivityLifecycleCallbacks() { - mNeedShowFloatView = false - HaloApp.getInstance().unregisterActivityLifecycleCallbacks(mActivityLifecycleCallbacks) - } - - private fun resumeTimeCount() { - if (!mIsBrowseTimeCountEnabled) return - - mIsBrowseTimeCountValid = true - - mThreadService.execute { - while (mIsBrowseTimeCountEnabled && mIsBrowseTimeCountValid) { - val topActivity = CurrentActivityHolder.getCurrentActivity() ?: continue - checkFirstEnterSquare(topActivity) - runBrowseTask(topActivity) - Thread.sleep(1000) - } - } - } - - private fun checkFirstEnterSquare(topActivity: Activity) { - if (isGameCollectionSquare(topActivity, false) && mIsFirstEnterSquare) { - mIsFirstEnterSquare = false - topActivity.intent.putExtra(KEY_IS_FORM_BROWSE_TASK, true) - } - } - - private fun runBrowseTask(topActivity: Activity) { - if (isTopActivityGameCollectionRelated(topActivity)) { - tryWithDefaultCatch { - showOrUpdateFloatView(topActivity, if (mIsFinished) mBrowseTimeTimeout else mBrowseTimeCount) - if (mIsFinished) { - disableBrowseTimeCount() - } else { - countBrowseTimeout(topActivity) - } - } - } - } - - private fun countBrowseTimeout(topActivity: Activity) { - mBrowseTimeCount++ - if (mBrowseTimeCount >= mBrowseTimeTimeout) { - showOrUpdateFloatView(topActivity, mBrowseTimeTimeout) - postBrowseFinish() - } - } - - private fun pauseTimeCount() { - if (!mIsBrowseTimeCountEnabled) return - - mIsBrowseTimeCountValid = false - } - - // 从任务跳转的游戏单广场/此游戏单广场进入的游戏单详情都计时 - private fun isTopActivityGameCollectionRelated(activity: Activity): Boolean { - return isGameCollectionSquare(activity) - || (activity is GameCollectionDetailActivity - && activity.intent.getBundleExtra(ToolBarActivity.NORMAL_FRAGMENT_BUNDLE) - ?.getBoolean(KEY_IS_FORM_BROWSE_TASK) == true) - } - - private fun isGameCollectionSquare(activity: Activity, checkIsFromTask: Boolean = true): Boolean { - return activity is GameCollectionSquareActivity - && (!checkIsFromTask || activity.intent.getBooleanExtra(KEY_IS_FORM_BROWSE_TASK, false)) - } - - private fun showOrUpdateFloatView(activity: Activity, time: Int) { - // 不支持 Android 4.1 的设备 - if (Build.VERSION.SDK_INT == Build.VERSION_CODES.JELLY_BEAN) return - - // 游戏单广场才显示FloatView - if (!isGameCollectionSquare(activity)) return - - runOnUiThread { - val isFinished = time == mBrowseTimeTimeout - val floatView = EasyFloat.getFloatView(FLOATING_SQUARE_BROWSE_TASK_VIEW) - if (floatView != null) { - updateFloatView(floatView, isFinished, time) - } else { - showFloatView(activity, isFinished) - } - } - } - - private fun showFloatView(activity: Activity, isFinished: Boolean) { - EasyFloat.with(activity) - .setLayout(R.layout.layout_square_browse_task_float) - .setTag(FLOATING_SQUARE_BROWSE_TASK_VIEW) - .setAnimator(null) - .setGravity(Gravity.END.or(Gravity.CENTER_VERTICAL), 0, 0) - .setSidePattern(SidePattern.RIGHT) - .setShowPattern(ShowPattern.CURRENT_ACTIVITY) - .setDragEnable(false) - .registerCallback { - createResult { _, _, view -> - initFloatView(view, isFinished) - } - } - .show() - } - - private fun initFloatView(view: View?, isFinished: Boolean) { - if (isFinished) { - view?.findViewById(R.id.browsePro)?.run { - max = mBrowseTimeTimeout - progress = mBrowseTimeTimeout - } - view?.findViewById(R.id.browsePic) - ?.setImageResource(R.drawable.pic_browse_square_finish) - } else { - view?.findViewById(R.id.browsePro)?.run { - mBrowsePro = this - max = mBrowseTimeTimeout - progress = 0 - } - view?.findViewById(R.id.browsePic) - ?.setImageResource(R.drawable.pic_browse_square) - } - } - - private fun updateFloatView(floatView: View, isFinished: Boolean, time: Int) { - if (mBrowsePro == null) { - mBrowsePro = floatView.findViewById(R.id.browsePro) - } - mBrowsePro?.progress = time - if (isFinished) { - floatView.findViewById(R.id.browsePic) - .setImageResource(R.drawable.pic_browse_square_finish) - } - } - - private fun dismissFloatView() { - EasyFloat.dismiss(FLOATING_SQUARE_BROWSE_TASK_VIEW) - } - - @SuppressLint("CheckResult") - private fun postBrowseFinish() { - RetrofitManager.getInstance() - .newApi - .postGameCollectionTask("browse_game_list_square", "0") - .compose(singleToMain()) - .subscribe(object : BiResponse() { - override fun onSuccess(data: ResponseBody) { - disableBrowseTimeCount() - } - }) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/gh/gamecenter/forum/home/CommunityHomeFragment.kt b/app/src/main/java/com/gh/gamecenter/forum/home/CommunityHomeFragment.kt index 2ba7722676..9972a13017 100644 --- a/app/src/main/java/com/gh/gamecenter/forum/home/CommunityHomeFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/forum/home/CommunityHomeFragment.kt @@ -14,7 +14,6 @@ import androidx.core.graphics.ColorUtils import androidx.core.os.bundleOf import androidx.fragment.app.Fragment import androidx.viewpager.widget.ViewPager -import com.gh.common.util.FloatingBackViewManager import com.gh.common.util.NewLogUtils import com.gh.gamecenter.R import com.gh.gamecenter.common.base.TrackableDialog @@ -26,14 +25,14 @@ import com.gh.gamecenter.core.utils.DisplayUtils import com.gh.gamecenter.core.utils.MtaHelper import com.gh.gamecenter.databinding.FragmentCommunityHomeBinding import com.gh.gamecenter.databinding.TabItemCommunityBinding -import com.gh.gamecenter.feature.entity.ForumVideoEntity import com.gh.gamecenter.eventbus.EBSkip import com.gh.gamecenter.eventbus.EBTypeChange import com.gh.gamecenter.eventbus.EBUISwitch +import com.gh.gamecenter.feature.entity.ArticleEntity +import com.gh.gamecenter.feature.entity.ForumVideoEntity import com.gh.gamecenter.forum.search.ForumOrUserSearchActivity import com.gh.gamecenter.fragment.MainWrapperFragment import com.gh.gamecenter.qa.article.edit.ArticleEditActivity -import com.gh.gamecenter.feature.entity.ArticleEntity import com.gh.gamecenter.qa.questions.edit.QuestionEditActivity import com.gh.gamecenter.qa.video.publish.VideoPublishActivity import com.google.android.material.tabs.TabLayout @@ -187,8 +186,6 @@ class CommunityHomeFragment : LazyFragment() { changeNavigationBg(this) } NewLogUtils.logCommunityHomeEvent("click_activity_tab") - FloatingBackViewManager.disableBackView() - FloatingBackViewManager.dismissBackView() } } }, diff --git a/app/src/main/java/com/gh/gamecenter/forum/home/ForumFragment.kt b/app/src/main/java/com/gh/gamecenter/forum/home/ForumFragment.kt index 74b553b61d..80637d7b8d 100644 --- a/app/src/main/java/com/gh/gamecenter/forum/home/ForumFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/forum/home/ForumFragment.kt @@ -15,15 +15,14 @@ import androidx.recyclerview.widget.RecyclerView import androidx.swiperefreshlayout.widget.SwipeRefreshLayout import com.ethanhua.skeleton.Skeleton import com.ethanhua.skeleton.ViewSkeletonScreen -import com.gh.gamecenter.common.base.fragment.LazyFragment -import com.gh.gamecenter.common.constant.Constants import com.gh.common.util.* import com.gh.common.util.NewLogUtils -import com.gh.gamecenter.common.view.GridSpacingItemColorDecoration import com.gh.gamecenter.R +import com.gh.gamecenter.common.base.fragment.LazyFragment +import com.gh.gamecenter.common.constant.Constants import com.gh.gamecenter.common.utils.* +import com.gh.gamecenter.common.view.GridSpacingItemColorDecoration import com.gh.gamecenter.databinding.ForumBannerIndicatorItemBinding - import com.gh.gamecenter.databinding.FragmentForumBinding import com.gh.gamecenter.entity.ForumBannerEntity import com.gh.gamecenter.entity.ForumEntity @@ -170,9 +169,6 @@ class ForumFragment : LazyFragment(), SwipeRefreshLayout.OnRefreshListener { mViewModel?.getForumUnreadStatus() } - activity?.intent?.putExtra(BbsStayTimeHelper.IS_BBS_CONTENT_VISIBLE, true) - BbsStayTimeHelper.resumeTimeCount() - if (mBanners.size > 1) { mIsAutoScroll = true mBinding?.bannerViewPager?.startAutoScroll() @@ -183,10 +179,6 @@ class ForumFragment : LazyFragment(), SwipeRefreshLayout.OnRefreshListener { override fun onFragmentPause() { super.onFragmentPause() - - activity?.intent?.putExtra(BbsStayTimeHelper.IS_BBS_CONTENT_VISIBLE, false) - BbsStayTimeHelper.pauseTimeCount() - if (mBanners.size > 1) { mIsAutoScroll = false mBinding?.bannerViewPager?.stopAutoScroll() diff --git a/app/src/main/java/com/gh/gamecenter/fragment/MainWrapperFragment.java b/app/src/main/java/com/gh/gamecenter/fragment/MainWrapperFragment.java index 1fb187ad50..294e2a8c94 100644 --- a/app/src/main/java/com/gh/gamecenter/fragment/MainWrapperFragment.java +++ b/app/src/main/java/com/gh/gamecenter/fragment/MainWrapperFragment.java @@ -29,8 +29,6 @@ import com.facebook.imagepipeline.image.ImageInfo; import com.gh.common.constant.Config; import com.gh.common.dialog.PrivacyPolicyDialogFragment; import com.gh.common.dialog.ReserveDialog; -import com.gh.gamecenter.feature.exposure.ExposureSource; -import com.gh.common.util.FloatingBackViewManager; import com.gh.common.util.HomeBottomBarHelper; import com.gh.common.util.IntegralLogHelper; import com.gh.common.util.LogUtils; @@ -41,19 +39,20 @@ import com.gh.gamecenter.common.base.fragment.BaseFragment_ViewPager_Checkable; import com.gh.gamecenter.common.callback.BiCallback; import com.gh.gamecenter.common.callback.OnDoubleTapListener; import com.gh.gamecenter.common.constant.EntranceConsts; +import com.gh.gamecenter.common.eventbus.EBReuse; import com.gh.gamecenter.common.syncpage.SyncPageRepository; import com.gh.gamecenter.common.tracker.TrackerLogger; import com.gh.gamecenter.common.utils.ExtensionsKt; import com.gh.gamecenter.common.utils.ImageUtils; import com.gh.gamecenter.core.utils.DisplayUtils; import com.gh.gamecenter.databinding.FragmentMainBinding; -import com.gh.gamecenter.feature.entity.SettingsEntity; import com.gh.gamecenter.entity.SubjectData; import com.gh.gamecenter.entity.SubjectRecommendEntity; import com.gh.gamecenter.entity.WelcomeDialogEntity; -import com.gh.gamecenter.common.eventbus.EBReuse; import com.gh.gamecenter.eventbus.EBSkip; import com.gh.gamecenter.eventbus.EBUISwitch; +import com.gh.gamecenter.feature.entity.SettingsEntity; +import com.gh.gamecenter.feature.exposure.ExposureSource; import com.gh.gamecenter.forum.home.CommunityHomeFragment; import com.gh.gamecenter.game.GameFragment; import com.gh.gamecenter.game.columncollection.detail.ColumnCollectionDetailFragment; @@ -546,11 +545,6 @@ public class MainWrapperFragment extends BaseFragment_ViewPager_Checkable implem TrackerLogger.logHomeTabSelected(index, tabText); - if (index != INDEX_BBS) { - FloatingBackViewManager.disableBackView(); - FloatingBackViewManager.dismissBackView(); - } - SubjectRecommendEntity navBarEntity = mViewModel.getNavBar().getValue(); if (navBarEntity != null) { if (index == INDEX_GAME) { diff --git a/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailActivity.kt b/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailActivity.kt index fbeaa16e29..62f549c4f9 100644 --- a/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailActivity.kt +++ b/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailActivity.kt @@ -4,13 +4,10 @@ import android.content.Context import android.content.Intent import android.os.Bundle import android.view.View -import com.gh.common.util.GameCollectionSquareBrowseTaskHelper import com.gh.gamecenter.R -import com.gh.gamecenter.common.base.activity.BaseActivity import com.gh.gamecenter.common.base.activity.ToolBarActivity import com.gh.gamecenter.common.constant.EntranceConsts import com.gh.gamecenter.core.utils.DisplayUtils -import com.gh.gamecenter.gamecollection.square.GameCollectionSquareActivity class GameCollectionDetailActivity : ToolBarActivity() { @@ -79,16 +76,6 @@ class GameCollectionDetailActivity : ToolBarActivity() { bundle.putString(EntranceConsts.KEY_TOP_COMMENT_ID, topCommentId) bundle.putBoolean(EntranceConsts.KEY_IS_FROM_SQUARE, isFromSquare) bundle.putBoolean(EntranceConsts.KEY_SCROLL_TO_COMMENT_AREA, isScrollToCommentArea) - if (context is GameCollectionSquareActivity) { - val isFromBrowseTask = context.intent.getBooleanExtra( - GameCollectionSquareBrowseTaskHelper.KEY_IS_FORM_BROWSE_TASK, - false - ) - bundle.putBoolean( - GameCollectionSquareBrowseTaskHelper.KEY_IS_FORM_BROWSE_TASK, - isFromBrowseTask - ) - } return getTargetIntent( context, GameCollectionDetailActivity::class.java, diff --git a/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailFragment.kt b/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailFragment.kt index 361b139b83..7ae1a42543 100644 --- a/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailFragment.kt @@ -241,7 +241,6 @@ class GameCollectionDetailFragment : if (!isEverPause && !mIsViewGameCollectionFinished) { mIsViewGameCollectionFinished = true logEvent("view_game_collect_detail") - mListViewModel.postGameCollectionTask("browse_game_list", mGameCollectionId) } } }, 2000) @@ -780,7 +779,6 @@ class GameCollectionDetailFragment : if (!isEverPause && !mIsViewGameCollectionFinished) { mIsViewGameCollectionFinished = true logEvent("view_game_collect_detail") - mListViewModel.postGameCollectionTask("browse_game_list", mGameCollectionId) } } }, 2000) diff --git a/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailViewModel.kt b/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailViewModel.kt index d36504b045..8606670fa9 100644 --- a/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailViewModel.kt +++ b/app/src/main/java/com/gh/gamecenter/gamecollection/detail/GameCollectionDetailViewModel.kt @@ -8,13 +8,15 @@ import android.text.TextUtils import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModelProvider -import com.gh.gamecenter.common.constant.Constants -import com.gh.gamecenter.common.syncpage.SyncDataEntity -import com.gh.gamecenter.common.syncpage.SyncFieldConstants -import com.gh.gamecenter.common.syncpage.SyncPageRepository import com.gh.common.util.* import com.gh.gamecenter.R import com.gh.gamecenter.common.baselist.LoadStatus +import com.gh.gamecenter.common.constant.Constants +import com.gh.gamecenter.common.retrofit.BiResponse +import com.gh.gamecenter.common.retrofit.Response +import com.gh.gamecenter.common.syncpage.SyncDataEntity +import com.gh.gamecenter.common.syncpage.SyncFieldConstants +import com.gh.gamecenter.common.syncpage.SyncPageRepository import com.gh.gamecenter.common.utils.observableToMain import com.gh.gamecenter.common.utils.singleToMain import com.gh.gamecenter.common.utils.toNewSimpleCount @@ -25,9 +27,6 @@ import com.gh.gamecenter.eventbus.EBUserFollow import com.gh.gamecenter.login.user.UserManager import com.gh.gamecenter.qa.article.detail.CommentItemData import com.gh.gamecenter.qa.comment.base.BaseCommentViewModel -import com.gh.gamecenter.common.retrofit.BiResponse -import com.gh.gamecenter.common.retrofit.EmptyResponse -import com.gh.gamecenter.common.retrofit.Response import com.gh.gamecenter.retrofit.RetrofitManager import com.halo.assistant.HaloApp import com.lightgame.utils.Utils @@ -274,8 +273,6 @@ open class GameCollectionDetailViewModel( @SuppressLint("CheckResult") fun postShareGameCollection() { - postGameCollectionTask("forward_share_game_list") - if (gameCollectionDetail == null) return mApi.shareGameCollection(gameCollectionId) .compose(singleToMain()) @@ -379,15 +376,6 @@ open class GameCollectionDetailViewModel( }) } - @SuppressLint("CheckResult") - fun postGameCollectionTask(event: String, gameCollectionId: String = "0") { - RetrofitManager.getInstance() - .newApi - .postGameCollectionTask(event, gameCollectionId) - .compose(singleToMain()) - .subscribe(EmptyResponse()) - } - fun getStarText(): String { val favoriteCount = gameCollectionDetail?.count?.favorite ?: 0 return when { diff --git a/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionSquareActivity.kt b/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionSquareActivity.kt index 2b5ae147dc..9711728f39 100644 --- a/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionSquareActivity.kt +++ b/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionSquareActivity.kt @@ -1,10 +1,9 @@ package com.gh.gamecenter.gamecollection.square import android.os.Bundle +import com.gh.gamecenter.R import com.gh.gamecenter.common.base.activity.BaseActivity import com.gh.gamecenter.core.utils.DisplayUtils -import com.gh.common.util.GameCollectionSquareBrowseTaskHelper -import com.gh.gamecenter.R class GameCollectionSquareActivity : BaseActivity() { override fun getLayoutId(): Int { @@ -24,14 +23,4 @@ class GameCollectionSquareActivity : BaseActivity() { .replace(R.id.placeholder, containerFragment, GameCollectionSquareFragment::class.java.name) .commitAllowingStateLoss() } - - override fun finish() { - GameCollectionSquareBrowseTaskHelper.run { - if (intent.getBooleanExtra(KEY_IS_FORM_BROWSE_TASK, false)) { - disableBrowseTimeCount() - unregisterActivityLifecycleCallbacks() - } - } - super.finish() - } } \ No newline at end of file diff --git a/app/src/main/java/com/gh/gamecenter/retrofit/service/ApiService.java b/app/src/main/java/com/gh/gamecenter/retrofit/service/ApiService.java index 0232a2d850..de9e7499fe 100644 --- a/app/src/main/java/com/gh/gamecenter/retrofit/service/ApiService.java +++ b/app/src/main/java/com/gh/gamecenter/retrofit/service/ApiService.java @@ -3,16 +3,15 @@ package com.gh.gamecenter.retrofit.service; import com.gh.common.filter.RegionSetting; import com.gh.gamecenter.common.entity.LinkEntity; import com.gh.gamecenter.common.entity.OssEntity; +import com.gh.gamecenter.common.entity.SimpleGameEntity; import com.gh.gamecenter.common.entity.ToolBoxEntity; import com.gh.gamecenter.common.entity.WechatConfigEntity; import com.gh.gamecenter.entity.ActivityLabelEntity; import com.gh.gamecenter.entity.AddonsUnreadEntity; import com.gh.gamecenter.entity.AmwayCommentEntity; -import com.gh.gamecenter.feature.entity.ApkEntity; import com.gh.gamecenter.entity.AppEntity; import com.gh.gamecenter.entity.ApplyModeratorStatusEntity; import com.gh.gamecenter.entity.ArchiveEntity; -import com.gh.gamecenter.feature.entity.AuthDialogEntity; import com.gh.gamecenter.entity.AvatarBorderCategoryEntity; import com.gh.gamecenter.entity.BadgeEntity; import com.gh.gamecenter.entity.CarouselEntity; @@ -33,12 +32,10 @@ import com.gh.gamecenter.entity.ForumBannerEntity; import com.gh.gamecenter.entity.ForumDetailEntity; import com.gh.gamecenter.entity.ForumEntity; import com.gh.gamecenter.entity.ForumUnreadEntity; -import com.gh.gamecenter.feature.entity.ForumVideoEntity; import com.gh.gamecenter.entity.GameCollectionCoverEntity; import com.gh.gamecenter.entity.GameCollectionTagEntity; import com.gh.gamecenter.entity.GameColumnCollection; import com.gh.gamecenter.entity.GameDigestEntity; -import com.gh.gamecenter.feature.entity.GameEntity; import com.gh.gamecenter.entity.GameGuidePopupEntity; import com.gh.gamecenter.entity.GameNavigationWrapper; import com.gh.gamecenter.entity.GameVideoInfo; @@ -60,10 +57,8 @@ import com.gh.gamecenter.entity.MyVideoEntity; import com.gh.gamecenter.entity.NewApiSettingsEntity; import com.gh.gamecenter.entity.NewSettingsEntity; import com.gh.gamecenter.entity.NewsDetailEntity; -import com.gh.gamecenter.feature.entity.NewsEntity; import com.gh.gamecenter.entity.PackageFilter; import com.gh.gamecenter.entity.PackageGame; -import com.gh.gamecenter.feature.entity.PersonalEntity; import com.gh.gamecenter.entity.PersonalHistoryEntity; import com.gh.gamecenter.entity.PrivacyPolicyEntity; import com.gh.gamecenter.entity.Rating; @@ -72,15 +67,11 @@ import com.gh.gamecenter.entity.RatingDraftEntity; import com.gh.gamecenter.entity.RatingReplyEntity; import com.gh.gamecenter.entity.RecommendPopupEntity; import com.gh.gamecenter.entity.SearchSubjectEntity; -import com.gh.gamecenter.feature.entity.ServerCalendarEntity; import com.gh.gamecenter.entity.ServerPublishEntity; import com.gh.gamecenter.entity.ServerTestEntity; import com.gh.gamecenter.entity.ServersGameCategory; -import com.gh.gamecenter.feature.entity.SettingsEntity; import com.gh.gamecenter.entity.SidebarsEntity; import com.gh.gamecenter.entity.SignEntity; -import com.gh.gamecenter.common.entity.SimpleGameEntity; -import com.gh.gamecenter.feature.entity.SimulatorEntity; import com.gh.gamecenter.entity.SpecialCatalogEntity; import com.gh.gamecenter.entity.SubjectEntity; import com.gh.gamecenter.entity.SubjectRecommendEntity; @@ -97,23 +88,32 @@ import com.gh.gamecenter.entity.VideoEntity; import com.gh.gamecenter.entity.VideoTagEntity; import com.gh.gamecenter.entity.ViewsEntity; import com.gh.gamecenter.entity.VoteEntity; -import com.gh.gamecenter.gamedetail.entity.BigEvent; -import com.gh.gamecenter.gamedetail.entity.NewGameDetailEntity; +import com.gh.gamecenter.feature.entity.AnswerEntity; +import com.gh.gamecenter.feature.entity.ApkEntity; +import com.gh.gamecenter.feature.entity.ArticleDraftEntity; +import com.gh.gamecenter.feature.entity.ArticleEntity; +import com.gh.gamecenter.feature.entity.AuthDialogEntity; import com.gh.gamecenter.feature.entity.AvatarBorderEntity; import com.gh.gamecenter.feature.entity.BackgroundImageEntity; +import com.gh.gamecenter.feature.entity.ForumVideoEntity; +import com.gh.gamecenter.feature.entity.GameEntity; +import com.gh.gamecenter.feature.entity.NewsEntity; +import com.gh.gamecenter.feature.entity.PersonalEntity; +import com.gh.gamecenter.feature.entity.QuestionDraftEntity; +import com.gh.gamecenter.feature.entity.Questions; +import com.gh.gamecenter.feature.entity.ServerCalendarEntity; +import com.gh.gamecenter.feature.entity.SettingsEntity; +import com.gh.gamecenter.feature.entity.SimulatorEntity; +import com.gh.gamecenter.gamedetail.entity.BigEvent; +import com.gh.gamecenter.gamedetail.entity.NewGameDetailEntity; import com.gh.gamecenter.login.entity.UserInfoEntity; import com.gh.gamecenter.personalhome.rating.MyRating; import com.gh.gamecenter.qa.entity.AnswerDetailEntity; import com.gh.gamecenter.qa.entity.AnswerDraftEntity; -import com.gh.gamecenter.feature.entity.AnswerEntity; import com.gh.gamecenter.qa.entity.ArticleDetailEntity; -import com.gh.gamecenter.feature.entity.ArticleDraftEntity; -import com.gh.gamecenter.feature.entity.ArticleEntity; import com.gh.gamecenter.qa.entity.AskSubjectEntity; import com.gh.gamecenter.qa.entity.EditorInsertDefaultEntity; import com.gh.gamecenter.qa.entity.InviteEntity; -import com.gh.gamecenter.feature.entity.QuestionDraftEntity; -import com.gh.gamecenter.feature.entity.Questions; import com.gh.gamecenter.qa.entity.QuestionsDetailEntity; import com.gh.gamecenter.qa.entity.QuestionsIndexEntity; import com.google.gson.JsonArray; @@ -2557,12 +2557,6 @@ public interface ApiService { @POST("questions/{question_id}/answers/{answer_id}:accept") Observable acceptQuestionComment(@Path("question_id") String questionId, @Path("answer_id") String answerId, @Body RequestBody body); - /** - * 完成论坛浏览页面停留任务 - */ - @POST("bbses/activities/explore/tasks/explore:finish") - Single postExplorerFinish(); - /** * 获取引导浮窗 */ @@ -2778,12 +2772,6 @@ public interface ApiService { @DELETE("api_go/game_list/{game_list_id}/comment/{comment_id}") Observable deleteGameCollectionComment(@Path("game_list_id") String gameCollectionId, @Path("comment_id") String commentId); - /** - * 游戏单活动上报任务 - */ - @POST("lottery/incr-progress/{task_event}/{game_list_id}") - Single postGameCollectionTask(@Path("task_event") String event, @Path("game_list_id") String gameCollectionId); - /** * 获取浏览器安装说明url */ diff --git a/app/src/main/res/drawable-xxxhdpi/pic_browse_square.webp b/app/src/main/res/drawable-xxxhdpi/pic_browse_square.webp deleted file mode 100644 index 155101db54..0000000000 Binary files a/app/src/main/res/drawable-xxxhdpi/pic_browse_square.webp and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/pic_browse_square_finish.webp b/app/src/main/res/drawable-xxxhdpi/pic_browse_square_finish.webp deleted file mode 100644 index 343f83f015..0000000000 Binary files a/app/src/main/res/drawable-xxxhdpi/pic_browse_square_finish.webp and /dev/null differ diff --git a/app/src/main/res/drawable/bg_browse_square_progress.xml b/app/src/main/res/drawable/bg_browse_square_progress.xml deleted file mode 100644 index 4757878588..0000000000 --- a/app/src/main/res/drawable/bg_browse_square_progress.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/progressbar_browse_square_style.xml b/app/src/main/res/drawable/progressbar_browse_square_style.xml deleted file mode 100644 index f56cb17c0a..0000000000 --- a/app/src/main/res/drawable/progressbar_browse_square_style.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/layout_square_browse_task_float.xml b/app/src/main/res/layout/layout_square_browse_task_float.xml deleted file mode 100644 index 8c087d2431..0000000000 --- a/app/src/main/res/layout/layout_square_browse_task_float.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - diff --git a/module_common/src/main/java/com/gh/gamecenter/common/retrofit/ApiService.kt b/module_common/src/main/java/com/gh/gamecenter/common/retrofit/ApiService.kt index dfeb58f28c..874132b06b 100644 --- a/module_common/src/main/java/com/gh/gamecenter/common/retrofit/ApiService.kt +++ b/module_common/src/main/java/com/gh/gamecenter/common/retrofit/ApiService.kt @@ -14,15 +14,6 @@ interface ApiService { @POST("shares") fun postShareResult(@Body body: RequestBody): Single - /** - * 游戏单活动上报任务 - */ - @POST("lottery/incr-progress/{task_event}/{game_list_id}") - fun postGameCollectionTask( - @Path("task_event") event: String, - @Path("game_list_id") gameCollectionId: String - ): Single - /** * 图片上传 */ diff --git a/module_common/src/main/java/com/gh/gamecenter/common/utils/LogUtils.java b/module_common/src/main/java/com/gh/gamecenter/common/utils/LogUtils.java index 61dd1cbb68..82d57fc55f 100644 --- a/module_common/src/main/java/com/gh/gamecenter/common/utils/LogUtils.java +++ b/module_common/src/main/java/com/gh/gamecenter/common/utils/LogUtils.java @@ -1,11 +1,9 @@ package com.gh.gamecenter.common.utils; import android.annotation.SuppressLint; -import android.text.TextUtils; import com.alibaba.android.arouter.launcher.ARouter; import com.gh.gamecenter.common.BuildConfig; -import com.gh.gamecenter.common.constant.Constants; import com.gh.gamecenter.common.constant.RouteConsts; import com.gh.gamecenter.common.entity.ShareResultEntity; import com.gh.gamecenter.common.exposure.meta.Meta; @@ -113,27 +111,6 @@ public class LogUtils { .postShareResult(body) .subscribeOn(Schedulers.io()) .subscribe(new EmptyResponse<>()); - - // 判断是否上报游戏单活动的"转发活动"任务 - postGameCollectionRepostActivityTaskCheck(url, shareResult); - } - - @SuppressLint("CheckResult") - public static void postGameCollectionRepostActivityTaskCheck(String url, String shareResult) { - if (!TextUtils.isEmpty(url) && "success".equals(shareResult)) { - String gameCollectionActivityUrl; - if (EnvHelper.isDevEnv()) { - gameCollectionActivityUrl = Constants.GAME_COLLECTION_ACTIVITY_ADDRESS_DEV; - } else { - gameCollectionActivityUrl = Constants.GAME_COLLECTION_ACTIVITY_ADDRESS; - } - if (url.contains(gameCollectionActivityUrl)) { - RetrofitManager.getInstance().getNewApi() - .postGameCollectionTask("repost_activity", "0") - .subscribeOn(Schedulers.io()) - .subscribe(new EmptyResponse<>()); - } - } } private static void uploadShare(JSONObject object) {