Small changes (add plugins & maps to long action list)

This commit is contained in:
Victor Shcherb 2015-03-24 10:34:50 +01:00
parent 69558db447
commit c3715723d9
3 changed files with 67 additions and 54 deletions

View file

@ -647,6 +647,7 @@ public class MapActivityActions implements DialogProvider {
// 2-4. Navigation related (directions, mute, cancel navigation) // 2-4. Navigation related (directions, mute, cancel navigation)
boolean muteVisible = routingHelper.getFinalLocation() != null && routingHelper.isFollowingMode(); boolean muteVisible = routingHelper.getFinalLocation() != null && routingHelper.isFollowingMode();
// TODO delete
if (muteVisible) { if (muteVisible) {
boolean mute = routingHelper.getVoiceRouter().isMute(); boolean mute = routingHelper.getVoiceRouter().isMute();
int t = mute ? R.string.menu_mute_on : R.string.menu_mute_off; int t = mute ? R.string.menu_mute_on : R.string.menu_mute_off;
@ -665,6 +666,7 @@ public class MapActivityActions implements DialogProvider {
} }
}).reg(); }).reg();
} }
// TODO delete
if(!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) { if(!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
optionsMenuHelper.item(R.string.get_directions) optionsMenuHelper.item(R.string.get_directions)
.iconColor(R.drawable.ic_action_gdirections_dark) .iconColor(R.drawable.ic_action_gdirections_dark)
@ -719,17 +721,15 @@ public class MapActivityActions implements DialogProvider {
} }
}).reg(); }).reg();
} }
if (getTargets().getPointToNavigate() != null) { optionsMenuHelper.item(R.string.target_points).iconColor(R.drawable.ic_action_flage_dark)
optionsMenuHelper.item(R.string.target_points).iconColor(R.drawable.ic_action_flage_dark) .listen(new OnContextMenuClick() {
.listen(new OnContextMenuClick() { @Override
@Override public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, showWaypointsInDrawer(false);
boolean isChecked) { return false;
showWaypointsInDrawer(false); }
return false; }).reg();
} // TODO delete
}).reg();
}
if(routingHelper.isRouteCalculated()) { if(routingHelper.isRouteCalculated()) {
optionsMenuHelper.item(R.string.impassable_road) optionsMenuHelper.item(R.string.impassable_road)
.iconColor(R.drawable.ic_action_road_works_dark) .iconColor(R.drawable.ic_action_road_works_dark)
@ -742,7 +742,7 @@ public class MapActivityActions implements DialogProvider {
}).reg(); }).reg();
} }
// 5-9. Default actions (Layers, Configure Map screen, Settings, Search, Favorites) // Default actions (Layers, Configure Map screen, Settings, Search, Favorites)
optionsMenuHelper.item(R.string.search_button) optionsMenuHelper.item(R.string.search_button)
.iconColor(R.drawable.ic_action_search_dark) .iconColor(R.drawable.ic_action_search_dark)
.listen(new OnContextMenuClick() { .listen(new OnContextMenuClick() {
@ -760,8 +760,8 @@ public class MapActivityActions implements DialogProvider {
} }
}).reg(); }).reg();
optionsMenuHelper.item(R.string.shared_string_my_places) optionsMenuHelper.item(R.string.shared_string_my_places).iconColor(R.drawable.ic_action_fav_dark)
.iconColor(R.drawable.ic_action_fav_dark).listen(new OnContextMenuClick() { .listen(new OnContextMenuClick() {
@Override @Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) { public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization() Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
@ -773,15 +773,14 @@ public class MapActivityActions implements DialogProvider {
}).reg(); }).reg();
optionsMenuHelper.item(R.string.show_point_options) optionsMenuHelper.item(R.string.show_point_options).iconColor(R.drawable.ic_action_marker_dark)
.iconColor(R.drawable.ic_action_marker_dark) .listen(new OnContextMenuClick() {
.listen(new OnContextMenuClick() { @Override
@Override public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) { contextMenuPoint(mapView.getLatitude(), mapView.getLongitude());
contextMenuPoint(mapView.getLatitude(), mapView.getLongitude()); return true;
return true; }
} }).reg();
}).reg();
optionsMenuHelper.item(R.string.configure_map).iconColor(R.drawable.ic_action_layers_dark) optionsMenuHelper.item(R.string.configure_map).iconColor(R.drawable.ic_action_layers_dark)
.listen(new OnContextMenuClick() { .listen(new OnContextMenuClick() {
@ -793,24 +792,50 @@ public class MapActivityActions implements DialogProvider {
}).reg(); }).reg();
optionsMenuHelper.item(R.string.layer_map_appearance).iconColor(R.drawable.ic_configure_screen_dark) optionsMenuHelper.item(R.string.layer_map_appearance).iconColor(R.drawable.ic_configure_screen_dark)
.listen(new OnContextMenuClick() { .listen(new OnContextMenuClick() {
@Override @Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) { public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
prepareConfigureScreen(); prepareConfigureScreen();
return false; return false;
} }
}).reg(); }).reg();
optionsMenuHelper.item(R.string.shared_string_settings) optionsMenuHelper.item(R.string.index_settings).iconColor(R.drawable.ic_type_archive)
.iconColor(R.drawable.ic_action_settings_enabled_dark) .listen(new OnContextMenuClick() {
.listen(new OnContextMenuClick() { @Override
@Override public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) { Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
final Intent settings = new Intent(mapActivity, getMyApplication().getAppCustomization().getSettingsActivity()); .getDownloadActivity());
mapActivity.startActivity(settings); // causes wrong position caching: newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
return true; mapActivity.startActivity(newIntent);
} return true;
}).reg(); }
}).reg();
optionsMenuHelper.item(R.string.prefs_plugins).iconColor(R.drawable.ic_extension_dark)
.listen(new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
.getDownloadActivity());
// causes wrong position caching: newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
mapActivity.startActivity(newIntent);
return true;
}
}).reg();
optionsMenuHelper.item(R.string.shared_string_settings).iconColor(R.drawable.ic_action_settings_enabled_dark)
.listen(new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
final Intent settings = new Intent(mapActivity, getMyApplication().getAppCustomization()
.getSettingsActivity());
mapActivity.startActivity(settings);
return true;
}
}).reg();
//////////// Others //////////// Others
OsmandPlugin.registerOptionsMenu(mapActivity, optionsMenuHelper); OsmandPlugin.registerOptionsMenu(mapActivity, optionsMenuHelper);

View file

@ -110,19 +110,7 @@ public class SettingsActivity extends SettingsBaseActivity {
@Override @Override
public boolean onPreferenceClick(Preference preference) { public boolean onPreferenceClick(Preference preference) {
if (preference == localIndexes) { if (preference == localIndexes) {
boolean empty = getMyApplication().getResourceManager().getIndexFileNames().isEmpty(); startActivity(new Intent(this, getMyApplication().getAppCustomization().getDownloadIndexActivity()));
if (empty) {
File folder = getMyApplication().getAppPath(IndexConstants.BACKUP_INDEX_DIR);
if (folder.exists() && folder.isDirectory()) {
String[] l = folder.list();
empty = l == null || l.length == 0;
}
}
if (empty) {
startActivity(new Intent(this, getMyApplication().getAppCustomization().getDownloadIndexActivity()));
} else {
startActivity(new Intent(this, getMyApplication().getAppCustomization().getDownloadActivity()));
}
return true; return true;
} else if (preference == general) { } else if (preference == general) {
startActivity(new Intent(this, SettingsGeneralActivity.class)); startActivity(new Intent(this, SettingsGeneralActivity.class));

View file

@ -266,13 +266,13 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
switchButton.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getIcon(R.drawable.ic_navigation_drawer, switchButton.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getIcon(R.drawable.ic_navigation_drawer,
R.color.icon_color_light)); R.color.icon_color_light));
mapActivity.findViewById(R.id.MapHudButtonsOverlay).setVisibility(View.INVISIBLE);
} else { } else {
scrollView.setVisibility(View.GONE); scrollView.setVisibility(View.GONE);
listViewLayout.setVisibility(View.VISIBLE); listViewLayout.setVisibility(View.VISIBLE);
switchButton.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getIcon(R.drawable.ic_dashboard_dark, switchButton.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getIcon(R.drawable.ic_dashboard_dark,
R.color.icon_color_light)); R.color.icon_color_light));
} }
mapActivity.findViewById(R.id.MapHudButtonsOverlay).setVisibility(View.INVISIBLE);
switchButton.setOnClickListener(new View.OnClickListener() { switchButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {