首页社区 TAB 和首页视频 TAB 互换位置
This commit is contained in:
@ -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) })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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(),
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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<RecommendItemDa
|
||||
case -1:
|
||||
// 当前在屏幕上的 fragment 为 AskQuestionRecommendsFragment 时才弹 toast
|
||||
if (mParentFragment instanceof MainWrapperFragment
|
||||
&& ((MainWrapperFragment) mParentFragment).getCurrentItem() == INDEX_ASK
|
||||
&& ((MainWrapperFragment) mParentFragment).getCurrentItem() == INDEX_BBS
|
||||
&& !TextUtils.isEmpty(UserManager.getInstance().getCommunity().getId())) {
|
||||
toast("获取失败,请检查网络设置");
|
||||
getDumbRefreshLayout().finishRefresh(false);
|
||||
|
||||
Reference in New Issue
Block a user