Small changes
This commit is contained in:
parent
52dd94adc7
commit
a0800890f3
7 changed files with 54 additions and 28 deletions
|
@ -7,12 +7,16 @@
|
|||
android:background="@drawable/bg_cardui"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/search_for"
|
||||
style="@style/DashboardSubHeader"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="40dp"
|
||||
android:text="@string/search_for" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:id="@+id/search_for"
|
||||
style="@style/DashboardSubHeader"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="40dp"
|
||||
android:text="@string/search_for" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
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="error_avoid_specific_road">Nearest road was not found</string>
|
||||
<string name="home_button">Home</string>
|
||||
<string name="osmo_use_https_descr">Use secure connection with server</string>
|
||||
<string name="osmo_use_https">Use https</string>
|
||||
|
|
|
@ -42,35 +42,32 @@ public class CurrentPositionHelper {
|
|||
ctx = new RoutePlannerFrontEnd(false).buildRoutingContext(cfg, null, app.getResourceManager().getRoutingMapFiles());
|
||||
}
|
||||
|
||||
public synchronized RouteDataObject runUpdateInThread(double lat , double lon) {
|
||||
public synchronized RouteDataObject runUpdateInThread(double lat, double lon) throws IOException {
|
||||
RoutePlannerFrontEnd rp = new RoutePlannerFrontEnd(false);
|
||||
try {
|
||||
if(ctx == null || am != app.getSettings().getApplicationMode()) {
|
||||
initCtx(app);
|
||||
if(ctx == null) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
RouteSegment sg = rp.findRouteSegment(lat, lon, ctx);
|
||||
if(sg == null) {
|
||||
if (ctx == null || am != app.getSettings().getApplicationMode()) {
|
||||
initCtx(app);
|
||||
if (ctx == null) {
|
||||
return null;
|
||||
}
|
||||
return sg.getRoad();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
RouteSegment sg = rp.findRouteSegment(lat, lon, ctx);
|
||||
if (sg == null) {
|
||||
return null;
|
||||
}
|
||||
return sg.getRoad();
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void scheduleRouteSegmentFind(final Location loc){
|
||||
if(calculatingThread == Thread.currentThread()) {
|
||||
lastFound = runUpdateInThread(loc.getLatitude(), loc.getLongitude());
|
||||
lastFound = runUpdateInThreadCatch(loc.getLatitude(), loc.getLongitude());
|
||||
} else if(calculatingThread == null && loc != null) {
|
||||
Runnable run = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
lastFound = runUpdateInThread(loc.getLatitude(), loc.getLongitude());
|
||||
lastFound = runUpdateInThreadCatch(loc.getLatitude(), loc.getLongitude());
|
||||
if (lastAskedLocation != loc) {
|
||||
// refresh and run new task if needed
|
||||
getLastKnownRouteSegment(lastAskedLocation);
|
||||
|
@ -85,6 +82,15 @@ public class CurrentPositionHelper {
|
|||
|
||||
}
|
||||
|
||||
protected RouteDataObject runUpdateInThreadCatch(double latitude, double longitude) {
|
||||
try {
|
||||
return runUpdateInThread(latitude, longitude);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static double getOrthogonalDistance(RouteDataObject r, Location loc){
|
||||
double d = 1000;
|
||||
if (r.getPointsLength() > 0) {
|
||||
|
|
|
@ -216,7 +216,7 @@ public class OsmAndLocationProvider implements SensorEventListener {
|
|||
}
|
||||
|
||||
public RouteDataObject findRoute(double lat , double lon) {
|
||||
return currentPositionHelper.runUpdateInThread(lat, lon);
|
||||
return currentPositionHelper.runUpdateInThreadCatch(lat, lon);
|
||||
}
|
||||
|
||||
public void resumeAllUpdates() {
|
||||
|
|
|
@ -1,18 +1,21 @@
|
|||
package net.osmand.plus.dashboard;
|
||||
|
||||
import net.osmand.plus.OsmAndAppCustomization;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.search.SearchActivity;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AutoCompleteTextView;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import net.osmand.plus.OsmAndAppCustomization;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.search.SearchActivity;
|
||||
|
||||
/**
|
||||
* Created by Denis on 24.11.2014.
|
||||
|
@ -25,6 +28,7 @@ public class DashSearchFragment extends DashBaseFragment {
|
|||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_search_fragment, container, false);
|
||||
setupButtons(view);
|
||||
// TODO cache typeface ?
|
||||
Typeface typeface = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Roboto-Medium.ttf");
|
||||
((TextView) view.findViewById(R.id.search_for)).setTypeface(typeface);
|
||||
return view;
|
||||
|
@ -39,6 +43,8 @@ public class DashSearchFragment extends DashBaseFragment {
|
|||
private void setupButtons(View view){
|
||||
final Activity activity = getActivity();
|
||||
final OsmAndAppCustomization appCustomization = getMyApplication().getAppCustomization();
|
||||
// EditText searchText = (EditText) view.findViewById(R.id.search_text);
|
||||
// searchText.addTextChangedListener(textWatcher);
|
||||
(view.findViewById(R.id.poi)).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
|
|
@ -27,6 +27,7 @@ import android.widget.ArrayAdapter;
|
|||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class AvoidSpecificRoads {
|
||||
private List<RouteDataObject> missingRoads;
|
||||
|
@ -143,14 +144,23 @@ public class AvoidSpecificRoads {
|
|||
}
|
||||
private void findRoad(final MapActivity activity, final LatLon loc) {
|
||||
new AsyncTask<LatLon, Void, RouteDataObject>() {
|
||||
Exception e = null;
|
||||
|
||||
@Override
|
||||
protected RouteDataObject doInBackground(LatLon... params) {
|
||||
return app.getLocationProvider().findRoute(loc.getLatitude(), loc.getLongitude());
|
||||
try {
|
||||
return app.getLocationProvider().findRoute(loc.getLatitude(), loc.getLongitude());
|
||||
} catch (Exception e) {
|
||||
this.e = e;
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected void onPostExecute(RouteDataObject result) {
|
||||
if(result != null) {
|
||||
if(e != null) {
|
||||
Toast.makeText(activity, R.string.error_avoid_specific_road, Toast.LENGTH_LONG).show();
|
||||
} else if(result != null) {
|
||||
getBuilder().addImpassableRoad(result);
|
||||
RoutingHelper rh = app.getRoutingHelper();
|
||||
if(rh.isRouteCalculated() || rh.isRouteBeingCalculated()) {
|
||||
|
|
|
@ -6,7 +6,6 @@ import android.graphics.Canvas;
|
|||
import android.util.AttributeSet;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.view.View;
|
||||
|
||||
public class OsmAndMapLayersView extends View {
|
||||
|
|
Loading…
Reference in a new issue