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)
boolean muteVisible = routingHelper.getFinalLocation() != null && routingHelper.isFollowingMode();
// TODO delete
if (muteVisible) {
boolean mute = routingHelper.getVoiceRouter().isMute();
int t = mute ? R.string.menu_mute_on : R.string.menu_mute_off;
@ -665,6 +666,7 @@ public class MapActivityActions implements DialogProvider {
}
}).reg();
}
// TODO delete
if(!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
optionsMenuHelper.item(R.string.get_directions)
.iconColor(R.drawable.ic_action_gdirections_dark)
@ -719,17 +721,15 @@ public class MapActivityActions implements DialogProvider {
}
}).reg();
}
if (getTargets().getPointToNavigate() != null) {
optionsMenuHelper.item(R.string.target_points).iconColor(R.drawable.ic_action_flage_dark)
.listen(new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos,
boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
showWaypointsInDrawer(false);
return false;
}
}).reg();
}
// TODO delete
if(routingHelper.isRouteCalculated()) {
optionsMenuHelper.item(R.string.impassable_road)
.iconColor(R.drawable.ic_action_road_works_dark)
@ -742,7 +742,7 @@ public class MapActivityActions implements DialogProvider {
}).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)
.iconColor(R.drawable.ic_action_search_dark)
.listen(new OnContextMenuClick() {
@ -760,8 +760,8 @@ public class MapActivityActions implements DialogProvider {
}
}).reg();
optionsMenuHelper.item(R.string.shared_string_my_places)
.iconColor(R.drawable.ic_action_fav_dark).listen(new OnContextMenuClick() {
optionsMenuHelper.item(R.string.shared_string_my_places).iconColor(R.drawable.ic_action_fav_dark)
.listen(new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
@ -773,8 +773,7 @@ public class MapActivityActions implements DialogProvider {
}).reg();
optionsMenuHelper.item(R.string.show_point_options)
.iconColor(R.drawable.ic_action_marker_dark)
optionsMenuHelper.item(R.string.show_point_options).iconColor(R.drawable.ic_action_marker_dark)
.listen(new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
@ -801,12 +800,38 @@ public class MapActivityActions implements DialogProvider {
}
}).reg();
optionsMenuHelper.item(R.string.shared_string_settings)
.iconColor(R.drawable.ic_action_settings_enabled_dark)
optionsMenuHelper.item(R.string.index_settings).iconColor(R.drawable.ic_type_archive)
.listen(new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
final Intent settings = new Intent(mapActivity, getMyApplication().getAppCustomization().getSettingsActivity());
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.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;
}

View file

@ -110,19 +110,7 @@ public class SettingsActivity extends SettingsBaseActivity {
@Override
public boolean onPreferenceClick(Preference preference) {
if (preference == localIndexes) {
boolean empty = getMyApplication().getResourceManager().getIndexFileNames().isEmpty();
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;
} else if (preference == general) {
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,
R.color.icon_color_light));
mapActivity.findViewById(R.id.MapHudButtonsOverlay).setVisibility(View.INVISIBLE);
} else {
scrollView.setVisibility(View.GONE);
listViewLayout.setVisibility(View.VISIBLE);
switchButton.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getIcon(R.drawable.ic_dashboard_dark,
R.color.icon_color_light));
}
mapActivity.findViewById(R.id.MapHudButtonsOverlay).setVisibility(View.INVISIBLE);
switchButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {