Add exit button and make dashboard first in menu

This commit is contained in:
Victor Shcherb 2014-12-09 01:40:49 +01:00
parent 91eb00e013
commit 54cb49b55a

View file

@ -680,6 +680,17 @@ public class MapActivityActions implements DialogProvider {
final OsmandApplication app = mapActivity.getMyApplication();
ContextMenuAdapter optionsMenuHelper = new ContextMenuAdapter(app);
currentDrawer = DrawerType.MAIN_MENU;
optionsMenuHelper.item(R.string.home_button).icons(R.drawable.ic_action_quit_dark, R.drawable.ic_action_quit_light )
.listen(new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getMainMenuActivity());
newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
mapActivity.startActivity(newIntent);
return true;
}
}).reg();
// 1. Where am I
optionsMenuHelper.item(R.string.where_am_i).
@ -886,7 +897,7 @@ public class MapActivityActions implements DialogProvider {
}
OsmandPlugin.registerOptionsMenu(mapActivity, optionsMenuHelper);
optionsMenuHelper.item(R.string.home_button).icons(R.drawable.ic_action_quit_dark, R.drawable.ic_action_quit_light )
optionsMenuHelper.item(R.string.exit_Button).icons(R.drawable.ic_action_quit_dark, R.drawable.ic_action_quit_light )
.listen(new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
@ -894,7 +905,7 @@ public class MapActivityActions implements DialogProvider {
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getMainMenuActivity());
newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// not exit
// newIntent.putExtra(DashboardActivity.APP_EXIT_KEY, DashboardActivity.APP_EXIT_CODE);
newIntent.putExtra(MainMenuActivity.APP_EXIT_KEY, MainMenuActivity.APP_EXIT_CODE);
mapActivity.startActivity(newIntent);
// In future when map will be main screen this should change
// app.closeApplication(mapActivity);