Fix back to context menu from gpx menu

This commit is contained in:
Vitaliy 2021-01-28 14:33:31 +02:00
parent 1b1ed6e02f
commit d2aa6c331e
2 changed files with 9 additions and 7 deletions

View file

@ -42,9 +42,7 @@ public class SelectedGpxMenuController extends MenuController {
leftTitleButtonController = new TitleButtonController() {
@Override
public void buttonPressed() {
SelectedGpxFile selectedGpxFile = selectedGpxPoint.getSelectedGpxFile();
mapActivity.getContextMenu().hide(false);
TrackMenuFragment.showInstance(mapActivity, selectedGpxFile.getGpxFile().path, selectedGpxFile.isShowCurrentTrack());
TrackMenuFragment.showInstance(mapActivity, selectedGpxPoint.getSelectedGpxFile());
}
};
leftTitleButtonController.caption = mapActivity.getString(R.string.shared_string_open_track);

View file

@ -227,12 +227,16 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
FragmentActivity activity = requireMyActivity();
activity.getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
public void handleOnBackPressed() {
if (getCurrentMenuState() != MenuState.HEADER_ONLY && isPortrait()) {
openMenuHeaderOnly();
} else {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
if (mapActivity != null && mapActivity.getSupportFragmentManager().getBackStackEntryCount() == 1) {
mapActivity.launchPrevActivityIntent();
}
dismiss();
}
}
});
}