Fix #2680
This commit is contained in:
parent
f5163ea7fe
commit
9a909cc6c3
5 changed files with 53 additions and 33 deletions
|
@ -9,6 +9,8 @@
|
|||
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
|
||||
-->
|
||||
<string name="coords_format">Coordinate format</string>
|
||||
<string name="coords_format_descr">Format for the geographical coordinates</string>
|
||||
<string name="app_mode_bus">Bus</string>
|
||||
<string name="app_mode_train">Train</string>
|
||||
<string name="current_track">Current track</string>
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
<ListPreference android:key="map_preferred_locale" android:title="@string/map_preferred_locale" android:summary="@string/map_preferred_locale_descr"></ListPreference>
|
||||
|
||||
<ListPreference android:key="default_metric_system" android:title="@string/unit_of_length" android:summary="@string/unit_of_length_descr"></ListPreference>
|
||||
|
||||
<ListPreference android:key="coordinates_format" android:title="@string/coords_format" android:summary="@string/coords_format_descr"></ListPreference>
|
||||
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/voice_pref_title" android:key="voice">
|
||||
<ListPreference android:title="@string/voice_provider" android:key="voice_provider" android:summary="@string/voice_provider_descr"></ListPreference>
|
||||
|
|
|
@ -303,7 +303,22 @@ public class PointDescription {
|
|||
public static final int FORMAT_SECONDS = 2;
|
||||
public static final int UTM_FORMAT = 3;
|
||||
private static final char DELIM = ':';
|
||||
|
||||
|
||||
public static String formatToHumanString(Context ctx, int format) {
|
||||
switch (format) {
|
||||
case FORMAT_DEGREES:
|
||||
return ctx.getString(R.string.navigate_point_format_D);
|
||||
case FORMAT_MINUTES:
|
||||
return ctx.getString(R.string.navigate_point_format_DM);
|
||||
case FORMAT_SECONDS:
|
||||
return ctx.getString(R.string.navigate_point_format_DMS);
|
||||
case UTM_FORMAT:
|
||||
return "UTM";
|
||||
default:
|
||||
return "Unknown format";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a String in one of the formats described by
|
||||
* FORMAT_DEGREES, FORMAT_MINUTES, or FORMAT_SECONDS into a
|
||||
|
|
|
@ -1,19 +1,5 @@
|
|||
package net.osmand.plus.activities;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.TargetPointsHelper;
|
||||
import net.osmand.plus.activities.search.SearchActivity;
|
||||
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
import net.osmand.plus.dialogs.FavoriteDialogs;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.util.Algorithms;
|
||||
import net.osmand.util.MapUtils;
|
||||
import android.app.Dialog;
|
||||
import android.content.Intent;
|
||||
import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
|
@ -37,16 +23,22 @@ import android.widget.TextView;
|
|||
import com.jwetherell.openmap.common.LatLonPoint;
|
||||
import com.jwetherell.openmap.common.UTMPoint;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.search.SearchActivity;
|
||||
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.util.Algorithms;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
public class NavigatePointFragment extends Fragment implements SearchActivityChild {
|
||||
int currentFormat = Location.FORMAT_DEGREES;
|
||||
|
||||
public static final String SEARCH_LAT = SearchActivity.SEARCH_LAT;
|
||||
public static final String SEARCH_LON = SearchActivity.SEARCH_LON;
|
||||
public static final String SEARCH_NORTHING = "NORTHING";
|
||||
public static final String SEARCH_EASTING = "EASTING";
|
||||
public static final String SEARCH_ZONE = "ZONE";
|
||||
private static final String SELECTION = "SELECTION";
|
||||
|
||||
|
||||
private static final int SHOW_ON_MAP = 3;
|
||||
|
||||
|
@ -82,8 +74,6 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
|
|||
String lat = savedInstanceState.getString(SEARCH_LAT);
|
||||
String lon = savedInstanceState.getString(SEARCH_LON);
|
||||
if(lat != null && lon != null && lat.length() > 0 && lon.length() > 0) {
|
||||
((Spinner)view.findViewById(R.id.Format)).setSelection(savedInstanceState.getInt(SELECTION, 0));
|
||||
currentFormat = savedInstanceState.getInt(SELECTION, 0);
|
||||
((TextView)view.findViewById(R.id.LatitudeEdit)).setText(lat);
|
||||
((TextView)view.findViewById(R.id.LongitudeEdit)).setText(lon);
|
||||
}
|
||||
|
@ -99,7 +89,6 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
|
|||
final TextView lonEdit = ((TextView)view.findViewById(R.id.LongitudeEdit));
|
||||
outState.putString(SEARCH_LAT, latEdit.getText().toString());
|
||||
outState.putString(SEARCH_LON, lonEdit.getText().toString());
|
||||
outState.putInt(SELECTION, ((Spinner)view.findViewById(R.id.Format)).getSelectedItemPosition());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -205,27 +194,27 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
|
|||
showCurrentFormat(new LatLon(latitude, longitude));
|
||||
final Spinner format = ((Spinner)view.findViewById(R.id.Format));
|
||||
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, new String[] {
|
||||
getString(R.string.navigate_point_format_D),
|
||||
getString(R.string.navigate_point_format_DM),
|
||||
getString(R.string.navigate_point_format_DMS),
|
||||
"UTM"
|
||||
PointDescription.formatToHumanString(this.getContext(), PointDescription.FORMAT_DEGREES),
|
||||
PointDescription.formatToHumanString(this.getContext(), PointDescription.FORMAT_MINUTES),
|
||||
PointDescription.formatToHumanString(this.getContext(), PointDescription.FORMAT_SECONDS),
|
||||
PointDescription.formatToHumanString(this.getContext(), PointDescription.UTM_FORMAT),
|
||||
});
|
||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
format.setAdapter(adapter);
|
||||
format.setSelection(0);
|
||||
format.setSelection(currentFormat);
|
||||
format.setOnItemSelectedListener(new OnItemSelectedListener() {
|
||||
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View v, int position, long id) {
|
||||
int newFormat = currentFormat;
|
||||
String itm = (String) format.getItemAtPosition(position);
|
||||
if(getString(R.string.navigate_point_format_D).equals(itm)){
|
||||
if (PointDescription.formatToHumanString(v.getContext(), PointDescription.FORMAT_DEGREES).equals(itm)) {
|
||||
newFormat = PointDescription.FORMAT_DEGREES;
|
||||
} else if(getString(R.string.navigate_point_format_DM).equals(itm)){
|
||||
} else if (PointDescription.formatToHumanString(v.getContext(), PointDescription.FORMAT_MINUTES).equals(itm)) {
|
||||
newFormat = PointDescription.FORMAT_MINUTES;
|
||||
} else if(getString(R.string.navigate_point_format_DMS).equals(itm)){
|
||||
} else if (PointDescription.formatToHumanString(v.getContext(), PointDescription.FORMAT_SECONDS).equals(itm)) {
|
||||
newFormat = PointDescription.FORMAT_SECONDS;
|
||||
} else if (position == PointDescription.UTM_FORMAT) {
|
||||
} else if (PointDescription.formatToHumanString(v.getContext(), PointDescription.UTM_FORMAT).equals(itm)) {
|
||||
newFormat = PointDescription.UTM_FORMAT;
|
||||
}
|
||||
try {
|
||||
|
|
|
@ -28,6 +28,7 @@ import android.widget.Toast;
|
|||
|
||||
import net.osmand.IProgress;
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.osm.io.NetworkUtils;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
|
@ -150,6 +151,18 @@ public class SettingsGeneralActivity extends SettingsBaseActivity implements OnR
|
|||
}
|
||||
registerListPreference(settings.METRIC_SYSTEM, screen, entries, mvls);
|
||||
|
||||
Integer[] cvls = new Integer[4];
|
||||
cvls[0] = PointDescription.FORMAT_DEGREES;
|
||||
cvls[1] = PointDescription.FORMAT_MINUTES;
|
||||
cvls[2] = PointDescription.FORMAT_SECONDS;
|
||||
cvls[3] = PointDescription.UTM_FORMAT;
|
||||
entries = new String[4];
|
||||
entries[0] = PointDescription.formatToHumanString(this, PointDescription.FORMAT_DEGREES);
|
||||
entries[1] = PointDescription.formatToHumanString(this, PointDescription.FORMAT_MINUTES);
|
||||
entries[2] = PointDescription.formatToHumanString(this, PointDescription.FORMAT_SECONDS);
|
||||
entries[3] = PointDescription.formatToHumanString(this, PointDescription.UTM_FORMAT);
|
||||
registerListPreference(settings.COORDINATES_FORMAT, screen, entries, cvls);
|
||||
|
||||
// See language list and statistics at: https://hosted.weblate.org/projects/osmand/main/
|
||||
// Hardy maintenance 2016-05-29:
|
||||
// - Include languages if their translation is >= ~10% (but any language will be visible if it is the device's system locale)
|
||||
|
|
Loading…
Reference in a new issue