Change interface
This commit is contained in:
parent
eefc6393de
commit
38192aae64
30 changed files with 278 additions and 430 deletions
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
|
@ -30,14 +30,13 @@ public class ContextMenuAdapter {
|
||||||
|
|
||||||
public interface OnContextMenuClick {
|
public interface OnContextMenuClick {
|
||||||
//boolean return type needed to desribe if drawer needed to be close or not
|
//boolean return type needed to desribe if drawer needed to be close or not
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked);
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Context ctx;
|
private final Context ctx;
|
||||||
private View anchor;
|
private View anchor;
|
||||||
private int defaultLayoutId = Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB ?
|
private int defaultLayoutId = Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB ?
|
||||||
R.layout.list_menu_item : R.layout.list_menu_item_native;
|
R.layout.list_menu_item : R.layout.list_menu_item_native;
|
||||||
private ArrayAdapter listAdapter;
|
|
||||||
final TIntArrayList items = new TIntArrayList();
|
final TIntArrayList items = new TIntArrayList();
|
||||||
final TIntArrayList isCategory = new TIntArrayList();
|
final TIntArrayList isCategory = new TIntArrayList();
|
||||||
final ArrayList<String> itemNames = new ArrayList<String>();
|
final ArrayList<String> itemNames = new ArrayList<String>();
|
||||||
|
@ -90,12 +89,6 @@ public class ContextMenuAdapter {
|
||||||
itemNames.set(pos, str);
|
itemNames.set(pos, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notifyDataSetChanged(){
|
|
||||||
if (listAdapter != null){
|
|
||||||
listAdapter.notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setItemDescription(int pos, String str) {
|
public void setItemDescription(int pos, String str) {
|
||||||
itemDescription.set(pos, str);
|
itemDescription.set(pos, str);
|
||||||
}
|
}
|
||||||
|
@ -158,8 +151,6 @@ public class ContextMenuAdapter {
|
||||||
int pos = -1;
|
int pos = -1;
|
||||||
String description = "";
|
String description = "";
|
||||||
private OnContextMenuClick checkBoxListener;
|
private OnContextMenuClick checkBoxListener;
|
||||||
private OnContextMenuClick itemClickListener;
|
|
||||||
boolean enabled = false;
|
|
||||||
|
|
||||||
private Item() {
|
private Item() {
|
||||||
}
|
}
|
||||||
|
@ -205,11 +196,6 @@ public class ContextMenuAdapter {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Item itemClickListen(OnContextMenuClick l) {
|
|
||||||
this.itemClickListener = l;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void reg() {
|
public void reg() {
|
||||||
if (pos >= items.size() || pos < 0) {
|
if (pos >= items.size() || pos < 0) {
|
||||||
pos = items.size();
|
pos = items.size();
|
||||||
|
@ -231,10 +217,6 @@ public class ContextMenuAdapter {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Item enabled(boolean checked) {
|
|
||||||
this.enabled = checked;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getItemNames() {
|
public String[] getItemNames() {
|
||||||
|
@ -245,13 +227,12 @@ public class ContextMenuAdapter {
|
||||||
items.removeAt(pos);
|
items.removeAt(pos);
|
||||||
itemNames.remove(pos);
|
itemNames.remove(pos);
|
||||||
selectedList.removeAt(pos);
|
selectedList.removeAt(pos);
|
||||||
loadingList.clear();
|
|
||||||
iconList.removeAt(pos);
|
iconList.removeAt(pos);
|
||||||
iconListLight.removeAt(pos);
|
iconListLight.removeAt(pos);
|
||||||
checkListeners.remove(pos);
|
checkListeners.remove(pos);
|
||||||
isCategory.removeAt(pos);
|
isCategory.removeAt(pos);
|
||||||
layoutIds.removeAt(pos);
|
layoutIds.removeAt(pos);
|
||||||
loadingList.clear();
|
loadingList.removeAt(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLayoutId(int position) {
|
public int getLayoutId(int position) {
|
||||||
|
@ -267,10 +248,9 @@ public class ContextMenuAdapter {
|
||||||
this.defaultLayoutId = defaultLayoutId;
|
this.defaultLayoutId = defaultLayoutId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ListAdapter createListAdapter(final Activity activity, final boolean holoLight) {
|
public ArrayAdapter<?> createListAdapter(final Activity activity, final boolean holoLight) {
|
||||||
final int padding = (int) (12 * activity.getResources().getDisplayMetrics().density + 0.5f);
|
|
||||||
final int layoutId = defaultLayoutId;
|
final int layoutId = defaultLayoutId;
|
||||||
listAdapter = new ArrayAdapter<String>(activity, layoutId, R.id.title,
|
ArrayAdapter<String> listAdapter = new ArrayAdapter<String>(activity, layoutId, R.id.title,
|
||||||
getItemNames()) {
|
getItemNames()) {
|
||||||
@Override
|
@Override
|
||||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||||
|
@ -291,7 +271,6 @@ public class ContextMenuAdapter {
|
||||||
} else if (v.findViewById(R.id.icon) != null){
|
} else if (v.findViewById(R.id.icon) != null){
|
||||||
v.findViewById(R.id.icon).setVisibility(View.GONE);
|
v.findViewById(R.id.icon).setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
tv.setCompoundDrawablePadding(padding);
|
|
||||||
|
|
||||||
if(isCategory(position)) {
|
if(isCategory(position)) {
|
||||||
tv.setTypeface(Typeface.DEFAULT_BOLD);
|
tv.setTypeface(Typeface.DEFAULT_BOLD);
|
||||||
|
@ -311,7 +290,7 @@ public class ContextMenuAdapter {
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
OnContextMenuClick ca = getClickAdapter(position);
|
OnContextMenuClick ca = getClickAdapter(position);
|
||||||
if(ca != null) {
|
if(ca != null) {
|
||||||
ca.onContextMenuClick(getElementId(position), position, isChecked);
|
ca.onContextMenuClick(null, getElementId(position), position, isChecked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -44,6 +44,7 @@ import android.view.ContextMenu.ContextMenuInfo;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ExpandableListView;
|
import android.widget.ExpandableListView;
|
||||||
|
@ -159,7 +160,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
||||||
optionsMenuAdapter = new ContextMenuAdapter(getActivity());
|
optionsMenuAdapter = new ContextMenuAdapter(getActivity());
|
||||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(final int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, final int itemId, int pos, boolean isChecked) {
|
||||||
if (itemId == R.string.local_index_mi_reload) {
|
if (itemId == R.string.local_index_mi_reload) {
|
||||||
asyncLoader = new LoadGpxTask();
|
asyncLoader = new LoadGpxTask();
|
||||||
asyncLoader.execute(getActivity());
|
asyncLoader.execute(getActivity());
|
||||||
|
@ -214,7 +215,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
||||||
int itemId = item.getItemId();
|
int itemId = item.getItemId();
|
||||||
for (int i = 0; i < optionsMenuAdapter.length(); i++) {
|
for (int i = 0; i < optionsMenuAdapter.length(); i++) {
|
||||||
if (itemId == optionsMenuAdapter.getElementId(i)) {
|
if (itemId == optionsMenuAdapter.getElementId(i)) {
|
||||||
optionsMenuAdapter.getClickAdapter(i).onContextMenuClick(itemId, i, false);
|
optionsMenuAdapter.getClickAdapter(i).onContextMenuClick(null, itemId, i, false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -396,7 +397,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
||||||
private void basicFileOperation(final GpxInfo info, ContextMenuAdapter adapter) {
|
private void basicFileOperation(final GpxInfo info, ContextMenuAdapter adapter) {
|
||||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int resId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int resId, int pos, boolean isChecked) {
|
||||||
if (resId == R.string.local_index_mi_rename) {
|
if (resId == R.string.local_index_mi_rename) {
|
||||||
renameFile(info);
|
renameFile(info);
|
||||||
} else if (resId == R.string.local_index_unselect_gpx_file ||
|
} else if (resId == R.string.local_index_unselect_gpx_file ||
|
||||||
|
@ -479,7 +480,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
OnContextMenuClick clk = adapter.getClickAdapter(which);
|
OnContextMenuClick clk = adapter.getClickAdapter(which);
|
||||||
if (clk != null) {
|
if (clk != null) {
|
||||||
clk.onContextMenuClick(adapter.getElementId(which), which, false);
|
clk.onContextMenuClick(null, adapter.getElementId(which), which, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -176,7 +176,7 @@ public class FavouritesTreeFragment extends OsmandExpandableListFragment {
|
||||||
new OnContextMenuClick() {
|
new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
editPoint(point);
|
editPoint(point);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -187,7 +187,7 @@ public class FavouritesTreeFragment extends OsmandExpandableListFragment {
|
||||||
new OnContextMenuClick() {
|
new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
deletePoint(point);
|
deletePoint(point);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,6 @@ import java.util.Date;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import android.support.v4.view.GravityCompat;
|
|
||||||
import android.support.v4.widget.DrawerLayout;
|
|
||||||
import android.widget.*;
|
|
||||||
import net.londatiga.android.ActionItem;
|
import net.londatiga.android.ActionItem;
|
||||||
import net.londatiga.android.QuickAction;
|
import net.londatiga.android.QuickAction;
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
|
@ -50,8 +47,8 @@ import net.osmand.plus.base.FavoriteImageDrawable;
|
||||||
import net.osmand.plus.configuremap.ConfigureMapMenu;
|
import net.osmand.plus.configuremap.ConfigureMapMenu;
|
||||||
import net.osmand.plus.development.OsmandDevelopmentPlugin;
|
import net.osmand.plus.development.OsmandDevelopmentPlugin;
|
||||||
import net.osmand.plus.helpers.WaypointDialogHelper;
|
import net.osmand.plus.helpers.WaypointDialogHelper;
|
||||||
import net.osmand.plus.osmo.OsMoPositionLayer;
|
|
||||||
import net.osmand.plus.helpers.WaypointHelper;
|
import net.osmand.plus.helpers.WaypointHelper;
|
||||||
|
import net.osmand.plus.osmo.OsMoPositionLayer;
|
||||||
import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
|
import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.views.BaseMapLayer;
|
import net.osmand.plus.views.BaseMapLayer;
|
||||||
|
@ -68,11 +65,26 @@ import android.content.res.Resources;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.view.GravityCompat;
|
||||||
|
import android.support.v4.widget.DrawerLayout;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.AutoCompleteTextView;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.ListAdapter;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class MapActivityActions implements DialogProvider {
|
public class MapActivityActions implements DialogProvider {
|
||||||
|
|
||||||
|
@ -315,13 +327,6 @@ public class MapActivityActions implements DialogProvider {
|
||||||
mapActivity.showDialog(DIALOG_ADD_WAYPOINT);
|
mapActivity.showDialog(DIALOG_ADD_WAYPOINT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openViewConfigureDrawer(){
|
|
||||||
if (!mDrawerLayout.isDrawerOpen(mDrawerList)){
|
|
||||||
mDrawerLayout.openDrawer(mDrawerList);
|
|
||||||
}
|
|
||||||
mapActivity.getMapLayers().getMapInfoLayer().openViewConfigureDrawer(mDrawerList);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Dialog createAddWaypointDialog(final Bundle args) {
|
private Dialog createAddWaypointDialog(final Bundle args) {
|
||||||
Builder builder = new AlertDialog.Builder(mapActivity);
|
Builder builder = new AlertDialog.Builder(mapActivity);
|
||||||
builder.setTitle(R.string.add_waypoint_dialog_title);
|
builder.setTitle(R.string.add_waypoint_dialog_title);
|
||||||
|
@ -507,7 +512,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
getMyApplication().getAppCustomization().prepareLocationMenu(mapActivity, adapter);
|
getMyApplication().getAppCustomization().prepareLocationMenu(mapActivity, adapter);
|
||||||
|
|
||||||
final Builder builder = new AlertDialog.Builder(mapActivity);
|
final Builder builder = new AlertDialog.Builder(mapActivity);
|
||||||
ListAdapter listAdapter =
|
final ArrayAdapter<?> listAdapter =
|
||||||
adapter.createListAdapter(mapActivity, getMyApplication().getSettings().isLightContentMenu());
|
adapter.createListAdapter(mapActivity, getMyApplication().getSettings().isLightContentMenu());
|
||||||
builder.setAdapter(listAdapter, new DialogInterface.OnClickListener() {
|
builder.setAdapter(listAdapter, new DialogInterface.OnClickListener() {
|
||||||
|
|
||||||
|
@ -516,7 +521,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
int standardId = adapter.getElementId(which);
|
int standardId = adapter.getElementId(which);
|
||||||
OnContextMenuClick click = adapter.getClickAdapter(which);
|
OnContextMenuClick click = adapter.getClickAdapter(which);
|
||||||
if (click != null) {
|
if (click != null) {
|
||||||
click.onContextMenuClick(standardId, which, false);
|
click.onContextMenuClick(listAdapter, standardId, which, false);
|
||||||
} else if (standardId == R.string.context_menu_item_search) {
|
} else if (standardId == R.string.context_menu_item_search) {
|
||||||
Intent intent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getSearchActivity());
|
Intent intent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getSearchActivity());
|
||||||
intent.putExtra(SearchActivity.SEARCH_LAT, latitude);
|
intent.putExtra(SearchActivity.SEARCH_LAT, latitude);
|
||||||
|
@ -760,7 +765,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void prepareOptionsMenu(final ContextMenuAdapter cm) {
|
public void prepareOptionsMenu(final ContextMenuAdapter cm) {
|
||||||
ListAdapter listAdapter =
|
final ArrayAdapter<?> listAdapter =
|
||||||
cm.createListAdapter(mapActivity, getMyApplication().getSettings().isLightContentMenu());
|
cm.createListAdapter(mapActivity, getMyApplication().getSettings().isLightContentMenu());
|
||||||
mDrawerList.setAdapter(listAdapter);
|
mDrawerList.setAdapter(listAdapter);
|
||||||
mDrawerList.setBackgroundColor(cm.getBackgroundColor(mapActivity, getMyApplication().getSettings().isLightContentMenu()));
|
mDrawerList.setBackgroundColor(cm.getBackgroundColor(mapActivity, getMyApplication().getSettings().isLightContentMenu()));
|
||||||
|
@ -770,7 +775,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int which, long id) {
|
public void onItemClick(AdapterView<?> parent, View view, int which, long id) {
|
||||||
OnContextMenuClick click = cm.getClickAdapter(which);
|
OnContextMenuClick click = cm.getClickAdapter(which);
|
||||||
if (click != null) {
|
if (click != null) {
|
||||||
if (click.onContextMenuClick(cm.getElementId(which), which, false)) {
|
if (click.onContextMenuClick(listAdapter, cm.getElementId(which), which, false)) {
|
||||||
mDrawerLayout.closeDrawer(mDrawerList);
|
mDrawerLayout.closeDrawer(mDrawerList);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -803,7 +808,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
icons(R.drawable.ic_action_gloc_dark, R.drawable.ic_action_gloc_light)
|
icons(R.drawable.ic_action_gloc_dark, R.drawable.ic_action_gloc_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
if (getMyApplication().accessibilityEnabled()) {
|
if (getMyApplication().accessibilityEnabled()) {
|
||||||
whereAmIDialog();
|
whereAmIDialog();
|
||||||
} else {
|
} else {
|
||||||
|
@ -830,7 +835,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
optionsMenuHelper.item(t).icons(icon, iconLight)
|
optionsMenuHelper.item(t).icons(icon, iconLight)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
routingHelper.getVoiceRouter().setMute(!routingHelper.getVoiceRouter().isMute());
|
routingHelper.getVoiceRouter().setMute(!routingHelper.getVoiceRouter().isMute());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -841,7 +846,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
.icons(R.drawable.ic_action_gdirections_dark, R.drawable.ic_action_gdirections_light)
|
.icons(R.drawable.ic_action_gdirections_dark, R.drawable.ic_action_gdirections_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
enterRoutePlanningMode(null, null, false);
|
enterRoutePlanningMode(null, null, false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -853,7 +858,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
.icons(R.drawable.ic_action_gdirections_dark, R.drawable.ic_action_gdirections_light)
|
.icons(R.drawable.ic_action_gdirections_dark, R.drawable.ic_action_gdirections_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
if(routingHelper.isRoutePlanningMode()) {
|
if(routingHelper.isRoutePlanningMode()) {
|
||||||
routingHelper.setRoutePlanningMode(false);
|
routingHelper.setRoutePlanningMode(false);
|
||||||
routingHelper.setFollowingMode(true);
|
routingHelper.setFollowingMode(true);
|
||||||
|
@ -880,7 +885,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
optionsMenuHelper.item(nav).icons(R.drawable.ic_action_remove_dark, R.drawable.ic_action_remove_light)
|
optionsMenuHelper.item(nav).icons(R.drawable.ic_action_remove_dark, R.drawable.ic_action_remove_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
stopNavigationActionConfirm(mapView);
|
stopNavigationActionConfirm(mapView);
|
||||||
OsMoPositionLayer osMoPositionLayer = mapActivity.getMapView().getLayerByClass(OsMoPositionLayer.class);
|
OsMoPositionLayer osMoPositionLayer = mapActivity.getMapView().getLayerByClass(OsMoPositionLayer.class);
|
||||||
if (osMoPositionLayer != null) {
|
if (osMoPositionLayer != null) {
|
||||||
|
@ -894,7 +899,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
optionsMenuHelper.item(R.string.target_points).icons(R.drawable.ic_action_flage_dark, R.drawable.ic_action_flage_light)
|
optionsMenuHelper.item(R.string.target_points).icons(R.drawable.ic_action_flage_dark, R.drawable.ic_action_flage_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
if (getMyApplication().getWaypointHelper().isRouteCalculated()) {
|
if (getMyApplication().getWaypointHelper().isRouteCalculated()) {
|
||||||
|
|
||||||
final List<WaypointHelper.LocationPointWrapper> deletedPoints = new ArrayList<WaypointHelper.LocationPointWrapper>();
|
final List<WaypointHelper.LocationPointWrapper> deletedPoints = new ArrayList<WaypointHelper.LocationPointWrapper>();
|
||||||
|
@ -913,7 +918,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
optionsMenuHelper.item(R.string.configure_map).icons(R.drawable.ic_action_layers_dark, R.drawable.ic_action_layers_light)
|
optionsMenuHelper.item(R.string.configure_map).icons(R.drawable.ic_action_layers_dark, R.drawable.ic_action_layers_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
prepareConfigureMap();
|
prepareConfigureMap();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -922,8 +927,9 @@ public class MapActivityActions implements DialogProvider {
|
||||||
optionsMenuHelper.item(R.string.layer_map_appearance).icons(R.drawable.ic_action_settings_dark, R.drawable.ic_action_settings_light)
|
optionsMenuHelper.item(R.string.layer_map_appearance).icons(R.drawable.ic_action_settings_dark, R.drawable.ic_action_settings_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
mapActivity.getMapLayers().getMapInfoLayer().openViewConfigureDrawer(mDrawerList);
|
ContextMenuAdapter cm = mapActivity.getMapLayers().getMapInfoLayer().openViewConfigureDrawer();
|
||||||
|
prepareOptionsMenu(cm);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}).reg();
|
}).reg();
|
||||||
|
@ -931,7 +937,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
optionsMenuHelper.item(R.string.settings_Button).icons(R.drawable.ic_action_settings2_dark, R.drawable.ic_action_settings2_light)
|
optionsMenuHelper.item(R.string.settings_Button).icons(R.drawable.ic_action_settings2_dark, R.drawable.ic_action_settings2_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
final Intent intentSettings = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getSettingsActivity());
|
final Intent intentSettings = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getSettingsActivity());
|
||||||
mapActivity.startActivity(intentSettings);
|
mapActivity.startActivity(intentSettings);
|
||||||
return true;
|
return true;
|
||||||
|
@ -941,7 +947,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
optionsMenuHelper.item(R.string.search_button).icons(R.drawable.ic_action_search_dark, R.drawable.ic_action_search_light)
|
optionsMenuHelper.item(R.string.search_button).icons(R.drawable.ic_action_search_dark, R.drawable.ic_action_search_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getSearchActivity());
|
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getSearchActivity());
|
||||||
// causes wrong position caching: newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
// causes wrong position caching: newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||||
LatLon loc = mapActivity.getMapLocation();
|
LatLon loc = mapActivity.getMapLocation();
|
||||||
|
@ -956,7 +962,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
optionsMenuHelper.item(R.string.favorites_Button).icons( R.drawable.ic_action_fav_dark, R.drawable.ic_action_fav_light)
|
optionsMenuHelper.item(R.string.favorites_Button).icons( R.drawable.ic_action_fav_dark, R.drawable.ic_action_fav_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getFavoritesActivity());
|
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getFavoritesActivity());
|
||||||
// causes wrong position caching: newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
// causes wrong position caching: newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||||
mapActivity.startActivity(newIntent);
|
mapActivity.startActivity(newIntent);
|
||||||
|
@ -966,7 +972,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
optionsMenuHelper.item(R.string.show_point_options).icons(R.drawable.ic_action_marker_dark, R.drawable.ic_action_marker_light )
|
optionsMenuHelper.item(R.string.show_point_options).icons(R.drawable.ic_action_marker_dark, R.drawable.ic_action_marker_light )
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
contextMenuPoint(mapView.getLatitude(), mapView.getLongitude());
|
contextMenuPoint(mapView.getLatitude(), mapView.getLongitude());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -977,7 +983,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
new StartGPSStatus(mapActivity).run();
|
new StartGPSStatus(mapActivity).run();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -988,7 +994,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
listen(new OnContextMenuClick() {
|
listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
if (MainMenuActivity.TIPS_AND_TRICKS) {
|
if (MainMenuActivity.TIPS_AND_TRICKS) {
|
||||||
TipsAndTricksActivity tactivity = new TipsAndTricksActivity(mapActivity);
|
TipsAndTricksActivity tactivity = new TipsAndTricksActivity(mapActivity);
|
||||||
Dialog dlg = tactivity.getDialogToShowTips(false, true);
|
Dialog dlg = tactivity.getDialogToShowTips(false, true);
|
||||||
|
@ -1009,7 +1015,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
// animate moving on route
|
// animate moving on route
|
||||||
loc.getLocationSimulation().startStopRouteAnimation(mapActivity);
|
loc.getLocationSimulation().startStopRouteAnimation(mapActivity);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1022,7 +1028,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
optionsMenuHelper.item(R.string.exit_Button).icons(R.drawable.ic_action_quit_dark, R.drawable.ic_action_quit_light )
|
optionsMenuHelper.item(R.string.exit_Button).icons(R.drawable.ic_action_quit_dark, R.drawable.ic_action_quit_light )
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
// 1. Work for almost all cases when user open apps from main menu
|
// 1. Work for almost all cases when user open apps from main menu
|
||||||
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getMainMenuActivity());
|
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getMainMenuActivity());
|
||||||
newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
@ -1133,7 +1139,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
new OnContextMenuClick() {
|
new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
MapActivityActions.directionsToDialogAndLaunchMap(activity, location.getLatitude(), location.getLongitude(), name);
|
MapActivityActions.directionsToDialogAndLaunchMap(activity, location.getLatitude(), location.getLongitude(), name);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1148,7 +1154,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
}
|
}
|
||||||
intermediate.listen(new OnContextMenuClick() {
|
intermediate.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
addWaypointDialogAndLaunchMap(activity, location.getLatitude(), location.getLongitude(), name);
|
addWaypointDialogAndLaunchMap(activity, location.getLatitude(), location.getLongitude(), name);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1160,7 +1166,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
new OnContextMenuClick() {
|
new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
app.getSettings().setMapLocationToShow(location.getLatitude(), location.getLongitude(), z, saveHistory ? name : null, name,
|
app.getSettings().setMapLocationToShow(location.getLatitude(), location.getLongitude(), z, saveHistory ? name : null, name,
|
||||||
obj); //$NON-NLS-1$
|
obj); //$NON-NLS-1$
|
||||||
MapActivity.launchMapActivityMoveToTop(activity);
|
MapActivity.launchMapActivityMoveToTop(activity);
|
||||||
|
@ -1173,7 +1179,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
addToFavorite.listen(new OnContextMenuClick() {
|
addToFavorite.listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
Dialog dlg = createAddFavouriteDialog(activity, args);
|
Dialog dlg = createAddFavouriteDialog(activity, args);
|
||||||
dlg.show();
|
dlg.show();
|
||||||
|
@ -1196,7 +1202,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
OnContextMenuClick clk = qa.getClickAdapter(which);
|
OnContextMenuClick clk = qa.getClickAdapter(which);
|
||||||
if (clk != null) {
|
if (clk != null) {
|
||||||
clk.onContextMenuClick(qa.getElementId(which), which, false);
|
clk.onContextMenuClick(null, qa.getElementId(which), which, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1221,7 +1227,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
onShow.onClick(v);
|
onShow.onClick(v);
|
||||||
}
|
}
|
||||||
view.dismiss();
|
view.dismiss();
|
||||||
qa.getClickAdapter(ki).onContextMenuClick(qa.getElementId(ki), ki, false);
|
qa.getClickAdapter(ki).onContextMenuClick(null, qa.getElementId(ki), ki, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -177,7 +177,7 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
OnContextMenuClick clk = adapter.getClickAdapter(which);
|
OnContextMenuClick clk = adapter.getClickAdapter(which);
|
||||||
if (clk != null) {
|
if (clk != null) {
|
||||||
clk.onContextMenuClick(adapter.getElementId(which), which, false);
|
clk.onContextMenuClick(null, adapter.getElementId(which), which, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment {
|
||||||
private void basicFileOperation(final GpxDisplayItem gpxDisplayItem, ContextMenuAdapter adapter) {
|
private void basicFileOperation(final GpxDisplayItem gpxDisplayItem, ContextMenuAdapter adapter) {
|
||||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int resId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int resId, int pos, boolean isChecked) {
|
||||||
if (resId == R.string.show_gpx_route) {
|
if (resId == R.string.show_gpx_route) {
|
||||||
OsmandSettings settings = app.getSettings();
|
OsmandSettings settings = app.getSettings();
|
||||||
settings.setMapLocationToShow(gpxDisplayItem.locationStart.lat, gpxDisplayItem.locationStart.lon,
|
settings.setMapLocationToShow(gpxDisplayItem.locationStart.lat, gpxDisplayItem.locationStart.lon,
|
||||||
|
|
|
@ -580,7 +580,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
poiDescr.listen(new OnContextMenuClick() {
|
poiDescr.listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
// Build text(amenity)
|
// Build text(amenity)
|
||||||
|
|
||||||
// Find and format links
|
// Find and format links
|
||||||
|
@ -607,7 +607,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
showDetails.listen(new OnContextMenuClick() {
|
showDetails.listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
showPOIDetails(amenity, settings.usingEnglishNames());
|
showPOIDetails(amenity, settings.usingEnglishNames());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ import android.graphics.Color;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.Paint.Style;
|
import android.graphics.Paint.Style;
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class AudioNotesLayer extends OsmandMapLayer implements IContextMenuProvider {
|
public class AudioNotesLayer extends OsmandMapLayer implements IContextMenuProvider {
|
||||||
|
@ -118,7 +119,7 @@ public class AudioNotesLayer extends OsmandMapLayer implements IContextMenuProvi
|
||||||
final Recording r = (Recording) o;
|
final Recording r = (Recording) o;
|
||||||
OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
if (itemId == R.string.recording_context_menu_play ||
|
if (itemId == R.string.recording_context_menu_play ||
|
||||||
itemId == R.string.recording_context_menu_show) {
|
itemId == R.string.recording_context_menu_show) {
|
||||||
plugin.playRecording(view.getContext(), r);
|
plugin.playRecording(view.getContext(), r);
|
||||||
|
|
|
@ -83,6 +83,7 @@ import android.view.SurfaceHolder.Callback;
|
||||||
import android.view.SurfaceView;
|
import android.view.SurfaceView;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
@ -414,7 +415,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
public void registerLayerContextMenuActions(final OsmandMapTileView mapView, ContextMenuAdapter adapter, final MapActivity mapActivity) {
|
public void registerLayerContextMenuActions(final OsmandMapTileView mapView, ContextMenuAdapter adapter, final MapActivity mapActivity) {
|
||||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
if (itemId == R.string.layer_recordings) {
|
if (itemId == R.string.layer_recordings) {
|
||||||
SHOW_RECORDINGS.set(!SHOW_RECORDINGS.get());
|
SHOW_RECORDINGS.set(!SHOW_RECORDINGS.get());
|
||||||
updateLayers(mapView, mapActivity);
|
updateLayers(mapView, mapActivity);
|
||||||
|
@ -433,7 +434,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
recordAudio(latitude, longitude, mapActivity);
|
recordAudio(latitude, longitude, mapActivity);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -442,7 +443,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
recordVideo(latitude, longitude, mapActivity);
|
recordVideo(latitude, longitude, mapActivity);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -450,7 +451,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
adapter.item(R.string.recording_context_menu_precord).icons(R.drawable.ic_action_photo_dark, R.drawable.ic_action_photo_light)
|
adapter.item(R.string.recording_context_menu_precord).icons(R.drawable.ic_action_photo_dark, R.drawable.ic_action_photo_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
takePhoto(latitude, longitude, mapActivity);
|
takePhoto(latitude, longitude, mapActivity);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1104,7 +1105,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
final RecordingLocalIndexInfo ri = (RecordingLocalIndexInfo) info;
|
final RecordingLocalIndexInfo ri = (RecordingLocalIndexInfo) info;
|
||||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
playRecording(la, ri.rec);
|
playRecording(la, ri.rec);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1122,7 +1123,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
.icons(R.drawable.ic_action_marker_dark, R.drawable.ic_action_marker_light)
|
.icons(R.drawable.ic_action_marker_dark, R.drawable.ic_action_marker_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
SHOW_RECORDINGS.set(true);
|
SHOW_RECORDINGS.set(true);
|
||||||
app.getSettings().setMapLocationToShow(ri.rec.lat, ri.rec.lon,
|
app.getSettings().setMapLocationToShow(ri.rec.lat, ri.rec.lon,
|
||||||
app.getSettings().getLastKnownMapZoom());
|
app.getSettings().getLastKnownMapZoom());
|
||||||
|
|
|
@ -21,6 +21,7 @@ import net.osmand.render.RenderingRuleProperty;
|
||||||
import net.osmand.render.RenderingRulesStorage;
|
import net.osmand.render.RenderingRulesStorage;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class ConfigureMapMenu {
|
public class ConfigureMapMenu {
|
||||||
|
@ -32,7 +33,7 @@ public class ConfigureMapMenu {
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
ma.getMapActions().prepareStartOptionsMenu();
|
ma.getMapActions().prepareStartOptionsMenu();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +62,7 @@ public class ConfigureMapMenu {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
OsmandSettings settings = ma.getMyApplication().getSettings();
|
OsmandSettings settings = ma.getMyApplication().getSettings();
|
||||||
if (itemId == R.string.layer_poi) {
|
if (itemId == R.string.layer_poi) {
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
|
@ -127,7 +128,7 @@ public class ConfigureMapMenu {
|
||||||
String descr = activity.getMyApplication().getRendererRegistry().getCurrentSelectedRenderer().getName();
|
String descr = activity.getMyApplication().getRendererRegistry().getCurrentSelectedRenderer().getName();
|
||||||
adapter.item(R.string.map_widget_renderer).listen(new OnContextMenuClick() {
|
adapter.item(R.string.map_widget_renderer).listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
AlertDialog.Builder bld = new AlertDialog.Builder(activity);
|
AlertDialog.Builder bld = new AlertDialog.Builder(activity);
|
||||||
bld.setTitle(R.string.renderers);
|
bld.setTitle(R.string.renderers);
|
||||||
final OsmandApplication app = activity.getMyApplication();
|
final OsmandApplication app = activity.getMyApplication();
|
||||||
|
@ -167,7 +168,7 @@ public class ConfigureMapMenu {
|
||||||
|
|
||||||
adapter.item(R.string.map_widget_day_night).description(activity.getMyApplication().getSettings().DAYNIGHT_MODE.get().toHumanString(activity)).listen(new OnContextMenuClick() {
|
adapter.item(R.string.map_widget_day_night).description(activity.getMyApplication().getSettings().DAYNIGHT_MODE.get().toHumanString(activity)).listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
final OsmandMapTileView view = activity.getMapView();
|
final OsmandMapTileView view = activity.getMapView();
|
||||||
AlertDialog.Builder bld = new AlertDialog.Builder(view.getContext());
|
AlertDialog.Builder bld = new AlertDialog.Builder(view.getContext());
|
||||||
bld.setTitle(R.string.daynight);
|
bld.setTitle(R.string.daynight);
|
||||||
|
@ -192,7 +193,7 @@ public class ConfigureMapMenu {
|
||||||
int scale = (int)(activity.getMyApplication().getSettings().TEXT_SCALE.get() * 100);
|
int scale = (int)(activity.getMyApplication().getSettings().TEXT_SCALE.get() * 100);
|
||||||
adapter.item(R.string.text_size).listen(new OnContextMenuClick() {
|
adapter.item(R.string.text_size).listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
final OsmandMapTileView view = activity.getMapView();
|
final OsmandMapTileView view = activity.getMapView();
|
||||||
AlertDialog.Builder b = new AlertDialog.Builder(view.getContext());
|
AlertDialog.Builder b = new AlertDialog.Builder(view.getContext());
|
||||||
// test old descr as title
|
// test old descr as title
|
||||||
|
@ -242,7 +243,7 @@ public class ConfigureMapMenu {
|
||||||
adapter.item(propertyName).listen(new OnContextMenuClick() {
|
adapter.item(propertyName).listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
pref.set(!pref.get());
|
pref.set(!pref.get());
|
||||||
refreshMapComplete(activity);
|
refreshMapComplete(activity);
|
||||||
return false;
|
return false;
|
||||||
|
@ -255,7 +256,7 @@ public class ConfigureMapMenu {
|
||||||
adapter.item(propertyName).listen(new OnContextMenuClick() {
|
adapter.item(propertyName).listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
AlertDialog.Builder b = new AlertDialog.Builder(view.getContext());
|
AlertDialog.Builder b = new AlertDialog.Builder(view.getContext());
|
||||||
// test old descr as title
|
// test old descr as title
|
||||||
b.setTitle(propertyDescr);
|
b.setTitle(propertyDescr);
|
||||||
|
|
|
@ -56,6 +56,7 @@ import android.os.AsyncTask;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
@ -584,7 +585,7 @@ public class DistanceCalculatorPlugin extends OsmandPlugin {
|
||||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
if (itemId == R.string.delete_point) {
|
if (itemId == R.string.delete_point) {
|
||||||
for (int i = 0; i < measurementPoints.size(); i++) {
|
for (int i = 0; i < measurementPoints.size(); i++) {
|
||||||
Iterator<WptPt> it = measurementPoints.get(i).iterator();
|
Iterator<WptPt> it = measurementPoints.get(i).iterator();
|
||||||
|
|
|
@ -40,6 +40,7 @@ import android.view.ContextMenu.ContextMenuInfo;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ExpandableListView;
|
import android.widget.ExpandableListView;
|
||||||
|
@ -141,7 +142,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
OnContextMenuClick clk = adapter.getClickAdapter(which);
|
OnContextMenuClick clk = adapter.getClickAdapter(which);
|
||||||
if (clk != null) {
|
if (clk != null) {
|
||||||
clk.onContextMenuClick(adapter.getElementId(which), which, false);
|
clk.onContextMenuClick(null, adapter.getElementId(which), which, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +154,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
||||||
private void basicFileOperation(final LocalIndexInfo info, ContextMenuAdapter adapter) {
|
private void basicFileOperation(final LocalIndexInfo info, ContextMenuAdapter adapter) {
|
||||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int resId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int resId, int pos, boolean isChecked) {
|
||||||
if (resId == R.string.local_index_mi_rename) {
|
if (resId == R.string.local_index_mi_rename) {
|
||||||
renameFile(info);
|
renameFile(info);
|
||||||
} else if (resId == R.string.local_index_mi_restore) {
|
} else if (resId == R.string.local_index_mi_restore) {
|
||||||
|
@ -471,7 +472,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
||||||
optionsMenuAdapter = new ContextMenuAdapter(getDownloadActivity());
|
optionsMenuAdapter = new ContextMenuAdapter(getDownloadActivity());
|
||||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
localOptionsMenu(itemId);
|
localOptionsMenu(itemId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -526,7 +527,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
||||||
int itemId = item.getItemId();
|
int itemId = item.getItemId();
|
||||||
for (int i = 0; i < optionsMenuAdapter.length(); i++) {
|
for (int i = 0; i < optionsMenuAdapter.length(); i++) {
|
||||||
if (itemId == optionsMenuAdapter.getElementId(i)) {
|
if (itemId == optionsMenuAdapter.getElementId(i)) {
|
||||||
optionsMenuAdapter.getClickAdapter(i).onContextMenuClick(itemId, i, false);
|
optionsMenuAdapter.getClickAdapter(i).onContextMenuClick(null, itemId, i, false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import net.osmand.Location;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.LocationPoint;
|
import net.osmand.data.LocationPoint;
|
||||||
import net.osmand.plus.*;
|
import net.osmand.plus.*;
|
||||||
|
import net.osmand.plus.ContextMenuAdapter.Item;
|
||||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper;
|
import net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper;
|
||||||
|
@ -61,7 +62,7 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
|
||||||
waypointHelper = this.app.getWaypointHelper();
|
waypointHelper = this.app.getWaypointHelper();
|
||||||
this.mapActivity = mapActivity;
|
this.mapActivity = mapActivity;
|
||||||
this.mainLayout = (LinearLayout) mapActivity.findViewById(R.id.dialog_layout);
|
this.mainLayout = (LinearLayout) mapActivity.findViewById(R.id.dialog_layout);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
|
@ -520,7 +521,6 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
|
||||||
|
|
||||||
private void recalculatePoints(final int[] running, final ContextMenuAdapter menuAdapter, final int type, final ListView mDrawerList){
|
private void recalculatePoints(final int[] running, final ContextMenuAdapter menuAdapter, final int type, final ListView mDrawerList){
|
||||||
new AsyncTask<Void, Void, Void>() {
|
new AsyncTask<Void, Void, Void>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
app.getWaypointHelper().recalculatePoints(type);
|
app.getWaypointHelper().recalculatePoints(type);
|
||||||
|
@ -537,108 +537,86 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void registerPoints(final ContextMenuAdapter adapter, final Activity ctx, final ListView drawerList) {
|
protected void registerPoints(final ContextMenuAdapter adapter, final Activity ctx, final ListView drawerList) {
|
||||||
final int[] running = new int[]{-1};
|
final int[] running = new int[] { -1 };
|
||||||
for (int i = 0; i < WaypointHelper.MAX; i++) {
|
for (int i = 0; i < WaypointHelper.MAX; i++) {
|
||||||
List<LocationPointWrapper> tp = waypointHelper.getWaypoints(i);
|
|
||||||
if (waypointHelper.isTypeVisible(i)) {
|
if (waypointHelper.isTypeVisible(i)) {
|
||||||
|
List<LocationPointWrapper> tp = waypointHelper.getWaypoints(i);
|
||||||
final boolean checked = waypointHelper.isTypeEnabled(i);
|
final boolean checked = waypointHelper.isTypeEnabled(i);
|
||||||
final int type = i;
|
final int type = i;
|
||||||
adapter.item(getHeader(ctx, i, checked)).enabled(checked).layout(R.layout.drawer_list_poi_header).itemClickListen(new ContextMenuAdapter.OnContextMenuClick() {
|
adapter.item(getHeader(ctx, i, checked)).layout(R.layout.drawer_list_poi_header)
|
||||||
@Override
|
.listen(new ContextMenuAdapter.OnContextMenuClick() {
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
@Override
|
||||||
running[0] = pos;
|
public boolean onContextMenuClick(ArrayAdapter<?> ra, int itemId, int pos, boolean isChecked) {
|
||||||
adapter.notifyDataSetChanged();
|
running[0] = pos;
|
||||||
if (type == WaypointHelper.POI && isChecked) {
|
ra.notifyDataSetChanged();
|
||||||
selectPoi(running, adapter, type, isChecked, mapActivity, drawerList);
|
if (type == WaypointHelper.POI && isChecked) {
|
||||||
} else {
|
selectPoi(running, adapter, type, isChecked, mapActivity, drawerList);
|
||||||
enableType(running, adapter, type, isChecked, drawerList);
|
} else {
|
||||||
}
|
enableType(running, adapter, type, isChecked, drawerList);
|
||||||
return false;
|
}
|
||||||
}
|
return false;
|
||||||
}).loading(0).reg();
|
}
|
||||||
|
}).loading(0).reg();
|
||||||
|
|
||||||
if (i == WaypointHelper.POI && waypointHelper.isTypeEnabled(WaypointHelper.POI)){
|
if (i == WaypointHelper.POI && checked) {
|
||||||
adapter.item(ctx.getString(R.string.search_radius_proximity)).itemClickListen(new ContextMenuAdapter.OnContextMenuClick() {
|
Item item = createRadiusProximityItem(adapter, ctx, drawerList, running, WaypointHelper.POI);
|
||||||
@Override
|
item.loading(0).selected(app.getSettings().SHOW_POI_OVER_MAP.get() ? 1 : 0).reg();
|
||||||
public boolean onContextMenuClick(int itemId, final int pos, boolean isChecked) {
|
} else if (i == WaypointHelper.FAVORITES && checked) {
|
||||||
int length = WaypointHelper.SEARCH_RADIUS_VALUES.length;
|
Item item = createRadiusProximityItem(adapter, ctx, drawerList, running, WaypointHelper.FAVORITES);
|
||||||
String[] names = new String[length];
|
item.loading(0).selected(app.getSettings().SHOW_FAVORITES.get() ? 1 : 0).reg();
|
||||||
int selected = 0;
|
|
||||||
for (int i = 0; i < length; i++) {
|
|
||||||
names[i] = OsmAndFormatter.getFormattedDistance(WaypointHelper.SEARCH_RADIUS_VALUES[i], app);
|
|
||||||
if (WaypointHelper.SEARCH_RADIUS_VALUES[i] == waypointHelper.getPoiSearchDeviationRadius()) {
|
|
||||||
selected = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
new AlertDialog.Builder(ctx)
|
|
||||||
.setSingleChoiceItems(names, selected, new OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
|
||||||
int value = WaypointHelper.SEARCH_RADIUS_VALUES[i];
|
|
||||||
if (waypointHelper.getPoiSearchDeviationRadius() != value) {
|
|
||||||
running[0] = pos;
|
|
||||||
adapter.notifyDataSetChanged();
|
|
||||||
waypointHelper.setPoiSearchDeviationRadius(value);
|
|
||||||
//radius.setText(OsmAndFormatter.getFormattedDistance(value, app));
|
|
||||||
recalculatePoints(running, adapter, WaypointHelper.POI, drawerList);
|
|
||||||
dialogInterface.dismiss();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).setTitle(app.getString(R.string.search_radius_proximity) + " " + app.getString(R.string.poi))
|
|
||||||
.setNegativeButton(R.string.default_buttons_cancel, null)
|
|
||||||
.show();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}).loading(0).selected(app.getSettings().SHOW_POI_OVER_MAP.get() ? 1 : 0).reg();
|
|
||||||
} else if (i == WaypointHelper.FAVORITES && waypointHelper.isTypeEnabled(WaypointHelper.FAVORITES)){
|
|
||||||
adapter.item(ctx.getString(R.string.search_radius_proximity)).itemClickListen(new ContextMenuAdapter.OnContextMenuClick() {
|
|
||||||
@Override
|
|
||||||
public boolean onContextMenuClick(int itemId, final int pos, boolean isChecked) {
|
|
||||||
int length = WaypointHelper.SEARCH_RADIUS_VALUES.length;
|
|
||||||
String[] names = new String[length];
|
|
||||||
int selected = 0;
|
|
||||||
for (int i = 0; i < length; i++) {
|
|
||||||
names[i] = OsmAndFormatter.getFormattedDistance(WaypointHelper.SEARCH_RADIUS_VALUES[i], app);
|
|
||||||
if (WaypointHelper.SEARCH_RADIUS_VALUES[i] == waypointHelper.getSearchDeviationRadius()){
|
|
||||||
selected = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
new AlertDialog.Builder(ctx)
|
|
||||||
.setSingleChoiceItems(names, selected, new OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
|
||||||
int value = WaypointHelper.SEARCH_RADIUS_VALUES[i];
|
|
||||||
if (waypointHelper.getSearchDeviationRadius() != value){
|
|
||||||
running[0] = pos;
|
|
||||||
waypointHelper.setSearchDeviationRadius(value);
|
|
||||||
//radius.setText(OsmAndFormatter.getFormattedDistance(value, app));
|
|
||||||
recalculatePoints(running, adapter, -1, drawerList);
|
|
||||||
dialogInterface.dismiss();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).setTitle(app.getString(R.string.search_radius_proximity))
|
|
||||||
.setNegativeButton(R.string.default_buttons_cancel, null)
|
|
||||||
.show();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}).loading(0).selected(app.getSettings().SHOW_FAVORITES.get() ? 1 : 0).reg();
|
|
||||||
}
|
}
|
||||||
if (tp != null && tp.size() > 0) {
|
if (tp != null && tp.size() > 0) {
|
||||||
for (LocationPointWrapper p : tp){
|
for (LocationPointWrapper p : tp) {
|
||||||
WaypointHelper wh =app.getWaypointHelper();
|
WaypointHelper wh = app.getWaypointHelper();
|
||||||
int dist = wh.getRouteDistance(p);
|
int dist = wh.getRouteDistance(p);
|
||||||
String dd = OsmAndFormatter.getFormattedDistance(dist, app);
|
String dd = OsmAndFormatter.getFormattedDistance(dist, app);
|
||||||
if (p.deviationDistance > 0) {
|
if (p.deviationDistance > 0) {
|
||||||
dd += "\n+" + OsmAndFormatter.getFormattedDistance(p.deviationDistance, app);
|
dd += "\n+" + OsmAndFormatter.getFormattedDistance(p.deviationDistance, app);
|
||||||
}
|
}
|
||||||
adapter.item(p.getPoint().getName(ctx)).icon(p.getDrawableId(ctx)).description(dd).layout(R.layout.drawer_list_waypoint).reg();
|
adapter.item(p.getPoint().getName(ctx)).icon(p.getDrawableId(ctx)).description(dd)
|
||||||
|
.layout(R.layout.drawer_list_waypoint).reg();
|
||||||
}
|
}
|
||||||
//points.addAll(tp);
|
// points.addAll(tp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Item createRadiusProximityItem(final ContextMenuAdapter adapter, final Activity ctx,
|
||||||
|
final ListView drawerList, final int[] running, final int type) {
|
||||||
|
return adapter.item(ctx.getString(R.string.search_radius_proximity)).listen(
|
||||||
|
new ContextMenuAdapter.OnContextMenuClick() {
|
||||||
|
@Override
|
||||||
|
public boolean onContextMenuClick(ArrayAdapter<?> ra, int itemId, final int pos, boolean isChecked) {
|
||||||
|
int length = WaypointHelper.SEARCH_RADIUS_VALUES.length;
|
||||||
|
String[] names = new String[length];
|
||||||
|
int selected = 0;
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
names[i] = OsmAndFormatter
|
||||||
|
.getFormattedDistance(WaypointHelper.SEARCH_RADIUS_VALUES[i], app);
|
||||||
|
if (WaypointHelper.SEARCH_RADIUS_VALUES[i] == waypointHelper.getSearchDeviationRadius(type)) {
|
||||||
|
selected = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
new AlertDialog.Builder(ctx).setSingleChoiceItems(names, selected, new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
|
int value = WaypointHelper.SEARCH_RADIUS_VALUES[i];
|
||||||
|
if (waypointHelper.getSearchDeviationRadius(type) != value) {
|
||||||
|
running[0] = pos;
|
||||||
|
waypointHelper.setSearchDeviationRadius(value, type);
|
||||||
|
// radius.setText(OsmAndFormatter.getFormattedDistance(value, app));
|
||||||
|
recalculatePoints(running, adapter, -1, drawerList);
|
||||||
|
dialogInterface.dismiss();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).setTitle(app.getString(R.string.search_radius_proximity))
|
||||||
|
.setNegativeButton(R.string.default_buttons_cancel, null).show();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void enableType(final int[] running, final ContextMenuAdapter menuAdapter, final int type,
|
private void enableType(final int[] running, final ContextMenuAdapter menuAdapter, final int type,
|
||||||
final boolean enable, final ListView drawerList) {
|
final boolean enable, final ListView drawerList) {
|
||||||
new AsyncTask<Void, Void, Void>() {
|
new AsyncTask<Void, Void, Void>() {
|
||||||
|
@ -653,11 +631,6 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
|
||||||
running[0] = -1;
|
running[0] = -1;
|
||||||
menuAdapter.clearAll();
|
menuAdapter.clearAll();
|
||||||
registerPoints(menuAdapter, mapActivity, drawerList);
|
registerPoints(menuAdapter, mapActivity, drawerList);
|
||||||
// menuAdapter.clear();
|
|
||||||
// for (Object point : registerPoints()) {
|
|
||||||
// menuAdapter.add(point);
|
|
||||||
// }
|
|
||||||
// menuAdapter.notifyDataSetChanged();
|
|
||||||
}
|
}
|
||||||
}.execute((Void) null);
|
}.execute((Void) null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -510,7 +510,7 @@ public class WaypointHelper {
|
||||||
PoiFilter pf = getPoiFilter();
|
PoiFilter pf = getPoiFilter();
|
||||||
if (pf != null) {
|
if (pf != null) {
|
||||||
final List<Location> locs = route.getImmutableAllLocations();
|
final List<Location> locs = route.getImmutableAllLocations();
|
||||||
List<Amenity> amenities = app.getResourceManager().searchAmenitiesOnThePath(locs, getPoiSearchDeviationRadius(),
|
List<Amenity> amenities = app.getResourceManager().searchAmenitiesOnThePath(locs, poiSearchDeviationRadius,
|
||||||
pf, new ResultMatcher<Amenity>() {
|
pf, new ResultMatcher<Amenity>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -575,7 +575,7 @@ public class WaypointHelper {
|
||||||
int[] ind = new int[1];
|
int[] ind = new int[1];
|
||||||
for(LocationPoint p : points) {
|
for(LocationPoint p : points) {
|
||||||
float dist = dist(p, immutableAllLocations, ind);
|
float dist = dist(p, immutableAllLocations, ind);
|
||||||
int rad = type == POI ? getPoiSearchDeviationRadius() : getSearchDeviationRadius();
|
int rad = getSearchDeviationRadius(type);
|
||||||
if(dist <= rad) {
|
if(dist <= rad) {
|
||||||
LocationPointWrapper lpw = new LocationPointWrapper(rt, type, p, dist, ind[0]);
|
LocationPointWrapper lpw = new LocationPointWrapper(rt, type, p, dist, ind[0]);
|
||||||
lpw.setAnnounce(announce);
|
lpw.setAnnounce(announce);
|
||||||
|
@ -737,22 +737,18 @@ public class WaypointHelper {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSearchDeviationRadius(){
|
public int getSearchDeviationRadius(int type){
|
||||||
return searchDeviationRadius;
|
return type == POI ? poiSearchDeviationRadius : searchDeviationRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSearchDeviationRadius(int radius){
|
public void setSearchDeviationRadius(int type, int radius){
|
||||||
this.searchDeviationRadius = radius;
|
if(type == POI) {
|
||||||
|
this.poiSearchDeviationRadius = radius;
|
||||||
|
} else {
|
||||||
|
this.searchDeviationRadius = radius;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPoiSearchDeviationRadius() {
|
|
||||||
return poiSearchDeviationRadius;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPoiSearchDeviationRadius(int radius) {
|
|
||||||
this.poiSearchDeviationRadius = radius;
|
|
||||||
}
|
|
||||||
|
|
||||||
private class AmenityLocationPoint implements LocationPoint {
|
private class AmenityLocationPoint implements LocationPoint {
|
||||||
|
|
||||||
Amenity a;
|
Amenity a;
|
||||||
|
|
|
@ -38,6 +38,7 @@ import android.preference.Preference;
|
||||||
import android.preference.Preference.OnPreferenceClickListener;
|
import android.preference.Preference.OnPreferenceClickListener;
|
||||||
import android.preference.PreferenceScreen;
|
import android.preference.PreferenceScreen;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||||
|
@ -115,7 +116,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn
|
||||||
ContextMenuAdapter adapter, Object selectedObj) {
|
ContextMenuAdapter adapter, Object selectedObj) {
|
||||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int resId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int resId, int pos, boolean isChecked) {
|
||||||
if (resId == R.string.context_menu_item_add_waypoint) {
|
if (resId == R.string.context_menu_item_add_waypoint) {
|
||||||
mapActivity.getMapActions().addWaypoint(latitude, longitude);
|
mapActivity.getMapActions().addWaypoint(latitude, longitude);
|
||||||
}
|
}
|
||||||
|
@ -448,7 +449,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn
|
||||||
int draw = !bgoff ? R.drawable.monitoring_rec_big : R.drawable.monitoring_rec_inactive;
|
int draw = !bgoff ? R.drawable.monitoring_rec_big : R.drawable.monitoring_rec_inactive;
|
||||||
qa.item(msgId).icon(draw).listen(new OnContextMenuClick() {
|
qa.item(msgId).icon(draw).listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
if (view.getApplication().getNavigationService() == null) {
|
if (view.getApplication().getNavigationService() == null) {
|
||||||
final ValueHolder<Integer> vs = new ValueHolder<Integer>();
|
final ValueHolder<Integer> vs = new ValueHolder<Integer>();
|
||||||
final ValueHolder<Boolean> choice = new ValueHolder<Boolean>();
|
final ValueHolder<Boolean> choice = new ValueHolder<Boolean>();
|
||||||
|
|
|
@ -43,6 +43,7 @@ import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Xml;
|
import android.util.Xml;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
@ -495,7 +496,7 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
|
||||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
if (itemId == R.string.osb_comment_menu_item) {
|
if (itemId == R.string.osb_comment_menu_item) {
|
||||||
commentBug(bug);
|
commentBug(bug);
|
||||||
} else if (itemId == R.string.osb_close_menu_item) {
|
} else if (itemId == R.string.osb_close_menu_item) {
|
||||||
|
|
|
@ -30,6 +30,7 @@ import android.preference.Preference.OnPreferenceClickListener;
|
||||||
import android.preference.PreferenceScreen;
|
import android.preference.PreferenceScreen;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
@ -122,7 +123,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
||||||
final Object selectedObj) {
|
final Object selectedObj) {
|
||||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int resId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int resId, int pos, boolean isChecked) {
|
||||||
if (resId == R.string.context_menu_item_create_poi) {
|
if (resId == R.string.context_menu_item_create_poi) {
|
||||||
getPoiActions(mapActivity).showCreateDialog(latitude, longitude);
|
getPoiActions(mapActivity).showCreateDialog(latitude, longitude);
|
||||||
} else if (resId == R.string.context_menu_item_open_bug) {
|
} else if (resId == R.string.context_menu_item_open_bug) {
|
||||||
|
@ -157,7 +158,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
||||||
.icons(R.drawable.ic_action_bug_dark, R.drawable.ic_action_bug_light).listen(new OnContextMenuClick() {
|
.icons(R.drawable.ic_action_bug_dark, R.drawable.ic_action_bug_light).listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
if (itemId == R.string.layer_osm_bugs) {
|
if (itemId == R.string.layer_osm_bugs) {
|
||||||
settings.SHOW_OSM_BUGS.set(isChecked);
|
settings.SHOW_OSM_BUGS.set(isChecked);
|
||||||
}
|
}
|
||||||
|
@ -180,7 +181,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
sendGPXFiles(la, (AvailableGPXFragment) fragment, (GpxInfo) info);
|
sendGPXFiles(la, (AvailableGPXFragment) fragment, (GpxInfo) info);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -197,7 +198,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
f.openSelectionMode(R.string.local_index_mi_upload_gpx, R.drawable.ic_action_gup_dark,
|
f.openSelectionMode(R.string.local_index_mi_upload_gpx, R.drawable.ic_action_gup_dark,
|
||||||
R.drawable.ic_action_gup_light, new OnClickListener() {
|
R.drawable.ic_action_gup_light, new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -49,6 +49,7 @@ import android.preference.Preference;
|
||||||
import android.preference.Preference.OnPreferenceClickListener;
|
import android.preference.Preference.OnPreferenceClickListener;
|
||||||
import android.preference.PreferenceScreen;
|
import android.preference.PreferenceScreen;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
|
||||||
public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlServices, OsMoReactor {
|
public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlServices, OsMoReactor {
|
||||||
|
|
||||||
|
@ -135,7 +136,7 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
|
||||||
R.drawable.ic_action_gloc_light).listen(new OnContextMenuClick() {
|
R.drawable.ic_action_gloc_light).listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
OsMoDevice o = (OsMoDevice) selectedObj;
|
OsMoDevice o = (OsMoDevice) selectedObj;
|
||||||
double lat = o.getLastLocation() == null ? latitude : o.getLastLocation().getLatitude();
|
double lat = o.getLastLocation() == null ? latitude : o.getLastLocation().getLatitude();
|
||||||
double lon = o.getLastLocation() == null ? longitude : o.getLastLocation().getLongitude();
|
double lon = o.getLastLocation() == null ? longitude : o.getLastLocation().getLongitude();
|
||||||
|
@ -150,7 +151,7 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
|
||||||
R.drawable.ic_action_close_light).listen(new OnContextMenuClick() {
|
R.drawable.ic_action_close_light).listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
OsMoPositionLayer.setFollowDestination(null);
|
OsMoPositionLayer.setFollowDestination(null);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -161,7 +162,7 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
|
||||||
R.drawable.ic_action_flag_light).listen(new OnContextMenuClick() {
|
R.drawable.ic_action_flag_light).listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
OsMoDevice o = (OsMoDevice) selectedObj;
|
OsMoDevice o = (OsMoDevice) selectedObj;
|
||||||
if(o.getLastLocation() != null) {
|
if(o.getLastLocation() != null) {
|
||||||
TargetPointsHelper targets = mapActivity.getMyApplication().getTargetPointsHelper();
|
TargetPointsHelper targets = mapActivity.getMyApplication().getTargetPointsHelper();
|
||||||
|
@ -292,7 +293,7 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
final double lat = view.getLatitude();
|
final double lat = view.getLatitude();
|
||||||
final double lon = view.getLongitude();
|
final double lon = view.getLongitude();
|
||||||
tracker.sendCoordinate(lat, lon);
|
tracker.sendCoordinate(lat, lon);
|
||||||
|
@ -323,7 +324,7 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
|
||||||
helper.item(R.string.osmo_groups).icons(R.drawable.ic_action_eye_dark, R.drawable.ic_action_eye_light).position(6)
|
helper.item(R.string.osmo_groups).icons(R.drawable.ic_action_eye_dark, R.drawable.ic_action_eye_light).position(6)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
Intent intent = new Intent(mapActivity, OsMoGroupsActivity.class);
|
Intent intent = new Intent(mapActivity, OsMoGroupsActivity.class);
|
||||||
mapActivity.startActivity(intent);
|
mapActivity.startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -27,6 +27,7 @@ import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
@ -200,8 +201,8 @@ public class ParkingPositionPlugin extends OsmandPlugin {
|
||||||
if (selectedObj == parkingPosition && parkingPosition != null) {
|
if (selectedObj == parkingPosition && parkingPosition != null) {
|
||||||
OnContextMenuClick removeListener = new OnContextMenuClick() {
|
OnContextMenuClick removeListener = new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int resId, int pos,
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int resId,
|
||||||
boolean isChecked) {
|
int pos, boolean isChecked) {
|
||||||
if ((resId == R.string.context_menu_item_delete_parking_point)) {
|
if ((resId == R.string.context_menu_item_delete_parking_point)) {
|
||||||
showDeleteDialog(mapActivity);
|
showDeleteDialog(mapActivity);
|
||||||
}
|
}
|
||||||
|
@ -214,8 +215,8 @@ public class ParkingPositionPlugin extends OsmandPlugin {
|
||||||
|
|
||||||
OnContextMenuClick addListener = new OnContextMenuClick() {
|
OnContextMenuClick addListener = new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int resId, int pos,
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int resId,
|
||||||
boolean isChecked) {
|
int pos, boolean isChecked) {
|
||||||
if (resId == R.string.context_menu_item_add_parking_point) {
|
if (resId == R.string.context_menu_item_add_parking_point) {
|
||||||
showAddParkingDialog(mapActivity, latitude, longitude);
|
showAddParkingDialog(mapActivity, latitude, longitude);
|
||||||
}
|
}
|
||||||
|
@ -421,7 +422,7 @@ public class ParkingPositionPlugin extends OsmandPlugin {
|
||||||
helper.item(R.string.osmand_parking_delete)
|
helper.item(R.string.osmand_parking_delete)
|
||||||
.icons(R.drawable.ic_action_remove_dark, R.drawable.ic_action_remove_light).listen(new OnContextMenuClick() {
|
.icons(R.drawable.ic_action_remove_dark, R.drawable.ic_action_remove_light).listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
showDeleteDialog(mapActivity);
|
showDeleteDialog(mapActivity);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,7 +185,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
|
||||||
final MapActivityLayers layers = mapActivity.getMapLayers();
|
final MapActivityLayers layers = mapActivity.getMapLayers();
|
||||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
if (itemId == R.string.layer_map) {
|
if (itemId == R.string.layer_map) {
|
||||||
layers.selectMapLayer(mapView);
|
layers.selectMapLayer(mapView);
|
||||||
} else if(itemId == R.string.layer_overlay){
|
} else if(itemId == R.string.layer_overlay){
|
||||||
|
@ -225,7 +225,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
|
||||||
if (mapView.getMainLayer() instanceof MapTileLayer) {
|
if (mapView.getMainLayer() instanceof MapTileLayer) {
|
||||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int resId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int resId, int pos, boolean isChecked) {
|
||||||
if (resId == R.string.context_menu_item_update_map) {
|
if (resId == R.string.context_menu_item_update_map) {
|
||||||
mapActivity.getMapActions().reloadTile(mapView.getZoom(), latitude, longitude);
|
mapActivity.getMapActions().reloadTile(mapView.getZoom(), latitude, longitude);
|
||||||
} else if (resId == R.string.context_menu_item_download_map) {
|
} else if (resId == R.string.context_menu_item_download_map) {
|
||||||
|
|
|
@ -3,6 +3,7 @@ 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.os.AsyncTask;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.RotatedTileBox;
|
import net.osmand.data.RotatedTileBox;
|
||||||
import net.osmand.plus.ContextMenuAdapter;
|
import net.osmand.plus.ContextMenuAdapter;
|
||||||
|
@ -74,7 +75,7 @@ public class RoutePointsLayer extends OsmandMapLayer implements ContextMenuLaye
|
||||||
final GPXUtilities.WptPt point = (GPXUtilities.WptPt) o;
|
final GPXUtilities.WptPt point = (GPXUtilities.WptPt) o;
|
||||||
ContextMenuAdapter.OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
ContextMenuAdapter.OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
if (itemId == R.string.mark_as_not_visited){
|
if (itemId == R.string.mark_as_not_visited){
|
||||||
plugin.getCurrentRoute().markPoint(point,false);
|
plugin.getCurrentRoute().markPoint(point,false);
|
||||||
plugin.saveCurrentRoute();
|
plugin.saveCurrentRoute();
|
||||||
|
|
|
@ -57,6 +57,7 @@ import android.support.v4.app.DialogFragment;
|
||||||
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.view.Window;
|
import android.view.Window;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
@ -513,7 +514,7 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
|
||||||
adapter.item(R.string.show_waypoint_information).icons(R.drawable.ic_action_info_dark, R.drawable.ic_action_info_light ).position(0)
|
adapter.item(R.string.show_waypoint_information).icons(R.drawable.ic_action_info_dark, R.drawable.ic_action_info_light ).position(0)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
showFavoriteDialog(mapActivity, selectedStage, sf);
|
showFavoriteDialog(mapActivity, selectedStage, sf);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -565,7 +566,7 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
|
||||||
R.drawable.ic_action_gremove_dark, R.drawable.ic_action_gremove_light)
|
R.drawable.ic_action_gremove_dark, R.drawable.ic_action_gremove_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
app.getSettings().SHOW_POI_OVER_MAP.set(false);
|
app.getSettings().SHOW_POI_OVER_MAP.set(false);
|
||||||
mapActivity.getMapLayers().updateLayers(mapActivity.getMapView());
|
mapActivity.getMapLayers().updateLayers(mapActivity.getMapView());
|
||||||
return true;
|
return true;
|
||||||
|
@ -575,7 +576,7 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
|
||||||
adapter.item(R.string.poi).icons(R.drawable.ic_action_layers_dark, R.drawable.ic_action_layers_light)
|
adapter.item(R.string.poi).icons(R.drawable.ic_action_layers_dark, R.drawable.ic_action_layers_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
mapActivity.getMapLayers().selectPOIFilterLayer(mapActivity.getMapView(), null);
|
mapActivity.getMapLayers().selectPOIFilterLayer(mapActivity.getMapView(), null);
|
||||||
app.getSettings().SHOW_POI_OVER_MAP.set(true);
|
app.getSettings().SHOW_POI_OVER_MAP.set(true);
|
||||||
mapActivity.getMapLayers().updateLayers(mapActivity.getMapView());
|
mapActivity.getMapLayers().updateLayers(mapActivity.getMapView());
|
||||||
|
@ -587,7 +588,7 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
|
||||||
adapter.item(R.string.sherpafy_tour_info_txt).icons(R.drawable.ic_action_info_dark, R.drawable.ic_action_info_light)
|
adapter.item(R.string.sherpafy_tour_info_txt).icons(R.drawable.ic_action_info_dark, R.drawable.ic_action_info_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
Intent newIntent = new Intent(mapActivity, TourViewActivity.class);
|
Intent newIntent = new Intent(mapActivity, TourViewActivity.class);
|
||||||
// newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
// newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
mapActivity.startActivity(newIntent);
|
mapActivity.startActivity(newIntent);
|
||||||
|
@ -601,7 +602,7 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
|
||||||
.icons(R.drawable.ic_action_finish_flag_dark, R.drawable.ic_action_finish_flag_light)
|
.icons(R.drawable.ic_action_finish_flag_dark, R.drawable.ic_action_finish_flag_light)
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
markStageAsCompleted(stage);
|
markStageAsCompleted(stage);
|
||||||
showCompleteStageFragment(mapActivity, stage, false);
|
showCompleteStageFragment(mapActivity, stage, false);
|
||||||
return true;
|
return true;
|
||||||
|
@ -612,7 +613,7 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
|
||||||
adapter.item(R.string.context_menu_item_share_location).icons(
|
adapter.item(R.string.context_menu_item_share_location).icons(
|
||||||
R.drawable.ic_action_gshare_dark, R.drawable.ic_action_gshare_light).listen(new OnContextMenuClick() {
|
R.drawable.ic_action_gshare_dark, R.drawable.ic_action_gshare_light).listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
if (app.getLocationProvider().getLastKnownLocation() != null) {
|
if (app.getLocationProvider().getLastKnownLocation() != null) {
|
||||||
new ShareLocation(mapActivity).run();
|
new ShareLocation(mapActivity).run();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package net.osmand.plus.srtmplugin;
|
package net.osmand.plus.srtmplugin;
|
||||||
|
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
import net.osmand.plus.ContextMenuAdapter;
|
import net.osmand.plus.ContextMenuAdapter;
|
||||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||||
|
@ -94,7 +95,7 @@ public class SRTMPlugin extends OsmandPlugin {
|
||||||
public void registerLayerContextMenuActions(final OsmandMapTileView mapView, ContextMenuAdapter adapter, final MapActivity mapActivity) {
|
public void registerLayerContextMenuActions(final OsmandMapTileView mapView, ContextMenuAdapter adapter, final MapActivity mapActivity) {
|
||||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
if (itemId == R.string.layer_hillshade) {
|
if (itemId == R.string.layer_hillshade) {
|
||||||
HILLSHADE.set(!HILLSHADE.get());
|
HILLSHADE.set(!HILLSHADE.get());
|
||||||
updateLayers(mapView, mapActivity);
|
updateLayers(mapView, mapActivity);
|
||||||
|
|
|
@ -22,6 +22,7 @@ import android.content.res.Resources;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class FavoritesLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider, MapTextProvider<LocationPoint> {
|
public class FavoritesLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider, MapTextProvider<LocationPoint> {
|
||||||
|
@ -198,7 +199,7 @@ public class FavoritesLayer extends OsmandMapLayer implements ContextMenuLayer.
|
||||||
final FavouritePoint a = (FavouritePoint) o;
|
final FavouritePoint a = (FavouritePoint) o;
|
||||||
OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
if (itemId == R.string.favourites_context_menu_delete) {
|
if (itemId == R.string.favourites_context_menu_delete) {
|
||||||
final Resources resources = view.getContext().getResources();
|
final Resources resources = view.getContext().getResources();
|
||||||
Builder builder = new AlertDialog.Builder(view.getContext());
|
Builder builder = new AlertDialog.Builder(view.getContext());
|
||||||
|
|
|
@ -8,9 +8,11 @@ import java.util.Set;
|
||||||
|
|
||||||
import net.osmand.data.RotatedTileBox;
|
import net.osmand.data.RotatedTileBox;
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
|
import net.osmand.plus.ContextMenuAdapter;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.actions.AppModeDialog;
|
import net.osmand.plus.activities.actions.AppModeDialog;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
|
@ -293,175 +295,82 @@ public class MapInfoLayer extends OsmandMapLayer {
|
||||||
recreateControls();
|
recreateControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> getSpecificVisibleCategories(Set<MapWidgetRegInfo> m) {
|
public ContextMenuAdapter openViewConfigureDrawer() {
|
||||||
Set<String> s = new LinkedHashSet<String>();
|
|
||||||
for(MapWidgetRegInfo ms : m){
|
|
||||||
if(ms.getCategory() != null) {
|
|
||||||
s.add(ms.getCategory());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void fillAppearanceWidgets(Set<MapWidgetRegInfo> widgets, String category, ArrayList<Object> registry) {
|
|
||||||
for(MapWidgetRegInfo w : widgets ) {
|
|
||||||
if(Algorithms.objectEquals(w.getCategory(), category)) {
|
|
||||||
registry.add(w);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void openViewConfigureDrawer(ListView listView) {
|
|
||||||
final OsmandSettings settings = view.getSettings();
|
final OsmandSettings settings = view.getSettings();
|
||||||
|
ContextMenuAdapter cm = new ContextMenuAdapter(view.getContext());
|
||||||
final ArrayList<Object> list = new ArrayList<Object>();
|
cm.setDefaultLayoutId(R.layout.drawer_list_item);
|
||||||
list.add(map.getString(R.string.layer_map_appearance));
|
cm.item(R.string.layer_map_appearance).icons(R.drawable.ic_back_drawer_dark, R.drawable.ic_back_drawer_white)
|
||||||
list.add(map.getString(R.string.map_widget_reset));
|
.listen(new OnContextMenuClick() {
|
||||||
list.add(map.getString(R.string.map_widget_top));
|
|
||||||
list.addAll(mapInfoControls.getTop());
|
|
||||||
list.add(map.getString(R.string.map_widget_right));
|
|
||||||
list.addAll(mapInfoControls.getRight());
|
|
||||||
list.add(map.getString(R.string.map_widget_left));
|
|
||||||
list.addAll(mapInfoControls.getLeft());
|
|
||||||
|
|
||||||
Set<MapWidgetRegInfo> widgets = mapInfoControls.getAppearanceWidgets();
|
@Override
|
||||||
Set<String> cats = getSpecificVisibleCategories(widgets);
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
list.add(map.getString(R.string.map_widget_appearance_rem));
|
map.getMapActions().prepareStartOptionsMenu();
|
||||||
fillAppearanceWidgets(widgets, null, list);
|
return false;
|
||||||
for(String cat : cats) {
|
}
|
||||||
list.add(cat);
|
}).reg();
|
||||||
fillAppearanceWidgets(widgets, cat, list);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
cm.item(R.string.map_widget_reset)
|
||||||
// final LayerMenuListener listener = new LayerMenuListener(adapter, mapView, settings);
|
.icons(R.drawable.widget_reset_to_default_light, R.drawable.widget_reset_to_default_dark).listen(new OnContextMenuClick() {
|
||||||
final Set<ApplicationMode> selected = new LinkedHashSet<ApplicationMode>();
|
|
||||||
final ArrayAdapter<Object> listAdapter = new ArrayAdapter<Object>(map, R.layout.layers_list_activity_item, R.id.title, list) {
|
|
||||||
@Override
|
|
||||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
|
||||||
final ApplicationMode mode = settings.getApplicationMode();
|
|
||||||
View v = convertView;
|
|
||||||
if (v == null) {
|
|
||||||
v = map.getLayoutInflater().inflate(R.layout.drawer_list_item, null);
|
|
||||||
}
|
|
||||||
final TextView tv = (TextView) v.findViewById(R.id.title);
|
|
||||||
final CheckBox ch = ((CheckBox) v.findViewById(R.id.check_item));
|
|
||||||
Object o = list.get(position);
|
|
||||||
if(o instanceof MapWidgetRegInfo) {
|
|
||||||
final MapWidgetRegInfo mi = (MapWidgetRegInfo) o;
|
|
||||||
|
|
||||||
String s = mi.visibleCollapsed(mode)? " - " : " ";
|
@Override
|
||||||
if(mi.message != null) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
tv.setText(s +mi.message +s);
|
mapInfoControls.resetToDefault();
|
||||||
} else {
|
recreateControls();
|
||||||
tv.setText(s +map.getString(mi.messageId) +s);
|
adapter.notifyDataSetInvalidated();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
}).reg();
|
||||||
|
final ApplicationMode mode = settings.getApplicationMode();
|
||||||
|
cm.item(R.string.map_widget_top).setCategory(true).layout(R.layout.drawer_list_sub_header).reg();
|
||||||
|
addControls(cm, mapInfoControls.getTop(), mode);
|
||||||
|
cm.item(R.string.map_widget_right).setCategory(true).layout(R.layout.drawer_list_sub_header).reg();
|
||||||
|
addControls(cm, mapInfoControls.getRight(), mode);
|
||||||
|
cm.item(R.string.map_widget_left).setCategory(true).layout(R.layout.drawer_list_sub_header).reg();
|
||||||
|
addControls(cm, mapInfoControls.getLeft(), mode);
|
||||||
|
|
||||||
int drawable = 0;
|
cm.item(R.string.map_widget_appearance_rem).setCategory(true).layout(R.layout.drawer_list_sub_header).reg();
|
||||||
if (map.getMyApplication().getSettings().isLightContent()){
|
addControls(cm, mapInfoControls.getAppearanceWidgets(), mode);
|
||||||
drawable = mi.drawableLight;
|
final Set<ApplicationMode> selected = new LinkedHashSet<ApplicationMode>();
|
||||||
} else {
|
|
||||||
drawable = mi.drawableDark;
|
// TODO add profiles
|
||||||
}
|
// View confirmDialog = View.inflate(view.getContext(), R.layout.configuration_dialog, null);
|
||||||
// Put the image on the TextView
|
// AppModeDialog.prepareAppModeView(map, selected, true,
|
||||||
if (drawable != 0) {
|
// (ViewGroup) confirmDialog.findViewById(R.id.TopBar), true,
|
||||||
tv.setPadding((int) (12 *scaleCoefficient), 0, 0, 0);
|
// new View.OnClickListener() {
|
||||||
tv.setCompoundDrawablesWithIntrinsicBounds(drawable, 0, 0, 0);
|
// @Override
|
||||||
} else {
|
// public void onClick(View v) {
|
||||||
tv.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
|
// if(selected.size() > 0) {
|
||||||
tv.setPadding((int) (30 *scaleCoefficient), 0, 0, 0);
|
// view.getSettings().APPLICATION_MODE.set(selected.iterator().next());
|
||||||
}
|
// listAdapter.notifyDataSetChanged();
|
||||||
final boolean selecteable = mi.selecteable();
|
// }
|
||||||
ch.setOnCheckedChangeListener(null);
|
// }
|
||||||
if(!mi.selecteable()) {
|
// });
|
||||||
ch.setVisibility(View.GONE);
|
|
||||||
} else {
|
|
||||||
boolean check = mi.visibleCollapsed(mode) || mi.visible(mode);
|
|
||||||
ch.setChecked(check);
|
|
||||||
ch.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
ch.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
|
||||||
@Override
|
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
||||||
mapInfoControls.changeVisibility(mi);
|
|
||||||
if (selecteable) {
|
|
||||||
ch.setChecked(mi.visible(mode) || mi.visibleCollapsed(mode));
|
|
||||||
}
|
|
||||||
String s = mi.visibleCollapsed(mode) ? " - " : " ";
|
|
||||||
if(mi.message != null) {
|
|
||||||
tv.setText(s +mi.message +s);
|
|
||||||
} else {
|
|
||||||
tv.setText(s +map.getString(mi.messageId) +s);
|
|
||||||
}
|
|
||||||
recreateControls();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
tv.setText(o.toString());
|
|
||||||
tv.setPadding((int) (5 *scaleCoefficient), 0, 0, 0);
|
|
||||||
// reset
|
|
||||||
if (position == 0) {
|
|
||||||
if (map.getMyApplication().getSettings().isLightContent()){
|
|
||||||
tv.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_back_drawer_white, 0, 0, 0);
|
|
||||||
} else {
|
|
||||||
tv.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_back_drawer_dark, 0, 0, 0);
|
|
||||||
}
|
|
||||||
} else if (position == 1) {
|
|
||||||
if (map.getMyApplication().getSettings().isLightContent()) {
|
|
||||||
tv.setCompoundDrawablesWithIntrinsicBounds(R.drawable.widget_reset_to_default_light, 0, 0, 0);
|
|
||||||
} else {
|
|
||||||
tv.setCompoundDrawablesWithIntrinsicBounds(R.drawable.widget_reset_to_default_dark, 0, 0, 0);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tv.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
ch.setVisibility(View.INVISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
View confirmDialog = View.inflate(view.getContext(), R.layout.configuration_dialog, null);
|
|
||||||
AppModeDialog.prepareAppModeView(map, selected, true,
|
|
||||||
(ViewGroup) confirmDialog.findViewById(R.id.TopBar), true,
|
|
||||||
new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
if(selected.size() > 0) {
|
|
||||||
view.getSettings().APPLICATION_MODE.set(selected.iterator().next());
|
|
||||||
listAdapter.notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
return cm;
|
||||||
listView.setOnItemClickListener(new OnItemClickListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
||||||
final ApplicationMode mode = settings.getApplicationMode();
|
|
||||||
Object o = list.get(position);
|
|
||||||
if (o instanceof MapWidgetRegInfo) {
|
|
||||||
final MapWidgetRegInfo mi = (MapWidgetRegInfo) o;
|
|
||||||
final boolean selecteable = mi.selecteable();
|
|
||||||
boolean check = mi.visibleCollapsed(mode) || mi.visible(mode);
|
|
||||||
if (check || selecteable) {
|
|
||||||
mapInfoControls.changeVisibility(mi);
|
|
||||||
}
|
|
||||||
recreateControls();
|
|
||||||
listAdapter.notifyDataSetInvalidated();
|
|
||||||
} else if(position == 0) {
|
|
||||||
map.getMapActions().prepareStartOptionsMenu();
|
|
||||||
} else if (position == 1) {
|
|
||||||
mapInfoControls.resetToDefault();
|
|
||||||
recreateControls();
|
|
||||||
listAdapter.notifyDataSetInvalidated();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
listView.setAdapter(listAdapter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addControls(ContextMenuAdapter adapter, Set<MapWidgetRegInfo> top, final ApplicationMode mode) {
|
||||||
|
for(final MapWidgetRegInfo r : top){
|
||||||
|
// String s = mi.visibleCollapsed(mode)? " - " : " ";
|
||||||
|
// tv.setText(s +map.getString(mi.messageId) +s);
|
||||||
|
adapter.item(r.messageId)
|
||||||
|
.icons(r.drawableLight, r.drawableDark).listen(new OnContextMenuClick() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
|
final boolean selecteable = r.selecteable();
|
||||||
|
boolean check = r.visibleCollapsed(mode) || r.visible(mode);
|
||||||
|
if (check || selecteable) {
|
||||||
|
mapInfoControls.changeVisibility(r);
|
||||||
|
}
|
||||||
|
recreateControls();
|
||||||
|
adapter.notifyDataSetInvalidated();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}).reg();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private int themeId = -1;
|
private int themeId = -1;
|
||||||
public void updateColorShadowsOfText(DrawSettings drawSettings) {
|
public void updateColorShadowsOfText(DrawSettings drawSettings) {
|
||||||
boolean transparent = view.getSettings().TRANSPARENT_MAP_THEME.get();
|
boolean transparent = view.getSettings().TRANSPARENT_MAP_THEME.get();
|
||||||
|
|
|
@ -81,7 +81,7 @@ public class MonitoringInfoControl {
|
||||||
ai.setOnClickListener(new View.OnClickListener() {
|
ai.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
ca.getClickAdapter(ij).onContextMenuClick(ca.getElementId(ij), ij, false);
|
ca.getClickAdapter(ij).onContextMenuClick(null, ca.getElementId(ij), ij, false);
|
||||||
qa.dismiss();
|
qa.dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -35,6 +35,7 @@ import android.graphics.Paint;
|
||||||
import android.graphics.Paint.Style;
|
import android.graphics.Paint.Style;
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider,
|
public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider,
|
||||||
|
@ -255,7 +256,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
||||||
final Amenity a = (Amenity) o;
|
final Amenity a = (Amenity) o;
|
||||||
OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
if (itemId == R.string.poi_context_menu_call) {
|
if (itemId == R.string.poi_context_menu_call) {
|
||||||
try {
|
try {
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||||
|
|
|
@ -20,6 +20,7 @@ import android.graphics.Paint;
|
||||||
import android.graphics.Paint.Align;
|
import android.graphics.Paint.Align;
|
||||||
import android.graphics.Paint.Style;
|
import android.graphics.Paint.Style;
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
|
||||||
public class PointNavigationLayer extends OsmandMapLayer implements IContextMenuProvider {
|
public class PointNavigationLayer extends OsmandMapLayer implements IContextMenuProvider {
|
||||||
protected final static int DIST_TO_SHOW = 80;
|
protected final static int DIST_TO_SHOW = 80;
|
||||||
|
@ -219,7 +220,7 @@ public class PointNavigationLayer extends OsmandMapLayer implements IContextMenu
|
||||||
final TargetPoint a = (TargetPoint) o;
|
final TargetPoint a = (TargetPoint) o;
|
||||||
OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
if (itemId == R.string.delete_target_point) {
|
if (itemId == R.string.delete_target_point) {
|
||||||
TargetPointsHelper targetPointsHelper = map.getMyApplication().getTargetPointsHelper();
|
TargetPointsHelper targetPointsHelper = map.getMyApplication().getTargetPointsHelper();
|
||||||
if(a.intermediate) {
|
if(a.intermediate) {
|
||||||
|
|
|
@ -20,6 +20,7 @@ import android.graphics.Paint;
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider {
|
public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider {
|
||||||
|
@ -215,7 +216,7 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
|
||||||
final TransportStop a = (TransportStop) o;
|
final TransportStop a = (TransportStop) o;
|
||||||
OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
showDescriptionDialog(a);
|
showDescriptionDialog(a);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,18 @@
|
||||||
package net.osmand.plus.views.mapwidgets;
|
package net.osmand.plus.views.mapwidgets;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.TreeSet;
|
||||||
|
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.OsmandSettings.CommonPreference;
|
import net.osmand.plus.OsmandSettings.CommonPreference;
|
||||||
import net.osmand.plus.OsmandSettings.OsmandPreference;
|
import net.osmand.plus.OsmandSettings.OsmandPreference;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
import net.osmand.util.Algorithms;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
@ -76,30 +81,6 @@ public class MapWidgetRegistry {
|
||||||
return ii;
|
return ii;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeApperanceWidgets(String category) {
|
|
||||||
Iterator<MapWidgetRegInfo> it = appearanceWidgets.iterator();
|
|
||||||
while(it.hasNext()) {
|
|
||||||
if(Algorithms.objectEquals(it.next().category, category)) {
|
|
||||||
it.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public MapWidgetRegInfo registerAppearanceWidget(int drawableDark,int drawableLight, String message, String key,
|
|
||||||
CommonPreference<?> pref, String subcategory) {
|
|
||||||
MapWidgetRegInfo ii = new MapWidgetRegInfo();
|
|
||||||
ii.key = key;
|
|
||||||
ii.category = subcategory;
|
|
||||||
ii.preference = pref;
|
|
||||||
ii.visibleModes = new LinkedHashSet<ApplicationMode>();
|
|
||||||
ii.visibleCollapsible = null;
|
|
||||||
ii.drawableDark = drawableDark;
|
|
||||||
ii.drawableLight = drawableLight;
|
|
||||||
ii.messageId = message.hashCode();
|
|
||||||
ii.message = message;
|
|
||||||
this.appearanceWidgets.add(ii);
|
|
||||||
return ii;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MapWidgetRegInfo registerTopWidget(View m, int drawableDark,int drawableLight, int messageId, String key, int left, int priorityOrder) {
|
public MapWidgetRegInfo registerTopWidget(View m, int drawableDark,int drawableLight, int messageId, String key, int left, int priorityOrder) {
|
||||||
MapWidgetRegInfo ii = new MapWidgetRegInfo();
|
MapWidgetRegInfo ii = new MapWidgetRegInfo();
|
||||||
|
@ -318,10 +299,8 @@ public class MapWidgetRegistry {
|
||||||
public int drawableDark;
|
public int drawableDark;
|
||||||
public int drawableLight;
|
public int drawableLight;
|
||||||
public int messageId;
|
public int messageId;
|
||||||
public String message;
|
|
||||||
private String key;
|
private String key;
|
||||||
private int position;
|
private int position;
|
||||||
private String category;
|
|
||||||
private Set<ApplicationMode> visibleModes;
|
private Set<ApplicationMode> visibleModes;
|
||||||
private Set<ApplicationMode> visibleCollapsible;
|
private Set<ApplicationMode> visibleCollapsible;
|
||||||
private OsmandPreference<?> preference = null;
|
private OsmandPreference<?> preference = null;
|
||||||
|
@ -336,10 +315,6 @@ public class MapWidgetRegistry {
|
||||||
return visibleCollapsible != null && preference == null;
|
return visibleCollapsible != null && preference == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getCategory() {
|
|
||||||
return category;
|
|
||||||
}
|
|
||||||
public boolean selecteable(){
|
public boolean selecteable(){
|
||||||
return preference == null || (preference.get() instanceof Boolean);
|
return preference == null || (preference.get() instanceof Boolean);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue