Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
0af6c25c15
9 changed files with 175 additions and 43 deletions
12
OsmAnd/res/layout/card_bottom_divider.xml
Normal file
12
OsmAnd/res/layout/card_bottom_divider.xml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:scaleType="fitXY"
|
||||||
|
android:src="@drawable/bg_shadow_list_bottom"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
16
OsmAnd/res/layout/card_top_divider.xml
Normal file
16
OsmAnd/res/layout/card_top_divider.xml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="6dp"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:scaleType="fitXY"
|
||||||
|
android:src="@drawable/bg_shadow_list_top"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -91,6 +91,14 @@ public class AndroidUtils {
|
||||||
setBackground(ctx, view, night, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
setBackground(ctx, view, night, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setBackgroundColor(Context ctx, View view, boolean night, int lightResId, int darkResId) {
|
||||||
|
view.setBackgroundColor(ctx.getResources().getColor(night ? darkResId : lightResId));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setListItemBackground(Context ctx, View view, boolean night) {
|
||||||
|
setBackgroundColor(ctx, view, night, R.color.bg_color_light, R.color.bg_color_dark);
|
||||||
|
}
|
||||||
|
|
||||||
public static void setTextPrimaryColor(Context ctx, TextView textView, boolean night) {
|
public static void setTextPrimaryColor(Context ctx, TextView textView, boolean night) {
|
||||||
textView.setTextColor(night ?
|
textView.setTextColor(night ?
|
||||||
ctx.getResources().getColor(R.color.primary_text_dark)
|
ctx.getResources().getColor(R.color.primary_text_dark)
|
||||||
|
|
|
@ -346,6 +346,7 @@ public class ContextMenuAdapter {
|
||||||
}
|
}
|
||||||
if (convertView == null || (!lid.equals(convertView.getTag()))) {
|
if (convertView == null || (!lid.equals(convertView.getTag()))) {
|
||||||
convertView = activity.getLayoutInflater().inflate(lid, parent, false);
|
convertView = activity.getLayoutInflater().inflate(lid, parent, false);
|
||||||
|
AndroidUtils.setListItemBackground(ctx, convertView, !holoLight);
|
||||||
convertView.setTag(lid);
|
convertView.setTag(lid);
|
||||||
}
|
}
|
||||||
TextView tv = (TextView) convertView.findViewById(R.id.title);
|
TextView tv = (TextView) convertView.findViewById(R.id.title);
|
||||||
|
|
|
@ -46,6 +46,13 @@ public class AppModeDialog {
|
||||||
public static View prepareAppModeView(Activity a, final List<ApplicationMode> values , final Set<ApplicationMode> selected,
|
public static View prepareAppModeView(Activity a, final List<ApplicationMode> values , final Set<ApplicationMode> selected,
|
||||||
ViewGroup parent, final boolean singleSelection, boolean drawer, boolean useMapTheme, final View.OnClickListener onClickListener) {
|
ViewGroup parent, final boolean singleSelection, boolean drawer, boolean useMapTheme, final View.OnClickListener onClickListener) {
|
||||||
View ll = a.getLayoutInflater().inflate(R.layout.mode_toggles, parent);
|
View ll = a.getLayoutInflater().inflate(R.layout.mode_toggles, parent);
|
||||||
|
if (useMapTheme) {
|
||||||
|
AndroidUtils.setListItemBackground(a, ll,
|
||||||
|
((OsmandApplication) a.getApplication()).getDaynightHelper().isNightModeForMapControls());
|
||||||
|
} else {
|
||||||
|
AndroidUtils.setListItemBackground(a, ll,
|
||||||
|
!((OsmandApplication) a.getApplication()).getSettings().isLightContent());
|
||||||
|
}
|
||||||
final View[] buttons = new View[values.size()];
|
final View[] buttons = new View[values.size()];
|
||||||
int k = 0;
|
int k = 0;
|
||||||
for(ApplicationMode ma : values) {
|
for(ApplicationMode ma : values) {
|
||||||
|
|
|
@ -154,7 +154,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
|
|
||||||
public enum DashboardActionButtonType {
|
public enum DashboardActionButtonType {
|
||||||
MY_LOCATION,
|
MY_LOCATION,
|
||||||
NAVIGATE
|
NAVIGATE,
|
||||||
|
ROUTE
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DashboardActionButton {
|
private class DashboardActionButton {
|
||||||
|
@ -191,13 +192,26 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
mFlexibleBlurSpaceHeight = mapActivity.getResources().getDimensionPixelSize(
|
mFlexibleBlurSpaceHeight = mapActivity.getResources().getDimensionPixelSize(
|
||||||
R.dimen.dashboard_map_toolbar);
|
R.dimen.dashboard_map_toolbar);
|
||||||
// Set padding view for ListView. This is the flexible space.
|
// Set padding view for ListView. This is the flexible space.
|
||||||
paddingView = new View(mapActivity);
|
paddingView = new FrameLayout(mapActivity);
|
||||||
AbsListView.LayoutParams lp = new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT,
|
AbsListView.LayoutParams lp = new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT,
|
||||||
mFlexibleSpaceImageHeight);
|
mFlexibleSpaceImageHeight);
|
||||||
paddingView.setLayoutParams(lp);
|
paddingView.setLayoutParams(lp);
|
||||||
// This is required to disable header's list selector effect
|
// This is required to disable header's list selector effect
|
||||||
paddingView.setClickable(true);
|
paddingView.setClickable(true);
|
||||||
paddingView.setOnClickListener(listener);
|
paddingView.setOnClickListener(listener);
|
||||||
|
|
||||||
|
FrameLayout shadowContainer = new FrameLayout(mapActivity);
|
||||||
|
FrameLayout.LayoutParams fl = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
FrameLayout.LayoutParams.MATCH_PARENT);
|
||||||
|
fl.gravity = Gravity.BOTTOM;
|
||||||
|
shadowContainer.setLayoutParams(fl);
|
||||||
|
ImageView shadow = new ImageView(mapActivity);
|
||||||
|
shadow.setImageDrawable(mapActivity.getResources().getDrawable(R.drawable.bg_shadow_onmap));
|
||||||
|
shadow.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.BOTTOM));
|
||||||
|
shadow.setScaleType(ScaleType.FIT_XY);
|
||||||
|
shadowContainer.addView(shadow);
|
||||||
|
((FrameLayout)paddingView).addView(shadowContainer);
|
||||||
listView.addHeaderView(paddingView);
|
listView.addHeaderView(paddingView);
|
||||||
listBackgroundView = mapActivity.findViewById(R.id.dash_list_background);
|
listBackgroundView = mapActivity.findViewById(R.id.dash_list_background);
|
||||||
}
|
}
|
||||||
|
@ -378,8 +392,19 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
DashboardActionButton routeButton = new DashboardActionButton();
|
||||||
|
routeButton.icon = mapActivity.getResources().getDrawable(R.drawable.map_directions);
|
||||||
|
routeButton.onClickListener = new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
mapActivity.getMapLayers().getMapControlsLayer().doRoute();
|
||||||
|
hideDashboard();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
actionButtons.put(DashboardActionButtonType.MY_LOCATION, myLocationButton);
|
actionButtons.put(DashboardActionButtonType.MY_LOCATION, myLocationButton);
|
||||||
actionButtons.put(DashboardActionButtonType.NAVIGATE, navigateButton);
|
actionButtons.put(DashboardActionButtonType.NAVIGATE, navigateButton);
|
||||||
|
actionButtons.put(DashboardActionButtonType.ROUTE, routeButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setActionButton(DashboardType type) {
|
private void setActionButton(DashboardType type) {
|
||||||
|
@ -391,6 +416,21 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
button = actionButtons.get(DashboardActionButtonType.MY_LOCATION);
|
button = actionButtons.get(DashboardActionButtonType.MY_LOCATION);
|
||||||
} else if (type == DashboardType.ROUTE_PREFERENCES) {
|
} else if (type == DashboardType.ROUTE_PREFERENCES) {
|
||||||
button = actionButtons.get(DashboardActionButtonType.NAVIGATE);
|
button = actionButtons.get(DashboardActionButtonType.NAVIGATE);
|
||||||
|
} else if (type == DashboardType.WAYPOINTS || type == DashboardType.WAYPOINTS_EDIT || type == DashboardType.WAYPOINTS_FLAT) {
|
||||||
|
boolean routePlanningMode = false;
|
||||||
|
RoutingHelper rh = mapActivity.getRoutingHelper();
|
||||||
|
if (rh.isRoutePlanningMode()) {
|
||||||
|
routePlanningMode = true;
|
||||||
|
} else if ((rh.isRouteCalculated() || rh.isRouteBeingCalculated()) && !rh.isFollowingMode()) {
|
||||||
|
routePlanningMode = true;
|
||||||
|
}
|
||||||
|
boolean routeFollowingMode = !routePlanningMode && rh.isFollowingMode();
|
||||||
|
|
||||||
|
if (routePlanningMode || routeFollowingMode) {
|
||||||
|
button = actionButtons.get(DashboardActionButtonType.NAVIGATE);
|
||||||
|
} else {
|
||||||
|
button = actionButtons.get(DashboardActionButtonType.ROUTE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (button != null) {
|
if (button != null) {
|
||||||
|
@ -528,22 +568,30 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
private void applyDayNightMode() {
|
private void applyDayNightMode() {
|
||||||
if (nightMode) {
|
if (nightMode) {
|
||||||
if (listBackgroundView != null) {
|
if (listBackgroundView != null) {
|
||||||
listBackgroundView.setBackgroundColor(mapActivity.getResources().getColor(R.color.bg_color_dark));
|
listBackgroundView.setBackgroundColor(mapActivity.getResources().getColor(R.color.ctx_menu_info_view_bg_dark));
|
||||||
} else {
|
} else {
|
||||||
listView.setBackgroundColor(mapActivity.getResources().getColor(R.color.bg_color_dark));
|
listView.setBackgroundColor(mapActivity.getResources().getColor(R.color.ctx_menu_info_view_bg_dark));
|
||||||
}
|
}
|
||||||
|
if (visibleType != DashboardType.WAYPOINTS) {
|
||||||
Drawable d = new ColorDrawable(mapActivity.getResources().getColor(R.color.dashboard_divider_dark));
|
Drawable d = new ColorDrawable(mapActivity.getResources().getColor(R.color.dashboard_divider_dark));
|
||||||
listView.setDivider(d);
|
listView.setDivider(d);
|
||||||
listView.setDividerHeight(dpToPx(1f));
|
listView.setDividerHeight(dpToPx(1f));
|
||||||
} else {
|
} else {
|
||||||
if (listBackgroundView != null) {
|
listView.setDivider(null);
|
||||||
listBackgroundView.setBackgroundColor(mapActivity.getResources().getColor(R.color.bg_color_light));
|
|
||||||
} else {
|
|
||||||
listView.setBackgroundColor(mapActivity.getResources().getColor(R.color.bg_color_light));
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (listBackgroundView != null) {
|
||||||
|
listBackgroundView.setBackgroundColor(mapActivity.getResources().getColor(R.color.ctx_menu_info_view_bg_light));
|
||||||
|
} else {
|
||||||
|
listView.setBackgroundColor(mapActivity.getResources().getColor(R.color.ctx_menu_info_view_bg_light));
|
||||||
|
}
|
||||||
|
if (visibleType != DashboardType.WAYPOINTS) {
|
||||||
Drawable d = new ColorDrawable(mapActivity.getResources().getColor(R.color.dashboard_divider_light));
|
Drawable d = new ColorDrawable(mapActivity.getResources().getColor(R.color.dashboard_divider_light));
|
||||||
listView.setDivider(d);
|
listView.setDivider(d);
|
||||||
listView.setDividerHeight(dpToPx(1f));
|
listView.setDividerHeight(dpToPx(1f));
|
||||||
|
} else {
|
||||||
|
listView.setDivider(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -865,6 +913,9 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
|
|
||||||
private boolean isActionButtonVisible() {
|
private boolean isActionButtonVisible() {
|
||||||
return visibleType == DashboardType.DASHBOARD
|
return visibleType == DashboardType.DASHBOARD
|
||||||
|
|| visibleType == DashboardType.WAYPOINTS
|
||||||
|
|| visibleType == DashboardType.WAYPOINTS_EDIT
|
||||||
|
|| visibleType == DashboardType.WAYPOINTS_FLAT
|
||||||
|| visibleType == DashboardType.LIST_MENU
|
|| visibleType == DashboardType.LIST_MENU
|
||||||
|| visibleType == DashboardType.ROUTE_PREFERENCES
|
|| visibleType == DashboardType.ROUTE_PREFERENCES
|
||||||
|| visibleType == DashboardType.CONFIGURE_SCREEN;
|
|| visibleType == DashboardType.CONFIGURE_SCREEN;
|
||||||
|
|
|
@ -4,6 +4,8 @@ import android.app.Activity;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.DialogInterface.OnClickListener;
|
import android.content.DialogInterface.OnClickListener;
|
||||||
import android.content.DialogInterface.OnDismissListener;
|
import android.content.DialogInterface.OnDismissListener;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
|
@ -101,7 +103,7 @@ public class WaypointDialogHelper {
|
||||||
descr = pd.getName();
|
descr = pd.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(textShadow != null) {
|
if (textShadow != null) {
|
||||||
textShadow.setText(descr);
|
textShadow.setText(descr);
|
||||||
}
|
}
|
||||||
text.setText(descr);
|
text.setText(descr);
|
||||||
|
@ -116,7 +118,7 @@ public class WaypointDialogHelper {
|
||||||
final boolean edit, final List<LocationPointWrapper> deletedPoints,
|
final boolean edit, final List<LocationPointWrapper> deletedPoints,
|
||||||
final MapActivity ctx, final int[] running, final boolean flat, final boolean nightMode) {
|
final MapActivity ctx, final int[] running, final boolean flat, final boolean nightMode) {
|
||||||
final List<Object> points;
|
final List<Object> points;
|
||||||
if(flat) {
|
if (flat) {
|
||||||
points = new ArrayList<Object>(waypointHelper.getAllPoints());
|
points = new ArrayList<Object>(waypointHelper.getAllPoints());
|
||||||
} else {
|
} else {
|
||||||
points = getPoints();
|
points = getPoints();
|
||||||
|
@ -129,15 +131,38 @@ public class WaypointDialogHelper {
|
||||||
// User super class to create the View
|
// User super class to create the View
|
||||||
View v = convertView;
|
View v = convertView;
|
||||||
final ArrayAdapter<Object> thisAdapter = this;
|
final ArrayAdapter<Object> thisAdapter = this;
|
||||||
boolean labelView = (getItem(position) instanceof Integer);
|
Object obj = getItem(position);
|
||||||
if (getItem(position) instanceof RadiusItem) {
|
boolean labelView = (obj instanceof Integer);
|
||||||
final int type = ((RadiusItem) getItem(position)).type;
|
boolean topDividerView = (obj instanceof Boolean) && ((Boolean) obj);
|
||||||
|
boolean bottomDividerView = (obj instanceof Boolean) && !((Boolean) obj);
|
||||||
|
if (obj instanceof RadiusItem) {
|
||||||
|
final int type = ((RadiusItem) obj).type;
|
||||||
v = createItemForRadiusProximity(ctx, type, running, position, thisAdapter, nightMode);
|
v = createItemForRadiusProximity(ctx, type, running, position, thisAdapter, nightMode);
|
||||||
} else if (labelView) {
|
//Drawable d = new ColorDrawable(mapActivity.getResources().getColor(R.color.dashboard_divider_light));
|
||||||
v = createItemForCategory(ctx, (Integer) getItem(position), running, position, thisAdapter, nightMode);
|
if (nightMode) {
|
||||||
|
v.setBackgroundColor(mapActivity.getResources().getColor(R.color.bg_color_dark));
|
||||||
} else {
|
} else {
|
||||||
LocationPointWrapper point = (LocationPointWrapper) getItem(position);
|
v.setBackgroundColor(mapActivity.getResources().getColor(R.color.bg_color_light));
|
||||||
|
}
|
||||||
|
} else if (labelView) {
|
||||||
|
v = createItemForCategory(ctx, (Integer) obj, running, position, thisAdapter, nightMode);
|
||||||
|
if (nightMode) {
|
||||||
|
v.setBackgroundColor(mapActivity.getResources().getColor(R.color.bg_color_dark));
|
||||||
|
} else {
|
||||||
|
v.setBackgroundColor(mapActivity.getResources().getColor(R.color.bg_color_light));
|
||||||
|
}
|
||||||
|
} else if (topDividerView) {
|
||||||
|
v = ctx.getLayoutInflater().inflate(R.layout.card_top_divider, null);
|
||||||
|
} else if (bottomDividerView) {
|
||||||
|
v = ctx.getLayoutInflater().inflate(R.layout.card_bottom_divider, null);
|
||||||
|
} else if (obj instanceof LocationPointWrapper) {
|
||||||
|
LocationPointWrapper point = (LocationPointWrapper) obj;
|
||||||
v = updateWaypointItemView(edit, deletedPoints, app, ctx, v, point, this, nightMode);
|
v = updateWaypointItemView(edit, deletedPoints, app, ctx, v, point, this, nightMode);
|
||||||
|
if (nightMode) {
|
||||||
|
v.setBackgroundColor(mapActivity.getResources().getColor(R.color.bg_color_dark));
|
||||||
|
} else {
|
||||||
|
v.setBackgroundColor(mapActivity.getResources().getColor(R.color.bg_color_light));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
@ -147,7 +172,6 @@ public class WaypointDialogHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static View updateWaypointItemView(final boolean edit, final List<LocationPointWrapper> deletedPoints,
|
public static View updateWaypointItemView(final boolean edit, final List<LocationPointWrapper> deletedPoints,
|
||||||
final OsmandApplication app, final Activity ctx, View v, final LocationPointWrapper point,
|
final OsmandApplication app, final Activity ctx, View v, final LocationPointWrapper point,
|
||||||
final ArrayAdapter adapter, final boolean nightMode) {
|
final ArrayAdapter adapter, final boolean nightMode) {
|
||||||
|
@ -166,7 +190,7 @@ public class WaypointDialogHelper {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
deletedPoints.add(point);
|
deletedPoints.add(point);
|
||||||
if(adapter != null) {
|
if (adapter != null) {
|
||||||
adapter.remove(point);
|
adapter.remove(point);
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
@ -177,8 +201,6 @@ public class WaypointDialogHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected View createItemForRadiusProximity(final FragmentActivity ctx, final int type, final int[] running,
|
protected View createItemForRadiusProximity(final FragmentActivity ctx, final int type, final int[] running,
|
||||||
final int position, final ArrayAdapter<Object> thisAdapter, boolean nightMode) {
|
final int position, final ArrayAdapter<Object> thisAdapter, boolean nightMode) {
|
||||||
View v;
|
View v;
|
||||||
|
@ -230,7 +252,7 @@ public class WaypointDialogHelper {
|
||||||
v.setOnClickListener(new View.OnClickListener() {
|
v.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
if (type == WaypointHelper.POI && btn.isChecked()){
|
if (type == WaypointHelper.POI && btn.isChecked()) {
|
||||||
running[0] = position;
|
running[0] = position;
|
||||||
thisAdapter.notifyDataSetInvalidated();
|
thisAdapter.notifyDataSetInvalidated();
|
||||||
MapActivity map = (MapActivity) ctx;
|
MapActivity map = (MapActivity) ctx;
|
||||||
|
@ -390,7 +412,10 @@ public class WaypointDialogHelper {
|
||||||
if (!rc && i != WaypointHelper.WAYPOINTS && i != WaypointHelper.TARGETS) {
|
if (!rc && i != WaypointHelper.WAYPOINTS && i != WaypointHelper.TARGETS) {
|
||||||
// skip
|
// skip
|
||||||
} else if (waypointHelper.isTypeVisible(i)) {
|
} else if (waypointHelper.isTypeVisible(i)) {
|
||||||
points.add(new Integer(i));
|
if (points.size() > 0) {
|
||||||
|
points.add(true);
|
||||||
|
}
|
||||||
|
points.add(i);
|
||||||
if ((i == WaypointHelper.POI || i == WaypointHelper.FAVORITES || i == WaypointHelper.WAYPOINTS)
|
if ((i == WaypointHelper.POI || i == WaypointHelper.FAVORITES || i == WaypointHelper.WAYPOINTS)
|
||||||
&& rc) {
|
&& rc) {
|
||||||
if (waypointHelper.isTypeEnabled(i)) {
|
if (waypointHelper.isTypeEnabled(i)) {
|
||||||
|
@ -400,6 +425,7 @@ public class WaypointDialogHelper {
|
||||||
if (tp != null && tp.size() > 0) {
|
if (tp != null && tp.size() > 0) {
|
||||||
points.addAll(tp);
|
points.addAll(tp);
|
||||||
}
|
}
|
||||||
|
points.add(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return points;
|
return points;
|
||||||
|
@ -414,7 +440,7 @@ public class WaypointDialogHelper {
|
||||||
int fZoom = ctx.getMapView().getZoom() < 15 ? 15 : ctx.getMapView().getZoom();
|
int fZoom = ctx.getMapView().getZoom() < 15 ? 15 : ctx.getMapView().getZoom();
|
||||||
double flat = locationPoint.getLatitude();
|
double flat = locationPoint.getLatitude();
|
||||||
double flon = locationPoint.getLongitude();
|
double flon = locationPoint.getLongitude();
|
||||||
if(!center) {
|
if (!center) {
|
||||||
RotatedTileBox cp = ctx.getMapView().getCurrentRotatedTileBox().copy();
|
RotatedTileBox cp = ctx.getMapView().getCurrentRotatedTileBox().copy();
|
||||||
cp.setCenterLocation(0.5f, 0.25f);
|
cp.setCenterLocation(0.5f, 0.25f);
|
||||||
cp.setLatLonCenter(flat, flon);
|
cp.setLatLonCenter(flat, flon);
|
||||||
|
@ -434,7 +460,7 @@ public class WaypointDialogHelper {
|
||||||
} else {
|
} else {
|
||||||
thread.startMoving(flat, flon, fZoom, true);
|
thread.startMoving(flat, flon, fZoom, true);
|
||||||
}
|
}
|
||||||
if(ctx.getDashboard().isVisible()) {
|
if (ctx.getDashboard().isVisible()) {
|
||||||
ctx.getDashboard().hideDashboard();
|
ctx.getDashboard().hideDashboard();
|
||||||
ctx.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu().hide();
|
ctx.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu().hide();
|
||||||
ctx.getContextMenu().show(
|
ctx.getContextMenu().show(
|
||||||
|
|
|
@ -275,6 +275,7 @@ public class RoutePreferencesMenu {
|
||||||
LocalRoutingParameter parameter = getItem(position);
|
LocalRoutingParameter parameter = getItem(position);
|
||||||
if (parameter instanceof MuteSoundRoutingParameter) {
|
if (parameter instanceof MuteSoundRoutingParameter) {
|
||||||
View v = mapActivity.getLayoutInflater().inflate(R.layout.switch_select_list_item, null);
|
View v = mapActivity.getLayoutInflater().inflate(R.layout.switch_select_list_item, null);
|
||||||
|
AndroidUtils.setListItemBackground(mapActivity, v, nightMode);
|
||||||
v.findViewById(R.id.description_text).setVisibility(View.GONE);
|
v.findViewById(R.id.description_text).setVisibility(View.GONE);
|
||||||
v.findViewById(R.id.select_button).setVisibility(View.GONE);
|
v.findViewById(R.id.select_button).setVisibility(View.GONE);
|
||||||
((ImageView) v.findViewById(R.id.icon))
|
((ImageView) v.findViewById(R.id.icon))
|
||||||
|
@ -296,6 +297,7 @@ public class RoutePreferencesMenu {
|
||||||
}
|
}
|
||||||
if (parameter instanceof AvoidRoadsRoutingParameter) {
|
if (parameter instanceof AvoidRoadsRoutingParameter) {
|
||||||
View v = mapActivity.getLayoutInflater().inflate(R.layout.switch_select_list_item, null);
|
View v = mapActivity.getLayoutInflater().inflate(R.layout.switch_select_list_item, null);
|
||||||
|
AndroidUtils.setListItemBackground(mapActivity, v, nightMode);
|
||||||
((ImageView) v.findViewById(R.id.icon))
|
((ImageView) v.findViewById(R.id.icon))
|
||||||
.setImageDrawable(app.getIconsCache().getContentIcon(R.drawable.ic_action_road_works_dark, !nightMode));
|
.setImageDrawable(app.getIconsCache().getContentIcon(R.drawable.ic_action_road_works_dark, !nightMode));
|
||||||
v.findViewById(R.id.check_item).setVisibility(View.GONE);
|
v.findViewById(R.id.check_item).setVisibility(View.GONE);
|
||||||
|
@ -320,6 +322,7 @@ public class RoutePreferencesMenu {
|
||||||
}
|
}
|
||||||
if (parameter instanceof VoiceGuidanceRoutingParameter) {
|
if (parameter instanceof VoiceGuidanceRoutingParameter) {
|
||||||
View v = mapActivity.getLayoutInflater().inflate(R.layout.switch_select_list_item, null);
|
View v = mapActivity.getLayoutInflater().inflate(R.layout.switch_select_list_item, null);
|
||||||
|
AndroidUtils.setListItemBackground(mapActivity, v, nightMode);
|
||||||
v.findViewById(R.id.icon).setVisibility(View.GONE);
|
v.findViewById(R.id.icon).setVisibility(View.GONE);
|
||||||
v.findViewById(R.id.description_text).setVisibility(View.GONE);
|
v.findViewById(R.id.description_text).setVisibility(View.GONE);
|
||||||
v.findViewById(R.id.check_item).setVisibility(View.GONE);
|
v.findViewById(R.id.check_item).setVisibility(View.GONE);
|
||||||
|
@ -360,6 +363,7 @@ public class RoutePreferencesMenu {
|
||||||
}
|
}
|
||||||
if (parameter instanceof InterruptMusicRoutingParameter) {
|
if (parameter instanceof InterruptMusicRoutingParameter) {
|
||||||
View v = mapActivity.getLayoutInflater().inflate(R.layout.switch_select_list_item, null);
|
View v = mapActivity.getLayoutInflater().inflate(R.layout.switch_select_list_item, null);
|
||||||
|
AndroidUtils.setListItemBackground(mapActivity, v, nightMode);
|
||||||
v.findViewById(R.id.select_button).setVisibility(View.GONE);
|
v.findViewById(R.id.select_button).setVisibility(View.GONE);
|
||||||
v.findViewById(R.id.icon).setVisibility(View.GONE);
|
v.findViewById(R.id.icon).setVisibility(View.GONE);
|
||||||
final CompoundButton btn = (CompoundButton) v.findViewById(R.id.check_item);
|
final CompoundButton btn = (CompoundButton) v.findViewById(R.id.check_item);
|
||||||
|
@ -383,6 +387,7 @@ public class RoutePreferencesMenu {
|
||||||
}
|
}
|
||||||
if (parameter instanceof GpxLocalRoutingParameter) {
|
if (parameter instanceof GpxLocalRoutingParameter) {
|
||||||
View v = mapActivity.getLayoutInflater().inflate(R.layout.plan_route_gpx, null);
|
View v = mapActivity.getLayoutInflater().inflate(R.layout.plan_route_gpx, null);
|
||||||
|
AndroidUtils.setListItemBackground(mapActivity, v, nightMode);
|
||||||
AndroidUtils.setTextPrimaryColor(mapActivity, (TextView) v.findViewById(R.id.GPXRouteTitle), nightMode);
|
AndroidUtils.setTextPrimaryColor(mapActivity, (TextView) v.findViewById(R.id.GPXRouteTitle), nightMode);
|
||||||
final TextView gpxSpinner = (TextView) v.findViewById(R.id.GPXRouteSpinner);
|
final TextView gpxSpinner = (TextView) v.findViewById(R.id.GPXRouteSpinner);
|
||||||
AndroidUtils.setTextPrimaryColor(mapActivity, gpxSpinner, nightMode);
|
AndroidUtils.setTextPrimaryColor(mapActivity, gpxSpinner, nightMode);
|
||||||
|
@ -393,6 +398,7 @@ public class RoutePreferencesMenu {
|
||||||
}
|
}
|
||||||
if (parameter instanceof OtherSettingsRoutingParameter) {
|
if (parameter instanceof OtherSettingsRoutingParameter) {
|
||||||
View v = mapActivity.getLayoutInflater().inflate(R.layout.layers_list_activity_item, null);
|
View v = mapActivity.getLayoutInflater().inflate(R.layout.layers_list_activity_item, null);
|
||||||
|
AndroidUtils.setListItemBackground(mapActivity, v, nightMode);
|
||||||
final ImageView icon = (ImageView) v.findViewById(R.id.icon);
|
final ImageView icon = (ImageView) v.findViewById(R.id.icon);
|
||||||
icon.setImageDrawable(app.getIconsCache().getContentIcon(R.drawable.map_action_settings, !nightMode));
|
icon.setImageDrawable(app.getIconsCache().getContentIcon(R.drawable.map_action_settings, !nightMode));
|
||||||
icon.setVisibility(View.VISIBLE);
|
icon.setVisibility(View.VISIBLE);
|
||||||
|
@ -407,6 +413,7 @@ public class RoutePreferencesMenu {
|
||||||
|
|
||||||
private View inflateRoutingParameter(final int position) {
|
private View inflateRoutingParameter(final int position) {
|
||||||
View v = mapActivity.getLayoutInflater().inflate(R.layout.layers_list_activity_item, null);
|
View v = mapActivity.getLayoutInflater().inflate(R.layout.layers_list_activity_item, null);
|
||||||
|
AndroidUtils.setListItemBackground(mapActivity, v, nightMode);
|
||||||
final TextView tv = (TextView) v.findViewById(R.id.title);
|
final TextView tv = (TextView) v.findViewById(R.id.title);
|
||||||
final CheckBox ch = ((CheckBox) v.findViewById(R.id.check_item));
|
final CheckBox ch = ((CheckBox) v.findViewById(R.id.check_item));
|
||||||
final LocalRoutingParameter rp = getItem(position);
|
final LocalRoutingParameter rp = getItem(position);
|
||||||
|
|
|
@ -358,6 +358,12 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
routePlanButton.setOnClickListener(new View.OnClickListener() {
|
routePlanButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
doRoute();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void doRoute() {
|
||||||
if (OsmAndLocationProvider.isLocationPermissionAvailable(mapActivity)) {
|
if (OsmAndLocationProvider.isLocationPermissionAvailable(mapActivity)) {
|
||||||
onNavigationClick();
|
onNavigationClick();
|
||||||
} else {
|
} else {
|
||||||
|
@ -366,8 +372,6 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
REQUEST_LOCATION_FOR_NAVIGATION_PERMISSION);
|
REQUEST_LOCATION_FOR_NAVIGATION_PERMISSION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void doNavigate() {
|
public void doNavigate() {
|
||||||
mapRouteInfoMenu.hide();
|
mapRouteInfoMenu.hide();
|
||||||
|
|
Loading…
Reference in a new issue