Fix context menu crash and bottom lines hiding
This commit is contained in:
parent
41c33c13ed
commit
fd80843baf
1 changed files with 25 additions and 18 deletions
|
@ -142,6 +142,12 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
markerPaddingXPx = dpToPx(MARKER_PADDING_X_DP);
|
markerPaddingXPx = dpToPx(MARKER_PADDING_X_DP);
|
||||||
|
|
||||||
menu = getMapActivity().getContextMenu();
|
menu = getMapActivity().getContextMenu();
|
||||||
|
view = inflater.inflate(R.layout.map_context_menu_fragment, container, false);
|
||||||
|
if (!menu.isActive()) {
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
mainView = view.findViewById(R.id.context_menu_main);
|
||||||
|
|
||||||
leftTitleButtonController = menu.getLeftTitleButtonController();
|
leftTitleButtonController = menu.getLeftTitleButtonController();
|
||||||
rightTitleButtonController = menu.getRightTitleButtonController();
|
rightTitleButtonController = menu.getRightTitleButtonController();
|
||||||
topRightTitleButtonController = menu.getTopRightTitleButtonController();
|
topRightTitleButtonController = menu.getTopRightTitleButtonController();
|
||||||
|
@ -166,9 +172,6 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
IconsCache iconsCache = getMyApplication().getIconsCache();
|
IconsCache iconsCache = getMyApplication().getIconsCache();
|
||||||
boolean light = getMyApplication().getSettings().isLightContent();
|
boolean light = getMyApplication().getSettings().isLightContent();
|
||||||
|
|
||||||
view = inflater.inflate(R.layout.map_context_menu_fragment, container, false);
|
|
||||||
mainView = view.findViewById(R.id.context_menu_main);
|
|
||||||
|
|
||||||
// Left title button
|
// Left title button
|
||||||
final Button leftTitleButton = (Button) view.findViewById(R.id.title_button);
|
final Button leftTitleButton = (Button) view.findViewById(R.id.title_button);
|
||||||
if (leftTitleButtonController != null) {
|
if (leftTitleButtonController != null) {
|
||||||
|
@ -453,26 +456,24 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
.setDuration(200)
|
.setDuration(200)
|
||||||
.setInterpolator(new DecelerateInterpolator())
|
.setInterpolator(new DecelerateInterpolator())
|
||||||
.setListener(new AnimatorListenerAdapter() {
|
.setListener(new AnimatorListenerAdapter() {
|
||||||
|
|
||||||
|
boolean canceled = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationCancel(Animator animation) {
|
public void onAnimationCancel(Animator animation) {
|
||||||
if (needCloseMenu) {
|
canceled = true;
|
||||||
menu.close();
|
|
||||||
} else {
|
|
||||||
updateMainViewLayout(posY);
|
|
||||||
if (previousMenuState != 0 && newMenuState != 0 && previousMenuState != newMenuState) {
|
|
||||||
doAfterMenuStateChange(previousMenuState, newMenuState);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationEnd(Animator animation) {
|
public void onAnimationEnd(Animator animation) {
|
||||||
if (needCloseMenu) {
|
if (!canceled) {
|
||||||
menu.close();
|
if (needCloseMenu) {
|
||||||
} else {
|
menu.close();
|
||||||
updateMainViewLayout(posY);
|
} else {
|
||||||
if (previousMenuState != 0 && newMenuState != 0 && previousMenuState != newMenuState) {
|
updateMainViewLayout(posY);
|
||||||
doAfterMenuStateChange(previousMenuState, newMenuState);
|
if (previousMenuState != 0 && newMenuState != 0 && previousMenuState != newMenuState) {
|
||||||
|
doAfterMenuStateChange(previousMenuState, newMenuState);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -626,6 +627,10 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
if (!menu.isActive()) {
|
||||||
|
dismissMenu();
|
||||||
|
return;
|
||||||
|
}
|
||||||
screenOrientation = DashLocationFragment.getScreenOrientation(getActivity());
|
screenOrientation = DashLocationFragment.getScreenOrientation(getActivity());
|
||||||
if (menu.displayDistanceDirection()) {
|
if (menu.displayDistanceDirection()) {
|
||||||
getMapActivity().getMapViewTrackingUtilities().setContextMenu(menu);
|
getMapActivity().getMapViewTrackingUtilities().setContextMenu(menu);
|
||||||
|
@ -641,7 +646,9 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyView() {
|
public void onDestroyView() {
|
||||||
super.onDestroyView();
|
super.onDestroyView();
|
||||||
map.setLatLon(mapCenter.getLatitude(), mapCenter.getLongitude());
|
if (mapCenter != null) {
|
||||||
|
map.setLatLon(mapCenter.getLatitude(), mapCenter.getLongitude());
|
||||||
|
}
|
||||||
menu.setMapCenter(null);
|
menu.setMapCenter(null);
|
||||||
getMapActivity().getMapLayers().getMapControlsLayer().setControlsClickable(true);
|
getMapActivity().getMapLayers().getMapControlsLayer().setControlsClickable(true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue