billyyoyo преди 5 години
родител
ревизия
6bdef516bd

+ 1 - 0
app/src/main/java/com/sheep/gamegroup/module/game/fragment/FgtGameCenter.java

@@ -20,6 +20,7 @@ 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.LogUtil;
 import com.sheep.gamegroup.util.ViewUtil;
 import com.sheep.gamegroup.view.activity.ActMain;
 import com.sheep.gamegroup.view.activity.helper.AdHelper;

+ 9 - 1
app/src/main/java/com/sheep/gamegroup/module/home/fragment/HomeWrapperFragment.java

@@ -8,6 +8,7 @@ import android.view.View;
 
 import com.kfzs.duanduan.cardview.ScreenUtil;
 import com.sheep.gamegroup.model.entity.WebParams;
+import com.sheep.gamegroup.util.LogUtil;
 import com.sheep.gamegroup.util.ViewUtil;
 import com.sheep.gamegroup.view.fragment.FgtFind;
 import com.sheep.gamegroup.view.fragment.FgtSmallSheep;
@@ -19,6 +20,8 @@ public class HomeWrapperFragment extends BaseFragment {
 
     private View frame_container;
 
+    private BaseFragment contentFragment;
+
     @Override
     public int getLayoutId() {
         return R.layout.common_container_v2;
@@ -28,7 +31,7 @@ public class HomeWrapperFragment extends BaseFragment {
     public void onViewCreated() {
         frame_container = getView().findViewById(R.id.frame_container);
         frame_container.setPadding(0, ScreenUtil.dip2px(getContext(), 8), 0, 0);
-        Fragment contentFragment = getChildFragmentManager().findFragmentByTag("fragment_content");
+        contentFragment = (BaseFragment) getChildFragmentManager().findFragmentByTag("fragment_content");
         FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
         if (contentFragment == null) {
             contentFragment = ViewUtil.newWebFragment(new WebParams(Config.getUrlByPath(Config.PATH_APP_HOME)).hideProgress());
@@ -38,4 +41,9 @@ public class HomeWrapperFragment extends BaseFragment {
         }
         transaction.commitAllowingStateLoss();
     }
+
+    @Override
+    public void initDataOnVisibleToUser() {
+        if (contentFragment != null) contentFragment.initDataOnVisibleToUser();
+    }
 }

+ 21 - 9
app/src/main/java/com/sheep/gamegroup/view/activity/ActMain.java

@@ -220,6 +220,8 @@ public class ActMain extends BaseActYmPermissionCheck {
     public static final int MIN_CLICK_DELAY_TIME = 200;
     private long lastClickTime = 0;
 
+    private Fragment[] mFragments = new Fragment[3];
+
     private void initFragments() {
         changeVisible(-1, lastPosition);
         //小绵羊3.4.10新增 判断用户是否是游戏用户,是的话默认打开游戏界面
@@ -242,18 +244,24 @@ public class ActMain extends BaseActYmPermissionCheck {
         int index = 0;
         int iconSize = ScreenUtil.dip2px(this, 30);
         for (MainTab mainTab : mainTabs) {
-            Fragment fragment = getSupportFragmentManager().findFragmentByTag("fragment_" + index);
-            if (fragment == null) {
-                fragment = mainTabs[index].getFragment();
-            }
-            if (!fragment.isAdded()) {
-                transaction.add(R.id.frame_container, fragment, "fragment_" + index);
+            mFragments[index] = getSupportFragmentManager().findFragmentByTag("fragment_" + index);
+            if (mFragments[index] == null) {
+                mFragments[index] = mainTabs[index].getFragment();
             }
             if (index == lastPosition) {
-                transaction.show(fragment);
-            } else {
-                transaction.hide(fragment);
+                if (!mFragments[index].isAdded()) {
+                    transaction.add(R.id.frame_container, mFragments[index], "fragment_" + index);
+                }
+                transaction.show(mFragments[index]);
             }
+//            if (!mFragments[index].isAdded()) {
+//                transaction.add(R.id.frame_container, mFragments[index], "fragment_" + index);
+//            }
+//            if (index == lastPosition) {
+//                transaction.show(mFragments[index]);
+//            } else {
+//                transaction.hide(mFragments[index]);
+//            }
             View view = tab_container.getChildAt(index);
             if (view instanceof TextView) {
                 ((TextView) view).setText(mainTab.getStringId());
@@ -299,6 +307,10 @@ public class ActMain extends BaseActYmPermissionCheck {
             }
             if (cFragment != null) {
                 transaction.show(cFragment);
+            } else {
+                cFragment = mFragments[position];
+                transaction.add(R.id.frame_container, mFragments[position], "fragment_" + position);
+                transaction.show(mFragments[position]);
             }
             transaction.commitAllowingStateLoss();
             if (lFragment != null) {

+ 5 - 0
app/src/main/java/com/sheep/jiuyan/samllsheep/ui/activity/SignActivity.java

@@ -104,6 +104,11 @@ public class SignActivity extends BaseUMActivity {
     private float per;//图片每像素在屏幕上的距离
 
     @Override
+    protected boolean showWhiteStatusBar() {
+        return true;
+    }
+
+    @Override
     public void initView() {
         TitleBarUtils.getInstance().setTitleFinish(this)
                 .setShowOrHide(this, true)