diff --git a/OsmAnd/res/layout/map_context_menu_fragment.xml b/OsmAnd/res/layout/map_context_menu_fragment.xml
index be85bf4a77..f271294c8f 100644
--- a/OsmAnd/res/layout/map_context_menu_fragment.xml
+++ b/OsmAnd/res/layout/map_context_menu_fragment.xml
@@ -298,6 +298,7 @@
android:src="@drawable/map_action_fav_dark"/>
@@ -313,6 +314,7 @@
android:src="@drawable/map_action_flag_dark"/>
@@ -328,6 +330,7 @@
android:src="@drawable/map_action_gshare_dark"/>
diff --git a/OsmAnd/res/values/colors.xml b/OsmAnd/res/values/colors.xml
index 52c98a44c5..04cc12659c 100644
--- a/OsmAnd/res/values/colors.xml
+++ b/OsmAnd/res/values/colors.xml
@@ -1,6 +1,11 @@
+ #de000000
+ #8a000000
+ #ffffffff
+ #b3ffffff
+
#128a89
#4caf50
#d44a4a
diff --git a/OsmAnd/src/net/osmand/AndroidUtils.java b/OsmAnd/src/net/osmand/AndroidUtils.java
index 63050e10c8..644392aaaf 100644
--- a/OsmAnd/src/net/osmand/AndroidUtils.java
+++ b/OsmAnd/src/net/osmand/AndroidUtils.java
@@ -1,8 +1,6 @@
package net.osmand;
-import java.util.Date;
-
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Configuration;
@@ -11,6 +9,11 @@ import android.text.format.DateFormat;
import android.view.View;
import android.view.ViewParent;
import android.view.inputmethod.InputMethodManager;
+import android.widget.TextView;
+
+import net.osmand.plus.R;
+
+import java.util.Date;
public class AndroidUtils {
@@ -77,4 +80,20 @@ public class AndroidUtils {
view.setBackgroundDrawable(ctx.getResources().getDrawable(night ? darkResId : lightResId));
}
}
+
+ public static void setDashButtonBackground(Context ctx, View view, boolean night) {
+ setBackground(ctx, view, night, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
+ }
+
+ public static void setTextPrimaryColor(Context ctx, TextView textView, boolean night) {
+ textView.setTextColor(night ?
+ ctx.getResources().getColor(R.color.primary_text_dark)
+ : ctx.getResources().getColor(R.color.primary_text_light));
+ }
+
+ public static void setTextSecondaryColor(Context ctx, TextView textView, boolean night) {
+ textView.setTextColor(night ?
+ ctx.getResources().getColor(R.color.secondary_text_dark)
+ : ctx.getResources().getColor(R.color.secondary_text_light));
+ }
}
diff --git a/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java b/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java
index 99c6187cca..311ae84364 100644
--- a/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java
+++ b/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java
@@ -14,6 +14,7 @@ import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
+import net.osmand.AndroidUtils;
import net.osmand.PlatformUtil;
import net.osmand.plus.activities.actions.AppModeDialog;
import net.osmand.plus.dialogs.ConfigureMapMenu;
@@ -330,7 +331,7 @@ public class ContextMenuAdapter {
Integer lid = getLayoutId(position);
if (lid == R.layout.mode_toggles) {
final Set selected = new LinkedHashSet();
- return AppModeDialog.prepareAppModeDrawerView(activity, visibleModes, selected, allModes, false, new View.OnClickListener() {
+ return AppModeDialog.prepareAppModeDrawerView(activity, visibleModes, selected, allModes, true, new View.OnClickListener() {
@Override
public void onClick(View view) {
if (selected.size() > 0) {
@@ -348,6 +349,9 @@ public class ContextMenuAdapter {
convertView.setTag(lid);
}
TextView tv = (TextView) convertView.findViewById(R.id.title);
+ if (!isCategory(position)) {
+ AndroidUtils.setTextPrimaryColor(ctx, tv, !holoLight);
+ }
tv.setText(isCategory(position) ? getItemName(position).toUpperCase() : getItemName(position));
if (layoutId == R.layout.simple_list_menu_item) {
diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
index 84b452fbcf..1d4a56deae 100644
--- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
+++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
@@ -763,6 +763,7 @@ public class MapActivity extends AccessibleActivity implements DownloadEvents,
mapLayers.getMapInfoLayer().recreateControls();
}
mapLayers.updateLayers(mapView);
+ mapActions.updateDrawerMenu();
mapView.setComplexZoom(mapView.getZoom(), mapView.getSettingsMapDensity());
app.getDaynightHelper().startSensorIfNeeded(new StateChangedListener() {
diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
index 011667d67f..41f3877b55 100644
--- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
+++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
@@ -4,6 +4,8 @@ import android.app.Activity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
+import android.graphics.drawable.ColorDrawable;
+import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
@@ -797,15 +799,19 @@ public class MapActivityActions implements DialogProvider {
menu.show();
}
-
-
protected void updateDrawerMenu() {
+ boolean nightMode = getMyApplication().getDaynightHelper().isNightMode();
final ListView menuItemsListView = (ListView) mapActivity.findViewById(R.id.menuItems);
+ if (nightMode) {
+ menuItemsListView.setBackgroundColor(mapActivity.getResources().getColor(R.color.bg_color_dark));
+ } else {
+ menuItemsListView.setBackgroundColor(mapActivity.getResources().getColor(R.color.bg_color_light));
+ }
menuItemsListView.setDivider(null);
final ContextMenuAdapter contextMenuAdapter = createMainOptionsMenu();
contextMenuAdapter.setDefaultLayoutId(R.layout.simple_list_menu_item);
final ArrayAdapter> simpleListAdapter = contextMenuAdapter.createListAdapter(mapActivity,
- settings.OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_THEME);
+ !nightMode);
menuItemsListView.setAdapter(simpleListAdapter);
menuItemsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashWaypointsFragment.java b/OsmAnd/src/net/osmand/plus/dashboard/DashWaypointsFragment.java
index 6c0cc3e4a8..0d9ad80bf0 100644
--- a/OsmAnd/src/net/osmand/plus/dashboard/DashWaypointsFragment.java
+++ b/OsmAnd/src/net/osmand/plus/dashboard/DashWaypointsFragment.java
@@ -95,7 +95,8 @@ public class DashWaypointsFragment extends DashLocationFragment {
LocationPointWrapper ps = allPoints.get(i);
View dv = getActivity().getLayoutInflater().inflate(R.layout.divider, null);
favorites.addView(dv);
- View v = WaypointDialogHelper.updateWaypointItemView(false, null, getMyApplication(), getActivity(), null, ps, null);
+ View v = WaypointDialogHelper.updateWaypointItemView(false, null, getMyApplication(),
+ getActivity(), null, ps, null, !getMyApplication().getSettings().isLightContent());
favorites.addView(v);
}
diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java b/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java
index ef11458bbe..f858c59b69 100644
--- a/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java
+++ b/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java
@@ -2,12 +2,15 @@ package net.osmand.plus.dashboard;
import android.annotation.SuppressLint;
import android.content.Intent;
+import android.content.res.Resources;
+import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.widget.Toolbar;
+import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
import android.view.animation.Animation;
@@ -57,9 +60,13 @@ import net.osmand.plus.views.OsmandMapTileView;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
+
+import static android.util.TypedValue.COMPLEX_UNIT_DIP;
/**
*/
@@ -124,6 +131,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
private final int[] running = new int[]{-1};
private List deletedPoints = new ArrayList<>();
private Drawable gradientToolbar;
+ boolean nightMode;
public DashFragmentData[] getFragmentsData() {
return fragmentsData;
@@ -136,9 +144,22 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
CONFIGURE_SCREEN,
CONFIGURE_MAP,
LIST_MENU,
+ ROUTE_SETTINGS,
DASHBOARD
}
+ private Map actionButtons = new HashMap<>();
+
+ public enum DashboardActionButtonType {
+ MY_LOCATION,
+ NAVIGATE
+ }
+
+ private class DashboardActionButton {
+ private Drawable icon;
+ private View.OnClickListener onClickListener;
+ }
+
public DashboardOnMap(MapActivity ma) {
this.mapActivity = ma;
}
@@ -181,7 +202,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
dashboardView.findViewById(R.id.animateContent).setOnClickListener(listener);
dashboardView.findViewById(R.id.map_part_dashboard).setOnClickListener(listener);
- initActionButton();
+ initActionButtons();
dashboardView.addView(actionButton);
}
@@ -312,7 +333,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
}
- private void initActionButton() {
+ private void initActionButtons() {
actionButton = new ImageView(mapActivity);
int btnSize = (int) mapActivity.getResources().getDimension(R.dimen.map_button_size);
int topPad = (int) mapActivity.getResources().getDimension(R.dimen.dashboard_map_top_padding);
@@ -325,11 +346,13 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
params.gravity = landscape ? Gravity.BOTTOM | Gravity.RIGHT : Gravity.TOP | Gravity.RIGHT;
actionButton.setLayoutParams(params);
actionButton.setScaleType(ScaleType.CENTER);
- actionButton.setImageDrawable(mapActivity.getResources().getDrawable(R.drawable.map_my_location));
-
actionButton.setBackgroundDrawable(mapActivity.getResources().getDrawable(R.drawable.btn_circle_blue));
hideActionButton();
- actionButton.setOnClickListener(new View.OnClickListener() {
+
+
+ DashboardActionButton myLocationButton = new DashboardActionButton();
+ myLocationButton.icon = mapActivity.getResources().getDrawable(R.drawable.map_my_location);
+ myLocationButton.onClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
if (getMyApplication().accessibilityEnabled()) {
@@ -339,9 +362,38 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
}
hideDashboard();
}
- });
+ };
+
+ DashboardActionButton navigateButton = new DashboardActionButton();
+ navigateButton.icon = mapActivity.getResources().getDrawable(R.drawable.map_start_navigation);
+ navigateButton.onClickListener = new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+
+ hideDashboard();
+ }
+ };
+
+ actionButtons.put(DashboardActionButtonType.MY_LOCATION, myLocationButton);
+ actionButtons.put(DashboardActionButtonType.NAVIGATE, navigateButton);
}
+ private void setActionButton(DashboardType type) {
+ DashboardActionButton button = null;
+
+ if (type == DashboardType.DASHBOARD
+ || type == DashboardType.LIST_MENU
+ || type == DashboardType.CONFIGURE_SCREEN) {
+ button = actionButtons.get(DashboardActionButtonType.MY_LOCATION);
+ } else if (type == DashboardType.ROUTE_SETTINGS) {
+ button = actionButtons.get(DashboardActionButtonType.NAVIGATE);
+ }
+
+ if (button != null) {
+ actionButton.setImageDrawable(button.icon);
+ actionButton.setOnClickListener(button.onClickListener);
+ }
+ }
private void hideActionButton() {
actionButton.setVisibility(View.GONE);
@@ -403,6 +455,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
if (visible == this.visible && type == visibleType) {
return;
}
+ nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightMode();
this.previousVisibleType = prevItem;
this.visible = visible;
boolean refresh = this.visibleType == type;
@@ -419,6 +472,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
mapActivity.disableDrawer();
dashboardView.setVisibility(View.VISIBLE);
if (isActionButtonVisible()) {
+ setActionButton(visibleType);
actionButton.setVisibility(View.VISIBLE);
} else {
hideActionButton();
@@ -444,6 +498,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
updateListAdapter();
updateListBackgroundHeight();
}
+ applyDayNightMode();
}
mapActivity.findViewById(R.id.toolbar_back).setVisibility(isBackButtonVisible() ? View.VISIBLE : View.GONE);
mapActivity.findViewById(R.id.MapHudButtonsOverlay).setVisibility(View.INVISIBLE);
@@ -466,18 +521,41 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
}
}
+ private void applyDayNightMode() {
+ if (nightMode) {
+ listBackgroundView.setBackgroundColor(mapActivity.getResources().getColor(R.color.bg_color_dark));
+ Drawable d = new ColorDrawable(mapActivity.getResources().getColor(R.color.dashboard_divider_light));
+ listView.setDivider(d);
+ listView.setDividerHeight(dpToPx(1f));
+ } else {
+ listBackgroundView.setBackgroundColor(mapActivity.getResources().getColor(R.color.bg_color_light));
+ Drawable d = new ColorDrawable(mapActivity.getResources().getColor(R.color.dashboard_divider_dark));
+ listView.setDivider(d);
+ listView.setDividerHeight(dpToPx(1f));
+ }
+ }
+
+ private int dpToPx(float dp) {
+ Resources r = mapActivity.getResources();
+ return (int) TypedValue.applyDimension(
+ COMPLEX_UNIT_DIP,
+ dp,
+ r.getDisplayMetrics()
+ );
+ }
+
private void updateListAdapter() {
ContextMenuAdapter cm = null;
if (DashboardType.WAYPOINTS == visibleType || DashboardType.WAYPOINTS_FLAT == visibleType) {
ArrayAdapter