Temp fix
This commit is contained in:
parent
ce1a2f4ccd
commit
47ab27b5d1
6 changed files with 123 additions and 32 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="delay_to_start_navigation_descr">Automatically start navigation after specified interval</string>
|
||||
<string name="delay_to_start_navigation">Skip route planning</string>
|
||||
<string name="shared_string_go">Go</string>
|
||||
<string name="action_create">Action create</string>
|
||||
<string name="action_modify">Action modify</string>
|
||||
|
@ -32,6 +34,7 @@
|
|||
<string name="shared_string_cancel">Cancel</string>
|
||||
<string name="shared_string_dismiss">Dismiss</string>
|
||||
<string name="shared_string_yes">Yes</string>
|
||||
<string name="shared_string_not_use">Not use</string>
|
||||
<string name="shared_string_no">No</string>
|
||||
<string name="shared_string_on">On</string>
|
||||
<string name="shared_string_off">Off</string>
|
||||
|
|
|
@ -32,5 +32,10 @@
|
|||
android:key="wake_on_voice_int"
|
||||
android:title="@string/wake_on_voice"
|
||||
android:summary="@string/wake_on_voice_descr" />
|
||||
|
||||
<ListPreference
|
||||
android:key="delay_to_start_navigation"
|
||||
android:title="@string/delay_to_start_navigation"
|
||||
android:summary="@string/delay_to_start_navigation_descr" />
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
|
|
|
@ -160,10 +160,10 @@ public class MapActivity extends AccessibleActivity {
|
|||
if (tn != null) {
|
||||
((TextView) findViewById(R.id.ProgressMessage)).setText(tn);
|
||||
}
|
||||
if(event == InitEvents.NATIVE_INITIALIZED) {
|
||||
setupOpenGLView();
|
||||
openGlSetup = true;
|
||||
}
|
||||
// if(event == InitEvents.NATIVE_INITIALIZED) {
|
||||
// setupOpenGLView();
|
||||
// openGlSetup = true;
|
||||
// }
|
||||
if(event == InitEvents.MAPS_INITIALIZED) {
|
||||
mapView.refreshMap(true);
|
||||
}
|
||||
|
|
|
@ -5,9 +5,14 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.osmand.plus.*;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.DeviceAdminRecv;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.OsmandSettings.AutoZoomMap;
|
||||
import net.osmand.plus.OsmandSettings.OsmandPreference;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.routing.RouteProvider.RouteService;
|
||||
import net.osmand.router.GeneralRouter;
|
||||
import net.osmand.router.GeneralRouter.RoutingParameter;
|
||||
|
@ -184,13 +189,22 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
|
|||
if (!mode.isDerivedRoutingFrom(ApplicationMode.CAR)) {
|
||||
category.removePreference(speedLimitExceed);
|
||||
}
|
||||
|
||||
Integer[] delayIntervals = new Integer[] { -1, 3, 5, 7, 10, 15, 20 };
|
||||
String[] delayIntervalNames = new String[delayIntervals.length];
|
||||
for (int i = 0; i < delayIntervals.length; i++) {
|
||||
if (i == 0) {
|
||||
delayIntervalNames[i] = getString(R.string.shared_string_not_use);
|
||||
} else {
|
||||
delayIntervalNames[i] = delayIntervals[i] + " " + getString(R.string.int_seconds);
|
||||
}
|
||||
}
|
||||
registerListPreference(settings.DELAY_TO_START_NAVIGATION, screen, delayIntervalNames, delayIntervals);
|
||||
|
||||
|
||||
profileDialog();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void prepareRoutingPrefs(PreferenceScreen screen) {
|
||||
PreferenceCategory cat = (PreferenceCategory) screen.findPreference("routing_preferences");
|
||||
|
|
|
@ -19,6 +19,7 @@ import android.graphics.Color;
|
|||
import android.graphics.ColorFilter;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Handler;
|
||||
import android.view.Gravity;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
@ -66,10 +67,14 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
private MapHudButton routeGoControl;
|
||||
private MapHudButton compassHud;
|
||||
private float cachedRotate = 0;
|
||||
private static long startCounter;
|
||||
private Runnable delayStart;
|
||||
private Handler showUIHandler;
|
||||
|
||||
public MapControlsLayer(MapActivity activity) {
|
||||
this.mapActivity = activity;
|
||||
settings = activity.getMyApplication().getSettings();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -84,6 +89,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
// TODO
|
||||
// rulerControl = init(new RulerControl(zoomControls, mapActivity, showUIHandler, scaleCoefficient), parent,
|
||||
// rightGravity);
|
||||
showUIHandler = new Handler();
|
||||
initTransparencyBar(view, parent);
|
||||
initZooms();
|
||||
initControls();
|
||||
|
@ -102,10 +108,41 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
@Override
|
||||
public void draw(Canvas canvas) {
|
||||
canvas.save();
|
||||
canvas.rotate(cachedRotate, canvas.getWidth() / 2, canvas.getHeight() / 2);
|
||||
canvas.rotate(cachedRotate, getIntrinsicWidth() / 2, getIntrinsicHeight() / 2);
|
||||
original.draw(canvas);
|
||||
canvas.restore();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinimumHeight() {
|
||||
return original.getMinimumHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinimumWidth() {
|
||||
return original.getMinimumWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIntrinsicHeight() {
|
||||
return original.getIntrinsicHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIntrinsicWidth() {
|
||||
return original.getIntrinsicWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChangingConfigurations(int configs) {
|
||||
super.setChangingConfigurations(configs);
|
||||
original.setChangingConfigurations(configs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBounds(int left, int top, int right, int bottom) {
|
||||
super.setBounds(left, top, right, bottom);
|
||||
original.setBounds(left, top, right, bottom);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -207,7 +244,12 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
notifyClicked();
|
||||
startNavigation();
|
||||
RoutingHelper routingHelper = mapActivity.getMyApplication().getRoutingHelper();
|
||||
if(!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
|
||||
mapActivity.getMapActions().enterRoutePlanningMode(null, null, false);
|
||||
} else {
|
||||
startNavigation();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -318,9 +360,36 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
}
|
||||
|
||||
private void stopCounter() {
|
||||
// TODO stop counter
|
||||
startCounter = 0;
|
||||
|
||||
}
|
||||
|
||||
public void startCounter() {
|
||||
OsmandSettings settings = mapActivity.getMyApplication().getSettings();
|
||||
int del = settings.DELAY_TO_START_NAVIGATION.get();
|
||||
if(del <= 0) {
|
||||
return;
|
||||
}
|
||||
if (startCounter <= 0) {
|
||||
startCounter = System.currentTimeMillis() + del * 1000;
|
||||
delayStart = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (startCounter > 0) {
|
||||
if (System.currentTimeMillis() > startCounter) {
|
||||
startCounter = 0;
|
||||
startNavigation();
|
||||
} else {
|
||||
mapActivity.refreshMap();
|
||||
showUIHandler.postDelayed(delayStart, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
delayStart.run();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void notifyClicked(MapControls m) {
|
||||
notifyClicked();
|
||||
|
@ -379,16 +448,30 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
int vis = showRouteCalculationControls ? View.VISIBLE : View.GONE;
|
||||
if (showRouteCalculationControls) {
|
||||
((TextView) routeGoControl.iv).setTextColor(textColor);
|
||||
final String text ;
|
||||
if (startCounter > 0) {
|
||||
int get = (int) ((startCounter - System.currentTimeMillis()) / 1000l);
|
||||
text = mapActivity.getString(R.string.shared_string_go) + " (" + get + ")";
|
||||
} else {
|
||||
text = mapActivity.getString(R.string.shared_string_go) ;
|
||||
}
|
||||
((TextView) routeGoControl.iv).setText(text);
|
||||
}
|
||||
|
||||
if (routePreparationLayout.getVisibility() != vis) {
|
||||
routePreparationLayout.setVisibility(vis);
|
||||
mapRouteInfoControlDialog.setVisible(showRouteCalculationControls);
|
||||
if(showRouteCalculationControls) {
|
||||
if(!mapActivity.getRoutingHelper().isFollowingMode() && !mapActivity.getRoutingHelper().isPauseNavigation()) {
|
||||
startCounter();
|
||||
}
|
||||
} else {
|
||||
stopCounter();
|
||||
}
|
||||
}
|
||||
|
||||
float mapRotate = mapActivity.getMapView().getRotate();
|
||||
if (mapRotate != cachedRotate) {
|
||||
float c = cachedRotate - mapRotate;
|
||||
cachedRotate = mapRotate;
|
||||
// Aply animation to image view
|
||||
compassHud.iv.invalidate();
|
||||
|
@ -411,26 +494,16 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
}
|
||||
|
||||
public boolean onSingleTap(PointF point, RotatedTileBox tileBox) {
|
||||
// TODO stop counter & show buttons
|
||||
// for(MapControls m : allControls) {
|
||||
// if(m.isVisible() && m.onSingleTap(point, tileBox)){
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
if(mapRouteInfoControlDialog.onSingleTap(point, tileBox)) {
|
||||
return true;
|
||||
}
|
||||
stopCounter();
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event, RotatedTileBox tileBox) {
|
||||
// TODO stop counter & show buttons
|
||||
// if(!mapActivity.getRoutingHelper().isRoutePlanningMode() && mapActivity.getRoutingHelper().isFollowingMode())
|
||||
// {
|
||||
// if(!settings.SHOW_ZOOM_BUTTONS_NAVIGATION.get()) {
|
||||
// zoomControls.showWithDelay(getParent(), TIMEOUT_TO_SHOW_BUTTONS);
|
||||
// mapMenuControls.showWithDelay(getParent(), TIMEOUT_TO_SHOW_BUTTONS);
|
||||
// }
|
||||
// mapRoutePlanControl.showWithDelay(getParent(), TIMEOUT_TO_SHOW_BUTTONS);
|
||||
// }
|
||||
stopCounter();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -570,7 +643,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
((ImageView) iv).setImageDrawable(ctx.getIconsCache().getIcon(resId, nightMode ? resDark : resLight));
|
||||
}
|
||||
} else if (iv instanceof TextView) {
|
||||
((TextView) iv).setCompoundDrawables(
|
||||
((TextView) iv).setCompoundDrawablesWithIntrinsicBounds(
|
||||
ctx.getIconsCache().getIcon(resId, nightMode ? resDark : resLight), null, null, null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ import net.osmand.plus.routing.RouteDirectionInfo;
|
|||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.routing.RoutingHelper.IRouteInformationListener;
|
||||
import net.osmand.plus.views.ContextMenuLayer;
|
||||
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AlertDialog.Builder;
|
||||
|
@ -28,9 +27,7 @@ import android.app.Dialog;
|
|||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnDismissListener;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
|
@ -38,7 +35,6 @@ import android.view.WindowManager;
|
|||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Spinner;
|
||||
|
|
Loading…
Reference in a new issue