mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-23 22:53:43 +00:00
[android] Hide currently active left button action from hamburger menu
fixes #549 And add "About CoMaps" option in burger menu when using custom buttons Signed-off-by: Harry Bond <me@hbond.xyz>
This commit is contained in:
committed by
Konstantin Pastbin
parent
464b3cf59a
commit
58bab61890
@@ -8,6 +8,7 @@ CoMaps contributors:
|
|||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
clover sage
|
clover sage
|
||||||
|
Harry Bond <me@hbond.xyz>
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
Organic Maps (formerly OMaps) contributors:
|
Organic Maps (formerly OMaps) contributors:
|
||||||
|
|||||||
@@ -2584,20 +2584,28 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||||||
{
|
{
|
||||||
if (id.equals(MAIN_MENU_ID))
|
if (id.equals(MAIN_MENU_ID))
|
||||||
{
|
{
|
||||||
|
final String activeLeftButton = buttonsHolder.getActiveButtonCode();
|
||||||
ArrayList<MenuBottomSheetItem> items = new ArrayList<>();
|
ArrayList<MenuBottomSheetItem> items = new ArrayList<>();
|
||||||
items.add(new MenuBottomSheetItem(R.string.placepage_add_place_button, R.drawable.ic_plus, this::onAddPlaceOptionSelected));
|
|
||||||
items.add(new MenuBottomSheetItem(
|
if (!BUTTON_ADD_PLACE_CODE.equals(activeLeftButton))
|
||||||
R.string.download_maps,
|
items.add(new MenuBottomSheetItem(R.string.placepage_add_place_button, R.drawable.ic_plus, this::onAddPlaceOptionSelected));
|
||||||
R.drawable.ic_download,
|
|
||||||
getDownloadMapsCounter(),
|
items.add(new MenuBottomSheetItem(R.string.download_maps, R.drawable.ic_download, getDownloadMapsCounter(), this::onDownloadMapsOptionSelected));
|
||||||
this::onDownloadMapsOptionSelected
|
|
||||||
));
|
if (!Config.getDonateUrl(getApplicationContext()).isEmpty())
|
||||||
mDonatesUrl = Config.getDonateUrl(getApplicationContext());
|
|
||||||
if (!TextUtils.isEmpty(mDonatesUrl))
|
|
||||||
items.add(new MenuBottomSheetItem(R.string.donate, R.drawable.ic_donate, this::onDonateOptionSelected));
|
items.add(new MenuBottomSheetItem(R.string.donate, R.drawable.ic_donate, this::onDonateOptionSelected));
|
||||||
items.add(new MenuBottomSheetItem(R.string.settings, R.drawable.ic_settings, this::onSettingsOptionSelected));
|
|
||||||
items.add(new MenuBottomSheetItem(R.string.start_track_recording, R.drawable.ic_track_recording_off, -1, this::onTrackRecordingOptionSelected));
|
if (!BUTTON_SETTINGS_CODE.equals(activeLeftButton))
|
||||||
|
items.add(new MenuBottomSheetItem(R.string.settings, R.drawable.ic_settings, this::onSettingsOptionSelected));
|
||||||
|
|
||||||
|
if (!BUTTON_RECORD_TRACK_CODE.equals(activeLeftButton))
|
||||||
|
items.add(new MenuBottomSheetItem(R.string.start_track_recording, R.drawable.ic_track_recording_off, -1, this::onTrackRecordingOptionSelected));
|
||||||
|
|
||||||
items.add(new MenuBottomSheetItem(R.string.share_my_location, R.drawable.ic_share, this::onShareLocationOptionSelected));
|
items.add(new MenuBottomSheetItem(R.string.share_my_location, R.drawable.ic_share, this::onShareLocationOptionSelected));
|
||||||
|
|
||||||
|
if (!BUTTON_HELP_CODE.equals(activeLeftButton))
|
||||||
|
items.add(new MenuBottomSheetItem(R.string.about_menu_title, R.drawable.ic_question_mark, this::showHelp));
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -43,15 +43,21 @@ public class LeftButtonsHolder
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public LeftButton getActiveButton()
|
public String getActiveButtonCode()
|
||||||
{
|
{
|
||||||
String activeButtonCode = prefs.getString(leftButtonPreferenceKey, DEFAULT_BUTTON_CODE);
|
String activeButtonCode = prefs.getString(leftButtonPreferenceKey, DEFAULT_BUTTON_CODE);
|
||||||
if (!TextUtils.isEmpty(activeButtonCode))
|
if (!TextUtils.isEmpty(activeButtonCode))
|
||||||
return availableButtons.get(activeButtonCode);
|
return activeButtonCode;
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public LeftButton getActiveButton()
|
||||||
|
{
|
||||||
|
return availableButtons.get(getActiveButtonCode());
|
||||||
|
}
|
||||||
|
|
||||||
public Collection<LeftButton> getAllButtons()
|
public Collection<LeftButton> getAllButtons()
|
||||||
{
|
{
|
||||||
return availableButtons.values();
|
return availableButtons.values();
|
||||||
|
|||||||
Reference in New Issue
Block a user