|
|
@@ -40,11 +40,15 @@ public class HomeFragment extends Fragment implements KPIFragment.KPIPagerScroll
|
|
|
|
|
|
if(ApexTrackingApplication.get_instance().recentactive)
|
|
|
{
|
|
|
- recentFragment.checkDirty();
|
|
|
+ if (recentFragment != null) {
|
|
|
+ recentFragment.checkDirty();
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- kpiFragment.checkDirty();
|
|
|
+ if (kpiFragment != null) {
|
|
|
+ kpiFragment.checkDirty();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
private int mode = 0;
|
|
|
@@ -56,8 +60,6 @@ public class HomeFragment extends Fragment implements KPIFragment.KPIPagerScroll
|
|
|
View v= inflater.inflate(R.layout.fragment_home, container, false);
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
if(kpiFragment==null) {
|
|
|
kpiFragment = new KPIFragment();
|
|
|
|
|
|
@@ -70,7 +72,6 @@ public class HomeFragment extends Fragment implements KPIFragment.KPIPagerScroll
|
|
|
// .add(R.id.container, recentFragment).commit();
|
|
|
}
|
|
|
|
|
|
- showFragment(mode);
|
|
|
|
|
|
// if(mode==0)
|
|
|
// ft.replace(R.id.container,kpiFragment);
|
|
|
@@ -134,6 +135,16 @@ public class HomeFragment extends Fragment implements KPIFragment.KPIPagerScroll
|
|
|
showFragment(mode);
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if(savedInstanceState!=null) {
|
|
|
+ mode = savedInstanceState.getInt("mode");
|
|
|
+ mSegmentView.setSelect(mode);
|
|
|
+ }
|
|
|
+ showFragment(mode);
|
|
|
+
|
|
|
+
|
|
|
return v;
|
|
|
}
|
|
|
|
|
|
@@ -147,7 +158,7 @@ public class HomeFragment extends Fragment implements KPIFragment.KPIPagerScroll
|
|
|
ApexTrackingApplication.getInstance().recentactive = false;
|
|
|
FragmentManager fm=getChildFragmentManager();
|
|
|
FragmentTransaction ft= fm .beginTransaction();
|
|
|
- if(activeFragment!=null)
|
|
|
+ if(activeFragment!=null && activeFragment.isAdded())
|
|
|
ft.hide(activeFragment);
|
|
|
Fragment fragment = null;
|
|
|
String tag = "";
|
|
|
@@ -211,11 +222,6 @@ public class HomeFragment extends Fragment implements KPIFragment.KPIPagerScroll
|
|
|
@Override
|
|
|
public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
|
|
|
super.onViewStateRestored(savedInstanceState);
|
|
|
-
|
|
|
- if(savedInstanceState!=null) {
|
|
|
- mode = savedInstanceState.getInt("mode");
|
|
|
- mSegmentView.setSelect(mode);
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
@Override
|