update buttons

This commit is contained in:
Victor Shcherb 2015-03-12 01:45:53 +01:00
parent 86bbdabb4c
commit 2aef8cc8d0
12 changed files with 274 additions and 135 deletions

View file

@ -4,7 +4,6 @@
<item android:state_pressed="true"><shape android:shape="rectangle">
<solid android:color="@color/map_widget_light_pressed" />
<stroke android:width="@dimen/map_button_stroke" android:color="@color/map_widget_stroke" />
<corners android:radius="@dimen/map_button_rect_rad" />
</shape></item>
<item><shape android:shape="rectangle">
<solid android:color="@color/map_widget_light" />

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"><shape android:shape="rectangle">
<solid android:color="@color/map_widget_dark_pressed" />
<stroke android:width="@dimen/map_button_stroke" android:color="@color/map_widget_stroke" />
</shape></item>
<item><shape android:shape="rectangle">
<solid android:color="@color/map_widget_dark" />
<stroke android:width="@dimen/map_button_stroke" android:color="@color/map_widget_stroke" />
</shape></item>
</selector>

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"><inset android:insetBottom="@dimen/map_button_inset" android:insetLeft="@dimen/map_button_inset" android:insetRight="@dimen/map_button_inset" android:insetTop="@dimen/map_button_inset">
<shape android:shape="oval">
<solid android:color="@color/map_widget_dark_pressed" />
<stroke android:color="@color/map_widget_stroke" android:width="@dimen/map_button_stroke"/>
</shape>
</inset></item>
<item><inset android:insetBottom="@dimen/map_button_inset" android:insetLeft="@dimen/map_button_inset" android:insetRight="@dimen/map_button_inset" android:insetTop="@dimen/map_button_inset">
<shape android:shape="oval">
<solid android:color="@color/map_widget_dark" />
<stroke android:color="@color/map_widget_stroke" android:width="@dimen/map_button_stroke"/>
</shape>
</inset></item>
</selector>

View file

@ -2,7 +2,7 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"><shape android:shape="rectangle">
<solid android:color="@color/map_widget_light_pressed" />
<solid android:color="@color/map_widget_dark_pressed" />
<corners android:radius="@dimen/map_button_rect_rad" />
<stroke android:width="@dimen/map_button_stroke" android:color="@color/map_widget_stroke" />
</shape></item>

View file

@ -116,6 +116,7 @@
android:paddingLeft="12dp"
android:drawableLeft="@drawable/ic_action_remove_light"
android:textSize="20sp"
android:textStyle="bold"
android:drawablePadding="4dp" />
</LinearLayout>

View file

@ -11,7 +11,7 @@
android:layout_marginLeft="@dimen/map_button_margin"
android:layout_marginTop="@dimen/map_button_margin"
android:background="@drawable/btn_inset_circle"
android:src="@drawable/ic_action_layers_light" />
android:src="@drawable/ic_action_remove_light" />
<Button
android:id="@+id/map_download_button"

View file

@ -13,6 +13,7 @@
<color name="map_widget_stroke">#333333</color>
<color name="map_widget_light">#eeffffff</color>
<color name="map_widget_dark">#aa3f3f3f</color>
<color name="map_widget_dark_pressed">#ddcccccc</color>
<color name="map_widget_light_trans">#88ffffff</color>
<color name="map_widget_light_pressed">#ddcccccc</color>
<color name="map_widget_blue">#30A0FF</color>

View file

@ -55,7 +55,7 @@
<dimen name="map_widget_icon">24dp</dimen>
<dimen name="map_widget_height">32dp</dimen>
<dimen name="map_widget_image">80dp</dimen>
<dimen name="map_button_spacing">18dp</dimen>
<dimen name="map_button_spacing">15dp</dimen>
<dimen name="map_button_margin">4dp</dimen>
<dimen name="map_button_inset">4dp</dimen>
<dimen name="map_button_rect_rad">3dp</dimen>

View file

@ -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="shared_string_go">Go</string>
<string name="action_create">Action create</string>
<string name="action_modify">Action modify</string>
<string name="action_delete">Action delete</string>

View file

@ -52,6 +52,7 @@ public class ApplicationMode {
static {
ApplicationMode[] exceptPedestrianAndDefault = new ApplicationMode[] { CAR, BICYCLE, BOAT, AIRCRAFT };
ApplicationMode[] exceptAirBoat = new ApplicationMode[] { DEFAULT, CAR, BICYCLE, PEDESTRIAN };
ApplicationMode[] exceptAirBoatDefault = new ApplicationMode[] { CAR, BICYCLE, PEDESTRIAN };
ApplicationMode[] pedestrian = new ApplicationMode[] { PEDESTRIAN };
ApplicationMode[] pedestrianBicycle = new ApplicationMode[] { PEDESTRIAN, BICYCLE };
@ -75,7 +76,7 @@ public class ApplicationMode {
// top
regWidget("compass", all);
regWidget("config", none);
regWidget("street_name", exceptAirBoat);
regWidget("street_name", exceptAirBoatDefault);
regWidget("back_to_location", all);
regWidget("monitoring_services", none);
regWidget("bgService", none);

View file

@ -38,6 +38,7 @@ import android.view.animation.Animation.AnimationListener;
import android.view.animation.TranslateAnimation;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ScrollView;
/**
@ -66,6 +67,7 @@ public class DashboardOnMap {
private float mapRotation;
private boolean inLocationUpdate = false;
private boolean saveBackAction;
private ImageView switchButton;
public DashboardOnMap(MapActivity ma) {
@ -90,12 +92,13 @@ public class DashboardOnMap {
dashboardView.setOnClickListener(listener);
dashboardView.findViewById(R.id.map_layers_button).setOnClickListener(new View.OnClickListener() {
switchButton = (ImageView) dashboardView.findViewById(R.id.map_layers_button);
switchButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
setDashboardVisibility(false);
mapActivity.getMapActions().prepareConfigureMap();
mapActivity.getMyApplication().getSettings().USE_DASHBOARD_INSTEAD_OF_DRAWER.set(false);
mapActivity.getMapActions().toggleDrawer();
}
});
@ -169,18 +172,17 @@ public class DashboardOnMap {
dashboardView.setVisibility(View.VISIBLE);
fabButton.showFloatingActionButton();
open(dashboardView.findViewById(R.id.animateContent));
switchButton.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_navigation_drawer));
mapActivity.getMapActions().disableDrawer();
mapActivity.findViewById(R.id.MapInfoControls).setVisibility(View.GONE);
mapActivity.findViewById(R.id.MapButtons).setVisibility(View.GONE);
mapActivity.findViewById(R.id.MapHudButtonsOverlay).setVisibility(View.GONE);
updateLocation(true, true, false);
} else {
mapActivity.getMapActions().enableDrawer();
mapActivity.getMapViewTrackingUtilities().setDashboard(null);
hide(dashboardView.findViewById(R.id.animateContent));
mapActivity.findViewById(R.id.MapInfoControls).setVisibility(View.VISIBLE);
mapActivity.findViewById(R.id.MapButtons).setVisibility(View.VISIBLE);
mapActivity.findViewById(R.id.MapHudButtonsOverlay).setVisibility(View.VISIBLE);
fabButton.hideFloatingActionButton();
for (WeakReference<DashBaseFragment> df : fragList) {
if (df.get() != null) {

View file

@ -19,6 +19,7 @@ import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.helpers.ScreenOrientationHelper;
import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.helpers.WaypointDialogHelper;
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
import net.osmand.plus.views.controls.MapRoutePlanControl;
import net.osmand.plus.views.controls.MapRoutePreferencesControl;
import net.osmand.plus.views.controls.MapCancelControl;
@ -29,6 +30,7 @@ import net.osmand.plus.views.controls.MapNavigateControl;
import net.osmand.plus.views.controls.MapZoomControls;
import net.osmand.plus.views.controls.RulerControl;
import net.osmand.plus.views.controls.SmallMapMenuControls;
import net.osmand.plus.views.mapwidgets.ImageViewWidget;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.PointF;
@ -39,17 +41,21 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.view.animation.Animation;
import android.view.animation.RotateAnimation;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.SeekBar;
import android.widget.TextView;
public class MapControlsLayer extends OsmandMapLayer {
private static final int TIMEOUT_TO_SHOW_BUTTONS = 5000;
private static class MapHudButton {
ImageView iv;
View iv;
int bgDark;
int bgLight;
int resId;
@ -59,7 +65,6 @@ public class MapControlsLayer extends OsmandMapLayer {
boolean nightMode = false;
boolean f = true;
public MapHudButton setRoundTransparent() {
setBg(R.drawable.btn_circle_trans);
return this;
@ -80,11 +85,10 @@ public class MapControlsLayer extends OsmandMapLayer {
return this;
}
public static MapHudButton create(ImageView iv, int resId) {
public static MapHudButton create(View iv, int resId) {
MapHudButton mc = new MapHudButton();
mc.iv = iv;
mc.resId = resId;
mc.setBg(R.drawable.btn_circle);
return mc;
}
@ -97,14 +101,14 @@ public class MapControlsLayer extends OsmandMapLayer {
return true;
}
public boolean setIconColorId(int clr) {
public MapHudButton setIconColorId(int clr) {
if (resLight == clr && resDark == clr) {
return false;
return this;
}
resLight = clr;
resDark = clr;
f = true;
return true;
return this;
}
public void update(OsmandApplication ctx, boolean night) {
@ -116,10 +120,13 @@ public class MapControlsLayer extends OsmandMapLayer {
if (bgDark != 0 && bgLight != 0) {
iv.setBackgroundDrawable(ctx.getResources().getDrawable(night ? bgDark : bgLight));
}
iv.setImageDrawable(ctx.getIconsCache().getIcon(resId, nightMode ? resDark : resLight));
if (iv instanceof ImageView) {
((ImageView) iv).setImageDrawable(ctx.getIconsCache().getIcon(resId, nightMode ? resDark : resLight));
} else if (iv instanceof TextView) {
((TextView) iv).setCompoundDrawables(
ctx.getIconsCache().getIcon(resId, nightMode ? resDark : resLight), null, null, null);
}
}
}
@ -136,25 +143,22 @@ public class MapControlsLayer extends OsmandMapLayer {
private static CommonPreference<Integer> settingsToTransparency;
private OsmandSettings settings;
private MapRoutePreferencesControl optionsRouteControlDialog;
private MapRouteInfoControl mapRouteInfoControlDialog;
private View routePreparationLayout;
private MapHudButton backToLocationControl;
private MapHudButton menuControl;
private View routePreparationLayout;
private MapRouteInfoControl mapRouteInfoControl;
private MapHudButton optionsRouteControl;
private MapRoutePreferencesControl optionsRouteControlDialog;
private MapHudButton routeGoControl;
private MapHudButton compassHud;
private float cachedRotate = 0;
private RotateAnimation rotateAnimation;
public MapControlsLayer(MapActivity activity) {
this.mapActivity = activity;
settings = activity.getMyApplication().getSettings();
}
@Override
public boolean drawInScreenPixels() {
return true;
@ -164,24 +168,48 @@ public class MapControlsLayer extends OsmandMapLayer {
public void initLayer(final OsmandMapTileView view) {
scaleCoefficient = view.getScaleCoefficient();
FrameLayout parent = getParent();
initNewControls();
// TODO
// rulerControl = init(new RulerControl(zoomControls, mapActivity, showUIHandler, scaleCoefficient), parent,
// rightGravity);
initTransparencyBar(view, parent);
}
private void initNewControls() {
initZooms();
initControls();
initRouteControls();
initTopControls();
}
private void initTopControls() {
View configureMap = mapActivity.findViewById(R.id.map_layers_button);
controls.add(MapHudButton.create((ImageView) configureMap, R.drawable.ic_action_layers_dark).setBg(
R.drawable.btn_inset_circle, R.drawable.btn_inset_circle_night));
configureMap.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
notifyClicked();
mapActivity.getMapActions().prepareConfigureMap();
mapActivity.getMapActions().toggleDrawer();
}
});
View compass = mapActivity.findViewById(R.id.map_compass_button);
compassHud = MapHudButton.create((ImageView) compass, R.drawable.map_compass).setIconColorId(0)
.setBg(R.drawable.btn_inset_circle, R.drawable.btn_inset_circle_night);
controls.add(compassHud);
compass.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
notifyClicked();
mapActivity.getMapViewTrackingUtilities().switchRotateMapMode();
}
});
}
private void initRouteControls() {
routePreparationLayout = mapActivity.findViewById(R.id.map_route_preparation_layout);
View cancelRouteButton = mapActivity.findViewById(R.id.map_cancel_route_button);
controls.add(MapHudButton.create((ImageView) cancelRouteButton, R.drawable.ic_action_remove_dark));
controls.add(MapHudButton.create((ImageView) cancelRouteButton, R.drawable.ic_action_remove_dark).setBg(
R.drawable.btn_flat, R.drawable.btn_flat_night));
cancelRouteButton.setOnClickListener(new View.OnClickListener() {
@Override
@ -194,21 +222,23 @@ public class MapControlsLayer extends OsmandMapLayer {
}
}
});
mapRouteInfoControl = new MapRouteInfoControl(mapActivity.getMapLayers().getContextMenuLayer(),
mapRouteInfoControlDialog = new MapRouteInfoControl(mapActivity.getMapLayers().getContextMenuLayer(),
mapActivity);
View waypointsButton = mapActivity.findViewById(R.id.map_waypoints_route_button);
controls.add(MapHudButton.create((ImageView) waypointsButton, R.drawable.ic_action_flage_dark));
controls.add(MapHudButton.create((ImageView) waypointsButton, R.drawable.ic_action_flage_dark).setBg(
R.drawable.btn_flat, R.drawable.btn_flat_night));
waypointsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
notifyClicked();
mapRouteInfoControl.showHideDialog();
mapRouteInfoControlDialog.showHideDialog();
}
});
View optionsRouteButton = mapActivity.findViewById(R.id.map_options_route_button);
optionsRouteControl = MapHudButton.create((ImageView) optionsRouteButton, settings.getApplicationMode().getSmallIcon(false));
optionsRouteControl = MapHudButton.create((ImageView) optionsRouteButton,
settings.getApplicationMode().getSmallIcon(true)).setBg(R.drawable.btn_flat, R.drawable.btn_flat_night);
optionsRouteControlDialog = new MapRoutePreferencesControl(mapActivity);
controls.add(optionsRouteControl);
optionsRouteButton.setOnClickListener(new View.OnClickListener() {
@ -218,16 +248,29 @@ public class MapControlsLayer extends OsmandMapLayer {
optionsRouteControlDialog.showAndHideDialog();
}
});
TextView routeGoButton = (TextView) mapActivity.findViewById(R.id.map_go_route_button);
routeGoControl = MapHudButton.create(routeGoButton, R.drawable.ic_destination_arrow_white).setBg(
R.drawable.btn_flat, R.drawable.btn_flat_night);
controls.add(routeGoControl);
routeGoButton.setText(mapActivity.getString(R.string.shared_string_go).toUpperCase());
routeGoButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
notifyClicked();
startNavigation();
}
});
}
public void showDialog() {
mapRouteInfoControl.setShowDialog();
mapRouteInfoControlDialog.setShowDialog();
}
private void initControls() {
View backToLocation = mapActivity.findViewById(R.id.map_my_location_button);
backToLocationControl = MapHudButton.create((ImageView) backToLocation, R.drawable.ic_action_get_my_location).setBg(R.drawable.btn_circle_blue)
;
backToLocationControl = MapHudButton.create((ImageView) backToLocation, R.drawable.ic_action_get_my_location)
.setBg(R.drawable.btn_circle_blue);
controls.add(backToLocationControl);
backToLocation.setOnClickListener(new View.OnClickListener() {
@ -238,8 +281,8 @@ public class MapControlsLayer extends OsmandMapLayer {
});
View backToMenuButton = mapActivity.findViewById(R.id.map_menu_button);
menuControl = MapHudButton.create((ImageView) backToMenuButton, R.drawable.ic_navigation_drawer).
setBg(R.drawable.btn_round, R.drawable.btn_round_night);
menuControl = MapHudButton.create((ImageView) backToMenuButton, R.drawable.ic_navigation_drawer).setBg(
R.drawable.btn_round, R.drawable.btn_round_night);
controls.add(menuControl);
backToMenuButton.setOnClickListener(new View.OnClickListener() {
@Override
@ -258,8 +301,8 @@ public class MapControlsLayer extends OsmandMapLayer {
});
View routePlanButton = mapActivity.findViewById(R.id.map_route_info_button);
controls.add(MapHudButton.create((ImageView) routePlanButton, R.drawable.ic_action_info_dark).
setBg(R.drawable.btn_round, R.drawable.btn_round_night));
controls.add(MapHudButton.create((ImageView) routePlanButton, R.drawable.ic_action_gdirections_dark).setBg(
R.drawable.btn_round, R.drawable.btn_round_night));
routePlanButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -269,14 +312,13 @@ public class MapControlsLayer extends OsmandMapLayer {
mapActivity.refreshMap();
}
});
}
}
private void initZooms() {
final OsmandMapTileView view = mapActivity.getMapView();
View zoomInButton = mapActivity.findViewById(R.id.map_zoom_in_button);
controls.add(MapHudButton.create((ImageView) zoomInButton, R.drawable.ic_action_zoom_in).setRoundTransparent()
);
controls.add(MapHudButton.create((ImageView) zoomInButton, R.drawable.ic_action_zoom_in).setRoundTransparent());
zoomInButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -292,8 +334,8 @@ public class MapControlsLayer extends OsmandMapLayer {
final View.OnLongClickListener listener = MapZoomControls.getOnClickMagnifierListener(view);
zoomInButton.setOnLongClickListener(listener);
View zoomOutButton = mapActivity.findViewById(R.id.map_zoom_out_button);
controls.add(MapHudButton.create((ImageView) zoomOutButton, R.drawable.ic_action_zoom_out).setRoundTransparent()
);
controls.add(MapHudButton.create((ImageView) zoomOutButton, R.drawable.ic_action_zoom_out)
.setRoundTransparent());
zoomOutButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -304,27 +346,39 @@ public class MapControlsLayer extends OsmandMapLayer {
zoomOutButton.setOnLongClickListener(listener);
}
public void startNavigation() {
// TODO
// if (mapNavigationControl == null) {
// return;
// }
// mapNavigationControl.startNavigation();
stopCounter();
OsmandApplication app = mapActivity.getMyApplication();
RoutingHelper routingHelper = app.getRoutingHelper();
if (routingHelper.isFollowingMode()) {
routingHelper.setRoutePlanningMode(false);
mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode();
} else {
if (!app.getTargetPointsHelper().checkPointToNavigateShort()) {
mapRouteInfoControlDialog.showDialog();
} else {
mapActivity.getMapViewTrackingUtilities().backToLocationImpl();
app.getSettings().FOLLOW_THE_ROUTE.set(true);
routingHelper.setFollowingMode(true);
routingHelper.setRoutePlanningMode(false);
mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode();
routingHelper.setCurrentLocation(app.getLocationProvider().getLastKnownLocation(), false);
app.getRoutingHelper().notifyIfRouteIsCalculated();
}
}
}
private void stopCounter() {
// TODO stop counter
}
protected void notifyClicked(MapControls m) {
notifyClicked();
}
protected void notifyClicked() {
// TODO
// if(mapNavigationControl != null) {
// mapNavigationControl.stopCounter();
// }
stopCounter();
}
@Override
@ -357,6 +411,7 @@ public class MapControlsLayer extends OsmandMapLayer {
&& (!routeFollowingMode || settings.SHOW_ZOOM_BUTTONS_NAVIGATION.get());
// /////////////////////////////////////////////
// new update
boolean enabled = mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation() != null;
boolean tracked = mapActivity.getMapViewTrackingUtilities().isMapLinkedToLocation();
if (!enabled) {
@ -366,34 +421,87 @@ public class MapControlsLayer extends OsmandMapLayer {
} else {
backToLocationControl.setIconColorId(R.color.color_white);
}
menuControl.setIconResId(mapActivity.getMyApplication().getSettings().USE_DASHBOARD_INSTEAD_OF_DRAWER.get() ? R.drawable.ic_dashboard_dark
menuControl
.setIconResId(mapActivity.getMyApplication().getSettings().USE_DASHBOARD_INSTEAD_OF_DRAWER.get() ? R.drawable.ic_dashboard_dark
: R.drawable.ic_navigation_drawer);
optionsRouteControl.setIconResId(settings.getApplicationMode().getSmallIcon(false));
optionsRouteControl.setIconResId(settings.getApplicationMode().getSmallIcon(true));
int vis = showRouteCalculationControls ? View.VISIBLE : View.GONE;
if (showRouteCalculationControls) {
((TextView) routeGoControl.iv).setTextColor(textColor);
}
if (routePreparationLayout.getVisibility() != vis) {
routePreparationLayout.setVisibility(vis);
mapRouteInfoControl.setVisible(showRouteCalculationControls);
mapRouteInfoControlDialog.setVisible(showRouteCalculationControls);
}
float mapRotate = mapActivity.getMapView().getRotate();
if (mapRotate != cachedRotate && (rotateAnimation == null || rotateAnimation.hasEnded())) {
float c = cachedRotate - mapRotate;
cachedRotate = mapRotate;
// compassHud.iv.setPivotX();
// compassHud.iv.setPivotY();
// compassHud.iv.setRotation(mapRotate);
rotateAnimation = new RotateAnimation(0.0f, c, compassHud.iv.getWidth() / 2,
compassHud.iv.getHeight() / 2);
// Set the animation's parameters
rotateAnimation.setDuration(100); // duration in ms
rotateAnimation.setRepeatCount(0); // -1 = infinite repeated
rotateAnimation.setRepeatMode(Animation.REVERSE); // reverses each repeat
rotateAnimation.setFillAfter(true); // keep rotation after animation
// Aply animation to image view
compassHud.iv.setAnimation(rotateAnimation);
// compassHud.iv.invalidate();
}
if (settings.ROTATE_MAP.get() == OsmandSettings.ROTATE_MAP_NONE) {
compassHud.setIconResId(isNight ? R.drawable.map_compass_niu_white : R.drawable.map_compass_niu);
} else if (settings.ROTATE_MAP.get() == OsmandSettings.ROTATE_MAP_BEARING) {
compassHud.setIconResId(isNight ? R.drawable.map_compass_bearing_white : R.drawable.map_compass_bearing);
} else {
compassHud.setIconResId(isNight ? R.drawable.map_compass_white : R.drawable.map_compass);
}
for (MapHudButton mc : controls) {
mc.update(mapActivity.getMyApplication(), nightMode == null ? false : nightMode.isNightMode());
}
}
// public ImageViewWidget createCompassView(final MapActivity map){
// final OsmandMapTileView view = map.getMapView();
// final OsmandApplication app = map.getMyApplication();
// final int mw = (int) compass.getMinimumWidth() ;
// final int mh = (int) compass.getMinimumHeight() ;
// ImageViewWidget compassView = new ImageViewWidget(map) {
// private float cachedRotate = 0;
// private int cachedRotateMap = 0;
// private boolean nm;
// @Override
// protected void onDraw(Canvas canvas) {
// canvas.save();
// canvas.rotate(view.getRotate(), mw / 2, mh / 2);
// getDrawable().draw(canvas);
// canvas.restore();
// }
//
//
// };
// compassView.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// map.getMapViewTrackingUtilities().switchRotateMapMode();
// }
// });
//
// return compassView;
// }
private void updatextColor(int textColor, int shadowColor, MapControls... mc) {
for(MapControls m : mc) {
m.updateTextColor(textColor, shadowColor);
}
}
private FrameLayout getParent() {
return (FrameLayout) mapActivity.findViewById(R.id.MapButtons);
}
@Override
public boolean onSingleTap(PointF point, RotatedTileBox tileBox) {
// TODO stop counter & show buttons
// for(MapControls m : allControls) {
@ -407,7 +515,8 @@ public class MapControlsLayer extends OsmandMapLayer {
@Override
public boolean onTouchEvent(MotionEvent event, RotatedTileBox tileBox) {
// TODO stop counter & show buttons
// if(!mapActivity.getRoutingHelper().isRoutePlanningMode() && mapActivity.getRoutingHelper().isFollowingMode()) {
// 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);
@ -417,12 +526,11 @@ public class MapControlsLayer extends OsmandMapLayer {
return false;
}
// /////////////// Transparency bar /////////////////////////
private void initTransparencyBar(final OsmandMapTileView view, FrameLayout parent) {
int minimumHeight = view.getResources().getDrawable(R.drawable.map_zoom_in).getMinimumHeight();
android.widget.FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT,
Gravity.BOTTOM | Gravity.CENTER);
android.widget.FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT, Gravity.BOTTOM | Gravity.CENTER);
params.setMargins(0, 0, 0, minimumHeight + 3);
transparencyBarLayout = new LinearLayout(view.getContext());
transparencyBarLayout.setVisibility(settingsToTransparency != null ? View.VISIBLE : View.GONE);
@ -486,7 +594,4 @@ public class MapControlsLayer extends OsmandMapLayer {
// TODO
}
}