Merge branch 'master' of https://github.com/osmandapp/Osmand
This commit is contained in:
commit
56bf62e942
30 changed files with 398 additions and 124 deletions
|
@ -50,6 +50,7 @@
|
||||||
</android.support.v7.widget.Toolbar>
|
</android.support.v7.widget.Toolbar>
|
||||||
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
|
android:id="@+id/editor_scroll_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?attr/ctx_menu_info_view_bg"
|
android:background="?attr/ctx_menu_info_view_bg"
|
||||||
|
@ -211,6 +212,7 @@
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/description_info_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:baselineAligned="false"
|
android:baselineAligned="false"
|
||||||
|
|
|
@ -3,13 +3,14 @@
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="350dp"
|
android:layout_width="350dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?attr/left_menu_view_bg">
|
android:background="@android:color/transparent">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/main_view"
|
android:id="@+id/main_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
|
android:background="?attr/left_menu_view_bg"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
|
|
@ -298,6 +298,7 @@
|
||||||
android:src="@drawable/map_action_fav_dark"/>
|
android:src="@drawable/map_action_fav_dark"/>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
|
android:id="@+id/divider_hor_1"
|
||||||
android:layout_width="1dp"
|
android:layout_width="1dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?attr/dashboard_divider"/>
|
android:background="?attr/dashboard_divider"/>
|
||||||
|
@ -313,6 +314,7 @@
|
||||||
android:src="@drawable/map_action_flag_dark"/>
|
android:src="@drawable/map_action_flag_dark"/>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
|
android:id="@+id/divider_hor_2"
|
||||||
android:layout_width="1dp"
|
android:layout_width="1dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?attr/dashboard_divider"/>
|
android:background="?attr/dashboard_divider"/>
|
||||||
|
@ -328,6 +330,7 @@
|
||||||
android:src="@drawable/map_action_gshare_dark"/>
|
android:src="@drawable/map_action_gshare_dark"/>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
|
android:id="@+id/divider_hor_3"
|
||||||
android:layout_width="1dp"
|
android:layout_width="1dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?attr/dashboard_divider"/>
|
android:background="?attr/dashboard_divider"/>
|
||||||
|
|
|
@ -208,6 +208,7 @@
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/description_info_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:baselineAligned="false"
|
android:baselineAligned="false"
|
||||||
|
|
|
@ -918,8 +918,8 @@
|
||||||
<string name="poi_wheelchair_no">Недоступно для инвалидных кресел</string>
|
<string name="poi_wheelchair_no">Недоступно для инвалидных кресел</string>
|
||||||
<string name="poi_wheelchair_limited">Инвалидные кресла: ограничено</string>
|
<string name="poi_wheelchair_limited">Инвалидные кресла: ограничено</string>
|
||||||
<string name="poi_wholesale">Опт</string>
|
<string name="poi_wholesale">Опт</string>
|
||||||
<string name="poi_parking_underground">Подземный(ая)</string>
|
<string name="poi_parking_underground">Тип: подземная</string>
|
||||||
<string name="poi_parking_multi_storey">Многоэтажный(ая)</string>
|
<string name="poi_parking_multi_storey">Тип: многоэтажная</string>
|
||||||
|
|
||||||
<string name="poi_bicycle_parking_anchors">Закреплённое кольцо</string>
|
<string name="poi_bicycle_parking_anchors">Закреплённое кольцо</string>
|
||||||
<string name="poi_bicycle_parking_stands">Стойка</string>
|
<string name="poi_bicycle_parking_stands">Стойка</string>
|
||||||
|
@ -1122,7 +1122,7 @@
|
||||||
<string name="poi_farmland">Сельскохозяйственные угодья</string>
|
<string name="poi_farmland">Сельскохозяйственные угодья</string>
|
||||||
<string name="poi_logging">Вырубка</string>
|
<string name="poi_logging">Вырубка</string>
|
||||||
<string name="poi_sand">Песок</string>
|
<string name="poi_sand">Песок</string>
|
||||||
<string name="poi_village_green">Общественная территория в центре населённого пункта</string>
|
<string name="poi_village_green">Общественная территория</string>
|
||||||
<string name="poi_brownfield">Земли под застройку (использованные ранее)</string>
|
<string name="poi_brownfield">Земли под застройку (использованные ранее)</string>
|
||||||
<string name="poi_greenfield">Земли под застройку</string>
|
<string name="poi_greenfield">Земли под застройку</string>
|
||||||
<string name="poi_bunker_silo">Сооружение для хранения силоса</string>
|
<string name="poi_bunker_silo">Сооружение для хранения силоса</string>
|
||||||
|
@ -2545,4 +2545,15 @@
|
||||||
|
|
||||||
<string name="poi_billiards">Бильярд</string>
|
<string name="poi_billiards">Бильярд</string>
|
||||||
|
|
||||||
|
<string name="poi_microwave_oven_yes">Микроволновая печь: присутствует</string>
|
||||||
|
<string name="poi_microwave_oven_no">Микроволновая печь: отсутствует</string>
|
||||||
|
<string name="poi_water_heater_yes">Водонагреватель: присутствует</string>
|
||||||
|
<string name="poi_water_heater_no">Водонагреватель: отсутствует</string>
|
||||||
|
|
||||||
|
<string name="poi_parking_surface">Тип: на поверхности</string>
|
||||||
|
<string name="poi_parking_garage_boxes">Тип: гаражи</string>
|
||||||
|
<string name="poi_parking_carports">Тип: навес</string>
|
||||||
|
|
||||||
|
<string name="poi_dojo">Додзё</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
|
<color name="primary_text_light">#de000000</color>
|
||||||
|
<color name="secondary_text_light">#8a000000</color>
|
||||||
|
<color name="primary_text_dark">#ffffffff</color>
|
||||||
|
<color name="secondary_text_dark">#b3ffffff</color>
|
||||||
|
|
||||||
<color name="audio_video_icon_color">#128a89</color>
|
<color name="audio_video_icon_color">#128a89</color>
|
||||||
<color name="created_poi_icon_color">#4caf50</color>
|
<color name="created_poi_icon_color">#4caf50</color>
|
||||||
<color name="osm_bug_unresolved_icon_color">#d44a4a</color>
|
<color name="osm_bug_unresolved_icon_color">#d44a4a</color>
|
||||||
|
|
|
@ -1163,8 +1163,8 @@
|
||||||
<string name="poi_trade_tile">Tile supplies</string>
|
<string name="poi_trade_tile">Tile supplies</string>
|
||||||
|
|
||||||
<string name="poi_population">Population</string>
|
<string name="poi_population">Population</string>
|
||||||
<string name="poi_parking_underground">Underground</string>
|
<string name="poi_parking_underground">Type: underground</string>
|
||||||
<string name="poi_parking_multi_storey">Multi-storey</string>
|
<string name="poi_parking_multi_storey">Type: multi-storey</string>
|
||||||
|
|
||||||
<string name="poi_bicycle_parking_anchors">Anchors</string>
|
<string name="poi_bicycle_parking_anchors">Anchors</string>
|
||||||
<string name="poi_bicycle_parking_stands">Stands</string>
|
<string name="poi_bicycle_parking_stands">Stands</string>
|
||||||
|
@ -2539,4 +2539,15 @@
|
||||||
|
|
||||||
<string name="poi_billiards">Billiards</string>
|
<string name="poi_billiards">Billiards</string>
|
||||||
|
|
||||||
|
<string name="poi_microwave_oven_yes">Microwave oven: yes</string>
|
||||||
|
<string name="poi_microwave_oven_no">Microwave oven: no</string>
|
||||||
|
<string name="poi_water_heater_yes">Water heater: yes</string>
|
||||||
|
<string name="poi_water_heater_no">Water heater: no</string>
|
||||||
|
|
||||||
|
<string name="poi_parking_surface">Type: surface</string>
|
||||||
|
<string name="poi_parking_garage_boxes">Type: garage boxes</string>
|
||||||
|
<string name="poi_parking_carports">Type: carports</string>
|
||||||
|
|
||||||
|
<string name="poi_dojo">Dojo</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package net.osmand;
|
package net.osmand;
|
||||||
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
|
@ -11,6 +9,11 @@ import android.text.format.DateFormat;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewParent;
|
import android.view.ViewParent;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
public class AndroidUtils {
|
public class AndroidUtils {
|
||||||
|
|
||||||
|
@ -77,4 +80,27 @@ public class AndroidUtils {
|
||||||
view.setBackgroundDrawable(ctx.getResources().getDrawable(night ? darkResId : lightResId));
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setHintTextSecondaryColor(Context ctx, TextView textView, boolean night) {
|
||||||
|
textView.setHintTextColor(night ?
|
||||||
|
ctx.getResources().getColor(R.color.secondary_text_dark)
|
||||||
|
: ctx.getResources().getColor(R.color.secondary_text_light));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import android.widget.ImageView;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.plus.activities.actions.AppModeDialog;
|
import net.osmand.plus.activities.actions.AppModeDialog;
|
||||||
import net.osmand.plus.dialogs.ConfigureMapMenu;
|
import net.osmand.plus.dialogs.ConfigureMapMenu;
|
||||||
|
@ -330,7 +331,7 @@ public class ContextMenuAdapter {
|
||||||
Integer lid = getLayoutId(position);
|
Integer lid = getLayoutId(position);
|
||||||
if (lid == R.layout.mode_toggles) {
|
if (lid == R.layout.mode_toggles) {
|
||||||
final Set<ApplicationMode> selected = new LinkedHashSet<ApplicationMode>();
|
final Set<ApplicationMode> selected = new LinkedHashSet<ApplicationMode>();
|
||||||
return AppModeDialog.prepareAppModeDrawerView(activity, visibleModes, selected, allModes, false, new View.OnClickListener() {
|
return AppModeDialog.prepareAppModeDrawerView(activity, visibleModes, selected, allModes, true, new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
if (selected.size() > 0) {
|
if (selected.size() > 0) {
|
||||||
|
@ -348,6 +349,9 @@ public class ContextMenuAdapter {
|
||||||
convertView.setTag(lid);
|
convertView.setTag(lid);
|
||||||
}
|
}
|
||||||
TextView tv = (TextView) convertView.findViewById(R.id.title);
|
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));
|
tv.setText(isCategory(position) ? getItemName(position).toUpperCase() : getItemName(position));
|
||||||
|
|
||||||
if (layoutId == R.layout.simple_list_menu_item) {
|
if (layoutId == R.layout.simple_list_menu_item) {
|
||||||
|
|
|
@ -763,6 +763,7 @@ public class MapActivity extends AccessibleActivity implements DownloadEvents,
|
||||||
mapLayers.getMapInfoLayer().recreateControls();
|
mapLayers.getMapInfoLayer().recreateControls();
|
||||||
}
|
}
|
||||||
mapLayers.updateLayers(mapView);
|
mapLayers.updateLayers(mapView);
|
||||||
|
mapActions.updateDrawerMenu();
|
||||||
mapView.setComplexZoom(mapView.getZoom(), mapView.getSettingsMapDensity());
|
mapView.setComplexZoom(mapView.getZoom(), mapView.getSettingsMapDensity());
|
||||||
app.getDaynightHelper().startSensorIfNeeded(new StateChangedListener<Boolean>() {
|
app.getDaynightHelper().startSensorIfNeeded(new StateChangedListener<Boolean>() {
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,8 @@ import android.app.Activity;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
|
@ -797,15 +799,19 @@ public class MapActivityActions implements DialogProvider {
|
||||||
menu.show();
|
menu.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected void updateDrawerMenu() {
|
protected void updateDrawerMenu() {
|
||||||
|
boolean nightMode = getMyApplication().getDaynightHelper().isNightMode();
|
||||||
final ListView menuItemsListView = (ListView) mapActivity.findViewById(R.id.menuItems);
|
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);
|
menuItemsListView.setDivider(null);
|
||||||
final ContextMenuAdapter contextMenuAdapter = createMainOptionsMenu();
|
final ContextMenuAdapter contextMenuAdapter = createMainOptionsMenu();
|
||||||
contextMenuAdapter.setDefaultLayoutId(R.layout.simple_list_menu_item);
|
contextMenuAdapter.setDefaultLayoutId(R.layout.simple_list_menu_item);
|
||||||
final ArrayAdapter<?> simpleListAdapter = contextMenuAdapter.createListAdapter(mapActivity,
|
final ArrayAdapter<?> simpleListAdapter = contextMenuAdapter.createListAdapter(mapActivity,
|
||||||
settings.OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_THEME);
|
!nightMode);
|
||||||
menuItemsListView.setAdapter(simpleListAdapter);
|
menuItemsListView.setAdapter(simpleListAdapter);
|
||||||
menuItemsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
menuItemsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1018,7 +1018,11 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
public void takePhoto(final double lat, final double lon, final MapActivity mapActivity) {
|
public void takePhoto(final double lat, final double lon, final MapActivity mapActivity) {
|
||||||
if (ActivityCompat.checkSelfPermission(mapActivity, Manifest.permission.CAMERA)
|
if (ActivityCompat.checkSelfPermission(mapActivity, Manifest.permission.CAMERA)
|
||||||
== PackageManager.PERMISSION_GRANTED) {
|
== PackageManager.PERMISSION_GRANTED) {
|
||||||
|
if (AV_EXTERNAL_PHOTO_CAM.get()) {
|
||||||
|
takePhotoExternal(lat, lon, mapActivity);
|
||||||
|
} else {
|
||||||
takePhotoInternalOrExternal(lat, lon, mapActivity);
|
takePhotoInternalOrExternal(lat, lon, mapActivity);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
actionLat = lat;
|
actionLat = lat;
|
||||||
actionLon = lon;
|
actionLon = lon;
|
||||||
|
|
|
@ -95,7 +95,8 @@ public class DashWaypointsFragment extends DashLocationFragment {
|
||||||
LocationPointWrapper ps = allPoints.get(i);
|
LocationPointWrapper ps = allPoints.get(i);
|
||||||
View dv = getActivity().getLayoutInflater().inflate(R.layout.divider, null);
|
View dv = getActivity().getLayoutInflater().inflate(R.layout.divider, null);
|
||||||
favorites.addView(dv);
|
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);
|
favorites.addView(v);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,15 @@ package net.osmand.plus.dashboard;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v4.app.FragmentTransaction;
|
import android.support.v4.app.FragmentTransaction;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
|
import android.util.TypedValue;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.animation.Animation;
|
import android.view.animation.Animation;
|
||||||
|
@ -57,9 +60,13 @@ import net.osmand.plus.views.OsmandMapTileView;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
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 final int[] running = new int[]{-1};
|
||||||
private List<LocationPointWrapper> deletedPoints = new ArrayList<>();
|
private List<LocationPointWrapper> deletedPoints = new ArrayList<>();
|
||||||
private Drawable gradientToolbar;
|
private Drawable gradientToolbar;
|
||||||
|
boolean nightMode;
|
||||||
|
|
||||||
public DashFragmentData[] getFragmentsData() {
|
public DashFragmentData[] getFragmentsData() {
|
||||||
return fragmentsData;
|
return fragmentsData;
|
||||||
|
@ -136,9 +144,22 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
CONFIGURE_SCREEN,
|
CONFIGURE_SCREEN,
|
||||||
CONFIGURE_MAP,
|
CONFIGURE_MAP,
|
||||||
LIST_MENU,
|
LIST_MENU,
|
||||||
|
ROUTE_SETTINGS,
|
||||||
DASHBOARD
|
DASHBOARD
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Map<DashboardActionButtonType, DashboardActionButton> actionButtons = new HashMap<>();
|
||||||
|
|
||||||
|
public enum DashboardActionButtonType {
|
||||||
|
MY_LOCATION,
|
||||||
|
NAVIGATE
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DashboardActionButton {
|
||||||
|
private Drawable icon;
|
||||||
|
private View.OnClickListener onClickListener;
|
||||||
|
}
|
||||||
|
|
||||||
public DashboardOnMap(MapActivity ma) {
|
public DashboardOnMap(MapActivity ma) {
|
||||||
this.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.animateContent).setOnClickListener(listener);
|
||||||
dashboardView.findViewById(R.id.map_part_dashboard).setOnClickListener(listener);
|
dashboardView.findViewById(R.id.map_part_dashboard).setOnClickListener(listener);
|
||||||
|
|
||||||
initActionButton();
|
initActionButtons();
|
||||||
dashboardView.addView(actionButton);
|
dashboardView.addView(actionButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,7 +333,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void initActionButton() {
|
private void initActionButtons() {
|
||||||
actionButton = new ImageView(mapActivity);
|
actionButton = new ImageView(mapActivity);
|
||||||
int btnSize = (int) mapActivity.getResources().getDimension(R.dimen.map_button_size);
|
int btnSize = (int) mapActivity.getResources().getDimension(R.dimen.map_button_size);
|
||||||
int topPad = (int) mapActivity.getResources().getDimension(R.dimen.dashboard_map_top_padding);
|
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;
|
params.gravity = landscape ? Gravity.BOTTOM | Gravity.RIGHT : Gravity.TOP | Gravity.RIGHT;
|
||||||
actionButton.setLayoutParams(params);
|
actionButton.setLayoutParams(params);
|
||||||
actionButton.setScaleType(ScaleType.CENTER);
|
actionButton.setScaleType(ScaleType.CENTER);
|
||||||
actionButton.setImageDrawable(mapActivity.getResources().getDrawable(R.drawable.map_my_location));
|
|
||||||
|
|
||||||
actionButton.setBackgroundDrawable(mapActivity.getResources().getDrawable(R.drawable.btn_circle_blue));
|
actionButton.setBackgroundDrawable(mapActivity.getResources().getDrawable(R.drawable.btn_circle_blue));
|
||||||
hideActionButton();
|
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
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (getMyApplication().accessibilityEnabled()) {
|
if (getMyApplication().accessibilityEnabled()) {
|
||||||
|
@ -339,9 +362,38 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
}
|
}
|
||||||
hideDashboard();
|
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() {
|
private void hideActionButton() {
|
||||||
actionButton.setVisibility(View.GONE);
|
actionButton.setVisibility(View.GONE);
|
||||||
|
@ -403,6 +455,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
if (visible == this.visible && type == visibleType) {
|
if (visible == this.visible && type == visibleType) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightMode();
|
||||||
this.previousVisibleType = prevItem;
|
this.previousVisibleType = prevItem;
|
||||||
this.visible = visible;
|
this.visible = visible;
|
||||||
boolean refresh = this.visibleType == type;
|
boolean refresh = this.visibleType == type;
|
||||||
|
@ -419,6 +472,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
mapActivity.disableDrawer();
|
mapActivity.disableDrawer();
|
||||||
dashboardView.setVisibility(View.VISIBLE);
|
dashboardView.setVisibility(View.VISIBLE);
|
||||||
if (isActionButtonVisible()) {
|
if (isActionButtonVisible()) {
|
||||||
|
setActionButton(visibleType);
|
||||||
actionButton.setVisibility(View.VISIBLE);
|
actionButton.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
hideActionButton();
|
hideActionButton();
|
||||||
|
@ -444,6 +498,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
updateListAdapter();
|
updateListAdapter();
|
||||||
updateListBackgroundHeight();
|
updateListBackgroundHeight();
|
||||||
}
|
}
|
||||||
|
applyDayNightMode();
|
||||||
}
|
}
|
||||||
mapActivity.findViewById(R.id.toolbar_back).setVisibility(isBackButtonVisible() ? View.VISIBLE : View.GONE);
|
mapActivity.findViewById(R.id.toolbar_back).setVisibility(isBackButtonVisible() ? View.VISIBLE : View.GONE);
|
||||||
mapActivity.findViewById(R.id.MapHudButtonsOverlay).setVisibility(View.INVISIBLE);
|
mapActivity.findViewById(R.id.MapHudButtonsOverlay).setVisibility(View.INVISIBLE);
|
||||||
|
@ -466,18 +521,49 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void applyDayNightMode() {
|
||||||
|
if (nightMode) {
|
||||||
|
if (listBackgroundView != null) {
|
||||||
|
listBackgroundView.setBackgroundColor(mapActivity.getResources().getColor(R.color.bg_color_dark));
|
||||||
|
} else {
|
||||||
|
listView.setBackgroundColor(mapActivity.getResources().getColor(R.color.bg_color_dark));
|
||||||
|
}
|
||||||
|
Drawable d = new ColorDrawable(mapActivity.getResources().getColor(R.color.dashboard_divider_dark));
|
||||||
|
listView.setDivider(d);
|
||||||
|
listView.setDividerHeight(dpToPx(1f));
|
||||||
|
} else {
|
||||||
|
if (listBackgroundView != null) {
|
||||||
|
listBackgroundView.setBackgroundColor(mapActivity.getResources().getColor(R.color.bg_color_light));
|
||||||
|
} else {
|
||||||
|
listView.setBackgroundColor(mapActivity.getResources().getColor(R.color.bg_color_light));
|
||||||
|
}
|
||||||
|
Drawable d = new ColorDrawable(mapActivity.getResources().getColor(R.color.dashboard_divider_light));
|
||||||
|
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() {
|
private void updateListAdapter() {
|
||||||
ContextMenuAdapter cm = null;
|
ContextMenuAdapter cm = null;
|
||||||
if (DashboardType.WAYPOINTS == visibleType || DashboardType.WAYPOINTS_FLAT == visibleType) {
|
if (DashboardType.WAYPOINTS == visibleType || DashboardType.WAYPOINTS_FLAT == visibleType) {
|
||||||
ArrayAdapter<Object> listAdapter = waypointDialogHelper.getWaypointsDrawerAdapter(false, deletedPoints, mapActivity, running,
|
ArrayAdapter<Object> listAdapter = waypointDialogHelper.getWaypointsDrawerAdapter(false, deletedPoints, mapActivity, running,
|
||||||
DashboardType.WAYPOINTS_FLAT == visibleType);
|
DashboardType.WAYPOINTS_FLAT == visibleType, nightMode);
|
||||||
OnItemClickListener listener = waypointDialogHelper.getDrawerItemClickListener(mapActivity, running,
|
OnItemClickListener listener = waypointDialogHelper.getDrawerItemClickListener(mapActivity, running,
|
||||||
listAdapter);
|
listAdapter);
|
||||||
updateListAdapter(listAdapter, listener);
|
updateListAdapter(listAdapter, listener);
|
||||||
} else if (DashboardType.WAYPOINTS_EDIT == visibleType) {
|
} else if (DashboardType.WAYPOINTS_EDIT == visibleType) {
|
||||||
deletedPoints.clear();
|
deletedPoints.clear();
|
||||||
ArrayAdapter<Object> listAdapter = waypointDialogHelper.getWaypointsDrawerAdapter(true, deletedPoints, mapActivity, running,
|
ArrayAdapter<Object> listAdapter = waypointDialogHelper.getWaypointsDrawerAdapter(true, deletedPoints, mapActivity, running,
|
||||||
DashboardType.WAYPOINTS_FLAT == visibleType);
|
DashboardType.WAYPOINTS_FLAT == visibleType, nightMode);
|
||||||
OnItemClickListener listener = waypointDialogHelper.getDrawerItemClickListener(mapActivity, running,
|
OnItemClickListener listener = waypointDialogHelper.getDrawerItemClickListener(mapActivity, running,
|
||||||
listAdapter);
|
listAdapter);
|
||||||
updateListAdapter(listAdapter, listener);
|
updateListAdapter(listAdapter, listener);
|
||||||
|
@ -497,8 +583,12 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateListAdapter(ContextMenuAdapter cm) {
|
public void updateListAdapter(ContextMenuAdapter cm) {
|
||||||
final ArrayAdapter<?> listAdapter = cm.createListAdapter(mapActivity, getMyApplication().getSettings()
|
boolean nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightMode();
|
||||||
.isLightContent());
|
if (this.nightMode != nightMode) {
|
||||||
|
this.nightMode = nightMode;
|
||||||
|
applyDayNightMode();
|
||||||
|
}
|
||||||
|
final ArrayAdapter<?> listAdapter = cm.createListAdapter(mapActivity, !nightMode);
|
||||||
OnItemClickListener listener = getOptionsMenuOnClickListener(cm, listAdapter);
|
OnItemClickListener listener = getOptionsMenuOnClickListener(cm, listAdapter);
|
||||||
updateListAdapter(listAdapter, listener);
|
updateListAdapter(listAdapter, listener);
|
||||||
}
|
}
|
||||||
|
@ -765,7 +855,10 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isActionButtonVisible() {
|
private boolean isActionButtonVisible() {
|
||||||
return visibleType == DashboardType.DASHBOARD || visibleType == DashboardType.LIST_MENU || visibleType == DashboardType.CONFIGURE_SCREEN;
|
return visibleType == DashboardType.DASHBOARD
|
||||||
|
|| visibleType == DashboardType.LIST_MENU
|
||||||
|
|| visibleType == DashboardType.ROUTE_SETTINGS
|
||||||
|
|| visibleType == DashboardType.CONFIGURE_SCREEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isBackButtonVisible() {
|
private boolean isBackButtonVisible() {
|
||||||
|
|
|
@ -16,7 +16,7 @@ import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import net.osmand.data.FavouritePoint;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.LocationPoint;
|
import net.osmand.data.LocationPoint;
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
|
@ -59,10 +59,12 @@ public class WaypointDialogHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updatePointInfoView(final OsmandApplication app, final Activity activity,
|
public static void updatePointInfoView(final OsmandApplication app, final Activity activity,
|
||||||
View localView, final LocationPointWrapper ps, final boolean mapCenter) {
|
View localView, final LocationPointWrapper ps,
|
||||||
|
final boolean mapCenter, final boolean nightMode) {
|
||||||
WaypointHelper wh = app.getWaypointHelper();
|
WaypointHelper wh = app.getWaypointHelper();
|
||||||
final LocationPoint point = ps.getPoint();
|
final LocationPoint point = ps.getPoint();
|
||||||
TextView text = (TextView) localView.findViewById(R.id.waypoint_text);
|
TextView text = (TextView) localView.findViewById(R.id.waypoint_text);
|
||||||
|
AndroidUtils.setTextPrimaryColor(activity, text, nightMode);
|
||||||
TextView textShadow = (TextView) localView.findViewById(R.id.waypoint_text_shadow);
|
TextView textShadow = (TextView) localView.findViewById(R.id.waypoint_text_shadow);
|
||||||
localView.setOnClickListener(new View.OnClickListener() {
|
localView.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -112,7 +114,7 @@ public class WaypointDialogHelper {
|
||||||
|
|
||||||
public ArrayAdapter<Object> getWaypointsDrawerAdapter(
|
public ArrayAdapter<Object> getWaypointsDrawerAdapter(
|
||||||
final boolean edit, final List<LocationPointWrapper> deletedPoints,
|
final boolean edit, final List<LocationPointWrapper> deletedPoints,
|
||||||
final MapActivity ctx, final int[] running, final boolean flat) {
|
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());
|
||||||
|
@ -130,12 +132,12 @@ public class WaypointDialogHelper {
|
||||||
boolean labelView = (getItem(position) instanceof Integer);
|
boolean labelView = (getItem(position) instanceof Integer);
|
||||||
if (getItem(position) instanceof RadiusItem) {
|
if (getItem(position) instanceof RadiusItem) {
|
||||||
final int type = ((RadiusItem) getItem(position)).type;
|
final int type = ((RadiusItem) getItem(position)).type;
|
||||||
v = createItemForRadiusProximity(ctx, type, running, position, thisAdapter);
|
v = createItemForRadiusProximity(ctx, type, running, position, thisAdapter, nightMode);
|
||||||
} else if (labelView) {
|
} else if (labelView) {
|
||||||
v = createItemForCategory(ctx, (Integer) getItem(position), running, position, thisAdapter);
|
v = createItemForCategory(ctx, (Integer) getItem(position), running, position, thisAdapter, nightMode);
|
||||||
} else {
|
} else {
|
||||||
LocationPointWrapper point = (LocationPointWrapper) getItem(position);
|
LocationPointWrapper point = (LocationPointWrapper) getItem(position);
|
||||||
v = updateWaypointItemView(edit, deletedPoints, app, ctx, v, point, this);
|
v = updateWaypointItemView(edit, deletedPoints, app, ctx, v, point, this, nightMode);
|
||||||
}
|
}
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
@ -148,18 +150,18 @@ 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 ArrayAdapter adapter, final boolean nightMode) {
|
||||||
if (v == null || v.findViewById(R.id.info_close) == null) {
|
if (v == null || v.findViewById(R.id.info_close) == null) {
|
||||||
v = ctx.getLayoutInflater().inflate(R.layout.waypoint_reached, null);
|
v = ctx.getLayoutInflater().inflate(R.layout.waypoint_reached, null);
|
||||||
}
|
}
|
||||||
updatePointInfoView(app, ctx, v, point, true);
|
updatePointInfoView(app, ctx, v, point, true, nightMode);
|
||||||
View remove = v.findViewById(R.id.info_close);
|
View remove = v.findViewById(R.id.info_close);
|
||||||
if (!edit) {
|
if (!edit) {
|
||||||
remove.setVisibility(View.GONE);
|
remove.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
remove.setVisibility(View.VISIBLE);
|
remove.setVisibility(View.VISIBLE);
|
||||||
((ImageButton) remove).setImageDrawable(app.getIconsCache().getContentIcon(
|
((ImageButton) remove).setImageDrawable(app.getIconsCache().getContentIcon(
|
||||||
R.drawable.ic_action_gremove_dark));
|
R.drawable.ic_action_gremove_dark, !nightMode));
|
||||||
remove.setOnClickListener(new View.OnClickListener() {
|
remove.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
@ -178,12 +180,13 @@ 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) {
|
final int position, final ArrayAdapter<Object> thisAdapter, boolean nightMode) {
|
||||||
View v;
|
View v;
|
||||||
IconsCache iconsCache = app.getIconsCache();
|
IconsCache iconsCache = app.getIconsCache();
|
||||||
v = ctx.getLayoutInflater().inflate(R.layout.drawer_list_radius, null);
|
v = ctx.getLayoutInflater().inflate(R.layout.drawer_list_radius, null);
|
||||||
|
AndroidUtils.setTextPrimaryColor(mapActivity, (TextView) v.findViewById(R.id.title), nightMode);
|
||||||
final TextView radius = (TextView) v.findViewById(R.id.description);
|
final TextView radius = (TextView) v.findViewById(R.id.description);
|
||||||
((ImageView) v.findViewById(R.id.waypoint_icon)).setImageDrawable(iconsCache.getContentIcon(R.drawable.ic_poi_radius_dark));
|
((ImageView) v.findViewById(R.id.waypoint_icon)).setImageDrawable(iconsCache.getContentIcon(R.drawable.ic_poi_radius_dark, !nightMode));
|
||||||
radius.setText(OsmAndFormatter.getFormattedDistance(waypointHelper.getSearchDeviationRadius(type), app));
|
radius.setText(OsmAndFormatter.getFormattedDistance(waypointHelper.getSearchDeviationRadius(type), app));
|
||||||
radius.setOnClickListener(new View.OnClickListener() {
|
radius.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -196,7 +199,7 @@ public class WaypointDialogHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected View createItemForCategory(final FragmentActivity ctx, final int type, final int[] running,
|
protected View createItemForCategory(final FragmentActivity ctx, final int type, final int[] running,
|
||||||
final int position, final ArrayAdapter<Object> thisAdapter) {
|
final int position, final ArrayAdapter<Object> thisAdapter, boolean nightMode) {
|
||||||
View v;
|
View v;
|
||||||
v = ctx.getLayoutInflater().inflate(R.layout.waypoint_header, null);
|
v = ctx.getLayoutInflater().inflate(R.layout.waypoint_header, null);
|
||||||
final CompoundButton btn = (CompoundButton) v.findViewById(R.id.check_item);
|
final CompoundButton btn = (CompoundButton) v.findViewById(R.id.check_item);
|
||||||
|
@ -222,6 +225,7 @@ public class WaypointDialogHelper {
|
||||||
});
|
});
|
||||||
|
|
||||||
TextView tv = (TextView) v.findViewById(R.id.header_text);
|
TextView tv = (TextView) v.findViewById(R.id.header_text);
|
||||||
|
AndroidUtils.setTextPrimaryColor(mapActivity, tv, nightMode);
|
||||||
tv.setText(getHeader(type, checked, ctx));
|
tv.setText(getHeader(type, checked, ctx));
|
||||||
v.setOnClickListener(new View.OnClickListener() {
|
v.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package net.osmand.plus.mapcontextmenu;
|
package net.osmand.plus.mapcontextmenu;
|
||||||
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.util.TypedValue;
|
|
||||||
|
|
||||||
import net.osmand.plus.IconsCache;
|
import net.osmand.plus.IconsCache;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -15,7 +14,7 @@ public abstract class BaseMenuController {
|
||||||
private MapActivity mapActivity;
|
private MapActivity mapActivity;
|
||||||
private boolean portraitMode;
|
private boolean portraitMode;
|
||||||
private boolean largeDevice;
|
private boolean largeDevice;
|
||||||
private boolean light;
|
private boolean nightMode;
|
||||||
|
|
||||||
public BaseMenuController(MapActivity mapActivity) {
|
public BaseMenuController(MapActivity mapActivity) {
|
||||||
this.mapActivity = mapActivity;
|
this.mapActivity = mapActivity;
|
||||||
|
@ -25,7 +24,7 @@ public abstract class BaseMenuController {
|
||||||
private void init() {
|
private void init() {
|
||||||
portraitMode = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
portraitMode = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
||||||
largeDevice = AndroidUiHelper.isXLargeDevice(mapActivity);
|
largeDevice = AndroidUiHelper.isXLargeDevice(mapActivity);
|
||||||
light = mapActivity.getMyApplication().getSettings().isLightContent();
|
updateNightMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapActivity getMapActivity() {
|
public MapActivity getMapActivity() {
|
||||||
|
@ -38,7 +37,11 @@ public abstract class BaseMenuController {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLight() {
|
public boolean isLight() {
|
||||||
return light;
|
return !nightMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateNightMode() {
|
||||||
|
nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLandscapeLayout() {
|
public boolean isLandscapeLayout() {
|
||||||
|
@ -75,7 +78,7 @@ public abstract class BaseMenuController {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Drawable getIcon(int iconId) {
|
protected Drawable getIcon(int iconId) {
|
||||||
return getIcon(iconId, R.color.icon_color, R.color.icon_color_light);
|
return getIcon(iconId, isLight() ? R.color.icon_color : R.color.icon_color_light);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Drawable getIcon(int iconId, int colorId) {
|
protected Drawable getIcon(int iconId, int colorId) {
|
||||||
|
@ -92,13 +95,4 @@ public abstract class BaseMenuController {
|
||||||
IconsCache iconsCache = getMapActivity().getMyApplication().getIconsCache();
|
IconsCache iconsCache = getMapActivity().getMyApplication().getIconsCache();
|
||||||
return iconsCache.getIcon(iconId, isLight() ? colorLightId : colorDarkId);
|
return iconsCache.getIcon(iconId, isLight() ? colorLightId : colorDarkId);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getResIdFromAttribute(final int attr) {
|
|
||||||
if (attr == 0)
|
|
||||||
return 0;
|
|
||||||
final TypedValue typedvalueattr = new TypedValue();
|
|
||||||
getMapActivity().getTheme().resolveAttribute(attr, typedvalueattr, true);
|
|
||||||
return typedvalueattr.resourceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,16 +7,19 @@ import android.support.v7.app.AlertDialog;
|
||||||
import android.support.v7.app.AlertDialog.Builder;
|
import android.support.v7.app.AlertDialog.Builder;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
import net.osmand.CallbackWithObject;
|
import net.osmand.CallbackWithObject;
|
||||||
|
import net.osmand.StateChangedListener;
|
||||||
import net.osmand.data.FavouritePoint;
|
import net.osmand.data.FavouritePoint;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
|
import net.osmand.plus.ApplicationMode;
|
||||||
import net.osmand.plus.ContextMenuAdapter;
|
import net.osmand.plus.ContextMenuAdapter;
|
||||||
import net.osmand.plus.TargetPointsHelper;
|
|
||||||
import net.osmand.plus.GPXUtilities.GPXFile;
|
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||||
import net.osmand.plus.GPXUtilities.WptPt;
|
import net.osmand.plus.GPXUtilities.WptPt;
|
||||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.TargetPointsHelper;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper;
|
import net.osmand.plus.helpers.GpxUiHelper;
|
||||||
import net.osmand.plus.mapcontextmenu.MenuController.MenuState;
|
import net.osmand.plus.mapcontextmenu.MenuController.MenuState;
|
||||||
|
@ -35,7 +38,7 @@ import net.osmand.util.MapUtils;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class MapContextMenu extends MenuTitleController {
|
public class MapContextMenu extends MenuTitleController implements StateChangedListener<ApplicationMode> {
|
||||||
|
|
||||||
private MapActivity mapActivity;
|
private MapActivity mapActivity;
|
||||||
private MapMultiSelectionMenu mapMultiSelectionMenu;
|
private MapMultiSelectionMenu mapMultiSelectionMenu;
|
||||||
|
@ -55,6 +58,8 @@ public class MapContextMenu extends MenuTitleController {
|
||||||
private LatLon myLocation;
|
private LatLon myLocation;
|
||||||
private Float heading;
|
private Float heading;
|
||||||
private boolean inLocationUpdate = false;
|
private boolean inLocationUpdate = false;
|
||||||
|
private boolean appModeChanged;
|
||||||
|
private boolean appModeListenerAdded;
|
||||||
|
|
||||||
private int favActionIconId;
|
private int favActionIconId;
|
||||||
|
|
||||||
|
@ -67,6 +72,10 @@ public class MapContextMenu extends MenuTitleController {
|
||||||
|
|
||||||
public void setMapActivity(MapActivity mapActivity) {
|
public void setMapActivity(MapActivity mapActivity) {
|
||||||
this.mapActivity = mapActivity;
|
this.mapActivity = mapActivity;
|
||||||
|
if (!appModeListenerAdded) {
|
||||||
|
mapActivity.getMyApplication().getSettings().APPLICATION_MODE.addListener(this);
|
||||||
|
appModeListenerAdded = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (mapMultiSelectionMenu == null) {
|
if (mapMultiSelectionMenu == null) {
|
||||||
mapMultiSelectionMenu = new MapMultiSelectionMenu(mapActivity);
|
mapMultiSelectionMenu = new MapMultiSelectionMenu(mapActivity);
|
||||||
|
@ -199,6 +208,7 @@ public class MapContextMenu extends MenuTitleController {
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean needAcquireMenuController = menuController == null
|
boolean needAcquireMenuController = menuController == null
|
||||||
|
|| appModeChanged
|
||||||
|| !update
|
|| !update
|
||||||
|| this.object == null && object != null
|
|| this.object == null && object != null
|
||||||
|| this.object != null && object == null
|
|| this.object != null && object == null
|
||||||
|
@ -208,6 +218,7 @@ public class MapContextMenu extends MenuTitleController {
|
||||||
this.object = object;
|
this.object = object;
|
||||||
|
|
||||||
active = true;
|
active = true;
|
||||||
|
appModeChanged = false;
|
||||||
|
|
||||||
if (needAcquireMenuController) {
|
if (needAcquireMenuController) {
|
||||||
acquireMenuController();
|
acquireMenuController();
|
||||||
|
@ -232,7 +243,11 @@ public class MapContextMenu extends MenuTitleController {
|
||||||
|
|
||||||
public void show() {
|
public void show() {
|
||||||
if (!isVisible()) {
|
if (!isVisible()) {
|
||||||
if (!MapContextMenuFragment.showInstance(this, mapActivity)) {
|
boolean wasInit = true;
|
||||||
|
if (appModeChanged) {
|
||||||
|
wasInit = init(latLon, pointDescription, object);
|
||||||
|
}
|
||||||
|
if (wasInit && !MapContextMenuFragment.showInstance(this, mapActivity)) {
|
||||||
active = false;
|
active = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -295,6 +310,11 @@ public class MapContextMenu extends MenuTitleController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stateChanged(ApplicationMode change) {
|
||||||
|
appModeChanged = active;
|
||||||
|
}
|
||||||
|
|
||||||
private void clearSelectedObject(Object object) {
|
private void clearSelectedObject(Object object) {
|
||||||
if (object != null) {
|
if (object != null) {
|
||||||
for (OsmandMapLayer l : mapActivity.getMapView().getLayers()) {
|
for (OsmandMapLayer l : mapActivity.getMapView().getLayers()) {
|
||||||
|
@ -644,6 +664,14 @@ public class MapContextMenu extends MenuTitleController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isNightMode() {
|
||||||
|
if (menuController != null) {
|
||||||
|
return !menuController.isLight();
|
||||||
|
} else {
|
||||||
|
return mapActivity.getMyApplication().getDaynightHelper().isNightMode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasHiddenBottomInfo() {
|
public boolean hasHiddenBottomInfo() {
|
||||||
return getCurrentMenuState() == MenuState.HEADER_ONLY;
|
return getCurrentMenuState() == MenuState.HEADER_ONLY;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ import android.widget.LinearLayout;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.QuadPoint;
|
import net.osmand.data.QuadPoint;
|
||||||
|
@ -90,6 +91,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
private int origMarkerY;
|
private int origMarkerY;
|
||||||
private boolean customMapCenter;
|
private boolean customMapCenter;
|
||||||
private boolean moving;
|
private boolean moving;
|
||||||
|
private boolean nightMode;
|
||||||
|
|
||||||
private float skipHalfScreenStateLimit;
|
private float skipHalfScreenStateLimit;
|
||||||
|
|
||||||
|
@ -149,6 +151,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
if (!menu.isActive()) {
|
if (!menu.isActive()) {
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
nightMode = menu.isNightMode();
|
||||||
mainView = view.findViewById(R.id.context_menu_main);
|
mainView = view.findViewById(R.id.context_menu_main);
|
||||||
|
|
||||||
leftTitleButtonController = menu.getLeftTitleButtonController();
|
leftTitleButtonController = menu.getLeftTitleButtonController();
|
||||||
|
@ -173,7 +176,6 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
}
|
}
|
||||||
|
|
||||||
IconsCache iconsCache = getMyApplication().getIconsCache();
|
IconsCache iconsCache = getMyApplication().getIconsCache();
|
||||||
boolean light = getMyApplication().getSettings().isLightContent();
|
|
||||||
|
|
||||||
// Left title button
|
// Left title button
|
||||||
final Button leftTitleButton = (Button) view.findViewById(R.id.title_button);
|
final Button leftTitleButton = (Button) view.findViewById(R.id.title_button);
|
||||||
|
@ -212,7 +214,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
if (titleProgressController != null) {
|
if (titleProgressController != null) {
|
||||||
final ImageView progressButton = (ImageView) view.findViewById(R.id.progressButton);
|
final ImageView progressButton = (ImageView) view.findViewById(R.id.progressButton);
|
||||||
progressButton.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_remove_dark,
|
progressButton.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_remove_dark,
|
||||||
light ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
||||||
progressButton.setOnClickListener(new View.OnClickListener() {
|
progressButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -333,6 +335,8 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
View topShadowView = view.findViewById(R.id.context_menu_top_shadow);
|
View topShadowView = view.findViewById(R.id.context_menu_top_shadow);
|
||||||
topShadowView.setOnTouchListener(slideTouchListener);
|
topShadowView.setOnTouchListener(slideTouchListener);
|
||||||
View topShadowAllView = view.findViewById(R.id.context_menu_top_shadow_all);
|
View topShadowAllView = view.findViewById(R.id.context_menu_top_shadow_all);
|
||||||
|
AndroidUtils.setBackground(getMapActivity(), topShadowAllView, nightMode, R.drawable.bg_map_context_menu_light,
|
||||||
|
R.drawable.bg_map_context_menu_dark);
|
||||||
topShadowAllView.setOnTouchListener(new View.OnTouchListener() {
|
topShadowAllView.setOnTouchListener(new View.OnTouchListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouch(View v, MotionEvent event) {
|
public boolean onTouch(View v, MotionEvent event) {
|
||||||
|
@ -345,6 +349,25 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
|
|
||||||
buildHeader();
|
buildHeader();
|
||||||
|
|
||||||
|
AndroidUtils.setTextPrimaryColor(getMapActivity(),
|
||||||
|
(TextView) view.findViewById(R.id.context_menu_line1), nightMode);
|
||||||
|
AndroidUtils.setTextSecondaryColor(getMapActivity(),
|
||||||
|
(TextView) view.findViewById(R.id.context_menu_line2), nightMode);
|
||||||
|
((Button) view.findViewById(R.id.title_button_top_right))
|
||||||
|
.setTextColor(!nightMode ? getResources().getColor(R.color.map_widget_blue) : getResources().getColor(R.color.osmand_orange));
|
||||||
|
AndroidUtils.setTextSecondaryColor(getMapActivity(),
|
||||||
|
(TextView) view.findViewById(R.id.distance), nightMode);
|
||||||
|
|
||||||
|
((Button) view.findViewById(R.id.title_button))
|
||||||
|
.setTextColor(!nightMode ? getResources().getColor(R.color.map_widget_blue) : getResources().getColor(R.color.osmand_orange));
|
||||||
|
AndroidUtils.setTextSecondaryColor(getMapActivity(),
|
||||||
|
(TextView) view.findViewById(R.id.title_button_right_text), nightMode);
|
||||||
|
((Button) view.findViewById(R.id.title_button_right))
|
||||||
|
.setTextColor(!nightMode ? getResources().getColor(R.color.map_widget_blue) : getResources().getColor(R.color.osmand_orange));
|
||||||
|
|
||||||
|
AndroidUtils.setTextSecondaryColor(getMapActivity(),
|
||||||
|
(TextView) view.findViewById(R.id.progressTitle), nightMode);
|
||||||
|
|
||||||
// FAB
|
// FAB
|
||||||
fabView = (ImageView)view.findViewById(R.id.context_menu_fab_view);
|
fabView = (ImageView)view.findViewById(R.id.context_menu_fab_view);
|
||||||
if (menu.fabVisible()) {
|
if (menu.fabVisible()) {
|
||||||
|
@ -363,17 +386,27 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
fabView.setVisibility(View.GONE);
|
fabView.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!menu.buttonsVisible()) {
|
|
||||||
View buttonsTopBorder = view.findViewById(R.id.buttons_top_border);
|
View buttonsTopBorder = view.findViewById(R.id.buttons_top_border);
|
||||||
|
AndroidUtils.setBackground(getMapActivity(), buttonsTopBorder, nightMode,
|
||||||
|
R.color.dashboard_divider_light, R.color.dashboard_divider_dark);
|
||||||
|
if (!menu.buttonsVisible()) {
|
||||||
View buttons = view.findViewById(R.id.context_menu_buttons);
|
View buttons = view.findViewById(R.id.context_menu_buttons);
|
||||||
buttonsTopBorder.setVisibility(View.GONE);
|
buttonsTopBorder.setVisibility(View.GONE);
|
||||||
buttons.setVisibility(View.GONE);
|
buttons.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AndroidUtils.setBackground(getMapActivity(), mainView.findViewById(R.id.divider_hor_1), nightMode,
|
||||||
|
R.color.dashboard_divider_light, R.color.dashboard_divider_dark);
|
||||||
|
AndroidUtils.setBackground(getMapActivity(), mainView.findViewById(R.id.divider_hor_2), nightMode,
|
||||||
|
R.color.dashboard_divider_light, R.color.dashboard_divider_dark);
|
||||||
|
AndroidUtils.setBackground(getMapActivity(), mainView.findViewById(R.id.divider_hor_3), nightMode,
|
||||||
|
R.color.dashboard_divider_light, R.color.dashboard_divider_dark);
|
||||||
|
|
||||||
// Action buttons
|
// Action buttons
|
||||||
final ImageButton buttonFavorite = (ImageButton) view.findViewById(R.id.context_menu_fav_button);
|
final ImageButton buttonFavorite = (ImageButton) view.findViewById(R.id.context_menu_fav_button);
|
||||||
buttonFavorite.setImageDrawable(iconsCache.getIcon(menu.getFavActionIconId(),
|
buttonFavorite.setImageDrawable(iconsCache.getIcon(menu.getFavActionIconId(),
|
||||||
light ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
||||||
|
AndroidUtils.setDashButtonBackground(getMapActivity(), buttonFavorite, nightMode);
|
||||||
buttonFavorite.setOnClickListener(new View.OnClickListener() {
|
buttonFavorite.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -383,7 +416,8 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
|
|
||||||
final ImageButton buttonWaypoint = (ImageButton) view.findViewById(R.id.context_menu_route_button);
|
final ImageButton buttonWaypoint = (ImageButton) view.findViewById(R.id.context_menu_route_button);
|
||||||
buttonWaypoint.setImageDrawable(iconsCache.getIcon(R.drawable.map_action_flag_dark,
|
buttonWaypoint.setImageDrawable(iconsCache.getIcon(R.drawable.map_action_flag_dark,
|
||||||
light ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
||||||
|
AndroidUtils.setDashButtonBackground(getMapActivity(), buttonWaypoint, nightMode);
|
||||||
buttonWaypoint.setOnClickListener(new View.OnClickListener() {
|
buttonWaypoint.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -393,7 +427,8 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
|
|
||||||
final ImageButton buttonShare = (ImageButton) view.findViewById(R.id.context_menu_share_button);
|
final ImageButton buttonShare = (ImageButton) view.findViewById(R.id.context_menu_share_button);
|
||||||
buttonShare.setImageDrawable(iconsCache.getIcon(R.drawable.map_action_gshare_dark,
|
buttonShare.setImageDrawable(iconsCache.getIcon(R.drawable.map_action_gshare_dark,
|
||||||
light ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
||||||
|
AndroidUtils.setDashButtonBackground(getMapActivity(), buttonShare, nightMode);
|
||||||
buttonShare.setOnClickListener(new View.OnClickListener() {
|
buttonShare.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -403,7 +438,8 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
|
|
||||||
final ImageButton buttonMore = (ImageButton) view.findViewById(R.id.context_menu_more_button);
|
final ImageButton buttonMore = (ImageButton) view.findViewById(R.id.context_menu_more_button);
|
||||||
buttonMore.setImageDrawable(iconsCache.getIcon(R.drawable.map_overflow_menu_white,
|
buttonMore.setImageDrawable(iconsCache.getIcon(R.drawable.map_overflow_menu_white,
|
||||||
light ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
||||||
|
AndroidUtils.setDashButtonBackground(getMapActivity(), buttonMore, nightMode);
|
||||||
buttonMore.setOnClickListener(new View.OnClickListener() {
|
buttonMore.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -413,6 +449,11 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
|
|
||||||
buildBottomView();
|
buildBottomView();
|
||||||
|
|
||||||
|
view.findViewById(R.id.context_menu_bottom_scroll).setBackgroundColor(nightMode ?
|
||||||
|
getResources().getColor(R.color.ctx_menu_info_view_bg_dark) : getResources().getColor(R.color.ctx_menu_info_view_bg_light));
|
||||||
|
view.findViewById(R.id.context_menu_bottom_view).setBackgroundColor(nightMode ?
|
||||||
|
getResources().getColor(R.color.ctx_menu_info_view_bg_dark) : getResources().getColor(R.color.ctx_menu_info_view_bg_light));
|
||||||
|
|
||||||
getMapActivity().getMapLayers().getMapControlsLayer().setControlsClickable(false);
|
getMapActivity().getMapLayers().getMapControlsLayer().setControlsClickable(false);
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
|
@ -606,7 +647,6 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
|
|
||||||
private void buildHeader() {
|
private void buildHeader() {
|
||||||
IconsCache iconsCache = getMyApplication().getIconsCache();
|
IconsCache iconsCache = getMyApplication().getIconsCache();
|
||||||
boolean light = getMyApplication().getSettings().isLightContent();
|
|
||||||
|
|
||||||
final View iconLayout = view.findViewById(R.id.context_menu_icon_layout);
|
final View iconLayout = view.findViewById(R.id.context_menu_icon_layout);
|
||||||
final ImageView iconView = (ImageView) view.findViewById(R.id.context_menu_icon_view);
|
final ImageView iconView = (ImageView) view.findViewById(R.id.context_menu_icon_view);
|
||||||
|
@ -617,7 +657,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
iconLayout.setVisibility(View.VISIBLE);
|
iconLayout.setVisibility(View.VISIBLE);
|
||||||
} else if (iconId != 0) {
|
} else if (iconId != 0) {
|
||||||
iconView.setImageDrawable(iconsCache.getIcon(iconId,
|
iconView.setImageDrawable(iconsCache.getIcon(iconId,
|
||||||
light ? R.color.osmand_orange : R.color.osmand_orange_dark));
|
!nightMode ? R.color.osmand_orange : R.color.osmand_orange_dark));
|
||||||
iconLayout.setVisibility(View.VISIBLE);
|
iconLayout.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
iconLayout.setVisibility(View.GONE);
|
iconLayout.setVisibility(View.GONE);
|
||||||
|
@ -669,10 +709,9 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
|
|
||||||
public void rebuildMenu() {
|
public void rebuildMenu() {
|
||||||
IconsCache iconsCache = getMyApplication().getIconsCache();
|
IconsCache iconsCache = getMyApplication().getIconsCache();
|
||||||
boolean light = getMyApplication().getSettings().isLightContent();
|
|
||||||
final ImageButton buttonFavorite = (ImageButton) view.findViewById(R.id.context_menu_fav_button);
|
final ImageButton buttonFavorite = (ImageButton) view.findViewById(R.id.context_menu_fav_button);
|
||||||
buttonFavorite.setImageDrawable(iconsCache.getIcon(menu.getFavActionIconId(),
|
buttonFavorite.setImageDrawable(iconsCache.getIcon(menu.getFavActionIconId(),
|
||||||
light ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
||||||
|
|
||||||
buildHeader();
|
buildHeader();
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class MenuBuilder {
|
||||||
protected OsmandApplication app;
|
protected OsmandApplication app;
|
||||||
protected LinkedList<PlainMenuItem> plainMenuItems;
|
protected LinkedList<PlainMenuItem> plainMenuItems;
|
||||||
private boolean firstRow;
|
private boolean firstRow;
|
||||||
private boolean light;
|
protected boolean light;
|
||||||
|
|
||||||
public class PlainMenuItem {
|
public class PlainMenuItem {
|
||||||
private int iconId;
|
private int iconId;
|
||||||
|
@ -66,6 +66,10 @@ public class MenuBuilder {
|
||||||
light = app.getSettings().isLightContent();
|
light = app.getSettings().isLightContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setLight(boolean light) {
|
||||||
|
this.light = light;
|
||||||
|
}
|
||||||
|
|
||||||
public void build(View view) {
|
public void build(View view) {
|
||||||
firstRow = true;
|
firstRow = true;
|
||||||
if (needBuildPlainMenuItems()) {
|
if (needBuildPlainMenuItems()) {
|
||||||
|
|
|
@ -65,6 +65,7 @@ public abstract class MenuController extends BaseMenuController {
|
||||||
this.pointDescription = pointDescription;
|
this.pointDescription = pointDescription;
|
||||||
this.builder = builder;
|
this.builder = builder;
|
||||||
this.currentMenuState = getInitialMenuState();
|
this.currentMenuState = getInitialMenuState();
|
||||||
|
this.builder.setLight(isLight());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void build(View rootView) {
|
public void build(View rootView) {
|
||||||
|
@ -287,7 +288,7 @@ public abstract class MenuController extends BaseMenuController {
|
||||||
|
|
||||||
public Drawable getLeftIcon() {
|
public Drawable getLeftIcon() {
|
||||||
if (leftIconId != 0) {
|
if (leftIconId != 0) {
|
||||||
return getIcon(leftIconId, getResIdFromAttribute(R.attr.contextMenuButtonColor));
|
return getIcon(leftIconId, isLight() ? R.color.map_widget_blue : R.color.osmand_orange);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,6 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
||||||
protected void buildRow(final View view, Drawable icon, final String text, final String textPrefix,
|
protected void buildRow(final View view, Drawable icon, final String text, final String textPrefix,
|
||||||
int textColor, boolean isWiki, boolean isText, boolean needLinks,
|
int textColor, boolean isWiki, boolean isText, boolean needLinks,
|
||||||
boolean isPhoneNumber, boolean isUrl) {
|
boolean isPhoneNumber, boolean isUrl) {
|
||||||
boolean light = app.getSettings().isLightContent();
|
|
||||||
|
|
||||||
if (!isFirstRow()) {
|
if (!isFirstRow()) {
|
||||||
buildRowDivider(view, false);
|
buildRowDivider(view, false);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package net.osmand.plus.mapcontextmenu.builders;
|
package net.osmand.plus.mapcontextmenu.builders;
|
||||||
|
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -49,10 +48,7 @@ public class GpxItemMenuBuilder extends MenuBuilder {
|
||||||
int gpxSmallTextMargin = (int) ll.getResources().getDimension(R.dimen.gpx_small_text_margin);
|
int gpxSmallTextMargin = (int) ll.getResources().getDimension(R.dimen.gpx_small_text_margin);
|
||||||
float gpxTextSize = ll.getResources().getDimension(R.dimen.default_desc_text_size);
|
float gpxTextSize = ll.getResources().getDimension(R.dimen.default_desc_text_size);
|
||||||
|
|
||||||
TypedValue typedValue = new TypedValue();
|
int textColor = app.getResources().getColor(light ? R.color.ctx_menu_info_text_light : R.color.ctx_menu_info_text_dark);
|
||||||
Resources.Theme theme = app.getTheme();
|
|
||||||
theme.resolveAttribute(android.R.attr.textColorSecondary, typedValue, true);
|
|
||||||
int textColor = typedValue.data;
|
|
||||||
|
|
||||||
buildIcon(ll, gpxSmallIconMargin, R.drawable.ic_small_point);
|
buildIcon(ll, gpxSmallIconMargin, R.drawable.ic_small_point);
|
||||||
buildTextView(ll, gpxSmallTextMargin, gpxTextSize, textColor, "" + item.analysis.wptPoints);
|
buildTextView(ll, gpxSmallTextMargin, gpxTextSize, textColor, "" + item.analysis.wptPoints);
|
||||||
|
|
|
@ -16,12 +16,14 @@ public abstract class PointEditor {
|
||||||
|
|
||||||
private boolean portraitMode;
|
private boolean portraitMode;
|
||||||
private boolean largeDevice;
|
private boolean largeDevice;
|
||||||
|
private boolean nightMode;
|
||||||
|
|
||||||
public PointEditor(MapActivity mapActivity) {
|
public PointEditor(MapActivity mapActivity) {
|
||||||
this.app = mapActivity.getMyApplication();
|
this.app = mapActivity.getMyApplication();
|
||||||
this.mapActivity = mapActivity;
|
this.mapActivity = mapActivity;
|
||||||
portraitMode = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
portraitMode = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
||||||
largeDevice = AndroidUiHelper.isXLargeDevice(mapActivity);
|
largeDevice = AndroidUiHelper.isXLargeDevice(mapActivity);
|
||||||
|
updateNightMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMapActivity(MapActivity mapActivity) {
|
public void setMapActivity(MapActivity mapActivity) {
|
||||||
|
@ -36,6 +38,14 @@ public abstract class PointEditor {
|
||||||
return !portraitMode && !largeDevice;
|
return !portraitMode && !largeDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isLight() {
|
||||||
|
return !nightMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateNightMode() {
|
||||||
|
nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightMode();
|
||||||
|
}
|
||||||
|
|
||||||
public int getSlideInAnimation() {
|
public int getSlideInAnimation() {
|
||||||
if (isLandscapeLayout()) {
|
if (isLandscapeLayout()) {
|
||||||
return R.anim.slide_in_left;
|
return R.anim.slide_in_left;
|
||||||
|
|
|
@ -56,6 +56,32 @@ public abstract class PointEditorFragment extends Fragment {
|
||||||
|
|
||||||
view = inflater.inflate(R.layout.point_editor_fragment, container, false);
|
view = inflater.inflate(R.layout.point_editor_fragment, container, false);
|
||||||
|
|
||||||
|
getEditor().updateNightMode();
|
||||||
|
if (getEditor().isLandscapeLayout()) {
|
||||||
|
AndroidUtils.setBackground(view.getContext(), view, !getEditor().isLight(),
|
||||||
|
R.drawable.bg_left_menu_light, R.drawable.bg_left_menu_dark);
|
||||||
|
} else {
|
||||||
|
AndroidUtils.setBackground(view.getContext(), view.findViewById(R.id.title_view), !getEditor().isLight(),
|
||||||
|
R.drawable.bg_point_editor_view_light, R.drawable.bg_point_editor_view_dark);
|
||||||
|
}
|
||||||
|
|
||||||
|
View editorScrollView = view.findViewById(R.id.editor_scroll_view);
|
||||||
|
if (editorScrollView != null) {
|
||||||
|
if (getEditor().isLight()) {
|
||||||
|
editorScrollView.setBackgroundColor(getResources().getColor(R.color.ctx_menu_info_view_bg_light));
|
||||||
|
} else {
|
||||||
|
editorScrollView.setBackgroundColor(getResources().getColor(R.color.ctx_menu_info_view_bg_dark));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
View descriptionInfoView = view.findViewById(R.id.description_info_view);
|
||||||
|
if (descriptionInfoView != null) {
|
||||||
|
if (getEditor().isLight()) {
|
||||||
|
descriptionInfoView.setBackgroundColor(getResources().getColor(R.color.ctx_menu_info_view_bg_light));
|
||||||
|
} else {
|
||||||
|
descriptionInfoView.setBackgroundColor(getResources().getColor(R.color.ctx_menu_info_view_bg_dark));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
|
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
|
||||||
toolbar.setTitle(getToolbarTitle());
|
toolbar.setTitle(getToolbarTitle());
|
||||||
toolbar.setNavigationIcon(getMyApplication().getIconsCache().getIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha));
|
toolbar.setNavigationIcon(getMyApplication().getIconsCache().getIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha));
|
||||||
|
@ -99,15 +125,21 @@ public abstract class PointEditorFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
TextView headerCaption = (TextView) view.findViewById(R.id.header_caption);
|
TextView headerCaption = (TextView) view.findViewById(R.id.header_caption);
|
||||||
|
AndroidUtils.setTextPrimaryColor(view.getContext(), headerCaption, !getEditor().isLight());
|
||||||
headerCaption.setText(getHeaderCaption());
|
headerCaption.setText(getHeaderCaption());
|
||||||
TextView nameCaption = (TextView) view.findViewById(R.id.name_caption);
|
TextView nameCaption = (TextView) view.findViewById(R.id.name_caption);
|
||||||
|
AndroidUtils.setTextSecondaryColor(view.getContext(), nameCaption, !getEditor().isLight());
|
||||||
nameCaption.setText(getNameCaption());
|
nameCaption.setText(getNameCaption());
|
||||||
TextView categoryCaption = (TextView) view.findViewById(R.id.category_caption);
|
TextView categoryCaption = (TextView) view.findViewById(R.id.category_caption);
|
||||||
|
AndroidUtils.setTextSecondaryColor(view.getContext(), categoryCaption, !getEditor().isLight());
|
||||||
categoryCaption.setText(getCategoryCaption());
|
categoryCaption.setText(getCategoryCaption());
|
||||||
|
|
||||||
nameEdit = (EditText) view.findViewById(R.id.name_edit);
|
nameEdit = (EditText) view.findViewById(R.id.name_edit);
|
||||||
|
AndroidUtils.setTextPrimaryColor(view.getContext(), nameEdit, !getEditor().isLight());
|
||||||
|
AndroidUtils.setHintTextSecondaryColor(view.getContext(), nameEdit, !getEditor().isLight());
|
||||||
nameEdit.setText(getNameInitValue());
|
nameEdit.setText(getNameInitValue());
|
||||||
AutoCompleteTextViewEx categoryEdit = (AutoCompleteTextViewEx) view.findViewById(R.id.category_edit);
|
AutoCompleteTextViewEx categoryEdit = (AutoCompleteTextViewEx) view.findViewById(R.id.category_edit);
|
||||||
|
AndroidUtils.setTextPrimaryColor(view.getContext(), categoryEdit, !getEditor().isLight());
|
||||||
categoryEdit.setText(getCategoryInitValue());
|
categoryEdit.setText(getCategoryInitValue());
|
||||||
categoryEdit.setFocusable(false);
|
categoryEdit.setFocusable(false);
|
||||||
categoryEdit.setOnTouchListener(new View.OnTouchListener() {
|
categoryEdit.setOnTouchListener(new View.OnTouchListener() {
|
||||||
|
@ -124,6 +156,8 @@ public abstract class PointEditorFragment extends Fragment {
|
||||||
});
|
});
|
||||||
|
|
||||||
EditText descriptionEdit = (EditText) view.findViewById(R.id.description_edit);
|
EditText descriptionEdit = (EditText) view.findViewById(R.id.description_edit);
|
||||||
|
AndroidUtils.setTextPrimaryColor(view.getContext(), descriptionEdit, !getEditor().isLight());
|
||||||
|
AndroidUtils.setHintTextSecondaryColor(view.getContext(), descriptionEdit, !getEditor().isLight());
|
||||||
if (getDescriptionInitValue() != null) {
|
if (getDescriptionInitValue() != null) {
|
||||||
descriptionEdit.setText(getDescriptionInitValue());
|
descriptionEdit.setText(getDescriptionInitValue());
|
||||||
}
|
}
|
||||||
|
@ -143,9 +177,8 @@ public abstract class PointEditorFragment extends Fragment {
|
||||||
|
|
||||||
public Drawable getRowIcon(int iconId) {
|
public Drawable getRowIcon(int iconId) {
|
||||||
IconsCache iconsCache = getMyApplication().getIconsCache();
|
IconsCache iconsCache = getMyApplication().getIconsCache();
|
||||||
boolean light = getMyApplication().getSettings().isLightContent();
|
|
||||||
return iconsCache.getIcon(iconId,
|
return iconsCache.getIcon(iconId,
|
||||||
light ? R.color.icon_color : R.color.icon_color_light);
|
getEditor().isLight() ? R.color.icon_color : R.color.icon_color_light);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -162,6 +162,7 @@ public class MapMultiSelectionMenu extends BaseMenuController {
|
||||||
|
|
||||||
this.latLon = latLon;
|
this.latLon = latLon;
|
||||||
createCollection(selectedObjects);
|
createCollection(selectedObjects);
|
||||||
|
updateNightMode();
|
||||||
MapMultiSelectionMenuFragment.showInstance(getMapActivity());
|
MapMultiSelectionMenuFragment.showInstance(getMapActivity());
|
||||||
getMapActivity().refreshMap();
|
getMapActivity().refreshMap();
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ import android.widget.ImageView;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.plus.IconsCache;
|
import net.osmand.plus.IconsCache;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
@ -44,6 +45,13 @@ public class MapMultiSelectionMenuFragment extends Fragment implements AdapterVi
|
||||||
menu = ((MapActivity) getActivity()).getContextMenu().getMultiSelectionMenu();
|
menu = ((MapActivity) getActivity()).getContextMenu().getMultiSelectionMenu();
|
||||||
|
|
||||||
view = inflater.inflate(R.layout.menu_obj_selection_fragment, container, false);
|
view = inflater.inflate(R.layout.menu_obj_selection_fragment, container, false);
|
||||||
|
if (menu.isLandscapeLayout()) {
|
||||||
|
AndroidUtils.setBackground(view.getContext(), view, !menu.isLight(),
|
||||||
|
R.drawable.bg_left_menu_light, R.drawable.bg_left_menu_dark);
|
||||||
|
} else {
|
||||||
|
AndroidUtils.setBackground(view.getContext(), view, !menu.isLight(),
|
||||||
|
R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark);
|
||||||
|
}
|
||||||
|
|
||||||
ListView listView = (ListView) view.findViewById(R.id.list);
|
ListView listView = (ListView) view.findViewById(R.id.list);
|
||||||
listAdapter = createAdapter();
|
listAdapter = createAdapter();
|
||||||
|
@ -134,6 +142,7 @@ public class MapMultiSelectionMenuFragment extends Fragment implements AdapterVi
|
||||||
|
|
||||||
private void buildHeader(View view, MenuObject item, MapActivity mapActivity) {
|
private void buildHeader(View view, MenuObject item, MapActivity mapActivity) {
|
||||||
|
|
||||||
|
AndroidUtils.setBackground(mapActivity, view, !menu.isLight(), R.drawable.expandable_list_item_background_light, R.drawable.expandable_list_item_background_dark);
|
||||||
IconsCache iconsCache = mapActivity.getMyApplication().getIconsCache();
|
IconsCache iconsCache = mapActivity.getMyApplication().getIconsCache();
|
||||||
final View iconLayout = view.findViewById(R.id.context_menu_icon_layout);
|
final View iconLayout = view.findViewById(R.id.context_menu_icon_layout);
|
||||||
final ImageView iconView = (ImageView) view.findViewById(R.id.context_menu_icon_view);
|
final ImageView iconView = (ImageView) view.findViewById(R.id.context_menu_icon_view);
|
||||||
|
@ -152,10 +161,12 @@ public class MapMultiSelectionMenuFragment extends Fragment implements AdapterVi
|
||||||
|
|
||||||
// Text line 1
|
// Text line 1
|
||||||
TextView line1 = (TextView) view.findViewById(R.id.context_menu_line1);
|
TextView line1 = (TextView) view.findViewById(R.id.context_menu_line1);
|
||||||
|
AndroidUtils.setTextPrimaryColor(mapActivity, line1, !menu.isLight());
|
||||||
line1.setText(item.getTitleStr());
|
line1.setText(item.getTitleStr());
|
||||||
|
|
||||||
// Text line 2
|
// Text line 2
|
||||||
TextView line2 = (TextView) view.findViewById(R.id.context_menu_line2);
|
TextView line2 = (TextView) view.findViewById(R.id.context_menu_line2);
|
||||||
|
AndroidUtils.setTextSecondaryColor(mapActivity, line2, !menu.isLight());
|
||||||
line2.setText(item.getTypeStr());
|
line2.setText(item.getTypeStr());
|
||||||
Drawable slIcon = item.getTypeIcon();
|
Drawable slIcon = item.getTypeIcon();
|
||||||
line2.setCompoundDrawablesWithIntrinsicBounds(slIcon, null, null, null);
|
line2.setCompoundDrawablesWithIntrinsicBounds(slIcon, null, null, null);
|
||||||
|
|
|
@ -4,7 +4,6 @@ import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v4.content.ContextCompat;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
@ -120,52 +119,24 @@ public class MapRouteInfoMenuFragment extends Fragment {
|
||||||
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerBtn3), nightMode,
|
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerBtn3), nightMode,
|
||||||
R.color.dashboard_divider_light, R.color.dashboard_divider_dark);
|
R.color.dashboard_divider_light, R.color.dashboard_divider_dark);
|
||||||
|
|
||||||
((TextView) mainView.findViewById(R.id.ViaView)).setTextColor(nightMode ?
|
AndroidUtils.setTextPrimaryColor(ctx, (TextView) mainView.findViewById(R.id.ViaView), nightMode);
|
||||||
ContextCompat.getColorStateList(ctx, android.R.color.primary_text_dark)
|
AndroidUtils.setTextSecondaryColor(ctx, (TextView) mainView.findViewById(R.id.ViaSubView), nightMode);
|
||||||
: ContextCompat.getColorStateList(ctx, android.R.color.primary_text_light));
|
AndroidUtils.setTextSecondaryColor(ctx, (TextView) mainView.findViewById(R.id.toTitle), nightMode);
|
||||||
((TextView) mainView.findViewById(R.id.ViaSubView)).setTextColor(nightMode ?
|
AndroidUtils.setTextSecondaryColor(ctx, (TextView) mainView.findViewById(R.id.fromTitle), nightMode);
|
||||||
ContextCompat.getColorStateList(ctx, android.R.color.secondary_text_dark)
|
AndroidUtils.setTextSecondaryColor(ctx, (TextView) mainView.findViewById(R.id.InfoTextView), nightMode);
|
||||||
: ContextCompat.getColorStateList(ctx, android.R.color.secondary_text_light));
|
|
||||||
|
|
||||||
((TextView) mainView.findViewById(R.id.toTitle)).setTextColor(nightMode ?
|
AndroidUtils.setDashButtonBackground(ctx, mainView.findViewById(R.id.FromLayout), nightMode);
|
||||||
ContextCompat.getColorStateList(ctx, android.R.color.secondary_text_dark)
|
AndroidUtils.setDashButtonBackground(ctx, mainView.findViewById(R.id.ViaLayout), nightMode);
|
||||||
: ContextCompat.getColorStateList(ctx, android.R.color.secondary_text_light));
|
AndroidUtils.setDashButtonBackground(ctx, mainView.findViewById(R.id.ToLayout), nightMode);
|
||||||
|
AndroidUtils.setDashButtonBackground(ctx, mainView.findViewById(R.id.Info), nightMode);
|
||||||
|
|
||||||
((TextView) mainView.findViewById(R.id.fromTitle)).setTextColor(nightMode ?
|
AndroidUtils.setDashButtonBackground(ctx, mainView.findViewById(R.id.Next), nightMode);
|
||||||
ContextCompat.getColorStateList(ctx, android.R.color.secondary_text_dark)
|
AndroidUtils.setDashButtonBackground(ctx, mainView.findViewById(R.id.Prev), nightMode);
|
||||||
: ContextCompat.getColorStateList(ctx, android.R.color.secondary_text_light));
|
|
||||||
|
|
||||||
((TextView) mainView.findViewById(R.id.InfoTextView)).setTextColor(nightMode ?
|
|
||||||
ContextCompat.getColorStateList(ctx, android.R.color.secondary_text_dark)
|
|
||||||
: ContextCompat.getColorStateList(ctx, android.R.color.secondary_text_light));
|
|
||||||
|
|
||||||
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.FromLayout), nightMode,
|
|
||||||
R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
|
||||||
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.ViaLayout), nightMode,
|
|
||||||
R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
|
||||||
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.ToLayout), nightMode,
|
|
||||||
R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
|
||||||
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.Info), nightMode,
|
|
||||||
R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
|
||||||
|
|
||||||
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.Next), nightMode,
|
|
||||||
R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
|
||||||
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.Prev), nightMode,
|
|
||||||
R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
|
||||||
|
|
||||||
((TextView) mainView.findViewById(R.id.DistanceText)).setTextColor(nightMode ?
|
|
||||||
ContextCompat.getColorStateList(ctx, android.R.color.primary_text_dark)
|
|
||||||
: ContextCompat.getColorStateList(ctx, android.R.color.primary_text_light));
|
|
||||||
((TextView) mainView.findViewById(R.id.DistanceTitle)).setTextColor(nightMode ?
|
|
||||||
ContextCompat.getColorStateList(ctx, android.R.color.secondary_text_dark)
|
|
||||||
: ContextCompat.getColorStateList(ctx, android.R.color.secondary_text_light));
|
|
||||||
((TextView) mainView.findViewById(R.id.DurationText)).setTextColor(nightMode ?
|
|
||||||
ContextCompat.getColorStateList(ctx, android.R.color.primary_text_dark)
|
|
||||||
: ContextCompat.getColorStateList(ctx, android.R.color.primary_text_light));
|
|
||||||
((TextView) mainView.findViewById(R.id.DurationTitle)).setTextColor(nightMode ?
|
|
||||||
ContextCompat.getColorStateList(ctx, android.R.color.secondary_text_dark)
|
|
||||||
: ContextCompat.getColorStateList(ctx, android.R.color.secondary_text_light));
|
|
||||||
|
|
||||||
|
AndroidUtils.setTextPrimaryColor(ctx, (TextView) mainView.findViewById(R.id.DistanceText), nightMode);
|
||||||
|
AndroidUtils.setTextSecondaryColor(ctx, (TextView) mainView.findViewById(R.id.DistanceTitle), nightMode);
|
||||||
|
AndroidUtils.setTextPrimaryColor(ctx, (TextView) mainView.findViewById(R.id.DurationText), nightMode);
|
||||||
|
AndroidUtils.setTextSecondaryColor(ctx, (TextView) mainView.findViewById(R.id.DurationTitle), nightMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean showInstance(final MapActivity mapActivity) {
|
public static boolean showInstance(final MapActivity mapActivity) {
|
||||||
|
|
|
@ -14,6 +14,7 @@ import android.widget.ImageView;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.mapcontextmenu.other.ShareMenu.ShareItem;
|
import net.osmand.plus.mapcontextmenu.other.ShareMenu.ShareItem;
|
||||||
|
@ -40,6 +41,18 @@ public class ShareMenuFragment extends Fragment implements OnItemClickListener {
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
View view = inflater.inflate(R.layout.share_menu_fragment, container, false);
|
View view = inflater.inflate(R.layout.share_menu_fragment, container, false);
|
||||||
|
|
||||||
|
View mainView = view.findViewById(R.id.main_view);
|
||||||
|
if (menu.isLandscapeLayout()) {
|
||||||
|
AndroidUtils.setBackground(view.getContext(), mainView, !menu.isLight(),
|
||||||
|
R.drawable.bg_left_menu_light, R.drawable.bg_left_menu_dark);
|
||||||
|
} else {
|
||||||
|
AndroidUtils.setBackground(view.getContext(), mainView, !menu.isLight(),
|
||||||
|
R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark);
|
||||||
|
}
|
||||||
|
|
||||||
|
TextView headerCaption = (TextView) view.findViewById(R.id.header_caption);
|
||||||
|
AndroidUtils.setTextSecondaryColor(view.getContext(), headerCaption, !menu.isLight());
|
||||||
|
|
||||||
ListView listView = (ListView) view.findViewById(R.id.list);
|
ListView listView = (ListView) view.findViewById(R.id.list);
|
||||||
listAdapter = createAdapter();
|
listAdapter = createAdapter();
|
||||||
listView.setAdapter(listAdapter);
|
listView.setAdapter(listAdapter);
|
||||||
|
@ -88,11 +101,13 @@ public class ShareMenuFragment extends Fragment implements OnItemClickListener {
|
||||||
if (v == null) {
|
if (v == null) {
|
||||||
v = menu.getMapActivity().getLayoutInflater().inflate(R.layout.share_list_item, null);
|
v = menu.getMapActivity().getLayoutInflater().inflate(R.layout.share_list_item, null);
|
||||||
}
|
}
|
||||||
|
AndroidUtils.setBackground(v.getContext(), v, !menu.isLight(), R.drawable.expandable_list_item_background_light, R.drawable.expandable_list_item_background_dark);
|
||||||
final ShareItem item = getItem(position);
|
final ShareItem item = getItem(position);
|
||||||
ImageView icon = (ImageView) v.findViewById(R.id.icon);
|
ImageView icon = (ImageView) v.findViewById(R.id.icon);
|
||||||
icon.setImageDrawable(menu.getMapActivity().getMyApplication()
|
icon.setImageDrawable(menu.getMapActivity().getMyApplication()
|
||||||
.getIconsCache().getContentIcon(item.getIconResourceId()));
|
.getIconsCache().getContentIcon(item.getIconResourceId(), menu.isLight()));
|
||||||
TextView name = (TextView) v.findViewById(R.id.name);
|
TextView name = (TextView) v.findViewById(R.id.name);
|
||||||
|
AndroidUtils.setTextPrimaryColor(v.getContext(), name, !menu.isLight());
|
||||||
name.setText(getContext().getText(item.getTitleResourceId()));
|
name.setText(getContext().getText(item.getTitleResourceId()));
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
|
@ -255,8 +255,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
TextView routeGoButton = (TextView) main.findViewById(R.id.map_go_route_button);
|
TextView routeGoButton = (TextView) main.findViewById(R.id.map_go_route_button);
|
||||||
routeGoButton.setCompoundDrawablesWithIntrinsicBounds(app.getIconsCache().getIcon(R.drawable.map_start_navigation, R.color.color_myloc_distance), null, null, null);
|
routeGoButton.setCompoundDrawablesWithIntrinsicBounds(app.getIconsCache().getIcon(R.drawable.map_start_navigation, R.color.color_myloc_distance), null, null, null);
|
||||||
routeGoButton.setText(mapActivity.getString(R.string.shared_string_go));
|
routeGoButton.setText(mapActivity.getString(R.string.shared_string_go));
|
||||||
routeGoButton.setTextColor(nightMode ?
|
AndroidUtils.setTextSecondaryColor(mapActivity, routeGoButton, nightMode);
|
||||||
ContextCompat.getColorStateList(mapActivity, android.R.color.secondary_text_dark) : ContextCompat.getColorStateList(mapActivity, android.R.color.secondary_text_light));
|
|
||||||
AndroidUtils.setBackground(mapActivity, routeGoButton, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
AndroidUtils.setBackground(mapActivity, routeGoButton, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
||||||
routeGoButton.setOnClickListener(new View.OnClickListener() {
|
routeGoButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -321,7 +321,7 @@ public class MapInfoWidgetsFactory {
|
||||||
boolean updated = updateVisibility(waypointInfoBar, true);
|
boolean updated = updateVisibility(waypointInfoBar, true);
|
||||||
// pass top bar to make it clickable
|
// pass top bar to make it clickable
|
||||||
WaypointDialogHelper.updatePointInfoView(map.getMyApplication(), map, topBar,
|
WaypointDialogHelper.updatePointInfoView(map.getMyApplication(), map, topBar,
|
||||||
pnt, true);
|
pnt, true, !map.getMyApplication().getSettings().isLightContent());
|
||||||
if (updated || changed) {
|
if (updated || changed) {
|
||||||
ImageView all = (ImageView) waypointInfoBar.findViewById(R.id.waypoint_more);
|
ImageView all = (ImageView) waypointInfoBar.findViewById(R.id.waypoint_more);
|
||||||
ImageView remove = (ImageView) waypointInfoBar.findViewById(R.id.waypoint_close);
|
ImageView remove = (ImageView) waypointInfoBar.findViewById(R.id.waypoint_close);
|
||||||
|
|
Loading…
Reference in a new issue