|
|
@@ -20,7 +20,6 @@ import com.sheep.gamegroup.module.guide.NewbieGuideHelper;
|
|
|
import com.sheep.gamegroup.module.webview.fragment.FgtWeb;
|
|
|
import com.sheep.gamegroup.module.webview.fragment.FgtWebX5;
|
|
|
import com.sheep.gamegroup.util.CommonUtil;
|
|
|
-import com.sheep.gamegroup.util.Jump2View;
|
|
|
import com.sheep.gamegroup.util.ViewUtil;
|
|
|
import com.sheep.gamegroup.view.activity.ActMain;
|
|
|
import com.sheep.gamegroup.view.activity.helper.AdHelper;
|
|
|
@@ -28,7 +27,6 @@ import com.sheep.gamegroup.view.adapter.TitleFragmentListAdapter;
|
|
|
import com.sheep.gamegroup.view.fragment.FgtFindChild;
|
|
|
import com.sheep.jiuyan.samllsheep.Config;
|
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
|
-import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
import com.sheep.jiuyan.samllsheep.base.BaseFragment;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.G;
|
|
|
import com.snail.antifake.jni.EmulatorDetectUtil;
|
|
|
@@ -53,7 +51,7 @@ public class FgtGameCenter extends BaseFragment {
|
|
|
|
|
|
public static WeakReference<TabLayout> gameRef;
|
|
|
|
|
|
- private Fragment gameMallFgt;
|
|
|
+ private Fragment gameMallFgt, gameCenterFgt, welfareCenterFgt;
|
|
|
|
|
|
@BindView(R.id.indicator)
|
|
|
TabLayout indicator;
|
|
|
@@ -103,26 +101,26 @@ public class FgtGameCenter extends BaseFragment {
|
|
|
|
|
|
private void initView() {
|
|
|
ViewUtil.setImage(fgt_gc_hb_500_yuan_iv, R.mipmap.bg_hb_500yuan);
|
|
|
-// backBtn.setVisibility((getActivity() instanceof ActMain) ? View.GONE : View.VISIBLE);
|
|
|
TitleFragmentListAdapter mAdapter = new TitleFragmentListAdapter(getChildFragmentManager());
|
|
|
-// mAdapter.add(new FgtPlayGame(), "玩转游戏");
|
|
|
-// mAdapter.add(new com.sheep.gamegroup.view.fragment.FgtGiftCenter(), "礼包中心");
|
|
|
if (EmulatorDetectUtil.isEmulator()) {
|
|
|
- mAdapter.add(FgtWeb.newInstance(new WebParams(Config.getUrlByPath(Config.PATH_GAME_HOME))), "玩转游戏");
|
|
|
+ gameCenterFgt = FgtWeb.newInstance(new WebParams(Config.getUrlByPath(Config.PATH_GAME_HOME)));
|
|
|
} else {
|
|
|
- mAdapter.add(FgtWebX5.newInstance(new WebParams(Config.getUrlByPath(Config.PATH_GAME_HOME))), "玩转游戏");
|
|
|
+ gameCenterFgt = FgtWebX5.newInstance(new WebParams(Config.getUrlByPath(Config.PATH_GAME_HOME)));
|
|
|
}
|
|
|
if (EmulatorDetectUtil.isEmulator()) {
|
|
|
- mAdapter.add(FgtWeb.newInstance(new WebParams(Config.getUrlByPath(Config.PATH_WELFARE_HOME))), "福利中心");
|
|
|
+ welfareCenterFgt = FgtWeb.newInstance(new WebParams(Config.getUrlByPath(Config.PATH_WELFARE_HOME)));
|
|
|
} else {
|
|
|
- mAdapter.add(FgtWebX5.newInstance(new WebParams(Config.getUrlByPath(Config.PATH_WELFARE_HOME))), "福利中心");
|
|
|
+ welfareCenterFgt = FgtWebX5.newInstance(new WebParams(Config.getUrlByPath(Config.PATH_WELFARE_HOME)));
|
|
|
}
|
|
|
- mAdapter.add(FgtFindChild.newInstance(new ArticleTag(-1, 1)), "游戏资讯");
|
|
|
+
|
|
|
if (EmulatorDetectUtil.isEmulator()) {
|
|
|
gameMallFgt = FgtWeb.newInstance(new WebParams(Config.getUrlByPath(Config.PATH_GAME_SHOP_HOME)));
|
|
|
} else {
|
|
|
gameMallFgt = FgtWebX5.newInstance(new WebParams(Config.getUrlByPath(Config.PATH_GAME_SHOP_HOME)));
|
|
|
}
|
|
|
+ mAdapter.add(gameCenterFgt, "玩转游戏");
|
|
|
+ mAdapter.add(welfareCenterFgt, "福利中心");
|
|
|
+ mAdapter.add(FgtFindChild.newInstance(new ArticleTag(-1, 1)), "游戏资讯");
|
|
|
mAdapter.add(gameMallFgt, "游戏商城");
|
|
|
pager.setAdapter(mAdapter);
|
|
|
indicator.setupWithViewPager(pager);
|
|
|
@@ -148,8 +146,19 @@ public class FgtGameCenter extends BaseFragment {
|
|
|
|
|
|
@Override
|
|
|
public void initDataOnVisibleToUser() {
|
|
|
- if (gameMallFgt != null && pager.getCurrentItem() == 3) {
|
|
|
- ((BaseFragment) gameMallFgt).initDataOnVisibleToUser();
|
|
|
+ if (pager == null) return;
|
|
|
+ switch (pager.getCurrentItem()) {
|
|
|
+ case 0:
|
|
|
+ if (gameCenterFgt != null) ((BaseFragment) gameCenterFgt).initDataOnVisibleToUser();
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ if (welfareCenterFgt != null) ((BaseFragment) welfareCenterFgt).initDataOnVisibleToUser();
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ if (gameMallFgt != null) ((BaseFragment) gameMallFgt).initDataOnVisibleToUser();
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
|