Implementing layout for configure screen.
This commit is contained in:
parent
ea59f417ec
commit
dc19cb8a0c
22 changed files with 269 additions and 187 deletions
|
@ -1,46 +1,46 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:minHeight="54dp"
|
android:background="?attr/bg_color"
|
||||||
android:orientation="horizontal"
|
android:minHeight="54dp"
|
||||||
android:paddingLeft="16dp"
|
android:orientation="horizontal"
|
||||||
android:paddingRight="16dp">
|
android:paddingLeft="16dp"
|
||||||
|
android:paddingRight="16dp">
|
||||||
|
|
||||||
<ImageView
|
<android.support.v7.widget.AppCompatImageView
|
||||||
android:id="@+id/icon"
|
android:id="@+id/icon"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="16dp"
|
|
||||||
android:layout_marginTop="16dp"
|
|
||||||
android:layout_marginRight="32dp"
|
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
tools:src="@drawable/ic_action_gabout_dark" />
|
android:layout_marginBottom="16dp"
|
||||||
|
android:layout_marginRight="32dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
tools:src="@drawable/ic_action_gabout_dark"/>
|
||||||
|
|
||||||
<TextView
|
<android.support.v7.widget.AppCompatTextView
|
||||||
android:id="@+id/title"
|
android:id="@+id/title"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="@dimen/default_list_text_size"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
tools:text="Some title text" />
|
android:layout_weight="1"
|
||||||
|
android:textSize="@dimen/default_list_text_size"
|
||||||
|
tools:text="Some title text"/>
|
||||||
|
|
||||||
<ImageView
|
<android.support.v7.widget.AppCompatImageView
|
||||||
android:id="@+id/menu"
|
android:id="@+id/secondary_icon"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="16dp"
|
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
tools:src="@drawable/ic_action_gabout_dark" />
|
android:layout_margin="16dp"
|
||||||
|
tools:src="@drawable/ic_action_gabout_dark"/>
|
||||||
|
|
||||||
<android.support.v7.widget.SwitchCompat
|
<android.support.v7.widget.SwitchCompat
|
||||||
android:id="@+id/toggle_item"
|
android:id="@+id/toggle_item"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginLeft="16dp"
|
android:layout_gravity="center_vertical"
|
||||||
android:focusable="false"
|
android:focusable="false"/>
|
||||||
android:layout_gravity="center_vertical" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
32
OsmAnd/res/layout/list_item_text_button.xml
Normal file
32
OsmAnd/res/layout/list_item_text_button.xml
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/bg_color"
|
||||||
|
android:minHeight="54dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/title"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:textSize="@dimen/default_list_text_size"
|
||||||
|
tools:text="Some title text"/>
|
||||||
|
|
||||||
|
<android.support.v7.widget.AppCompatButton
|
||||||
|
android:id="@+id/description"
|
||||||
|
style="@style/Widget.AppCompat.Button.Borderless"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:inputType="textCapWords"
|
||||||
|
tools:text="topbar"
|
||||||
|
android:textColor="?colorAccent"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:focusable="false"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -5,8 +5,12 @@ import android.content.Context;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
import android.support.annotation.DrawableRes;
|
||||||
|
import android.support.annotation.IdRes;
|
||||||
import android.support.annotation.LayoutRes;
|
import android.support.annotation.LayoutRes;
|
||||||
import android.support.annotation.StringRes;
|
import android.support.annotation.StringRes;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
|
import android.support.v4.graphics.drawable.DrawableCompat;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
|
@ -88,7 +92,8 @@ public class ContextMenuAdapter {
|
||||||
final TIntArrayList loadingList = new TIntArrayList();
|
final TIntArrayList loadingList = new TIntArrayList();
|
||||||
final TIntArrayList layoutIds = new TIntArrayList();
|
final TIntArrayList layoutIds = new TIntArrayList();
|
||||||
final TIntArrayList iconList = new TIntArrayList();
|
final TIntArrayList iconList = new TIntArrayList();
|
||||||
final TIntArrayList iconListLight = new TIntArrayList();
|
final TIntArrayList lightIconList = new TIntArrayList();
|
||||||
|
final TIntArrayList secondaryLightIconList = new TIntArrayList();
|
||||||
final ArrayList<String> itemDescription = new ArrayList<String>();
|
final ArrayList<String> itemDescription = new ArrayList<String>();
|
||||||
private List<ApplicationMode> visibleModes = new ArrayList<ApplicationMode>();
|
private List<ApplicationMode> visibleModes = new ArrayList<ApplicationMode>();
|
||||||
private ConfigureMapMenu.OnClickListener changeAppModeListener = null;
|
private ConfigureMapMenu.OnClickListener changeAppModeListener = null;
|
||||||
|
@ -170,13 +175,22 @@ public class ContextMenuAdapter {
|
||||||
if (lst != 0) {
|
if (lst != 0) {
|
||||||
return ctx.getResources().getDrawable(lst);
|
return ctx.getResources().getDrawable(lst);
|
||||||
}
|
}
|
||||||
int lstLight = iconListLight.get(pos);
|
int lstLight = lightIconList.get(pos);
|
||||||
if (lstLight != 0) {
|
if (lstLight != 0) {
|
||||||
return ctx.getIconsCache().getIcon(lstLight, light);
|
return ctx.getIconsCache().getIcon(lstLight, light);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Drawable getSecondaryImage(OsmandApplication ctx, int pos, boolean light) {
|
||||||
|
@DrawableRes
|
||||||
|
int secondaryDrawableId = secondaryLightIconList.get(pos);
|
||||||
|
if (secondaryDrawableId != 0) {
|
||||||
|
return ContextCompat.getDrawable(ctx, secondaryDrawableId);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public int getBackgroundColor(Context ctx, boolean holoLight) {
|
public int getBackgroundColor(Context ctx, boolean holoLight) {
|
||||||
if (holoLight) {
|
if (holoLight) {
|
||||||
return ctx.getResources().getColor(R.color.bg_color_light);
|
return ctx.getResources().getColor(R.color.bg_color_light);
|
||||||
|
@ -206,12 +220,18 @@ public class ContextMenuAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Item {
|
public class Item {
|
||||||
|
@DrawableRes
|
||||||
int icon = 0;
|
int icon = 0;
|
||||||
|
@DrawableRes
|
||||||
int lightIcon = 0;
|
int lightIcon = 0;
|
||||||
|
@DrawableRes
|
||||||
|
int secondaryLightIcon = 0;
|
||||||
|
@IdRes
|
||||||
int id;
|
int id;
|
||||||
String name;
|
String name;
|
||||||
int selected = -1;
|
int selected = -1;
|
||||||
int progress = -1;
|
int progress = -1;
|
||||||
|
@LayoutRes
|
||||||
int layout = -1;
|
int layout = -1;
|
||||||
int loading = -1;
|
int loading = -1;
|
||||||
boolean cat;
|
boolean cat;
|
||||||
|
@ -223,16 +243,20 @@ public class ContextMenuAdapter {
|
||||||
private Item() {
|
private Item() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Item icon(int icon) {
|
public Item icon(@DrawableRes int icon) {
|
||||||
this.icon = icon;
|
this.icon = icon;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Item iconColor(int icon) {
|
public Item colorIcon(@DrawableRes int icon) {
|
||||||
this.lightIcon = icon;
|
this.lightIcon = icon;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Item secondaryIconColor(@DrawableRes int icon) {
|
||||||
|
this.secondaryLightIcon = icon;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Item position(int pos) {
|
public Item position(int pos) {
|
||||||
this.pos = pos;
|
this.pos = pos;
|
||||||
|
@ -254,7 +278,7 @@ public class ContextMenuAdapter {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Item layout(int l) {
|
public Item layout(@LayoutRes int l) {
|
||||||
this.layout = l;
|
this.layout = l;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -286,7 +310,8 @@ public class ContextMenuAdapter {
|
||||||
loadingList.insert(pos, loading);
|
loadingList.insert(pos, loading);
|
||||||
layoutIds.insert(pos, layout);
|
layoutIds.insert(pos, layout);
|
||||||
iconList.insert(pos, icon);
|
iconList.insert(pos, icon);
|
||||||
iconListLight.insert(pos, lightIcon);
|
lightIconList.insert(pos, lightIcon);
|
||||||
|
secondaryLightIconList.insert(pos, secondaryLightIcon);
|
||||||
checkListeners.add(pos, checkBoxListener);
|
checkListeners.add(pos, checkBoxListener);
|
||||||
integerListeners.add(pos, integerListener);
|
integerListeners.add(pos, integerListener);
|
||||||
isCategory.insert(pos, cat ? 1 : 0);
|
isCategory.insert(pos, cat ? 1 : 0);
|
||||||
|
@ -314,7 +339,8 @@ public class ContextMenuAdapter {
|
||||||
selectedList.removeAt(pos);
|
selectedList.removeAt(pos);
|
||||||
progressList.removeAt(pos);
|
progressList.removeAt(pos);
|
||||||
iconList.removeAt(pos);
|
iconList.removeAt(pos);
|
||||||
iconListLight.removeAt(pos);
|
lightIconList.removeAt(pos);
|
||||||
|
secondaryLightIconList.removeAt(pos);
|
||||||
checkListeners.remove(pos);
|
checkListeners.remove(pos);
|
||||||
integerListeners.remove(pos);
|
integerListeners.remove(pos);
|
||||||
isCategory.removeAt(pos);
|
isCategory.removeAt(pos);
|
||||||
|
@ -344,9 +370,8 @@ public class ContextMenuAdapter {
|
||||||
public ArrayAdapter<?> createListAdapter(final Activity activity, final boolean holoLight) {
|
public ArrayAdapter<?> createListAdapter(final Activity activity, final boolean holoLight) {
|
||||||
final int layoutId = defaultLayoutId;
|
final int layoutId = defaultLayoutId;
|
||||||
final OsmandApplication app = ((OsmandApplication) activity.getApplication());
|
final OsmandApplication app = ((OsmandApplication) activity.getApplication());
|
||||||
ArrayAdapter<String> listAdapter = new ContextMenuArrayAdapter(activity, layoutId, R.id.title,
|
return new ContextMenuArrayAdapter(activity, layoutId, R.id.title,
|
||||||
getItemNames(), app, holoLight);
|
getItemNames(), app, holoLight);
|
||||||
return listAdapter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ContextMenuArrayAdapter extends ArrayAdapter<String> {
|
public class ContextMenuArrayAdapter extends ArrayAdapter<String> {
|
||||||
|
@ -385,7 +410,7 @@ public class ContextMenuAdapter {
|
||||||
}
|
}
|
||||||
if (convertView == null || (!lid.equals(convertView.getTag()))) {
|
if (convertView == null || (!lid.equals(convertView.getTag()))) {
|
||||||
convertView = activity.getLayoutInflater().inflate(lid, parent, false);
|
convertView = activity.getLayoutInflater().inflate(lid, parent, false);
|
||||||
AndroidUtils.setListItemBackground(ctx, convertView, !holoLight);
|
// AndroidUtils.setListItemBackground(ctx, convertView, !holoLight);
|
||||||
convertView.setTag(lid);
|
convertView.setTag(lid);
|
||||||
}
|
}
|
||||||
TextView tv = (TextView) convertView.findViewById(R.id.title);
|
TextView tv = (TextView) convertView.findViewById(R.id.title);
|
||||||
|
@ -398,7 +423,7 @@ public class ContextMenuAdapter {
|
||||||
int color = activity.getResources()
|
int color = activity.getResources()
|
||||||
.getColor(holoLight ? R.color.icon_color : R.color.dashboard_subheader_text_dark);
|
.getColor(holoLight ? R.color.icon_color : R.color.dashboard_subheader_text_dark);
|
||||||
Drawable imageId = app.getIconsCache().getPaintedContentIcon(
|
Drawable imageId = app.getIconsCache().getPaintedContentIcon(
|
||||||
iconListLight.get(position), color);
|
lightIconList.get(position), color);
|
||||||
float density = activity.getResources().getDisplayMetrics().density;
|
float density = activity.getResources().getDisplayMetrics().density;
|
||||||
int paddingInPixels = (int) (24 * density);
|
int paddingInPixels = (int) (24 * density);
|
||||||
int drawableSizeInPixels = (int) (24 * density); // 32
|
int drawableSizeInPixels = (int) (24 * density); // 32
|
||||||
|
@ -406,15 +431,31 @@ public class ContextMenuAdapter {
|
||||||
tv.setCompoundDrawables(imageId, null, null, null);
|
tv.setCompoundDrawables(imageId, null, null, null);
|
||||||
tv.setCompoundDrawablePadding(paddingInPixels);
|
tv.setCompoundDrawablePadding(paddingInPixels);
|
||||||
} else {
|
} else {
|
||||||
Drawable imageId = getImage(app, position, holoLight);
|
Drawable drawable = getImage(app, position, holoLight);
|
||||||
if (imageId != null) {
|
if (drawable != null) {
|
||||||
|
|
||||||
((ImageView) convertView.findViewById(R.id.icon)).setImageDrawable(imageId);
|
((ImageView) convertView.findViewById(R.id.icon)).setImageDrawable(drawable);
|
||||||
convertView.findViewById(R.id.icon).setVisibility(View.VISIBLE);
|
convertView.findViewById(R.id.icon).setVisibility(View.VISIBLE);
|
||||||
} else if (convertView.findViewById(R.id.icon) != null) {
|
} else if (convertView.findViewById(R.id.icon) != null) {
|
||||||
convertView.findViewById(R.id.icon).setVisibility(View.GONE);
|
convertView.findViewById(R.id.icon).setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@DrawableRes
|
||||||
|
int secondaryLightDrawable = secondaryLightIconList.get(position);
|
||||||
|
if (secondaryLightDrawable != 0) {
|
||||||
|
int color = ContextCompat.getColor(ctx,
|
||||||
|
holoLight ? R.color.icon_color : R.color.dashboard_subheader_text_dark);
|
||||||
|
Drawable drawable = getSecondaryImage(app, position, holoLight);
|
||||||
|
DrawableCompat.setTint(drawable, color);
|
||||||
|
ImageView imageView = (ImageView) convertView.findViewById(R.id.secondary_icon);
|
||||||
|
imageView.setImageDrawable(drawable);
|
||||||
|
imageView.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
ImageView imageView = (ImageView) convertView.findViewById(R.id.secondary_icon);
|
||||||
|
if (imageView != null) {
|
||||||
|
imageView.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isCategory(position)) {
|
if (isCategory(position)) {
|
||||||
tv.setTypeface(Typeface.DEFAULT_BOLD);
|
tv.setTypeface(Typeface.DEFAULT_BOLD);
|
||||||
|
|
|
@ -279,14 +279,14 @@ public class MapActivityActions implements DialogProvider {
|
||||||
|
|
||||||
public void contextMenuPoint(final double latitude, final double longitude, final ContextMenuAdapter iadapter, Object selectedObj) {
|
public void contextMenuPoint(final double latitude, final double longitude, final ContextMenuAdapter iadapter, Object selectedObj) {
|
||||||
final ContextMenuAdapter adapter = iadapter == null ? new ContextMenuAdapter(mapActivity) : iadapter;
|
final ContextMenuAdapter adapter = iadapter == null ? new ContextMenuAdapter(mapActivity) : iadapter;
|
||||||
adapter.item(R.string.context_menu_item_search).iconColor(R.drawable.ic_action_search_dark).reg();
|
adapter.item(R.string.context_menu_item_search).colorIcon(R.drawable.ic_action_search_dark).reg();
|
||||||
if (!mapActivity.getRoutingHelper().isFollowingMode() && !mapActivity.getRoutingHelper().isRoutePlanningMode()) {
|
if (!mapActivity.getRoutingHelper().isFollowingMode() && !mapActivity.getRoutingHelper().isRoutePlanningMode()) {
|
||||||
adapter.item(R.string.context_menu_item_directions_from).iconColor(
|
adapter.item(R.string.context_menu_item_directions_from).colorIcon(
|
||||||
R.drawable.ic_action_gdirections_dark).reg();
|
R.drawable.ic_action_gdirections_dark).reg();
|
||||||
}
|
}
|
||||||
if (getMyApplication().getTargetPointsHelper().getPointToNavigate() != null &&
|
if (getMyApplication().getTargetPointsHelper().getPointToNavigate() != null &&
|
||||||
(mapActivity.getRoutingHelper().isFollowingMode() || mapActivity.getRoutingHelper().isRoutePlanningMode())) {
|
(mapActivity.getRoutingHelper().isFollowingMode() || mapActivity.getRoutingHelper().isRoutePlanningMode())) {
|
||||||
adapter.item(R.string.context_menu_item_last_intermediate_point).iconColor(
|
adapter.item(R.string.context_menu_item_last_intermediate_point).colorIcon(
|
||||||
R.drawable.ic_action_intermediate).reg();
|
R.drawable.ic_action_intermediate).reg();
|
||||||
}
|
}
|
||||||
OsmandPlugin.registerMapContextMenu(mapActivity, latitude, longitude, adapter, selectedObj);
|
OsmandPlugin.registerMapContextMenu(mapActivity, latitude, longitude, adapter, selectedObj);
|
||||||
|
@ -593,7 +593,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
final OsmandApplication app = mapActivity.getMyApplication();
|
final OsmandApplication app = mapActivity.getMyApplication();
|
||||||
ContextMenuAdapter optionsMenuHelper = new ContextMenuAdapter(app);
|
ContextMenuAdapter optionsMenuHelper = new ContextMenuAdapter(app);
|
||||||
|
|
||||||
optionsMenuHelper.item(R.string.home).iconColor(R.drawable.map_dashboard)
|
optionsMenuHelper.item(R.string.home).colorIcon(R.drawable.map_dashboard)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
|
@ -604,7 +604,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
if (settings.USE_MAP_MARKERS.get()) {
|
if (settings.USE_MAP_MARKERS.get()) {
|
||||||
optionsMenuHelper.item(R.string.map_markers).iconColor(R.drawable.ic_action_flag_dark)
|
optionsMenuHelper.item(R.string.map_markers).colorIcon(R.drawable.ic_action_flag_dark)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
|
@ -614,7 +614,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
} else {
|
} else {
|
||||||
optionsMenuHelper.item(R.string.waypoints).iconColor(R.drawable.ic_action_intermediate)
|
optionsMenuHelper.item(R.string.waypoints).colorIcon(R.drawable.ic_action_intermediate)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
|
@ -624,7 +624,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
}
|
}
|
||||||
optionsMenuHelper.item(R.string.get_directions).iconColor(R.drawable.ic_action_gdirections_dark)
|
optionsMenuHelper.item(R.string.get_directions).colorIcon(R.drawable.ic_action_gdirections_dark)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
|
@ -643,7 +643,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
}).reg();
|
}).reg();
|
||||||
// Default actions (Layers, Configure Map screen, Settings, Search, Favorites)
|
// Default actions (Layers, Configure Map screen, Settings, Search, Favorites)
|
||||||
optionsMenuHelper.item(R.string.search_button)
|
optionsMenuHelper.item(R.string.search_button)
|
||||||
.iconColor(R.drawable.ic_action_search_dark)
|
.colorIcon(R.drawable.ic_action_search_dark)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
|
@ -661,7 +661,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
|
|
||||||
optionsMenuHelper.item(R.string.shared_string_my_places).iconColor(R.drawable.ic_action_fav_dark)
|
optionsMenuHelper.item(R.string.shared_string_my_places).colorIcon(R.drawable.ic_action_fav_dark)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
|
@ -674,7 +674,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
}).reg();
|
}).reg();
|
||||||
|
|
||||||
|
|
||||||
optionsMenuHelper.item(R.string.show_point_options).iconColor(R.drawable.ic_action_marker_dark)
|
optionsMenuHelper.item(R.string.show_point_options).colorIcon(R.drawable.ic_action_marker_dark)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
|
@ -684,7 +684,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
|
|
||||||
optionsMenuHelper.item(R.string.configure_map).iconColor(R.drawable.ic_action_layers_dark)
|
optionsMenuHelper.item(R.string.configure_map).colorIcon(R.drawable.ic_action_layers_dark)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
|
@ -694,7 +694,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
|
|
||||||
optionsMenuHelper.item(R.string.layer_map_appearance).iconColor(R.drawable.ic_configure_screen_dark)
|
optionsMenuHelper.item(R.string.layer_map_appearance).colorIcon(R.drawable.ic_configure_screen_dark)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
|
@ -711,7 +711,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
d += " (" + updt.size() + ")";
|
d += " (" + updt.size() + ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
optionsMenuHelper.item(R.string.index_settings).name(d).iconColor(R.drawable.ic_type_archive)
|
optionsMenuHelper.item(R.string.index_settings).name(d).colorIcon(R.drawable.ic_type_archive)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
|
@ -724,7 +724,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
}).reg();
|
}).reg();
|
||||||
|
|
||||||
if (Version.isGooglePlayEnabled(app)) {
|
if (Version.isGooglePlayEnabled(app)) {
|
||||||
optionsMenuHelper.item(R.string.osm_live).iconColor(R.drawable.ic_action_osm_live)
|
optionsMenuHelper.item(R.string.osm_live).colorIcon(R.drawable.ic_action_osm_live)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
|
@ -736,7 +736,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
}).reg();
|
}).reg();
|
||||||
}
|
}
|
||||||
|
|
||||||
optionsMenuHelper.item(R.string.prefs_plugins).iconColor(R.drawable.ic_extension_dark)
|
optionsMenuHelper.item(R.string.prefs_plugins).colorIcon(R.drawable.ic_extension_dark)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
|
@ -749,7 +749,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
}).reg();
|
}).reg();
|
||||||
|
|
||||||
|
|
||||||
optionsMenuHelper.item(R.string.shared_string_settings).iconColor(R.drawable.ic_action_settings)
|
optionsMenuHelper.item(R.string.shared_string_settings).colorIcon(R.drawable.ic_action_settings)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
|
@ -760,7 +760,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
optionsMenuHelper.item(R.string.shared_string_help).iconColor(R.drawable.ic_action_help)
|
optionsMenuHelper.item(R.string.shared_string_help).colorIcon(R.drawable.ic_action_help)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
|
@ -774,7 +774,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
//////////// Others
|
//////////// Others
|
||||||
OsmandPlugin.registerOptionsMenu(mapActivity, optionsMenuHelper);
|
OsmandPlugin.registerOptionsMenu(mapActivity, optionsMenuHelper);
|
||||||
|
|
||||||
// optionsMenuHelper.item(R.string.shared_string_exit).iconColor(R.drawable.ic_action_quit_dark )
|
// optionsMenuHelper.item(R.string.shared_string_exit).colorIcon(R.drawable.ic_action_quit_dark )
|
||||||
// .listen(new OnContextMenuClick() {
|
// .listen(new OnContextMenuClick() {
|
||||||
// @Override
|
// @Override
|
||||||
// public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
// public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
|
|
|
@ -262,7 +262,7 @@ public class MapActivityLayers {
|
||||||
OsmandApplication app = (OsmandApplication) getApplication();
|
OsmandApplication app = (OsmandApplication) getApplication();
|
||||||
final PoiFiltersHelper poiFilters = app.getPoiFilters();
|
final PoiFiltersHelper poiFilters = app.getPoiFilters();
|
||||||
final ContextMenuAdapter adapter = new ContextMenuAdapter(activity);
|
final ContextMenuAdapter adapter = new ContextMenuAdapter(activity);
|
||||||
adapter.item(R.string.shared_string_search).iconColor(R.drawable.ic_action_search_dark).reg();
|
adapter.item(R.string.shared_string_search).colorIcon(R.drawable.ic_action_search_dark).reg();
|
||||||
final List<PoiUIFilter> list = new ArrayList<PoiUIFilter>();
|
final List<PoiUIFilter> list = new ArrayList<PoiUIFilter>();
|
||||||
list.add(poiFilters.getCustomPOIFilter());
|
list.add(poiFilters.getCustomPOIFilter());
|
||||||
for (PoiUIFilter f : poiFilters.getTopDefinedPoiFilters()) {
|
for (PoiUIFilter f : poiFilters.getTopDefinedPoiFilters()) {
|
||||||
|
|
|
@ -591,7 +591,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
adapter.item(R.string.layer_recordings).selected(SHOW_RECORDINGS.get() ? 1 : 0)
|
adapter.item(R.string.layer_recordings).selected(SHOW_RECORDINGS.get() ? 1 : 0)
|
||||||
.iconColor(R.drawable.ic_action_micro_dark).listen(listener).position(12).reg();
|
.colorIcon(R.drawable.ic_action_micro_dark).listen(listener).position(12).reg();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -600,7 +600,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
if (isRecording()) {
|
if (isRecording()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
adapter.item(R.string.recording_context_menu_arecord).iconColor(R.drawable.ic_action_micro_dark)
|
adapter.item(R.string.recording_context_menu_arecord).colorIcon(R.drawable.ic_action_micro_dark)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -609,7 +609,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}).position(6).reg();
|
}).position(6).reg();
|
||||||
adapter.item(R.string.recording_context_menu_vrecord).iconColor(R.drawable.ic_action_video_dark)
|
adapter.item(R.string.recording_context_menu_vrecord).colorIcon(R.drawable.ic_action_video_dark)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -618,7 +618,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}).position(7).reg();
|
}).position(7).reg();
|
||||||
adapter.item(R.string.recording_context_menu_precord).iconColor(R.drawable.ic_action_photo_dark)
|
adapter.item(R.string.recording_context_menu_precord).colorIcon(R.drawable.ic_action_photo_dark)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
|
|
|
@ -874,7 +874,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
if (listBackgroundView != null) {
|
if (listBackgroundView != null) {
|
||||||
listBackgroundView.setBackgroundColor(backgroundColor);
|
listBackgroundView.setBackgroundColor(backgroundColor);
|
||||||
} else {
|
} else {
|
||||||
listView.setBackgroundColor(backgroundColor);
|
// listView.setBackgroundColor(backgroundColor);
|
||||||
listEmptyTextView.setBackgroundColor(backgroundColor);
|
listEmptyTextView.setBackgroundColor(backgroundColor);
|
||||||
}
|
}
|
||||||
if (visibleType != DashboardType.WAYPOINTS && visibleType != DashboardType.MAP_MARKERS
|
if (visibleType != DashboardType.WAYPOINTS && visibleType != DashboardType.MAP_MARKERS
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class OsmandDevelopmentPlugin extends OsmandPlugin {
|
||||||
@Override
|
@Override
|
||||||
public void registerOptionsMenuItems(final MapActivity mapActivity, ContextMenuAdapter helper) {
|
public void registerOptionsMenuItems(final MapActivity mapActivity, ContextMenuAdapter helper) {
|
||||||
if (Version.isDeveloperVersion(mapActivity.getMyApplication())) {
|
if (Version.isDeveloperVersion(mapActivity.getMyApplication())) {
|
||||||
helper.item(R.string.version_settings).iconColor(R.drawable.ic_action_gabout_dark)
|
helper.item(R.string.version_settings).colorIcon(R.drawable.ic_action_gabout_dark)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
|
|
|
@ -172,20 +172,20 @@ public class ConfigureMapMenu {
|
||||||
adapter.item(R.string.shared_string_show).setCategory(true).layout(R.layout.drawer_list_sub_header).reg();
|
adapter.item(R.string.shared_string_show).setCategory(true).layout(R.layout.drawer_list_sub_header).reg();
|
||||||
// String appMode = " [" + settings.getApplicationMode().toHumanString(view.getApplication()) +"] ";
|
// String appMode = " [" + settings.getApplicationMode().toHumanString(view.getApplication()) +"] ";
|
||||||
adapter.item(R.string.layer_poi).selected(settings.SELECTED_POI_FILTER_FOR_MAP.get() != null ? 1 : 0)
|
adapter.item(R.string.layer_poi).selected(settings.SELECTED_POI_FILTER_FOR_MAP.get() != null ? 1 : 0)
|
||||||
.iconColor(R.drawable.ic_action_info_dark).listen(l).reg();
|
.colorIcon(R.drawable.ic_action_info_dark).listen(l).reg();
|
||||||
adapter.item(R.string.layer_amenity_label).selected(settings.SHOW_POI_LABEL.get() ? 1 : 0)
|
adapter.item(R.string.layer_amenity_label).selected(settings.SHOW_POI_LABEL.get() ? 1 : 0)
|
||||||
.iconColor(R.drawable.ic_action_text_dark).listen(l).reg();
|
.colorIcon(R.drawable.ic_action_text_dark).listen(l).reg();
|
||||||
adapter.item(R.string.shared_string_favorites).selected(settings.SHOW_FAVORITES.get() ? 1 : 0)
|
adapter.item(R.string.shared_string_favorites).selected(settings.SHOW_FAVORITES.get() ? 1 : 0)
|
||||||
.iconColor(R.drawable.ic_action_fav_dark).listen(l).reg();
|
.colorIcon(R.drawable.ic_action_fav_dark).listen(l).reg();
|
||||||
adapter.item(R.string.layer_gpx_layer).selected(
|
adapter.item(R.string.layer_gpx_layer).selected(
|
||||||
app.getSelectedGpxHelper().isShowingAnyGpxFiles() ? 1 : 0)
|
app.getSelectedGpxHelper().isShowingAnyGpxFiles() ? 1 : 0)
|
||||||
.iconColor(R.drawable.ic_action_polygom_dark)
|
.colorIcon(R.drawable.ic_action_polygom_dark)
|
||||||
.listen(l).reg();
|
.listen(l).reg();
|
||||||
adapter.item(R.string.layer_map).iconColor(R.drawable.ic_world_globe_dark)
|
adapter.item(R.string.layer_map).colorIcon(R.drawable.ic_world_globe_dark)
|
||||||
.listen(l).reg();
|
.listen(l).reg();
|
||||||
if(TransportRouteHelper.getInstance().routeIsCalculated()){
|
if(TransportRouteHelper.getInstance().routeIsCalculated()){
|
||||||
adapter.item(R.string.layer_transport_route).selected(1)
|
adapter.item(R.string.layer_transport_route).selected(1)
|
||||||
.iconColor(R.drawable.ic_action_bus_dark).listen(l).reg();
|
.colorIcon(R.drawable.ic_action_bus_dark).listen(l).reg();
|
||||||
}
|
}
|
||||||
|
|
||||||
OsmandPlugin.registerLayerContextMenu(activity.getMapView(), adapter, activity);
|
OsmandPlugin.registerLayerContextMenu(activity.getMapView(), adapter, activity);
|
||||||
|
|
|
@ -129,7 +129,7 @@ public class RasterMapMenu {
|
||||||
// android:max="255" in layout is expected
|
// android:max="255" in layout is expected
|
||||||
contextMenuAdapter.item(mapTypeStringTransparency)
|
contextMenuAdapter.item(mapTypeStringTransparency)
|
||||||
.layout(R.layout.progress_list_item)
|
.layout(R.layout.progress_list_item)
|
||||||
.iconColor(R.drawable.ic_action_opacity)
|
.colorIcon(R.drawable.ic_action_opacity)
|
||||||
.progress(mapTransparencyPreference.get())
|
.progress(mapTransparencyPreference.get())
|
||||||
.listen(l)
|
.listen(l)
|
||||||
.listenInteger(integerListener).reg();
|
.listenInteger(integerListener).reg();
|
||||||
|
|
|
@ -675,7 +675,7 @@ public class DistanceCalculatorPlugin extends OsmandPlugin {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
adapter.item(R.string.delete_point).iconColor(R.drawable.ic_action_delete_dark).listen(listener).reg();
|
adapter.item(R.string.delete_point).colorIcon(R.drawable.ic_action_delete_dark).listen(listener).reg();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,7 +208,7 @@ public class GpxUiHelper {
|
||||||
s = s.replace('_', ' ');
|
s = s.replace('_', ' ');
|
||||||
|
|
||||||
adapter.item(s).selected(multipleChoice ? 0 : -1)
|
adapter.item(s).selected(multipleChoice ? 0 : -1)
|
||||||
.iconColor(R.drawable.ic_action_polygom_dark).reg();
|
.colorIcon(R.drawable.ic_action_polygom_dark).reg();
|
||||||
|
|
||||||
//if there's some selected files - need to mark them as selected
|
//if there's some selected files - need to mark them as selected
|
||||||
if (selectedGpxList != null) {
|
if (selectedGpxList != null) {
|
||||||
|
|
|
@ -140,12 +140,12 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
adapter.item(R.string.context_menu_item_add_waypoint).iconColor(R.drawable.ic_action_gnew_label_dark)
|
adapter.item(R.string.context_menu_item_add_waypoint).colorIcon(R.drawable.ic_action_gnew_label_dark)
|
||||||
.listen(listener).reg();
|
.listen(listener).reg();
|
||||||
if (selectedObj instanceof WptPt) {
|
if (selectedObj instanceof WptPt) {
|
||||||
WptPt pt = (WptPt) selectedObj;
|
WptPt pt = (WptPt) selectedObj;
|
||||||
if (app.getSelectedGpxHelper().getSelectedGPXFile(pt) != null) {
|
if (app.getSelectedGpxHelper().getSelectedGPXFile(pt) != null) {
|
||||||
adapter.item(R.string.context_menu_item_edit_waypoint).iconColor(R.drawable.ic_action_edit_dark)
|
adapter.item(R.string.context_menu_item_edit_waypoint).colorIcon(R.drawable.ic_action_edit_dark)
|
||||||
.listen(listener).reg();
|
.listen(listener).reg();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,15 +216,15 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
||||||
isEditable = !amenity.getType().isWiki() && !poiType.isNotEditableOsm();
|
isEditable = !amenity.getType().isWiki() && !poiType.isNotEditableOsm();
|
||||||
}
|
}
|
||||||
if (isEditable) {
|
if (isEditable) {
|
||||||
adapter.item(R.string.poi_context_menu_modify).iconColor(R.drawable.ic_action_edit_dark).listen(listener).position(1).reg();
|
adapter.item(R.string.poi_context_menu_modify).colorIcon(R.drawable.ic_action_edit_dark).listen(listener).position(1).reg();
|
||||||
adapter.item(R.string.poi_context_menu_delete).iconColor(R.drawable.ic_action_delete_dark).listen(listener).position(2).reg();
|
adapter.item(R.string.poi_context_menu_delete).colorIcon(R.drawable.ic_action_delete_dark).listen(listener).position(2).reg();
|
||||||
} else if (selectedObj instanceof OpenstreetmapPoint && ((OpenstreetmapPoint) selectedObj).getAction() != Action.DELETE) {
|
} else if (selectedObj instanceof OpenstreetmapPoint && ((OpenstreetmapPoint) selectedObj).getAction() != Action.DELETE) {
|
||||||
adapter.item(R.string.poi_context_menu_modify_osm_change)
|
adapter.item(R.string.poi_context_menu_modify_osm_change)
|
||||||
.iconColor(R.drawable.ic_action_edit_dark).listen(listener).position(1).reg();
|
.colorIcon(R.drawable.ic_action_edit_dark).listen(listener).position(1).reg();
|
||||||
} else {
|
} else {
|
||||||
adapter.item(R.string.context_menu_item_create_poi).iconColor(R.drawable.ic_action_plus_dark).listen(listener).position(-1).reg();
|
adapter.item(R.string.context_menu_item_create_poi).colorIcon(R.drawable.ic_action_plus_dark).listen(listener).position(-1).reg();
|
||||||
}
|
}
|
||||||
adapter.item(R.string.context_menu_item_open_note).iconColor(R.drawable.ic_action_bug_dark).listen(listener).reg();
|
adapter.item(R.string.context_menu_item_open_note).colorIcon(R.drawable.ic_action_bug_dark).listen(listener).reg();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -240,7 +240,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
||||||
@Override
|
@Override
|
||||||
public void registerLayerContextMenuActions(OsmandMapTileView mapView, ContextMenuAdapter adapter, final MapActivity mapActivity) {
|
public void registerLayerContextMenuActions(OsmandMapTileView mapView, ContextMenuAdapter adapter, final MapActivity mapActivity) {
|
||||||
adapter.item(R.string.layer_osm_bugs).selected(settings.SHOW_OSM_BUGS.get() ? 1 : 0)
|
adapter.item(R.string.layer_osm_bugs).selected(settings.SHOW_OSM_BUGS.get() ? 1 : 0)
|
||||||
.iconColor(R.drawable.ic_action_bug_dark).listen(new OnContextMenuClick() {
|
.colorIcon(R.drawable.ic_action_bug_dark).listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
|
@ -263,7 +263,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
||||||
public void contextMenuFragment(final Activity la, final Fragment fragment, final Object info, ContextMenuAdapter adapter) {
|
public void contextMenuFragment(final Activity la, final Fragment fragment, final Object info, ContextMenuAdapter adapter) {
|
||||||
if (fragment instanceof AvailableGPXFragment) {
|
if (fragment instanceof AvailableGPXFragment) {
|
||||||
adapter.item(R.string.local_index_mi_upload_gpx)
|
adapter.item(R.string.local_index_mi_upload_gpx)
|
||||||
.iconColor(R.drawable.ic_action_export)
|
.colorIcon(R.drawable.ic_action_export)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -274,7 +274,7 @@ public class OsMoPlugin extends OsmandPlugin implements OsMoReactor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerOptionsMenuItems(final MapActivity mapActivity, ContextMenuAdapter helper) {
|
public void registerOptionsMenuItems(final MapActivity mapActivity, ContextMenuAdapter helper) {
|
||||||
helper.item(R.string.osmo_groups).iconColor(R.drawable.ic_osmo_dark).position(6)
|
helper.item(R.string.osmo_groups).colorIcon(R.drawable.ic_osmo_dark).position(6)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
|
|
|
@ -227,7 +227,7 @@ public class ParkingPositionPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
adapter.item(R.string.context_menu_item_add_parking_point)
|
adapter.item(R.string.context_menu_item_add_parking_point)
|
||||||
.iconColor( R.drawable.ic_action_parking_dark).listen(addListener).reg();
|
.colorIcon(R.drawable.ic_action_parking_dark).listen(addListener).reg();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -255,11 +255,11 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
|
||||||
String overlayMapDescr = settings.MAP_OVERLAY.get();
|
String overlayMapDescr = settings.MAP_OVERLAY.get();
|
||||||
overlayMapDescr = overlayMapDescr != null ? overlayMapDescr : mapActivity.getString(R.string.shared_string_none);
|
overlayMapDescr = overlayMapDescr != null ? overlayMapDescr : mapActivity.getString(R.string.shared_string_none);
|
||||||
adapter.item(R.string.layer_overlay).layout(R.layout.drawer_list_doubleitem).description(overlayMapDescr)
|
adapter.item(R.string.layer_overlay).layout(R.layout.drawer_list_doubleitem).description(overlayMapDescr)
|
||||||
.iconColor(R.drawable.ic_layer_top_dark).listen(listener).position(14).reg();
|
.colorIcon(R.drawable.ic_layer_top_dark).listen(listener).position(14).reg();
|
||||||
String underlayMapDescr = settings.MAP_UNDERLAY.get();
|
String underlayMapDescr = settings.MAP_UNDERLAY.get();
|
||||||
underlayMapDescr = underlayMapDescr != null ? underlayMapDescr : mapActivity.getString(R.string.shared_string_none);
|
underlayMapDescr = underlayMapDescr != null ? underlayMapDescr : mapActivity.getString(R.string.shared_string_none);
|
||||||
adapter.item(R.string.layer_underlay).layout(R.layout.drawer_list_doubleitem).description(underlayMapDescr)
|
adapter.item(R.string.layer_underlay).layout(R.layout.drawer_list_doubleitem).description(underlayMapDescr)
|
||||||
.iconColor(R.drawable.ic_layer_bottom_dark).listen(listener).position(15).reg();
|
.colorIcon(R.drawable.ic_layer_bottom_dark).listen(listener).position(15).reg();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -280,9 +280,9 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
adapter.item(R.string.context_menu_item_update_map).iconColor(R.drawable.ic_action_refresh_dark)
|
adapter.item(R.string.context_menu_item_update_map).colorIcon(R.drawable.ic_action_refresh_dark)
|
||||||
.listen(listener).reg();
|
.listen(listener).reg();
|
||||||
adapter.item(R.string.shared_string_download_map).iconColor(R.drawable.ic_action_import)
|
adapter.item(R.string.shared_string_download_map).colorIcon(R.drawable.ic_action_import)
|
||||||
.listen(listener).reg();
|
.listen(listener).reg();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@ package net.osmand.plus.routepointsnavigation;
|
||||||
|
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
import android.os.AsyncTask;
|
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
|
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.data.RotatedTileBox;
|
import net.osmand.data.RotatedTileBox;
|
||||||
|
@ -17,9 +17,6 @@ import net.osmand.plus.views.OsmandMapTileView;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Barsik on 20.06.2014.
|
|
||||||
*/
|
|
||||||
public class RoutePointsLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider {
|
public class RoutePointsLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider {
|
||||||
|
|
||||||
private final RoutePointsPlugin plugin;
|
private final RoutePointsPlugin plugin;
|
||||||
|
@ -112,10 +109,10 @@ public class RoutePointsLayer extends OsmandMapLayer implements ContextMenuLaye
|
||||||
};
|
};
|
||||||
|
|
||||||
if (plugin.getCurrentRoute().getPointStatus(point)){
|
if (plugin.getCurrentRoute().getPointStatus(point)){
|
||||||
adapter.item(R.string.mark_as_not_visited).iconColor(
|
adapter.item(R.string.mark_as_not_visited).colorIcon(
|
||||||
R.drawable.ic_action_gremove_dark).listen(listener).reg();
|
R.drawable.ic_action_gremove_dark).listen(listener).reg();
|
||||||
} else {
|
} else {
|
||||||
adapter.item(R.string.mark_as_visited).iconColor(
|
adapter.item(R.string.mark_as_visited).colorIcon(
|
||||||
R.drawable.ic_action_done).listen(listener).reg();
|
R.drawable.ic_action_done).listen(listener).reg();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,11 +120,11 @@ public class RoutePointsLayer extends OsmandMapLayer implements ContextMenuLaye
|
||||||
if (routePoint != null) {
|
if (routePoint != null) {
|
||||||
if (routePoint.isNextNavigate) {
|
if (routePoint.isNextNavigate) {
|
||||||
adapter.item(R.string.navigate_to_next)
|
adapter.item(R.string.navigate_to_next)
|
||||||
.iconColor(R.drawable.ic_action_gnext_dark).listen(listener)
|
.colorIcon(R.drawable.ic_action_gnext_dark).listen(listener)
|
||||||
.reg();
|
.reg();
|
||||||
} else {
|
} else {
|
||||||
adapter.item(R.string.mark_as_current)
|
adapter.item(R.string.mark_as_current)
|
||||||
.iconColor(R.drawable.ic_action_signpost_dark)
|
.colorIcon(R.drawable.ic_action_signpost_dark)
|
||||||
.listen(listener).reg();
|
.listen(listener).reg();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,7 @@ public class SRTMPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
adapter.item(R.string.layer_hillshade).selected(HILLSHADE.get()? 1 : 0)
|
adapter.item(R.string.layer_hillshade).selected(HILLSHADE.get()? 1 : 0)
|
||||||
.iconColor( R.drawable.ic_action_hillshade_dark).listen(listener).position(13).layout(R.layout.drawer_list_item).reg();
|
.colorIcon(R.drawable.ic_action_hillshade_dark).listen(listener).position(13).layout(R.layout.drawer_list_item).reg();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -143,7 +143,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
adapter.item(R.string.shared_string_show_description)
|
adapter.item(R.string.shared_string_show_description)
|
||||||
.iconColor(R.drawable.ic_action_note_dark).listen(listener)
|
.colorIcon(R.drawable.ic_action_note_dark).listen(listener)
|
||||||
.reg();
|
.reg();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,7 +176,7 @@ public class ImpassableRoadsLayer extends OsmandMapLayer implements ContextMenuL
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
adapter.item(R.string.avoid_road).iconColor(
|
adapter.item(R.string.avoid_road).colorIcon(
|
||||||
R.drawable.ic_action_road_works_dark).listen(listener).reg();
|
R.drawable.ic_action_road_works_dark).listen(listener).reg();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@ package net.osmand.plus.views.mapwidgets;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
import android.support.annotation.DrawableRes;
|
||||||
|
import android.support.annotation.StringRes;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
@ -38,20 +40,20 @@ public class MapWidgetRegistry {
|
||||||
public MapWidgetRegistry(OsmandSettings settings) {
|
public MapWidgetRegistry(OsmandSettings settings) {
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
|
|
||||||
for(ApplicationMode ms : ApplicationMode.values(settings) ) {
|
for (ApplicationMode ms : ApplicationMode.values(settings)) {
|
||||||
String mpf = settings.MAP_INFO_CONTROLS.getModeValue(ms);
|
String mpf = settings.MAP_INFO_CONTROLS.getModeValue(ms);
|
||||||
if(mpf.equals("")) {
|
if (mpf.equals("")) {
|
||||||
visibleElementsFromSettings.put(ms, null);
|
visibleElementsFromSettings.put(ms, null);
|
||||||
} else {
|
} else {
|
||||||
LinkedHashSet<String> set = new LinkedHashSet<String>();
|
LinkedHashSet<String> set = new LinkedHashSet<String>();
|
||||||
visibleElementsFromSettings.put(ms, set);
|
visibleElementsFromSettings.put(ms, set);
|
||||||
Collections.addAll(set, mpf.split(";"));
|
Collections.addAll(set, mpf.split(";"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void populateStackControl(LinearLayout stack,
|
public void populateStackControl(LinearLayout stack,
|
||||||
ApplicationMode mode, boolean left, boolean expanded) {
|
ApplicationMode mode, boolean left, boolean expanded) {
|
||||||
Set<MapWidgetRegInfo> s = left ? this.left : this.right;
|
Set<MapWidgetRegInfo> s = left ? this.left : this.right;
|
||||||
for (MapWidgetRegInfo r : s) {
|
for (MapWidgetRegInfo r : s) {
|
||||||
if (r.visible(mode) || r.widget.isExplicitlyVisible()) {
|
if (r.visible(mode) || r.widget.isExplicitlyVisible()) {
|
||||||
|
@ -113,21 +115,23 @@ public class MapWidgetRegistry {
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends TextInfoWidget> T getSideWidget(Class<T> cl) {
|
public <T extends TextInfoWidget> T getSideWidget(Class<T> cl) {
|
||||||
for(MapWidgetRegInfo ri : left) {
|
for (MapWidgetRegInfo ri : left) {
|
||||||
if(cl.isInstance(ri)) {
|
if (cl.isInstance(ri)) {
|
||||||
return (T) ri.widget;
|
return (T) ri.widget;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(MapWidgetRegInfo ri : right) {
|
for (MapWidgetRegInfo ri : right) {
|
||||||
if(cl.isInstance(ri)) {
|
if (cl.isInstance(ri)) {
|
||||||
return (T) ri.widget;
|
return (T) ri.widget;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapWidgetRegInfo registerSideWidgetInternal(TextInfoWidget widget, int drawableMenu,
|
public MapWidgetRegInfo registerSideWidgetInternal(TextInfoWidget widget,
|
||||||
int messageId, String key, boolean left, int priorityOrder) {
|
@DrawableRes int drawableMenu,
|
||||||
|
@StringRes int messageId,
|
||||||
|
String key, boolean left, int priorityOrder) {
|
||||||
MapWidgetRegInfo ii = new MapWidgetRegInfo(key, widget, drawableMenu,
|
MapWidgetRegInfo ii = new MapWidgetRegInfo(key, widget, drawableMenu,
|
||||||
messageId, priorityOrder, left);
|
messageId, priorityOrder, left);
|
||||||
for (ApplicationMode ms : ApplicationMode.values(settings)) {
|
for (ApplicationMode ms : ApplicationMode.values(settings)) {
|
||||||
|
@ -155,7 +159,7 @@ public class MapWidgetRegistry {
|
||||||
if (widget != null) {
|
if (widget != null) {
|
||||||
widget.setContentTitle(messageId);
|
widget.setContentTitle(messageId);
|
||||||
}
|
}
|
||||||
if(left) {
|
if (left) {
|
||||||
this.left.add(ii);
|
this.left.add(ii);
|
||||||
} else {
|
} else {
|
||||||
this.right.add(ii);
|
this.right.add(ii);
|
||||||
|
@ -240,7 +244,7 @@ public class MapWidgetRegistry {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void resetDefault(ApplicationMode mode, Set<MapWidgetRegInfo> set ){
|
private void resetDefault(ApplicationMode mode, Set<MapWidgetRegInfo> set) {
|
||||||
for (MapWidgetRegInfo ri : set) {
|
for (MapWidgetRegInfo ri : set) {
|
||||||
ri.visibleCollapsible.remove(mode);
|
ri.visibleCollapsible.remove(mode);
|
||||||
ri.visibleModes.remove(mode);
|
ri.visibleModes.remove(mode);
|
||||||
|
@ -277,7 +281,7 @@ public class MapWidgetRegistry {
|
||||||
addControlId(map, cm, R.string.map_widget_show_destination_arrow, settings.SHOW_DESTINATION_ARROW);
|
addControlId(map, cm, R.string.map_widget_show_destination_arrow, settings.SHOW_DESTINATION_ARROW);
|
||||||
addControlId(map, cm, R.string.map_widget_transparent, settings.TRANSPARENT_MAP_THEME);
|
addControlId(map, cm, R.string.map_widget_transparent, settings.TRANSPARENT_MAP_THEME);
|
||||||
addControlId(map, cm, R.string.always_center_position_on_map, settings.CENTER_POSITION_ON_MAP);
|
addControlId(map, cm, R.string.always_center_position_on_map, settings.CENTER_POSITION_ON_MAP);
|
||||||
if(mode != ApplicationMode.DEFAULT) {
|
if (mode != ApplicationMode.DEFAULT) {
|
||||||
addControlId(map, cm, R.string.map_widget_top_text, settings.SHOW_STREET_NAME);
|
addControlId(map, cm, R.string.map_widget_top_text, settings.SHOW_STREET_NAME);
|
||||||
}
|
}
|
||||||
if (settings.USE_MAP_MARKERS.get()) {
|
if (settings.USE_MAP_MARKERS.get()) {
|
||||||
|
@ -314,14 +318,14 @@ public class MapWidgetRegistry {
|
||||||
bld.show();
|
bld.show();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}).layout(R.layout.drawer_list_doubleitem).reg();
|
}).layout(R.layout.list_item_text_button).reg();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addControlId(final MapActivity map, ContextMenuAdapter cm, int stringId, OsmandPreference<Boolean> pref) {
|
private void addControlId(final MapActivity map, ContextMenuAdapter cm, int stringId, OsmandPreference<Boolean> pref) {
|
||||||
cm.item(stringId).selected( pref.get() ? 1 : 0)
|
cm.item(stringId).selected(pref.get() ? 1 : 0)
|
||||||
// .icons(r.drawableDark, r.drawableLight)
|
// .icons(r.drawableDark, r.drawableLight)
|
||||||
.listen(new ApearanceOnContextMenuClick(pref, map)).reg();
|
.listen(new ApearanceOnContextMenuClick(pref, map)).reg();
|
||||||
}
|
}
|
||||||
|
|
||||||
class ApearanceOnContextMenuClick implements OnContextMenuClick {
|
class ApearanceOnContextMenuClick implements OnContextMenuClick {
|
||||||
|
@ -338,14 +342,17 @@ public class MapWidgetRegistry {
|
||||||
public boolean onContextMenuClick(ArrayAdapter<?> a, int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> a, int itemId, int pos, boolean isChecked) {
|
||||||
pref.set(!pref.get());
|
pref.set(!pref.get());
|
||||||
map.updateApplicationModeSettings();
|
map.updateApplicationModeSettings();
|
||||||
a.notifyDataSetChanged();;
|
a.notifyDataSetChanged();
|
||||||
|
;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
public static boolean distChanged(int oldDist, int dist){
|
public static boolean distChanged(int oldDist, int dist) {
|
||||||
if(oldDist != 0 && oldDist - dist < 100 && Math.abs(((float) dist - oldDist)/oldDist) < 0.01){
|
if (oldDist != 0 && oldDist - dist < 100 && Math.abs(((float) dist - oldDist) / oldDist) < 0.01) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -355,7 +362,7 @@ public class MapWidgetRegistry {
|
||||||
public void addControls(MapActivity map, ContextMenuAdapter cm, ApplicationMode mode) {
|
public void addControls(MapActivity map, ContextMenuAdapter cm, ApplicationMode mode) {
|
||||||
cm.item(R.string.map_widget_right).setCategory(true).layout(R.layout.list_group_title_with_switch).reg();
|
cm.item(R.string.map_widget_right).setCategory(true).layout(R.layout.list_group_title_with_switch).reg();
|
||||||
addControls(map, cm, right, mode);
|
addControls(map, cm, right, mode);
|
||||||
if(mode != ApplicationMode.DEFAULT) {
|
if (mode != ApplicationMode.DEFAULT) {
|
||||||
cm.item(R.string.map_widget_left).setCategory(true).layout(R.layout.list_group_title_with_switch).reg();
|
cm.item(R.string.map_widget_left).setCategory(true).layout(R.layout.list_group_title_with_switch).reg();
|
||||||
addControls(map, cm, left, mode);
|
addControls(map, cm, left, mode);
|
||||||
}
|
}
|
||||||
|
@ -364,7 +371,7 @@ public class MapWidgetRegistry {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getText(Context ctx, final ApplicationMode mode, final MapWidgetRegInfo r) {
|
public String getText(Context ctx, final ApplicationMode mode, final MapWidgetRegInfo r) {
|
||||||
return (r.visibleCollapsed(mode)? " + " : " ") + ctx.getString(r.messageId);
|
return (r.visibleCollapsed(mode) ? " + " : " ") + ctx.getString(r.messageId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<MapWidgetRegInfo> getRight() {
|
public Set<MapWidgetRegInfo> getRight() {
|
||||||
|
@ -375,7 +382,8 @@ public class MapWidgetRegistry {
|
||||||
return left;
|
return left;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addControls(final MapActivity map, final ContextMenuAdapter adapter, Set<MapWidgetRegInfo> top, final ApplicationMode mode) {
|
private void addControls(final MapActivity map, final ContextMenuAdapter adapter,
|
||||||
|
Set<MapWidgetRegInfo> top, final ApplicationMode mode) {
|
||||||
for (final MapWidgetRegInfo r : top) {
|
for (final MapWidgetRegInfo r : top) {
|
||||||
if (mode == ApplicationMode.DEFAULT) {
|
if (mode == ApplicationMode.DEFAULT) {
|
||||||
if ("intermediate_distance".equals(r.key) || "distance".equals(r.key) || "time".equals(r.key)) {
|
if ("intermediate_distance".equals(r.key) || "distance".equals(r.key) || "time".equals(r.key)) {
|
||||||
|
@ -385,33 +393,35 @@ public class MapWidgetRegistry {
|
||||||
if ("map_marker_1st".equals(r.key) || "map_marker_2nd".equals(r.key)) {
|
if ("map_marker_1st".equals(r.key) || "map_marker_2nd".equals(r.key)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
adapter.item(r.messageId).selected(r.visibleCollapsed(mode) || r.visible(mode) ? 1 : 0)
|
adapter.item(r.messageId)
|
||||||
.iconColor(r.drawableMenu).listen(new OnContextMenuClick() {
|
.selected(r.visibleCollapsed(mode) || r.visible(mode) ? 1 : 0)
|
||||||
|
.colorIcon(r.drawableMenu)
|
||||||
@Override
|
.secondaryIconColor(R.drawable.ic_action_additional_option)
|
||||||
public boolean onContextMenuClick(ArrayAdapter<?> a, int itemId, int pos, boolean isChecked) {
|
.listen(new OnContextMenuClick() {
|
||||||
changeVisibility(r);
|
@Override
|
||||||
MapInfoLayer mil = map.getMapLayers().getMapInfoLayer();
|
public boolean onContextMenuClick(ArrayAdapter<?> a, int itemId, int pos, boolean isChecked) {
|
||||||
if (mil != null) {
|
changeVisibility(r);
|
||||||
mil.recreateControls();
|
MapInfoLayer mil = map.getMapLayers().getMapInfoLayer();
|
||||||
}
|
if (mil != null) {
|
||||||
adapter.setItemName(pos, getText(mil.getMapActivity(), mode, r));
|
mil.recreateControls();
|
||||||
adapter.setSelection(pos, r.visibleCollapsed(mode) || r.visible(mode) ? 1 : 0);
|
}
|
||||||
a.notifyDataSetChanged();
|
adapter.setItemName(pos, getText(mil.getMapActivity(), mode, r));
|
||||||
return false;
|
adapter.setSelection(pos, r.visibleCollapsed(mode) || r.visible(mode) ? 1 : 0);
|
||||||
}
|
a.notifyDataSetChanged();
|
||||||
}).reg();
|
return false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.reg();
|
||||||
adapter.setItemName(adapter.length() - 1, getText(map, mode, r));
|
adapter.setItemName(adapter.length() - 1, getText(map, mode, r));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static class MapWidgetRegInfo implements Comparable<MapWidgetRegInfo> {
|
||||||
|
|
||||||
|
|
||||||
public static class MapWidgetRegInfo implements Comparable<MapWidgetRegInfo> {
|
|
||||||
public final TextInfoWidget widget;
|
public final TextInfoWidget widget;
|
||||||
|
@DrawableRes
|
||||||
public final int drawableMenu;
|
public final int drawableMenu;
|
||||||
|
@StringRes
|
||||||
public final int messageId;
|
public final int messageId;
|
||||||
public final String key;
|
public final String key;
|
||||||
public final boolean left;
|
public final boolean left;
|
||||||
|
@ -420,8 +430,8 @@ public class MapWidgetRegistry {
|
||||||
private final Set<ApplicationMode> visibleModes = new LinkedHashSet<ApplicationMode>();
|
private final Set<ApplicationMode> visibleModes = new LinkedHashSet<ApplicationMode>();
|
||||||
private Runnable stateChangeListener = null;
|
private Runnable stateChangeListener = null;
|
||||||
|
|
||||||
public MapWidgetRegInfo(String key, TextInfoWidget widget, int drawableMenu,
|
public MapWidgetRegInfo(String key, TextInfoWidget widget, @DrawableRes int drawableMenu,
|
||||||
int messageId, int priorityOrder, boolean left) {
|
@StringRes int messageId, int priorityOrder, boolean left) {
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.widget = widget;
|
this.widget = widget;
|
||||||
this.drawableMenu = drawableMenu;
|
this.drawableMenu = drawableMenu;
|
||||||
|
@ -430,16 +440,16 @@ public class MapWidgetRegistry {
|
||||||
this.left = left;
|
this.left = left;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean visibleCollapsed(ApplicationMode mode){
|
public boolean visibleCollapsed(ApplicationMode mode) {
|
||||||
return visibleCollapsible.contains(mode);
|
return visibleCollapsible.contains(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean visible(ApplicationMode mode){
|
public boolean visible(ApplicationMode mode) {
|
||||||
return visibleModes.contains(mode);
|
return visibleModes.contains(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapWidgetRegInfo required(ApplicationMode... modes){
|
public MapWidgetRegInfo required(ApplicationMode... modes) {
|
||||||
Collections.addAll(visibleModes, modes);
|
Collections.addAll(visibleModes, modes);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -452,6 +462,7 @@ public class MapWidgetRegistry {
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return messageId;
|
return messageId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (this == obj)
|
if (this == obj)
|
||||||
|
@ -465,12 +476,13 @@ public class MapWidgetRegistry {
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(MapWidgetRegInfo another) {
|
public int compareTo(MapWidgetRegInfo another) {
|
||||||
if (messageId == another.messageId) {
|
if (messageId == another.messageId) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if(priorityOrder == another.priorityOrder) {
|
if (priorityOrder == another.priorityOrder) {
|
||||||
return messageId - another.messageId;
|
return messageId - another.messageId;
|
||||||
}
|
}
|
||||||
return priorityOrder - another.priorityOrder;
|
return priorityOrder - another.priorityOrder;
|
||||||
|
|
Loading…
Reference in a new issue