Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-04-21 23:22:51 +02:00
commit f4ab204531
30 changed files with 89 additions and 59 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

@ -8,22 +8,7 @@
<item name="android:backgroundDimEnabled">false</item> <item name="android:backgroundDimEnabled">false</item>
</style> </style>
<style name="Dialog_Fullscreen_Dark" parent="OsmandDarkTheme">
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@color/color_transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:backgroundDimEnabled">false</item>
</style>
<style name="Dialog_Fullscreen_Light" parent="OsmandLightTheme">
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@color/color_transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:backgroundDimEnabled">false</item>
</style>
<style name="OsmandListView" parent="@android:style/Widget.ListView"> <style name="OsmandListView" parent="@android:style/Widget.ListView">
</style> </style>

View file

@ -388,16 +388,31 @@ public class MapControlsLayer extends OsmandMapLayer {
if (!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) { if (!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
mapActivity.getMapActions().enterRoutePlanningMode(null, null, false); mapActivity.getMapActions().enterRoutePlanningMode(null, null, false);
} else { } else {
mapActivity.getRoutingHelper().setRoutePlanningMode(true); switchToRoutePlanningLayout();
mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode();
mapActivity.refreshMap();
} }
} }
}); });
} }
public void switchToRouteFollowingLayout() {
touchEvent = 0;
mapActivity.getMyApplication().getRoutingHelper().setRoutePlanningMode(false);
mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode();
mapActivity.refreshMap();
}
public boolean switchToRoutePlanningLayout() {
if (!mapActivity.getRoutingHelper().isRoutePlanningMode() && mapActivity.getRoutingHelper().isFollowingMode()) {
mapActivity.getRoutingHelper().setRoutePlanningMode(true);
mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode();
mapActivity.refreshMap();
return true;
}
return false;
}
private void initZooms() { private void initZooms() {
final OsmandMapTileView view = mapActivity.getMapView(); final OsmandMapTileView view = mapActivity.getMapView();
@ -436,12 +451,12 @@ public class MapControlsLayer extends OsmandMapLayer {
OsmandApplication app = mapActivity.getMyApplication(); OsmandApplication app = mapActivity.getMyApplication();
RoutingHelper routingHelper = app.getRoutingHelper(); RoutingHelper routingHelper = app.getRoutingHelper();
if (routingHelper.isFollowingMode()) { if (routingHelper.isFollowingMode()) {
routingHelper.setRoutePlanningMode(false); switchToRouteFollowingLayout();
mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode();
} else { } else {
if (!app.getTargetPointsHelper().checkPointToNavigateShort()) { if (!app.getTargetPointsHelper().checkPointToNavigateShort()) {
mapRouteInfoControlDialog.showDialog(); mapRouteInfoControlDialog.showDialog();
} else { } else {
touchEvent = 0;
mapActivity.getMapViewTrackingUtilities().backToLocationImpl(); mapActivity.getMapViewTrackingUtilities().backToLocationImpl();
app.getSettings().FOLLOW_THE_ROUTE.set(true); app.getSettings().FOLLOW_THE_ROUTE.set(true);
routingHelper.setFollowingMode(true); routingHelper.setFollowingMode(true);
@ -453,6 +468,8 @@ public class MapControlsLayer extends OsmandMapLayer {
} }
} }
private void stopCounter() { private void stopCounter() {
startCounter = 0; startCounter = 0;
@ -534,14 +551,14 @@ public class MapControlsLayer extends OsmandMapLayer {
boolean routeFollowingMode = !routePlanningMode && rh.isFollowingMode(); boolean routeFollowingMode = !routePlanningMode && rh.isFollowingMode();
boolean showRouteCalculationControls = routePlanningMode || boolean showRouteCalculationControls = routePlanningMode ||
((System.currentTimeMillis() - touchEvent < TIMEOUT_TO_SHOW_BUTTONS) && routeFollowingMode); ((System.currentTimeMillis() - touchEvent < TIMEOUT_TO_SHOW_BUTTONS) && routeFollowingMode);
boolean showButtons = routePlanningMode || !routeFollowingMode; boolean showMenuButton = showRouteCalculationControls || !routeFollowingMode;
updateMyLocation(rh); updateMyLocation(rh);
// routePlanningBtn.setIconResId(routeFollowingMode ? R.drawable.ic_action_gabout_dark : R.drawable.map_directions ); // routePlanningBtn.setIconResId(routeFollowingMode ? R.drawable.ic_action_gabout_dark : R.drawable.map_directions );
// routePlanningBtn.updateVisibility(showButtons && !routePlanningMode); // routePlanningBtn.updateVisibility(showButtons && !routePlanningMode);
routePlanningBtn.setIconResId(R.drawable.map_directions ); routePlanningBtn.setIconResId(R.drawable.map_directions );
routePlanningBtn.updateVisibility(!routeFollowingMode && !routePlanningMode); routePlanningBtn.updateVisibility(!routeFollowingMode && !routePlanningMode);
menuControl.updateVisibility(showButtons); menuControl.updateVisibility(showMenuButton);
if(routeFollowingMode || routePlanningMode) { if(routeFollowingMode || routePlanningMode) {
mapAppModeShadow.setVisibility(View.GONE); mapAppModeShadow.setVisibility(View.GONE);

View file

@ -41,9 +41,10 @@ import android.graphics.PointF;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.Gravity; import android.view.Gravity;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.view.View.MeasureSpec; import android.view.View.MeasureSpec;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams; import android.view.ViewGroup.LayoutParams;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.AdapterView; import android.widget.AdapterView;
@ -119,34 +120,44 @@ public class MapRouteInfoControl implements IRouteInformationListener {
} }
private Dialog createDialog() { private Dialog createDialog() {
Dialog dialog = new Dialog(mapActivity); final Dialog dialog = new Dialog(mapActivity);
View ll = mapActivity.getLayoutInflater().inflate(R.layout.plan_route_info, null); final View ll = mapActivity.getLayoutInflater().inflate(R.layout.plan_route_info, null);
updateInfo(ll); updateInfo(ll);
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
//lp.copyFrom(dialog.getWindow().getAttributes()); //lp.copyFrom(dialog.getWindow().getAttributes());
lp.width = WindowManager.LayoutParams.MATCH_PARENT; lp.width = WindowManager.LayoutParams.MATCH_PARENT;
ll.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.EXACTLY), ll.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.EXACTLY),
MeasureSpec.makeMeasureSpec(0, MeasureSpec.EXACTLY)); MeasureSpec.makeMeasureSpec(0, MeasureSpec.EXACTLY));
int h = ll.getHeight(); final int maxHeight ;
if(ScreenOrientationHelper.isOrientationPortrait(mapActivity)) { if(ScreenOrientationHelper.isOrientationPortrait(mapActivity)) {
lp.height = //Math.max(h, maxHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 280, mapActivity.getResources().getDisplayMetrics());
(int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 280, mapActivity.getResources().getDisplayMetrics());
} else { } else {
lp.height = WindowManager.LayoutParams.WRAP_CONTENT; maxHeight = -1;
} }
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
lp.gravity = Gravity.BOTTOM; lp.gravity = Gravity.BOTTOM;
if(mapActivity.getMyApplication().getDaynightHelper().isNightMode()) { dialog.getContext().setTheme(R.style.Dialog_Fullscreen);
dialog.getContext().setTheme(R.style.Dialog_Fullscreen_Dark);
} else {
dialog.getContext().setTheme(R.style.Dialog_Fullscreen_Light);
}
dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE); dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(ll, new LayoutParams(WindowManager.LayoutParams.MATCH_PARENT, dialog.setContentView(ll, new LayoutParams(WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.WRAP_CONTENT)); WindowManager.LayoutParams.WRAP_CONTENT));
dialog.setCanceledOnTouchOutside(true); dialog.setCanceledOnTouchOutside(true);
dialog.getWindow().setAttributes(lp); dialog.getWindow().setAttributes(lp);
ll.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
boolean wrap = true;
@Override
public void onGlobalLayout() {
if(ll.getHeight() > maxHeight && maxHeight != -1) {
dialog.setContentView(ll, new LayoutParams(WindowManager.LayoutParams.MATCH_PARENT,
maxHeight));
wrap = false;
} else if(ll.getHeight() < maxHeight && !wrap){
dialog.setContentView(ll, new LayoutParams(WindowManager.LayoutParams.MATCH_PARENT,
ll.getHeight()));
wrap = true;
}
}
});
return dialog; return dialog;
} }
@ -569,10 +580,14 @@ public class MapRouteInfoControl implements IRouteInformationListener {
public void showDialog() { public void showDialog() {
dialog = createDialog(); dialog = createDialog();
final boolean switched = mapControlsLayer.switchToRoutePlanningLayout();
dialog.show(); dialog.show();
dialog.setOnDismissListener(new OnDismissListener() { dialog.setOnDismissListener(new OnDismissListener() {
@Override @Override
public void onDismiss(DialogInterface dlg) { public void onDismiss(DialogInterface dlg) {
if(switched) {
mapControlsLayer.switchToRouteFollowingLayout();
}
dialog = null; dialog = null;
} }
}); });

View file

@ -44,6 +44,7 @@ import android.view.View;
import android.view.View.MeasureSpec; import android.view.View.MeasureSpec;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams; import android.view.ViewGroup.LayoutParams;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.AdapterView; import android.widget.AdapterView;
@ -132,45 +133,57 @@ public class MapRoutePreferencesControl {
dialog.hide(); dialog.hide();
dialog = null; dialog = null;
} else { } else {
dialog = showDialog(); final boolean switched = controlsLayer.switchToRoutePlanningLayout();
dialog = createDialog();
dialog.show(); dialog.show();
dialog.setOnDismissListener(new OnDismissListener() { dialog.setOnDismissListener(new OnDismissListener() {
@Override @Override
public void onDismiss(DialogInterface dlg) { public void onDismiss(DialogInterface dlg) {
dialog = null; dialog = null;
if(switched) {
controlsLayer.switchToRouteFollowingLayout();
}
} }
}); });
} }
} }
private Dialog showDialog() { private Dialog createDialog() {
Dialog dialog = new Dialog(mapActivity); final Dialog dialog = new Dialog(mapActivity);
View ll = createLayout(); final View ll = createLayout();
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
//lp.copyFrom(dialog.getWindow().getAttributes()); //lp.copyFrom(dialog.getWindow().getAttributes());
lp.width = WindowManager.LayoutParams.MATCH_PARENT; lp.width = WindowManager.LayoutParams.MATCH_PARENT;
ll.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.EXACTLY), final int maxHeight ;
MeasureSpec.makeMeasureSpec(0, MeasureSpec.EXACTLY)); if(ScreenOrientationHelper.isOrientationPortrait(mapActivity)) {
int h = ll.getHeight(); maxHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 280, mapActivity.getResources().getDisplayMetrics());
if (ScreenOrientationHelper.isOrientationPortrait(mapActivity)) {
lp.height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 260, mapActivity.getResources()
.getDisplayMetrics());
} else { } else {
lp.height = WindowManager.LayoutParams.WRAP_CONTENT; maxHeight = -1;
} }
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
lp.gravity = Gravity.BOTTOM; lp.gravity = Gravity.BOTTOM;
if(mapActivity.getMyApplication().getDaynightHelper().isNightMode()) { dialog.getContext().setTheme(R.style.Dialog_Fullscreen);
dialog.getContext().setTheme(R.style.Dialog_Fullscreen_Dark);
} else {
dialog.getContext().setTheme(R.style.Dialog_Fullscreen_Light);
}
dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE); dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(ll, new LayoutParams(WindowManager.LayoutParams.MATCH_PARENT, dialog.setContentView(ll, new LayoutParams(WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.WRAP_CONTENT)); WindowManager.LayoutParams.WRAP_CONTENT));
dialog.setCanceledOnTouchOutside(true); dialog.setCanceledOnTouchOutside(true);
dialog.getWindow().setAttributes(lp); dialog.getWindow().setAttributes(lp);
ll.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
boolean wrap = true;
@Override
public void onGlobalLayout() {
if(ll.getHeight() > maxHeight && maxHeight != -1) {
dialog.setContentView(ll, new LayoutParams(WindowManager.LayoutParams.MATCH_PARENT,
maxHeight));
wrap = false;
} else if(ll.getHeight() < maxHeight && !wrap){
dialog.setContentView(ll, new LayoutParams(WindowManager.LayoutParams.MATCH_PARENT,
ll.getHeight()));
wrap = true;
}
}
});
return dialog; return dialog;
} }

View file

@ -30,7 +30,6 @@ import android.app.AlertDialog.Builder;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.graphics.Typeface;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.view.View; import android.view.View;
import android.view.WindowManager; import android.view.WindowManager;
@ -175,6 +174,7 @@ public class MapInfoWidgetsFactory {
private View waypointInfoBar; private View waypointInfoBar;
private LocationPointWrapper lastPoint; private LocationPointWrapper lastPoint;
private TurnDrawable turnDrawable; private TurnDrawable turnDrawable;
private int shadowRad;
public TopTextView(OsmandApplication app, MapActivity map) { public TopTextView(OsmandApplication app, MapActivity map) {
topBar = map.findViewById(R.id.map_top_bar); topBar = map.findViewById(R.id.map_top_bar);
@ -208,6 +208,7 @@ public class MapInfoWidgetsFactory {
} }
public void updateTextColor(boolean nightMode, int textColor, int textShadowColor, boolean bold, int rad) { public void updateTextColor(boolean nightMode, int textColor, int textShadowColor, boolean bold, int rad) {
this.shadowRad = rad;
TextInfoWidget.updateTextColor(addressText, addressTextShadow, textColor, textShadowColor, bold, rad); TextInfoWidget.updateTextColor(addressText, addressTextShadow, textColor, textShadowColor, bold, rad);
TextInfoWidget.updateTextColor((TextView) waypointInfoBar.findViewById(R.id.waypoint_text), TextInfoWidget.updateTextColor((TextView) waypointInfoBar.findViewById(R.id.waypoint_text),
(TextView) waypointInfoBar.findViewById(R.id.waypoint_text_shadow), (TextView) waypointInfoBar.findViewById(R.id.waypoint_text_shadow),
@ -263,7 +264,7 @@ public class MapInfoWidgetsFactory {
text = ""; text = "";
} }
} }
if(!showNextTurn && updateWaypoint()) { if (!showNextTurn && updateWaypoint()) {
updateVisibility(true); updateVisibility(true);
updateVisibility(addressText, false); updateVisibility(addressText, false);
updateVisibility(addressTextShadow, false); updateVisibility(addressTextShadow, false);
@ -273,7 +274,7 @@ public class MapInfoWidgetsFactory {
updateVisibility(true); updateVisibility(true);
updateVisibility(waypointInfoBar, false); updateVisibility(waypointInfoBar, false);
updateVisibility(addressText, true); updateVisibility(addressText, true);
updateVisibility(addressTextShadow, true); updateVisibility(addressTextShadow, shadowRad > 0);
boolean update = turnDrawable.setTurnType(type[0]); boolean update = turnDrawable.setTurnType(type[0]);
int h = addressText.getHeight() / 4 * 3; int h = addressText.getHeight() / 4 * 3;

View file

@ -41,7 +41,6 @@ import android.graphics.Color;
import android.graphics.ColorFilter; import android.graphics.ColorFilter;
import android.graphics.Matrix; import android.graphics.Matrix;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.Typeface;
import android.graphics.Paint.Style; import android.graphics.Paint.Style;
import android.graphics.Path; import android.graphics.Path;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
@ -49,8 +48,6 @@ import android.text.format.DateFormat;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TextView; import android.widget.TextView;
public class RouteInfoWidgetsFactory { public class RouteInfoWidgetsFactory {
@ -526,6 +523,7 @@ public class RouteInfoWidgetsFactory {
private LanesDrawable lanesDrawable; private LanesDrawable lanesDrawable;
private View centerInfo; private View centerInfo;
private View progress; private View progress;
private int shadowRadius;
public LanesControl(final MapActivity map, final OsmandMapTileView view) { public LanesControl(final MapActivity map, final OsmandMapTileView view) {
lanesView = (ImageView) map.findViewById(R.id.map_lanes); lanesView = (ImageView) map.findViewById(R.id.map_lanes);
@ -543,6 +541,7 @@ public class RouteInfoWidgetsFactory {
} }
public void updateTextSize(boolean isNight, int textColor, int textShadowColor, boolean textBold, int shadowRadius) { public void updateTextSize(boolean isNight, int textColor, int textShadowColor, boolean textBold, int shadowRadius) {
this.shadowRadius = shadowRadius;
TextInfoWidget.updateTextColor(lanesText, lanesShadowText, textColor, textShadowColor, textBold, shadowRadius); TextInfoWidget.updateTextColor(lanesText, lanesShadowText, textColor, textShadowColor, textBold, shadowRadius);
} }
@ -613,7 +612,7 @@ public class RouteInfoWidgetsFactory {
lanesText.invalidate(); lanesText.invalidate();
} }
} }
updateVisibility(lanesShadowText, visible); updateVisibility(lanesShadowText, visible && shadowRadius > 0);
updateVisibility(lanesText, visible); updateVisibility(lanesText, visible);
updateVisibility(lanesView, visible); updateVisibility(lanesView, visible);
updateVisibility(centerInfo, visible || progress.getVisibility() == View.VISIBLE); updateVisibility(centerInfo, visible || progress.getVisibility() == View.VISIBLE);