|
|
@@ -3,6 +3,7 @@ package com.sheep.gamegroup.module.home.fragment;
|
|
|
import android.support.v4.app.Fragment;
|
|
|
import android.support.v4.app.FragmentTransaction;
|
|
|
|
|
|
+import com.kfzs.duanduan.cardview.ScreenUtil;
|
|
|
import com.sheep.gamegroup.model.entity.WebParams;
|
|
|
import com.sheep.gamegroup.module.webview.fragment.FgtWeb;
|
|
|
import com.sheep.gamegroup.module.webview.fragment.FgtWebX5;
|
|
|
@@ -14,7 +15,7 @@ import com.snail.antifake.jni.EmulatorDetectUtil;
|
|
|
|
|
|
public class FgtWrapper extends BaseFragment {
|
|
|
|
|
|
- private Fragment subFragment;
|
|
|
+ private BaseFragment subFragment;
|
|
|
|
|
|
@Override
|
|
|
public int getLayoutId() {
|
|
|
@@ -23,14 +24,19 @@ public class FgtWrapper extends BaseFragment {
|
|
|
|
|
|
@Override
|
|
|
public void onViewCreated() {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- public void loadSubFragment() {
|
|
|
- if (subFragment != null) return;
|
|
|
- subFragment = ViewUtil.newWebFragment(new WebParams(Config.getUrlByPath(Config.PATH_SMALL_SHEEP_INVITATION_HOME), "邀请赚钱"));
|
|
|
+ subFragment = (BaseFragment) getChildFragmentManager().findFragmentByTag("fragment_sub");
|
|
|
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
|
|
|
- transaction.add(R.id.fragment_container, subFragment, "fragment_sub").show(subFragment);
|
|
|
+ if (subFragment == null) {
|
|
|
+ subFragment = ViewUtil.newWebFragment(new WebParams(Config.getUrlByPath(Config.PATH_SMALL_SHEEP_INVITATION_HOME),"邀请赚钱").hideProgress());
|
|
|
+ transaction.add(R.id.fragment_container, subFragment, "fragment_sub").show(subFragment);
|
|
|
+ } else {
|
|
|
+ transaction.show(subFragment);
|
|
|
+ }
|
|
|
transaction.commitAllowingStateLoss();
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void initDataOnVisibleToUser() {
|
|
|
+ if (subFragment != null) subFragment.initDataOnVisibleToUser();
|
|
|
+ }
|
|
|
}
|