Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2014-08-28 01:25:03 +02:00
commit e1cc085d9f
6 changed files with 46 additions and 20 deletions

View file

@ -473,7 +473,7 @@ public class MapRenderingTypes {
} }
if (poiParentCategory != null) { if (poiParentCategory != null && poiParentCategory.length() > 0) {
rtype.poiCategory = AmenityType.getAndRegisterType(poiParentCategory); rtype.poiCategory = AmenityType.getAndRegisterType(poiParentCategory);
rtype.poiSpecified = true; rtype.poiSpecified = true;
} }
@ -482,7 +482,7 @@ public class MapRenderingTypes {
} }
String poiCategory = parser.getAttributeValue("", "poi_category"); String poiCategory = parser.getAttributeValue("", "poi_category");
if (poiCategory != null) { if (poiCategory != null && poiCategory.length() > 0) {
rtype.poiSpecified = true; rtype.poiSpecified = true;
if (poiCategory.length() == 0) { if (poiCategory.length() == 0) {
rtype.poiCategory = null; rtype.poiCategory = null;
@ -568,7 +568,7 @@ public class MapRenderingTypes {
protected void parseCategoryFromXml(XmlPullParser parser, String poiParentCategory, String poiParentPrefix) { protected void parseCategoryFromXml(XmlPullParser parser, String poiParentCategory, String poiParentPrefix) {
String poi_tag = parser.getAttributeValue("","poi_tag"); String poi_tag = parser.getAttributeValue("","poi_tag");
if (poi_tag != null) { if (poi_tag != null && poiParentCategory.length() > 0) {
MapRulType rtype = new MapRulType(); MapRulType rtype = new MapRulType();
rtype.poiCategory = AmenityType.getAndRegisterType(poiParentCategory); rtype.poiCategory = AmenityType.getAndRegisterType(poiParentCategory);
rtype.poiSpecified = true; rtype.poiSpecified = true;

View file

@ -9,7 +9,9 @@
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="confirm_every_run">Ask every run</string>
<string name="save_global_track_interval_descr">Choose logging interval for track recording enabled by selecting widget on the map.</string>
<string name="save_global_track_interval">Default Global Logging interval </string>
<string name="background_service_int">GPS Wake-up interval</string> <string name="background_service_int">GPS Wake-up interval</string>
<string name="enable_sleep_mode">Enable GPS sleep mode</string> <string name="enable_sleep_mode">Enable GPS sleep mode</string>
<string name="sleep_mode_stop_dialog">Stop GPS sleep mode?</string> <string name="sleep_mode_stop_dialog">Stop GPS sleep mode?</string>

View file

@ -560,10 +560,9 @@ public class OsmandApplication extends Application {
} }
} }
} }
//I guess we should not start the sleep mode service automatically upon app start if(getSettings().SAVE_GLOBAL_TRACK_TO_GPX.get()){
//if(getSettings().SAVE_GLOBAL_TRACK_TO_GPX.get()){ startNavigationService(NavigationService.USED_BY_GPX);
// startNavigationService(NavigationService.USED_BY_GPX); }
//}
// restore backuped favorites to normal file // restore backuped favorites to normal file
final File appDir = getAppPath(null); final File appDir = getAppPath(null);
File save = new File(appDir, FavouritesDbHelper.FILE_TO_SAVE); File save = new File(appDir, FavouritesDbHelper.FILE_TO_SAVE);

View file

@ -13,6 +13,7 @@ import net.osmand.access.AccessibleToast;
import net.osmand.plus.ApplicationMode; import net.osmand.plus.ApplicationMode;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
import net.osmand.plus.OsmandSettings.CommonPreference;
import net.osmand.plus.OsmandSettings.OsmandPreference; import net.osmand.plus.OsmandSettings.OsmandPreference;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.actions.AppModeDialog; import net.osmand.plus.activities.actions.AppModeDialog;
@ -223,6 +224,12 @@ public abstract class SettingsBaseActivity extends SherlockPreferenceActivity im
} }
} }
@SuppressWarnings("unused")
private void registerDisablePreference(OsmandPreference p, String value, OsmandPreference<Boolean> disable) {
LinkedHashMap<String, Object> vals = (LinkedHashMap<String, Object>) listPrefValues.get(p.getId());
vals.put(value, disable);
}
public void registerEditTextPreference(OsmandPreference<String> b, PreferenceScreen screen) { public void registerEditTextPreference(OsmandPreference<String> b, PreferenceScreen screen) {
EditTextPreference p = (EditTextPreference) screen.findPreference(b.getId()); EditTextPreference p = (EditTextPreference) screen.findPreference(b.getId());
p.setOnPreferenceChangeListener(this); p.setOnPreferenceChangeListener(this);
@ -258,21 +265,29 @@ public abstract class SettingsBaseActivity extends SherlockPreferenceActivity im
registerListPreference(b, screen, intDescriptions, ints); registerListPreference(b, screen, intDescriptions, ints);
} }
public ListPreference createTimeListPreference(OsmandPreference<Integer> b, int[] seconds, int[] minutes, int coeff, int title, public ListPreference createTimeListPreference(OsmandPreference<Integer> b, int[] seconds, int[] minutes, int coeff, int title, int summary) {
return createTimeListPreference(b, seconds, minutes, coeff, null, title, summary);
}
public ListPreference createTimeListPreference(OsmandPreference<Integer> b, int[] seconds, int[] minutes, int coeff, CommonPreference<Boolean> disable, int title,
int summary) { int summary) {
int minutesLength = minutes == null ? 0 : minutes.length; int minutesLength = minutes == null ? 0 : minutes.length;
int secondsLength = seconds == null ? 0 : seconds.length; int secondsLength = seconds == null ? 0 : seconds.length;
Integer[] ints = new Integer[secondsLength + minutesLength]; Integer[] ints = new Integer[secondsLength + minutesLength];
String[] intDescriptions = new String[ints.length]; String[] intDescriptions = new String[ints.length];
int k = 0;
for (int i = 0; i < secondsLength; i++) { for (int i = 0; i < secondsLength; i++) {
ints[i] = seconds[i] * coeff; ints[k] = seconds[i] * coeff;
intDescriptions[i] = seconds[i] + " " + getString(R.string.int_seconds); //$NON-NLS-1$ intDescriptions[k] = seconds[i] + " " + getString(R.string.int_seconds); //$NON-NLS-1$
k++;
} }
for (int i = 0; i < minutesLength; i++) { for (int i = 0; i < minutesLength; i++) {
ints[secondsLength + i] = (minutes[i] * 60) * coeff; ints[k] = (minutes[i] * 60) * coeff;
intDescriptions[secondsLength + i] = minutes[i] + " " + getString(R.string.int_min); //$NON-NLS-1$ intDescriptions[k] = minutes[i] + " " + getString(R.string.int_min); //$NON-NLS-1$
k++;
} }
return createListPreference(b, intDescriptions, ints, title, summary); ListPreference lp = createListPreference(b, intDescriptions, ints, title, summary);
registerDisablePreference(b, getString(R.string.confirm_every_run), disable);
return lp;
} }
@ -443,7 +458,14 @@ public abstract class SettingsBaseActivity extends SherlockPreferenceActivity im
CharSequence entry = ((ListPreference) preference).getEntries()[ind]; CharSequence entry = ((ListPreference) preference).getEntries()[ind];
Map<String, ?> map = listPrefValues.get(preference.getKey()); Map<String, ?> map = listPrefValues.get(preference.getKey());
Object obj = map.get(entry); Object obj = map.get(entry);
boolean changed = listPref.set(obj); boolean changed ;
if(obj instanceof OsmandPreference) {
changed = true;
((OsmandPreference<Boolean>) obj).set(false);
} else {
changed = listPref.set(obj);
}
return changed; return changed;
} }
return true; return true;

View file

@ -341,10 +341,9 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn
app.startNavigationService(NavigationService.USED_BY_GPX); app.startNavigationService(NavigationService.USED_BY_GPX);
} }
}; };
//Comment this out for now as we have no way to reverse the REMEMBER flag?! if(choice.value) {
//if(choice.value) { runnable.run();
// runnable.run(); } else {
//} else {
showIntervalChooseDialog(map, app.getString(R.string.save_track_interval_globally) + " : %s", showIntervalChooseDialog(map, app.getString(R.string.save_track_interval_globally) + " : %s",
app.getString(R.string.save_track_to_gpx_globally), SECONDS, MINUTES, choice, vs, app.getString(R.string.save_track_to_gpx_globally), SECONDS, MINUTES, choice, vs,
new OnClickListener() { new OnClickListener() {
@ -353,7 +352,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn
runnable.run(); runnable.run();
} }
}); });
//} }
} }

View file

@ -84,6 +84,10 @@ public class SettingsMonitoringActivity extends SettingsBaseActivity {
R.string.save_track_to_gpx_descrp)); R.string.save_track_to_gpx_descrp));
cat.addPreference(createTimeListPreference(settings.SAVE_TRACK_INTERVAL, SECONDS, cat.addPreference(createTimeListPreference(settings.SAVE_TRACK_INTERVAL, SECONDS,
MINUTES, 1000, R.string.save_track_interval, R.string.save_track_interval_descr)); MINUTES, 1000, R.string.save_track_interval, R.string.save_track_interval_descr));
if(settings.SAVE_GLOBAL_TRACK_REMEMBER.get()) {
cat.addPreference(createTimeListPreference(settings.SAVE_GLOBAL_TRACK_INTERVAL, SECONDS,
MINUTES, 1000, settings.SAVE_GLOBAL_TRACK_REMEMBER, R.string.save_global_track_interval, R.string.save_global_track_interval_descr));
}
} }