Fix RP crash
This commit is contained in:
parent
15cff2a0dd
commit
8e5032d612
2 changed files with 10 additions and 2 deletions
|
@ -1379,7 +1379,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
|
|
||||||
public WeakReference<MapRouteInfoMenuFragment> findMenuFragment() {
|
public WeakReference<MapRouteInfoMenuFragment> findMenuFragment() {
|
||||||
Fragment fragment = mapActivity.getSupportFragmentManager().findFragmentByTag(MapRouteInfoMenuFragment.TAG);
|
Fragment fragment = mapActivity.getSupportFragmentManager().findFragmentByTag(MapRouteInfoMenuFragment.TAG);
|
||||||
if (fragment != null && !fragment.isDetached()) {
|
if (fragment instanceof MapRouteInfoMenuFragment && !((MapRouteInfoMenuFragment) fragment).isPaused()) {
|
||||||
return new WeakReference<>((MapRouteInfoMenuFragment) fragment);
|
return new WeakReference<>((MapRouteInfoMenuFragment) fragment);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -84,6 +84,8 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
|
||||||
private int screenHeight;
|
private int screenHeight;
|
||||||
private int viewHeight;
|
private int viewHeight;
|
||||||
|
|
||||||
|
private boolean paused;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private MapActivity getMapActivity() {
|
private MapActivity getMapActivity() {
|
||||||
FragmentActivity activity = getActivity();
|
FragmentActivity activity = getActivity();
|
||||||
|
@ -322,6 +324,7 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
paused = false;
|
||||||
if (menu == null) {
|
if (menu == null) {
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
|
@ -343,6 +346,7 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
|
paused = true;
|
||||||
if (view != null) {
|
if (view != null) {
|
||||||
ViewParent parent = view.getParent();
|
ViewParent parent = view.getParent();
|
||||||
if (parent != null && containerLayoutListener != null) {
|
if (parent != null && containerLayoutListener != null) {
|
||||||
|
@ -380,6 +384,10 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isPaused() {
|
||||||
|
return paused;
|
||||||
|
}
|
||||||
|
|
||||||
private void buildBottomView() {
|
private void buildBottomView() {
|
||||||
if (cardsContainer != null) {
|
if (cardsContainer != null) {
|
||||||
menu.build(cardsContainer);
|
menu.build(cardsContainer);
|
||||||
|
@ -777,7 +785,7 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
|
||||||
|
|
||||||
public void setBottomShadowVisible(boolean visible) {
|
public void setBottomShadowVisible(boolean visible) {
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null && bottomContainer != null) {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
AndroidUtils.setForeground(mapActivity, bottomContainer, nightMode,
|
AndroidUtils.setForeground(mapActivity, bottomContainer, nightMode,
|
||||||
R.drawable.bg_contextmenu_shadow, R.drawable.bg_contextmenu_shadow);
|
R.drawable.bg_contextmenu_shadow, R.drawable.bg_contextmenu_shadow);
|
||||||
|
|
Loading…
Reference in a new issue