Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
7b028addc8
6 changed files with 147 additions and 38 deletions
|
@ -9,6 +9,7 @@
|
||||||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||||
-->
|
-->
|
||||||
|
<string name="rendering_attr_transportStops_name">Transport Stops</string>
|
||||||
<string name="application_dir_change_warning2">Do you want OsmAnd to also copy its data files to the new destination? Select \'No\' for OsmAnd to just create and use the new folder.</string>
|
<string name="application_dir_change_warning2">Do you want OsmAnd to also copy its data files to the new destination? Select \'No\' for OsmAnd to just create and use the new folder.</string>
|
||||||
<string name="navigate_point_zone">Zone</string>
|
<string name="navigate_point_zone">Zone</string>
|
||||||
<string name="navigate_point_northing">Northing</string>
|
<string name="navigate_point_northing">Northing</string>
|
||||||
|
|
|
@ -728,12 +728,11 @@ public class OsmandSettings {
|
||||||
|
|
||||||
public final OsmandPreference<Boolean> SHOW_POI_LABEL = new BooleanPreference("show_poi_label", false).makeGlobal();
|
public final OsmandPreference<Boolean> SHOW_POI_LABEL = new BooleanPreference("show_poi_label", false).makeGlobal();
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
|
||||||
public final OsmandPreference<Boolean> SHOW_TRANSPORT_OVER_MAP = new BooleanPreference("show_transport_over_map", false).makeGlobal();
|
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
public final OsmandPreference<String> PREFERRED_LOCALE = new StringPreference("preferred_locale", "").makeGlobal();
|
public final OsmandPreference<String> PREFERRED_LOCALE = new StringPreference("preferred_locale", "").makeGlobal();
|
||||||
|
|
||||||
|
public static final String TRANSPORT_STOPS_OVER_MAP = "transportStops";
|
||||||
|
|
||||||
public final OsmandPreference<String> MAP_PREFERRED_LOCALE = new StringPreference("map_preferred_locale", "").makeGlobal();
|
public final OsmandPreference<String> MAP_PREFERRED_LOCALE = new StringPreference("map_preferred_locale", "").makeGlobal();
|
||||||
|
|
||||||
public boolean usingEnglishNames() {
|
public boolean usingEnglishNames() {
|
||||||
|
|
|
@ -93,8 +93,11 @@ public class DashboardActivity extends BaseDownloadActivity {
|
||||||
setContentView(R.layout.dashboard);
|
setContentView(R.layout.dashboard);
|
||||||
lp = getMyApplication().getLocationProvider();
|
lp = getMyApplication().getLocationProvider();
|
||||||
|
|
||||||
final String textVersion = Version.getFullVersion(getMyApplication());
|
String textVersion = Version.getFullVersion(getMyApplication());
|
||||||
getSupportActionBar().setTitle(textVersion.substring(0, textVersion.indexOf("#")+1));
|
if(textVersion.indexOf("#") != -1) {
|
||||||
|
textVersion = textVersion.substring(0, textVersion.indexOf("#") + 1);
|
||||||
|
}
|
||||||
|
getSupportActionBar().setTitle(textVersion);
|
||||||
ColorDrawable color = new ColorDrawable(getResources().getColor(R.color.actionbar_color));
|
ColorDrawable color = new ColorDrawable(getResources().getColor(R.color.actionbar_color));
|
||||||
getSupportActionBar().setBackgroundDrawable(color);
|
getSupportActionBar().setBackgroundDrawable(color);
|
||||||
getSupportActionBar().setIcon(android.R.color.transparent);
|
getSupportActionBar().setIcon(android.R.color.transparent);
|
||||||
|
|
|
@ -50,7 +50,6 @@ import android.app.AlertDialog;
|
||||||
import android.app.AlertDialog.Builder;
|
import android.app.AlertDialog.Builder;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.opengl.GLSurfaceView;
|
|
||||||
import android.widget.ListAdapter;
|
import android.widget.ListAdapter;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
@ -159,8 +158,9 @@ public class MapActivityLayers {
|
||||||
public void updateLayers(OsmandMapTileView mapView){
|
public void updateLayers(OsmandMapTileView mapView){
|
||||||
OsmandSettings settings = getApplication().getSettings();
|
OsmandSettings settings = getApplication().getSettings();
|
||||||
updateMapSource(mapView, settings.MAP_TILE_SOURCES);
|
updateMapSource(mapView, settings.MAP_TILE_SOURCES);
|
||||||
if(mapView.getLayers().contains(transportStopsLayer) != settings.SHOW_TRANSPORT_OVER_MAP.get()){
|
boolean showStops = settings.getCustomRenderBooleanProperty(OsmandSettings.TRANSPORT_STOPS_OVER_MAP).get();
|
||||||
if(settings.SHOW_TRANSPORT_OVER_MAP.get()){
|
if(mapView.getLayers().contains(transportStopsLayer) != showStops){
|
||||||
|
if(showStops){
|
||||||
mapView.addLayer(transportStopsLayer, 5);
|
mapView.addLayer(transportStopsLayer, 5);
|
||||||
} else {
|
} else {
|
||||||
mapView.removeLayer(transportStopsLayer);
|
mapView.removeLayer(transportStopsLayer);
|
||||||
|
|
|
@ -132,27 +132,10 @@ public class SettingsGeneralActivity extends SettingsBaseActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void addPrefmapNames(PreferenceGroup screen) {
|
|
||||||
String[] entrieValues = new String[] { "", "en", "be", "ca", "cs", "da", "de", "el", "es", "fi", "fr", "he", "hi",
|
|
||||||
"hr", "hu", "it", "ja", "ko", "lv", "nl", "pl", "ro", "ru", "sk", "sl", "sv", "sw", "zh" };
|
|
||||||
String[] entries = new String[] { getString(R.string.local_map_names), getString(R.string.lang_en),
|
|
||||||
getString(R.string.lang_be), getString(R.string.lang_ca), getString(R.string.lang_cs),
|
|
||||||
getString(R.string.lang_da), getString(R.string.lang_de), getString(R.string.lang_el),
|
|
||||||
getString(R.string.lang_es), getString(R.string.lang_fi), getString(R.string.lang_fr),
|
|
||||||
getString(R.string.lang_he), getString(R.string.lang_hi), getString(R.string.lang_hr),
|
|
||||||
getString(R.string.lang_hu), getString(R.string.lang_it), getString(R.string.lang_ja),
|
|
||||||
getString(R.string.lang_ko), getString(R.string.lang_lv), getString(R.string.lang_nl),
|
|
||||||
getString(R.string.lang_pl), getString(R.string.lang_ro), getString(R.string.lang_ru),
|
|
||||||
getString(R.string.lang_sk), getString(R.string.lang_sl), getString(R.string.lang_sv),
|
|
||||||
getString(R.string.lang_sw), getString(R.string.lang_zh) };
|
|
||||||
registerListPreference(settings.MAP_PREFERRED_LOCALE, screen, entries, entrieValues);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void addLocalPrefs(PreferenceGroup screen) {
|
private void addLocalPrefs(PreferenceGroup screen) {
|
||||||
String[] entries;
|
String[] entries;
|
||||||
String[] entrieValues;
|
String[] entrieValues;
|
||||||
addPrefmapNames(screen);
|
|
||||||
|
|
||||||
DrivingRegion[] drs = DrivingRegion.values();
|
DrivingRegion[] drs = DrivingRegion.values();
|
||||||
entries = new String[drs.length];
|
entries = new String[drs.length];
|
||||||
|
|
|
@ -14,6 +14,7 @@ import net.osmand.plus.GpxSelectionHelper;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
|
import net.osmand.plus.OsmandSettings.CommonPreference;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.SettingsActivity;
|
import net.osmand.plus.activities.SettingsActivity;
|
||||||
|
@ -23,7 +24,11 @@ import net.osmand.render.RenderingRuleProperty;
|
||||||
import net.osmand.render.RenderingRuleStorageProperties;
|
import net.osmand.render.RenderingRuleStorageProperties;
|
||||||
import net.osmand.render.RenderingRulesStorage;
|
import net.osmand.render.RenderingRulesStorage;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
import android.app.AlertDialog.Builder;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
import android.content.DialogInterface.OnMultiChoiceClickListener;
|
||||||
|
import android.preference.PreferenceGroup;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
@ -128,8 +133,6 @@ public class ConfigureMapMenu {
|
||||||
}
|
}
|
||||||
} else if (itemId == R.string.layer_transport_route) {
|
} else if (itemId == R.string.layer_transport_route) {
|
||||||
ma.getMapLayers().getTransportInfoLayer().setVisible(isChecked);
|
ma.getMapLayers().getTransportInfoLayer().setVisible(isChecked);
|
||||||
} else if (itemId == R.string.layer_transport) {
|
|
||||||
settings.SHOW_TRANSPORT_OVER_MAP.set(isChecked);
|
|
||||||
}
|
}
|
||||||
ma.getMapLayers().updateLayers(ma.getMapView());
|
ma.getMapLayers().updateLayers(ma.getMapView());
|
||||||
ma.getMapView().refreshMap();
|
ma.getMapView().refreshMap();
|
||||||
|
@ -154,8 +157,6 @@ public class ConfigureMapMenu {
|
||||||
// .icons(R.drawable.ic_action_foot_dark, R.drawable.ic_action_foot_light)
|
// .icons(R.drawable.ic_action_foot_dark, R.drawable.ic_action_foot_light)
|
||||||
.icons(R.drawable.ic_action_polygom_dark, R.drawable.ic_action_polygom_light)
|
.icons(R.drawable.ic_action_polygom_dark, R.drawable.ic_action_polygom_light)
|
||||||
.listen(l).reg();
|
.listen(l).reg();
|
||||||
adapter.item(R.string.layer_transport).selected(settings.SHOW_TRANSPORT_OVER_MAP.get() ? 1 : 0)
|
|
||||||
.icons(R.drawable.ic_action_bus_dark, R.drawable.ic_action_bus_light).listen(l).reg();
|
|
||||||
if(TransportRouteHelper.getInstance().routeIsCalculated()){
|
if(TransportRouteHelper.getInstance().routeIsCalculated()){
|
||||||
adapter.item(R.string.layer_transport_route).selected(1)
|
adapter.item(R.string.layer_transport_route).selected(1)
|
||||||
.icons(R.drawable.ic_action_bus_dark, R.drawable.ic_action_bus_light).listen(l).reg();
|
.icons(R.drawable.ic_action_bus_dark, R.drawable.ic_action_bus_light).listen(l).reg();
|
||||||
|
@ -273,18 +274,49 @@ public class ConfigureMapMenu {
|
||||||
}
|
}
|
||||||
}).description(getScale(activity)).layout(R.layout.drawer_list_doubleitem).reg();
|
}).description(getScale(activity)).layout(R.layout.drawer_list_doubleitem).reg();
|
||||||
|
|
||||||
|
adapter.item(R.string.map_preferred_locale).listen(new OnContextMenuClick() {
|
||||||
|
@Override
|
||||||
|
public boolean onContextMenuClick(final ArrayAdapter<?> ad, int itemId, final int pos, boolean isChecked) {
|
||||||
|
final OsmandMapTileView view = activity.getMapView();
|
||||||
|
AlertDialog.Builder b = new AlertDialog.Builder(view.getContext());
|
||||||
|
// test old descr as title
|
||||||
|
b.setTitle(R.string.map_preferred_locale);
|
||||||
|
final String[] txtValues = mapNamesIds;
|
||||||
|
final String[] txtNames = getMapNamesValues(activity);
|
||||||
|
int selected = -1;
|
||||||
|
for (int i = 0; i < txtValues.length; i++) {
|
||||||
|
if(view.getSettings().MAP_PREFERRED_LOCALE.get().equals(txtValues[i])) {
|
||||||
|
selected = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
b.setSingleChoiceItems(txtNames, selected, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
view.getSettings().MAP_PREFERRED_LOCALE.set(txtValues[which]);
|
||||||
|
refreshMapComplete(activity);
|
||||||
|
adapter.setItemDescription(pos, txtValues[which]);
|
||||||
|
ad.notifyDataSetInvalidated();
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
b.show();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}).description(activity.getMyApplication().getSettings().MAP_PREFERRED_LOCALE.get()).layout(R.layout.drawer_list_doubleitem).reg();
|
||||||
|
|
||||||
RenderingRulesStorage renderer = activity.getMyApplication().getRendererRegistry().getCurrentSelectedRenderer();
|
RenderingRulesStorage renderer = activity.getMyApplication().getRendererRegistry().getCurrentSelectedRenderer();
|
||||||
if (renderer != null) {
|
if (renderer != null) {
|
||||||
List<RenderingRuleProperty> customRules = new ArrayList<RenderingRuleProperty>(renderer.PROPS.getCustomRules());
|
List<RenderingRuleProperty> customRules = new ArrayList<RenderingRuleProperty>(renderer.PROPS.getCustomRules());
|
||||||
|
|
||||||
createProperties(customRules, R.string.rendering_category_transport, "transport",
|
createProperties(customRules, R.string.rendering_category_transport, "transport",
|
||||||
adapter, activity);
|
adapter, activity);
|
||||||
createProperties(customRules, R.string.rendering_category_routes, "routes",
|
|
||||||
adapter, activity);
|
|
||||||
createProperties(customRules, R.string.rendering_category_details, "details",
|
createProperties(customRules, R.string.rendering_category_details, "details",
|
||||||
adapter, activity);
|
adapter, activity);
|
||||||
createProperties(customRules, R.string.rendering_category_hide, "hide",
|
createProperties(customRules, R.string.rendering_category_hide, "hide",
|
||||||
adapter, activity);
|
adapter, activity);
|
||||||
|
createProperties(customRules, R.string.rendering_category_routes, "routes",
|
||||||
|
adapter, activity);
|
||||||
|
|
||||||
if(customRules.size() > 0) {
|
if(customRules.size() > 0) {
|
||||||
adapter.item(R.string.rendering_category_others).setCategory(true).layout(R.layout.drawer_list_sub_header).reg();
|
adapter.item(R.string.rendering_category_others).setCategory(true).layout(R.layout.drawer_list_sub_header).reg();
|
||||||
|
@ -293,20 +325,111 @@ public class ConfigureMapMenu {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createProperties(List<RenderingRuleProperty> customRules, int strId, String cat, ContextMenuAdapter adapter, MapActivity activity) {
|
static String[] mapNamesIds = new String[] { "", "en", "be", "ca", "cs", "da", "de", "el", "es", "fi", "fr", "he", "hi",
|
||||||
List<RenderingRuleProperty> ps = new ArrayList<RenderingRuleProperty>();
|
"hr", "hu", "it", "ja", "ko", "lv", "nl", "pl", "ro", "ru", "sk", "sl", "sv", "sw", "zh" };
|
||||||
|
|
||||||
|
private String[] getMapNamesValues(Context ctx) {
|
||||||
|
return new String[] { ctx.getString(R.string.local_map_names), ctx.getString(R.string.lang_en),
|
||||||
|
ctx.getString(R.string.lang_be), ctx.getString(R.string.lang_ca), ctx.getString(R.string.lang_cs),
|
||||||
|
ctx.getString(R.string.lang_da), ctx.getString(R.string.lang_de), ctx.getString(R.string.lang_el),
|
||||||
|
ctx.getString(R.string.lang_es), ctx.getString(R.string.lang_fi), ctx.getString(R.string.lang_fr),
|
||||||
|
ctx.getString(R.string.lang_he), ctx.getString(R.string.lang_hi), ctx.getString(R.string.lang_hr),
|
||||||
|
ctx.getString(R.string.lang_hu), ctx.getString(R.string.lang_it), ctx.getString(R.string.lang_ja),
|
||||||
|
ctx.getString(R.string.lang_ko), ctx.getString(R.string.lang_lv), ctx.getString(R.string.lang_nl),
|
||||||
|
ctx.getString(R.string.lang_pl), ctx.getString(R.string.lang_ro), ctx.getString(R.string.lang_ru),
|
||||||
|
ctx.getString(R.string.lang_sk), ctx.getString(R.string.lang_sl), ctx.getString(R.string.lang_sv),
|
||||||
|
ctx.getString(R.string.lang_sw), ctx.getString(R.string.lang_zh) };
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createProperties(List<RenderingRuleProperty> customRules, final int strId, String cat,
|
||||||
|
final ContextMenuAdapter adapter, final MapActivity activity) {
|
||||||
|
final List<RenderingRuleProperty> ps = new ArrayList<RenderingRuleProperty>();
|
||||||
|
final List<OsmandSettings.CommonPreference<Boolean>> prefs = new ArrayList<OsmandSettings.CommonPreference<Boolean>>();
|
||||||
Iterator<RenderingRuleProperty> it = customRules.iterator();
|
Iterator<RenderingRuleProperty> it = customRules.iterator();
|
||||||
while(it.hasNext()) {
|
|
||||||
|
while (it.hasNext()) {
|
||||||
RenderingRuleProperty p = it.next();
|
RenderingRuleProperty p = it.next();
|
||||||
if(cat.equals(p.getCategory())) {
|
if (cat.equals(p.getCategory()) && p.isBoolean()) {
|
||||||
ps.add(p);
|
ps.add(p);
|
||||||
|
final OsmandSettings.CommonPreference<Boolean> pref = activity.getMyApplication().getSettings()
|
||||||
|
.getCustomRenderBooleanProperty(p.getAttrName());
|
||||||
|
prefs.add(pref);
|
||||||
it.remove();
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(ps.size() > 0) {
|
if(prefs.size() > 0) {
|
||||||
adapter.item(strId).setCategory(true).layout(R.layout.drawer_list_sub_header).reg();
|
final String descr = getDescription(prefs);
|
||||||
createCustomRenderingProperties(adapter, activity, ps);
|
adapter.item(strId).description(descr).
|
||||||
|
layout(R.layout.drawer_list_doubleitem).listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onContextMenuClick(ArrayAdapter<?> a, int itemId, int pos, boolean isChecked) {
|
||||||
|
showPreferencesDialog(adapter, a, pos, activity, activity.getString(strId), ps, prefs);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
}).reg();
|
||||||
|
// createCustomRenderingProperties(adapter, activity, ps);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getDescription(final List<OsmandSettings.CommonPreference<Boolean>> prefs) {
|
||||||
|
int count = 0;
|
||||||
|
int enabled = 0;
|
||||||
|
for(OsmandSettings.CommonPreference<Boolean> p : prefs) {
|
||||||
|
count ++;
|
||||||
|
if(p.get()) {
|
||||||
|
enabled++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final String descr = enabled +"/"+count;
|
||||||
|
return descr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showPreferencesDialog(final ContextMenuAdapter adapter, final ArrayAdapter<?> a, final int pos, final MapActivity activity,
|
||||||
|
String category, List<RenderingRuleProperty> ps, final List<CommonPreference<Boolean>> prefs) {
|
||||||
|
Builder bld = new AlertDialog.Builder(activity);
|
||||||
|
boolean[] checkedItems = new boolean[prefs.size()];
|
||||||
|
for (int i = 0; i < prefs.size(); i++) {
|
||||||
|
checkedItems[i] = prefs.get(i).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
final boolean[] tempPrefs = new boolean[prefs.size()];
|
||||||
|
for (int i = 0; i < prefs.size(); i++) {
|
||||||
|
tempPrefs[i] = prefs.get(i).get();
|
||||||
|
}
|
||||||
|
final String[] vals = new String[ps.size()];
|
||||||
|
for(int i = 0; i < ps.size(); i++) {
|
||||||
|
RenderingRuleProperty p = ps.get(i);
|
||||||
|
String propertyName = SettingsActivity.getStringPropertyName(activity, p.getAttrName(),
|
||||||
|
p.getName());
|
||||||
|
vals[i] = propertyName;
|
||||||
|
}
|
||||||
|
|
||||||
|
bld.setMultiChoiceItems(vals, checkedItems, new OnMultiChoiceClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
|
||||||
|
tempPrefs[which] = isChecked;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
bld.setTitle(category);
|
||||||
|
|
||||||
|
bld.setNegativeButton(R.string.default_buttons_cancel, null);
|
||||||
|
|
||||||
|
bld.setPositiveButton(R.string.default_buttons_ok, new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int whichButton) {
|
||||||
|
for (int i = 0; i < prefs.size(); i++) {
|
||||||
|
prefs.get(i).set(tempPrefs[i]);
|
||||||
|
}
|
||||||
|
adapter.setItemDescription(pos, getDescription(prefs));
|
||||||
|
a.notifyDataSetInvalidated();
|
||||||
|
refreshMapComplete(activity);
|
||||||
|
activity.getMapLayers().updateLayers(activity.getMapView());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
bld.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getRenderDescr(final MapActivity activity) {
|
protected String getRenderDescr(final MapActivity activity) {
|
||||||
|
|
Loading…
Reference in a new issue