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>
</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>

View file

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

View file

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

View file

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

View file

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

View file

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