From 2eded373211fbaaaced640da805a8df455086812 Mon Sep 17 00:00:00 2001 From: juntao Date: Wed, 26 May 2021 10:20:06 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E7=A4=BE=E5=8C=BA=20TAB=20?= =?UTF-8?q?=E5=92=8C=E9=A6=96=E9=A1=B5=E8=A7=86=E9=A2=91=20TAB=20=E4=BA=92?= =?UTF-8?q?=E6=8D=A2=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/gh/common/util/DirectUtils.kt | 8 +- .../java/com/gh/gamecenter/MainActivity.java | 4 +- .../forum/home/ForumHomeFragment.kt | 2 +- .../fragment/MainWrapperFragment.java | 44 +++++----- .../com/gh/gamecenter/qa/CommunityFragment.kt | 2 +- .../AskQuestionsRecommendsFragment.java | 4 +- app/src/main/res/layout/fragment_main.xml | 81 +++++++++---------- app/src/main/res/values/strings.xml | 2 +- 8 files changed, 73 insertions(+), 74 deletions(-) diff --git a/app/src/main/java/com/gh/common/util/DirectUtils.kt b/app/src/main/java/com/gh/common/util/DirectUtils.kt index 061dadacd5..54b04c3dd7 100644 --- a/app/src/main/java/com/gh/common/util/DirectUtils.kt +++ b/app/src/main/java/com/gh/common/util/DirectUtils.kt @@ -766,7 +766,7 @@ object DirectUtils { // 这里换个线程操作是为了做一点延时 AppExecutor.ioExecutor.execute { - EventBus.getDefault().post(EBSkip(MainActivity.EB_SKIP_MAIN, MainWrapperFragment.INDEX_ASK)) + EventBus.getDefault().post(EBSkip(MainActivity.EB_SKIP_MAIN, MainWrapperFragment.INDEX_BBS)) EventBus.getDefault().post(EBReuse(CommunityFragment.EB_RETRY_PAGE)) } } @@ -781,7 +781,7 @@ object DirectUtils { // 这里换个线程操作是为了做一点延时 AppExecutor.ioExecutor.execute { - EventBus.getDefault().post(EBSkip(MainActivity.EB_SKIP_MAIN, MainWrapperFragment.INDEX_ASK)) + EventBus.getDefault().post(EBSkip(MainActivity.EB_SKIP_MAIN, MainWrapperFragment.INDEX_BBS)) EventBus.getDefault().post(EBReuse(CommunityFragment.EB_RETRY_PAGE)) } } @@ -1177,10 +1177,10 @@ object DirectUtils { // 这里换个线程操作是为了做一点延时 AppExecutor.ioExecutor.execute { - EventBus.getDefault().post(EBSkip(MainActivity.EB_SKIP_MAIN, MainWrapperFragment.INDEX_ASK)) + EventBus.getDefault().post(EBSkip(MainActivity.EB_SKIP_MAIN, MainWrapperFragment.INDEX_BBS)) } } else { - jumpActivity(context, Bundle().apply { putInt(KEY_POSITION, MainWrapperFragment.INDEX_ASK) }) + jumpActivity(context, Bundle().apply { putInt(KEY_POSITION, MainWrapperFragment.INDEX_BBS) }) } } diff --git a/app/src/main/java/com/gh/gamecenter/MainActivity.java b/app/src/main/java/com/gh/gamecenter/MainActivity.java index f1e17667aa..1aa01cf578 100644 --- a/app/src/main/java/com/gh/gamecenter/MainActivity.java +++ b/app/src/main/java/com/gh/gamecenter/MainActivity.java @@ -745,7 +745,7 @@ public class MainActivity extends BaseActivity { private void switchToCommunityTabAndRefresh() { getIntent().putExtra(SWITCH_TO_COMMUNITY, false); Log.e("Switch", "true"); - EventBus.getDefault().post(new EBSkip(MainActivity.EB_SKIP_MAIN, MainWrapperFragment.INDEX_ASK)); + EventBus.getDefault().post(new EBSkip(MainActivity.EB_SKIP_MAIN, MainWrapperFragment.INDEX_BBS)); EventBus.getDefault().post(new EBReuse(CommunityFragment.EB_RETRY_PAGE)); } @@ -878,7 +878,7 @@ public class MainActivity extends BaseActivity { if (info != null) { if (EntranceUtils.HOST_COMMUNITY.equals(info.getType())) { UserManager.getInstance().setCommunityData(new CommunityEntity(info.getLink(), info.getText())); - runOnUiThread(() -> mMainWrapperFragment.setCurrentItem(MainWrapperFragment.INDEX_ASK)); + runOnUiThread(() -> mMainWrapperFragment.setCurrentItem(MainWrapperFragment.INDEX_BBS)); } else { DirectUtils.directToSpecificPage(this, info.getType(), diff --git a/app/src/main/java/com/gh/gamecenter/forum/home/ForumHomeFragment.kt b/app/src/main/java/com/gh/gamecenter/forum/home/ForumHomeFragment.kt index 86f0ab0318..2ac021888f 100644 --- a/app/src/main/java/com/gh/gamecenter/forum/home/ForumHomeFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/forum/home/ForumHomeFragment.kt @@ -409,7 +409,7 @@ class ForumHomeFragment : BaseLazyTabFragment() { @Subscribe(threadMode = ThreadMode.MAIN) fun onEventMainThread(busNine: EBUISwitch) { - if (busNine.position == MainWrapperFragment.INDEX_ASK) { + if (busNine.position == MainWrapperFragment.INDEX_BBS) { mFollowForumArticleListFragment?.scrollToTop() mRecommendForumArticleListFragment?.scrollToTop() appbar.setExpanded(true) 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 5ca3cc8a52..2a754435d0 100644 --- a/app/src/main/java/com/gh/gamecenter/fragment/MainWrapperFragment.java +++ b/app/src/main/java/com/gh/gamecenter/fragment/MainWrapperFragment.java @@ -57,7 +57,6 @@ import com.gh.gamecenter.personal.PersonalFragment; import com.gh.gamecenter.video.detail.HomeVideoFragment; import com.halo.assistant.HaloApp; import com.lightgame.listeners.OnBackPressedListener; -import com.lightgame.utils.Utils; import com.lightgame.view.CheckableImageView; import com.lightgame.view.CheckableLinearLayout; import com.lightgame.view.NoScrollableViewPager; @@ -95,7 +94,7 @@ public class MainWrapperFragment extends BaseFragment_ViewPager_Checkable implem @BindView(R.id.lottieVideo) LottieAnimationView mLottieVideo; @BindView(R.id.lottieCommunity) - LottieAnimationView mLottieCommunity; + LottieAnimationView mLottieBBS; @BindView(R.id.lottieMine) SimpleDraweeView mLottieMine; @BindView(R.id.main_tab_game_name) @@ -103,8 +102,8 @@ public class MainWrapperFragment extends BaseFragment_ViewPager_Checkable implem public static final int INDEX_HOME = 0; public static final int INDEX_GAME = 1; - public static final int INDEX_VIDEO = 2; - public static final int INDEX_ASK = 3; + public static final int INDEX_BBS = 2; + public static final int INDEX_VIDEO = 3; public static final int INDEX_PERSONAL = 4; public static final String EB_MAIN_SCROLL_TOP = "main_scroll_top"; @@ -147,12 +146,13 @@ public class MainWrapperFragment extends BaseFragment_ViewPager_Checkable implem Bundle videoArgs = new Bundle(); videoArgs.putBoolean(EntranceUtils.KEY_IS_HOME_VIDEO, true); homeVideoFragment.setArguments(videoArgs); + + fragments.add(new ForumHomeFragment()); fragments.add(homeVideoFragment); if (mViewModel.shouldHideVideoTab()) { mTabVideo.setVisibility(View.GONE); } - fragments.add(new ForumHomeFragment()); fragments.add(new PersonalFragment()); } @@ -292,7 +292,7 @@ public class MainWrapperFragment extends BaseFragment_ViewPager_Checkable implem case INDEX_VIDEO: DataUtils.onMtaEvent(getContext(), "顶级页面", "BottomBar_双击", "视频"); break; - case INDEX_ASK: + case INDEX_BBS: DataUtils.onMtaEvent(getContext(), "顶级页面", "BottomBar_双击", "问答"); break; case INDEX_PERSONAL: @@ -328,42 +328,42 @@ public class MainWrapperFragment extends BaseFragment_ViewPager_Checkable implem private void playTabAnimation(int toCheck) { switch (toCheck) { - case 0: + case INDEX_HOME: stopAnimation(mLottieGame, INDEX_GAME); stopAnimation(mLottieVideo, INDEX_VIDEO); - stopAnimation(mLottieCommunity, INDEX_ASK); + stopAnimation(mLottieBBS, INDEX_BBS); stopAnimation(mLottieMine, INDEX_PERSONAL); playAnimation(mLottieHome, toCheck); break; - case 1: + case INDEX_GAME: SubjectRecommendEntity value = mViewModel.getNavBar().getValue(); if (value != null && !TextUtils.isEmpty(value.getAnimationCode())) { stopAnimation(mLottieHome, INDEX_HOME); stopAnimation(mLottieVideo, INDEX_VIDEO); - stopAnimation(mLottieCommunity, INDEX_ASK); + stopAnimation(mLottieBBS, INDEX_BBS); stopAnimation(mLottieMine, INDEX_PERSONAL); playGameAnimation(value, toCheck); } break; - case 2: + case INDEX_BBS: stopAnimation(mLottieHome, INDEX_HOME); stopAnimation(mLottieGame, INDEX_GAME); - stopAnimation(mLottieCommunity, INDEX_ASK); + stopAnimation(mLottieVideo, INDEX_VIDEO); + stopAnimation(mLottieMine, INDEX_PERSONAL); + playAnimation(mLottieBBS, toCheck); + break; + case INDEX_VIDEO: + stopAnimation(mLottieHome, INDEX_HOME); + stopAnimation(mLottieGame, INDEX_GAME); + stopAnimation(mLottieBBS, INDEX_BBS); stopAnimation(mLottieMine, INDEX_PERSONAL); playAnimation(mLottieVideo, toCheck); break; - case 3: + case INDEX_PERSONAL: stopAnimation(mLottieHome, INDEX_HOME); stopAnimation(mLottieGame, INDEX_GAME); stopAnimation(mLottieVideo, INDEX_VIDEO); - stopAnimation(mLottieMine, INDEX_PERSONAL); - playAnimation(mLottieCommunity, toCheck); - break; - case 4: - stopAnimation(mLottieHome, INDEX_HOME); - stopAnimation(mLottieGame, INDEX_GAME); - stopAnimation(mLottieVideo, INDEX_VIDEO); - stopAnimation(mLottieCommunity, INDEX_ASK); + stopAnimation(mLottieBBS, INDEX_BBS); playAnimation(mLottieMine, toCheck); break; default: @@ -477,7 +477,7 @@ public class MainWrapperFragment extends BaseFragment_ViewPager_Checkable implem case INDEX_GAME: tabText = "游戏库"; break; - case INDEX_ASK: + case INDEX_BBS: tabText = "论坛"; LogUtils.uploadAccessBbsTab(); break; diff --git a/app/src/main/java/com/gh/gamecenter/qa/CommunityFragment.kt b/app/src/main/java/com/gh/gamecenter/qa/CommunityFragment.kt index c337e74242..c85a6f0137 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/CommunityFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/CommunityFragment.kt @@ -390,7 +390,7 @@ class CommunityFragment : BaseLazyTabFragment() { @Subscribe(threadMode = ThreadMode.MAIN) fun onEventMainThread(busNine: EBUISwitch) { if (MainWrapperFragment.EB_MAIN_SCROLL_TOP == busNine.from - && MainWrapperFragment.INDEX_ASK == busNine.position) { + && MainWrapperFragment.INDEX_BBS == busNine.position) { when (mTabLayout.getTabAt(mViewPager.currentItem)?.text) { TAB_TITLE_FOLLOW -> mAskFollowFragment?.scrollToTop(false) TAB_TITLE_RECOMMEND -> mRecommendsFragment?.scrollToTop(false) diff --git a/app/src/main/java/com/gh/gamecenter/qa/recommends/AskQuestionsRecommendsFragment.java b/app/src/main/java/com/gh/gamecenter/qa/recommends/AskQuestionsRecommendsFragment.java index 7c3bbaddd8..f6a2d120a8 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/recommends/AskQuestionsRecommendsFragment.java +++ b/app/src/main/java/com/gh/gamecenter/qa/recommends/AskQuestionsRecommendsFragment.java @@ -38,7 +38,7 @@ import androidx.recyclerview.widget.RecyclerView; import butterknife.BindView; import butterknife.OnClick; -import static com.gh.gamecenter.fragment.MainWrapperFragment.INDEX_ASK; +import static com.gh.gamecenter.fragment.MainWrapperFragment.INDEX_BBS; import static com.gh.gamecenter.personal.PersonalFragment.LOGIN_TAG; import static com.gh.gamecenter.personal.PersonalFragment.LOGOUT_TAG; import static com.gh.gamecenter.qa.CommunityFragment.COMMUNITIES_SELECT_REQUEST; @@ -85,7 +85,7 @@ public class AskQuestionsRecommendsFragment extends ListFragment + + + + + + + + + + + + + - - - - - - - - - - - - - - 请输入正确的链接 登录成功 问答 - 论坛 + 社区 推荐 问题