Replace isResumed with isRemoving

This commit is contained in:
Alexander Sytnyk 2017-11-07 11:39:14 +02:00
parent 3046db3338
commit e9aef89dee
2 changed files with 3 additions and 3 deletions

View file

@ -817,7 +817,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
if (Build.VERSION.SDK_INT >= 21) { if (Build.VERSION.SDK_INT >= 21) {
int colorId = -1; int colorId = -1;
Fragment fragment = getVisibleFragment(getSupportFragmentManager()); Fragment fragment = getVisibleFragment(getSupportFragmentManager());
if (fragment != null && fragment.isResumed() && fragment instanceof BaseOsmAndFragment) { if (fragment != null && !fragment.isRemoving() && fragment instanceof BaseOsmAndFragment) {
colorId = ((BaseOsmAndFragment) fragment).getStatusBarColorId(); colorId = ((BaseOsmAndFragment) fragment).getStatusBarColorId();
} else if (dashboardOnMap.isVisible()) { } else if (dashboardOnMap.isVisible()) {
colorId = dashboardOnMap.getStatusBarColor(); colorId = dashboardOnMap.getStatusBarColor();

View file

@ -58,8 +58,8 @@ public class BaseOsmAndFragment extends Fragment {
} }
@Override @Override
public void onStop() { public void onDetach() {
super.onStop(); super.onDetach();
if (Build.VERSION.SDK_INT >= 21 && getStatusBarColorId() != -1) { if (Build.VERSION.SDK_INT >= 21 && getStatusBarColorId() != -1) {
Activity activity = getActivity(); Activity activity = getActivity();
if (activity instanceof MapActivity) { if (activity instanceof MapActivity) {