Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2014-12-31 09:56:19 +01:00
commit 2c7cc5673e

View file

@ -55,30 +55,29 @@ public class NavigatePointFragment extends SherlockFragment implements SearchAct
private static final int SHOW_ON_MAP = 3; private static final int SHOW_ON_MAP = 3;
private static final int ADD_TO_FAVORITE = 4; private static final int ADD_TO_FAVORITE = 4;
private View view; private View view;
private LatLon location;
public View onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, Bundle savedInstanceState) { public View onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, Bundle savedInstanceState) {
view = inflater.inflate(R.layout.navigate_point, container, false); view = inflater.inflate(R.layout.navigate_point, container, false);
setHasOptionsMenu(true); setHasOptionsMenu(true);
LatLon loc = null;
OsmandApplication app = (OsmandApplication) getActivity().getApplication(); OsmandApplication app = (OsmandApplication) getActivity().getApplication();
Intent intent = getSherlockActivity().getIntent(); Intent intent = getSherlockActivity().getIntent();
if(intent != null){ if(intent != null){
double lat = intent.getDoubleExtra(SEARCH_LAT, 0); double lat = intent.getDoubleExtra(SEARCH_LAT, 0);
double lon = intent.getDoubleExtra(SEARCH_LON, 0); double lon = intent.getDoubleExtra(SEARCH_LON, 0);
if(lat != 0 || lon != 0){ if(lat != 0 || lon != 0){
loc = new LatLon(lat, lon); location = new LatLon(lat, lon);
} }
} }
if (loc == null && getActivity() instanceof SearchActivity) { if (location == null && getActivity() instanceof SearchActivity) {
loc = ((SearchActivity) getActivity()).getSearchPoint(); location = ((SearchActivity) getActivity()).getSearchPoint();
} }
if (loc == null) { if (location == null) {
loc = app.getSettings().getLastKnownMapLocation(); location = app.getSettings().getLastKnownMapLocation();
} }
initUI(loc.getLatitude(), loc.getLongitude()); initUI(location.getLatitude(), location.getLongitude());
if(savedInstanceState != null && savedInstanceState.containsKey(SEARCH_LAT) && savedInstanceState.containsKey(SEARCH_LON) && if(savedInstanceState != null && savedInstanceState.containsKey(SEARCH_LAT) && savedInstanceState.containsKey(SEARCH_LON) &&
currentFormat != UTM_FORMAT) { currentFormat != UTM_FORMAT) {
String lat = savedInstanceState.getString(SEARCH_LAT); String lat = savedInstanceState.getString(SEARCH_LAT);
@ -166,7 +165,6 @@ public class NavigatePointFragment extends SherlockFragment implements SearchAct
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
LatLon location = null;
OsmandApplication app = (OsmandApplication) getActivity().getApplication(); OsmandApplication app = (OsmandApplication) getActivity().getApplication();
//Intent intent = getSherlockActivity().getIntent(); //Intent intent = getSherlockActivity().getIntent();
//if (intent != null) { //if (intent != null) {
@ -188,17 +186,18 @@ public class NavigatePointFragment extends SherlockFragment implements SearchAct
} }
@Override @Override
public void locationUpdate(LatLon loc) { public void locationUpdate(LatLon l) {
if (view != null) { if (view != null) {
if (loc != null) { if (l != null) {
showCurrentFormat(loc); location = l;
showCurrentFormat(l);
} else { } else {
showCurrentFormat(new LatLon(0, 0)); showCurrentFormat(new LatLon(0, 0));
} }
} }
} }
protected void showCurrentFormat( LatLon loc) { protected void showCurrentFormat(LatLon l) {
final EditText latEdit = ((EditText)view.findViewById(R.id.LatitudeEdit)); final EditText latEdit = ((EditText)view.findViewById(R.id.LatitudeEdit));
final EditText lonEdit = ((EditText)view.findViewById(R.id.LongitudeEdit)); final EditText lonEdit = ((EditText)view.findViewById(R.id.LongitudeEdit));
boolean utm = currentFormat == UTM_FORMAT; boolean utm = currentFormat == UTM_FORMAT;
@ -211,13 +210,13 @@ public class NavigatePointFragment extends SherlockFragment implements SearchAct
final EditText northingEdit = ((EditText)view.findViewById(R.id.NorthingEdit)); final EditText northingEdit = ((EditText)view.findViewById(R.id.NorthingEdit));
final EditText eastingEdit = ((EditText)view.findViewById(R.id.EastingEdit)); final EditText eastingEdit = ((EditText)view.findViewById(R.id.EastingEdit));
final EditText zoneEdit = ((EditText)view.findViewById(R.id.ZoneEdit)); final EditText zoneEdit = ((EditText)view.findViewById(R.id.ZoneEdit));
UTMPoint pnt = new UTMPoint(new LatLonPoint(loc.getLatitude(), loc.getLongitude())); UTMPoint pnt = new UTMPoint(new LatLonPoint(l.getLatitude(), l.getLongitude()));
zoneEdit.setText(pnt.zone_number + ""+pnt.zone_letter); zoneEdit.setText(pnt.zone_number + ""+pnt.zone_letter);
northingEdit.setText(((long)pnt.northing)+""); northingEdit.setText(((long)pnt.northing)+"");
eastingEdit.setText(((long)pnt.easting)+""); eastingEdit.setText(((long)pnt.easting)+"");
} else { } else {
latEdit.setText(convert(MapUtils.checkLatitude(loc.getLatitude()), currentFormat)); latEdit.setText(convert(MapUtils.checkLatitude(l.getLatitude()), currentFormat));
lonEdit.setText(convert(MapUtils.checkLongitude(loc.getLongitude()), currentFormat)); lonEdit.setText(convert(MapUtils.checkLongitude(l.getLongitude()), currentFormat));
} }
} }