Merge pull request #1087 from Bars107/master
Fixed tracks menu and returned delete for search history.
This commit is contained in:
commit
cd757b4cd8
5 changed files with 154 additions and 70 deletions
|
@ -51,10 +51,18 @@
|
|||
android:id="@+id/turn_off_all"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="?attr/dashboardGeneralButtonStyle"
|
||||
android:textColor="@color/color_distance"
|
||||
android:text="@string/turn_off_all"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
|
||||
<ListView
|
||||
android:id="@+id/gpx_on_map"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -100,12 +100,7 @@
|
|||
android:src="@drawable/ic_action_gsave_dark"/>
|
||||
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/check"
|
||||
android:layout_width="@dimen/list_item_height"
|
||||
android:layout_height="@dimen/list_item_height"
|
||||
android:focusable="false"
|
||||
android:visibility="gone"/>
|
||||
<include layout="@layout/check_item_rel" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
|
||||
<Button
|
||||
android:id="@+id/clearAll"
|
||||
android:layout_marginLeft="@dimen/list_content_padding"
|
||||
android:layout_marginRight="@dimen/list_content_padding"
|
||||
android:background="?attr/downloadButtonBackground"
|
||||
android:textColor="?attr/pstsTextColor"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -67,6 +67,7 @@ import android.widget.Filter;
|
|||
import android.widget.Filterable;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
@ -82,8 +83,8 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
private List<GpxInfo> selectedItems = new ArrayList<>();
|
||||
private ActionMode actionMode;
|
||||
private LoadGpxTask asyncLoader;
|
||||
private GpxIndexesAdapter listAdapter;
|
||||
private ShowedOnMapAdapter showOnMapAdapter;
|
||||
private GpxIndexesAdapter allGpxAdapter;
|
||||
private ShowedOnMapAdapter showOnMapGpxAdapter;
|
||||
MessageFormat formatMb = new MessageFormat("{0, number,##.#} MB", Locale.US);
|
||||
private LoadLocalIndexDescriptionTask descriptionLoader;
|
||||
private ContextMenuAdapter optionsMenuAdapter;
|
||||
|
@ -102,8 +103,8 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
asyncLoader = new LoadGpxTask();
|
||||
selectedGpxHelper = ((OsmandApplication) activity.getApplication()).getSelectedGpxHelper();
|
||||
savingTrackHelper = ((OsmandApplication) activity.getApplication()).getSavingTrackHelper();
|
||||
listAdapter = new GpxIndexesAdapter(getActivity());
|
||||
setAdapter(listAdapter);
|
||||
allGpxAdapter = new GpxIndexesAdapter(getActivity());
|
||||
setAdapter(allGpxAdapter);
|
||||
}
|
||||
|
||||
public List<GpxInfo> getSelectedItems() {
|
||||
|
@ -122,10 +123,15 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
}
|
||||
|
||||
private void createShowedOnMapsView(View v) {
|
||||
v.findViewById(R.id.on_map_layout).setVisibility(View.GONE);
|
||||
ListView onMap = (ListView)v.findViewById(R.id.gpx_on_map);
|
||||
showOnMapAdapter = new ShowedOnMapAdapter(getActivity(), R.layout.dash_gpx_track_item);
|
||||
onMap.setAdapter(showOnMapAdapter);
|
||||
ListView onMap = (ListView) v.findViewById(R.id.gpx_on_map);
|
||||
showOnMapGpxAdapter = new ShowedOnMapAdapter(getActivity(), R.layout.dash_gpx_track_item);
|
||||
onMap.setAdapter(showOnMapGpxAdapter);
|
||||
v.findViewById(R.id.turn_off_all).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
showOnMapGpxAdapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -136,6 +142,20 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
}
|
||||
}
|
||||
|
||||
private void setShowedOnMapVisibility(boolean visibility) {
|
||||
View v = getView();
|
||||
if (v == null) {
|
||||
return;
|
||||
}
|
||||
//temporary hiding this view
|
||||
v.findViewById(R.id.show_on_map).setVisibility(View.GONE);
|
||||
/* if (visibility) {
|
||||
v.findViewById(R.id.on_map_layout).setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
v.findViewById(R.id.on_map_layout).setVisibility(View.GONE);
|
||||
}*/
|
||||
}
|
||||
|
||||
private void updateCurrentTrack(View v) {
|
||||
if (v == null) {
|
||||
return;
|
||||
|
@ -163,7 +183,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
if (this.adapter != null) {
|
||||
listView.setAdapter(this.adapter);
|
||||
}
|
||||
|
||||
setHasOptionsMenu(true);
|
||||
((TextView) v.findViewById(R.id.name)).setText(R.string.currently_recording_track);
|
||||
v.findViewById(R.id.time_icon).setVisibility(View.GONE);
|
||||
|
||||
|
@ -246,13 +266,13 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
|
||||
@Override
|
||||
public boolean onQueryTextSubmit(String query) {
|
||||
listAdapter.getFilter().filter(query);
|
||||
allGpxAdapter.getFilter().filter(query);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
listAdapter.getFilter().filter(newText);
|
||||
allGpxAdapter.getFilter().filter(newText);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
@ -383,7 +403,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
private void openShowOnMapMode() {
|
||||
enableSelectionMode(true);
|
||||
selectedItems.clear();
|
||||
final Set<GpxInfo> originalSelectedItems = listAdapter.getSelectedGpx();
|
||||
final Set<GpxInfo> originalSelectedItems = allGpxAdapter.getSelectedGpx();
|
||||
selectedItems.addAll(originalSelectedItems);
|
||||
actionMode = getActionBarActivity().startSupportActionMode(new ActionMode.Callback() {
|
||||
|
||||
|
@ -424,11 +444,11 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
enableSelectionMode(false);
|
||||
getView().findViewById(R.id.memory_size).setVisibility(View.GONE);
|
||||
runSelection(false);
|
||||
listAdapter.notifyDataSetChanged();
|
||||
allGpxAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
});
|
||||
listAdapter.notifyDataSetChanged();
|
||||
allGpxAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
||||
|
@ -440,7 +460,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
value = value.substring(0, value.length() - 3);
|
||||
}
|
||||
final String actionButton = value;
|
||||
if (listAdapter.getGroupCount() == 0) {
|
||||
if (allGpxAdapter.getGroupCount() == 0) {
|
||||
AccessibleToast.makeText(getActivity(), app.getString(R.string.local_index_no_items_to_do, actionButton.toLowerCase()), Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
@ -485,7 +505,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
public void onDestroyActionMode(ActionMode mode) {
|
||||
enableSelectionMode(false);
|
||||
getView().findViewById(R.id.memory_size).setVisibility(View.GONE);
|
||||
listAdapter.notifyDataSetChanged();
|
||||
allGpxAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -494,7 +514,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
((TextView) getView().findViewById(R.id.memory_size)).setText(R.string.local_index_upload_gpx_description);
|
||||
((TextView) getView().findViewById(R.id.memory_size)).setVisibility(View.VISIBLE);
|
||||
}
|
||||
listAdapter.notifyDataSetChanged();
|
||||
allGpxAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private void renameFile(GpxInfo info) {
|
||||
|
@ -544,7 +564,9 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
loadGpxAsync(info, resId == R.string.local_index_select_gpx_file);
|
||||
} else {
|
||||
getMyApplication().getSelectedGpxHelper().selectGpxFile(info.gpx, resId == R.string.local_index_select_gpx_file, true);
|
||||
listAdapter.notifyDataSetChanged();
|
||||
showOnMapGpxAdapter.addGpxInfo(info);
|
||||
|
||||
allGpxAdapter.notifyDataSetChanged();
|
||||
selectedGpxHelper.runUiListeners();
|
||||
}
|
||||
} else if (resId == R.string.local_index_mi_delete) {
|
||||
|
@ -604,6 +626,10 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
e = false;
|
||||
getMyApplication().getSelectedGpxHelper().setGpxFileToDisplay(info.gpx);
|
||||
MapActivity.launchMapActivityMoveToTop(getActivity());
|
||||
if (showOnMapGpxAdapter.getCount() == 0) {
|
||||
setShowedOnMapVisibility(true);
|
||||
}
|
||||
showOnMapGpxAdapter.addGpxInfo(info);
|
||||
}
|
||||
}
|
||||
if (e) {
|
||||
|
@ -633,37 +659,37 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
@Override
|
||||
protected void onPreExecute() {
|
||||
((ActionBarActivity) getActivity()).setSupportProgressBarIndeterminateVisibility(true);
|
||||
listAdapter.clear();
|
||||
if (showOnMapAdapter != null) {
|
||||
showOnMapAdapter.clear();
|
||||
allGpxAdapter.clear();
|
||||
if (showOnMapGpxAdapter != null) {
|
||||
showOnMapGpxAdapter.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onProgressUpdate(GpxInfo... values) {
|
||||
for (GpxInfo v : values) {
|
||||
listAdapter.addLocalIndexInfo(v);
|
||||
if (selectedGpxHelper.getSelectedFileByName(v.getFileName()) != null){
|
||||
showOnMapAdapter.add(v);
|
||||
allGpxAdapter.addLocalIndexInfo(v);
|
||||
if (selectedGpxHelper.getSelectedFileByName(v.getFileName()) != null) {
|
||||
showOnMapGpxAdapter.addGpxInfo(v);
|
||||
}
|
||||
}
|
||||
showOnMapAdapter.notifyDataSetChanged();
|
||||
listAdapter.notifyDataSetChanged();
|
||||
showOnMapGpxAdapter.notifyDataSetChanged();
|
||||
allGpxAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void setResult(List<GpxInfo> result) {
|
||||
this.result = result;
|
||||
listAdapter.clear();
|
||||
showOnMapAdapter.clear();
|
||||
allGpxAdapter.clear();
|
||||
showOnMapGpxAdapter.clear();
|
||||
if (result != null) {
|
||||
for (GpxInfo v : result) {
|
||||
listAdapter.addLocalIndexInfo(v);
|
||||
if (selectedGpxHelper.getSelectedFileByName(v.getFileName()) != null){
|
||||
showOnMapAdapter.add(v);
|
||||
allGpxAdapter.addLocalIndexInfo(v);
|
||||
if (selectedGpxHelper.getSelectedFileByName(v.getFileName()) != null) {
|
||||
showOnMapGpxAdapter.addGpxInfo(v);
|
||||
}
|
||||
}
|
||||
listAdapter.notifyDataSetChanged();
|
||||
showOnMapAdapter.notifyDataSetChanged();
|
||||
allGpxAdapter.notifyDataSetChanged();
|
||||
showOnMapGpxAdapter.notifyDataSetChanged();
|
||||
onPostExecute(result);
|
||||
}
|
||||
}
|
||||
|
@ -674,9 +700,15 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
if (getActivity() != null) {
|
||||
((ActionBarActivity) getActivity()).setSupportProgressBarIndeterminateVisibility(false);
|
||||
}
|
||||
if (listAdapter.getGroupCount() > 0) {
|
||||
if (allGpxAdapter.getGroupCount() > 0) {
|
||||
getExpandableListView().expandGroup(0);
|
||||
}
|
||||
|
||||
if (showOnMapGpxAdapter.getCount() > 0) {
|
||||
setShowedOnMapVisibility(true);
|
||||
} else {
|
||||
setShowedOnMapVisibility(false);
|
||||
}
|
||||
}
|
||||
|
||||
private File[] listFilesSorted(File dir) {
|
||||
|
@ -1065,13 +1097,13 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
|
||||
@Override
|
||||
protected void onProgressUpdate(GpxInfo... values) {
|
||||
listAdapter.notifyDataSetChanged();
|
||||
allGpxAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(GpxInfo[] result) {
|
||||
hideProgressBar();
|
||||
listAdapter.notifyDataSetChanged();
|
||||
allGpxAdapter.notifyDataSetChanged();
|
||||
|
||||
}
|
||||
|
||||
|
@ -1101,9 +1133,9 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
@Override
|
||||
protected void onProgressUpdate(GpxInfo... values) {
|
||||
for (GpxInfo g : values) {
|
||||
listAdapter.delete(g);
|
||||
allGpxAdapter.delete(g);
|
||||
}
|
||||
listAdapter.notifyDataSetChanged();
|
||||
allGpxAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1149,7 +1181,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
toShow = g.gpx.findPointToShow();
|
||||
}
|
||||
}
|
||||
listAdapter.notifyDataSetInvalidated();
|
||||
allGpxAdapter.notifyDataSetInvalidated();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1201,7 +1233,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
}
|
||||
if (info.gpx != null) {
|
||||
getMyApplication().getSelectedGpxHelper().selectGpxFile(info.gpx, selected, true);
|
||||
listAdapter.notifyDataSetChanged();
|
||||
allGpxAdapter.notifyDataSetChanged();
|
||||
selectedGpxHelper.runUiListeners();
|
||||
}
|
||||
}
|
||||
|
@ -1237,18 +1269,18 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
@Override
|
||||
protected void publishResults(CharSequence constraint, FilterResults results) {
|
||||
if (results.values != null) {
|
||||
synchronized (listAdapter) {
|
||||
listAdapter.clear();
|
||||
showOnMapAdapter.clear();
|
||||
synchronized (allGpxAdapter) {
|
||||
allGpxAdapter.clear();
|
||||
showOnMapGpxAdapter.clear();
|
||||
for (GpxInfo i : ((List<GpxInfo>) results.values)) {
|
||||
listAdapter.addLocalIndexInfo(i);
|
||||
if (selectedGpxHelper.getSelectedFileByName(i.getFileName()) != null){
|
||||
showOnMapAdapter.add(i);
|
||||
allGpxAdapter.addLocalIndexInfo(i);
|
||||
if (selectedGpxHelper.getSelectedFileByName(i.getFileName()) != null) {
|
||||
showOnMapGpxAdapter.addGpxInfo(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
showOnMapAdapter.notifyDataSetChanged();
|
||||
listAdapter.notifyDataSetChanged();
|
||||
showOnMapGpxAdapter.notifyDataSetChanged();
|
||||
allGpxAdapter.notifyDataSetChanged();
|
||||
if (constraint != null && constraint.length() > 3) {
|
||||
collapseTrees(10);
|
||||
}
|
||||
|
@ -1270,7 +1302,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
|
||||
@Override
|
||||
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
|
||||
GpxInfo item = listAdapter.getChild(groupPosition, childPosition);
|
||||
GpxInfo item = allGpxAdapter.getChild(groupPosition, childPosition);
|
||||
if (!selectionMode) {
|
||||
item.setExpanded(!item.isExpanded());
|
||||
if (item.isExpanded()) {
|
||||
|
@ -1285,7 +1317,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
}
|
||||
updateSelectionMode(actionMode);
|
||||
}
|
||||
listAdapter.notifyDataSetInvalidated();
|
||||
allGpxAdapter.notifyDataSetInvalidated();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1394,7 +1426,39 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
}
|
||||
}
|
||||
|
||||
class ShowedOnMapAdapter extends ArrayAdapter<GpxInfo>{
|
||||
private void adjustShowOnMapListViewSize() {
|
||||
View v = getView();
|
||||
if (v == null) {
|
||||
return;
|
||||
}
|
||||
float size = getResources().getDimension(R.dimen.dashListItemHeight) * 3.5f;
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, (int) size);
|
||||
getView().findViewById(R.id.gpx_on_map).setLayoutParams(params);
|
||||
}
|
||||
|
||||
class ShowedOnMapAdapter extends ArrayAdapter<GpxInfo> {
|
||||
|
||||
public void addGpxInfo(GpxInfo info) {
|
||||
boolean contains = false;
|
||||
for (int i = 0; i < getCount(); i++) {
|
||||
if (getItem(i).equals(info)) {
|
||||
contains = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (contains) {
|
||||
return;
|
||||
}
|
||||
|
||||
add(info);
|
||||
notifyDataSetChanged();
|
||||
|
||||
//if there's too many items, we need to set size of listview
|
||||
if (getCount() == 4) {
|
||||
adjustShowOnMapListViewSize();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ShowedOnMapAdapter(Context context, int resource) {
|
||||
super(context, resource);
|
||||
|
@ -1408,7 +1472,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
v = inflater.inflate(R.layout.dash_gpx_track_item, parent, false);
|
||||
}
|
||||
|
||||
GpxInfo gpxInfo = getItem(position);
|
||||
final GpxInfo gpxInfo = getItem(position);
|
||||
|
||||
TextView viewName = ((TextView) v.findViewById(R.id.name));
|
||||
viewName.setText(gpxInfo.getName());
|
||||
|
@ -1426,9 +1490,24 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
|
||||
}
|
||||
|
||||
CompoundButton check = (CompoundButton)v.findViewById(R.id.check);
|
||||
final CompoundButton check = (CompoundButton) v.findViewById(R.id.check_item);
|
||||
check.setVisibility(View.VISIBLE);
|
||||
|
||||
if (selectedGpxHelper.getSelectedFileByName(gpxInfo.getFileName()) != null) {
|
||||
check.setChecked(true);
|
||||
} else {
|
||||
check.setChecked(false);
|
||||
}
|
||||
check.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (gpxInfo.gpx == null) {
|
||||
loadGpxAsync(gpxInfo, check.isChecked());
|
||||
} else {
|
||||
selectedGpxHelper.selectGpxFile(gpxInfo.gpx, check.isChecked(), true);
|
||||
}
|
||||
allGpxAdapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package net.osmand.plus.activities.search;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.List;
|
||||
|
||||
import net.osmand.data.LatLon;
|
||||
|
@ -10,25 +9,18 @@ import net.osmand.plus.OsmandApplication;
|
|||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
|
||||
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
import net.osmand.plus.helpers.SearchHistoryHelper;
|
||||
import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.media.Image;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.ListFragment;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.text.Spannable;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
|
@ -130,10 +122,22 @@ public class SearchHistoryFragment extends ListFragment implements SearchActivit
|
|||
|
||||
private void selectModel(final HistoryEntry model, View v) {
|
||||
PointDescription name = model.getName();
|
||||
boolean light = ((OsmandApplication) getActivity().getApplication()).getSettings().isLightContent();
|
||||
final PopupMenu optionsMenu = new PopupMenu(getActivity(), v);
|
||||
OsmandSettings settings = ((OsmandApplication) getActivity().getApplication()).getSettings();
|
||||
DirectionsDialogs.createDirectionsActionsPopUpMenu(optionsMenu, new LatLon(model.getLat(), model.getLon()),
|
||||
model, name, settings.getLastKnownMapZoom(), getActivity(), true);
|
||||
MenuItem item = optionsMenu.getMenu().add(
|
||||
R.string.edit_filter_delete_menu_item).setIcon(light ?
|
||||
R.drawable.ic_action_delete_light : R.drawable.ic_action_delete_dark);
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
helper.remove(model);
|
||||
historyAdapter.remove(model);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
optionsMenu.show();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue