Formatting
This commit is contained in:
parent
df32aa5b57
commit
30c71820aa
1 changed files with 53 additions and 53 deletions
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package net.osmand.plus.activities.search;
|
package net.osmand.plus.activities.search;
|
||||||
|
|
||||||
|
@ -91,11 +91,11 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
private static final int SEARCH_MORE = 0;
|
private static final int SEARCH_MORE = 0;
|
||||||
private static final int SHOW_ON_MAP = 1;
|
private static final int SHOW_ON_MAP = 1;
|
||||||
private static final int FILTER = 2;
|
private static final int FILTER = 2;
|
||||||
|
|
||||||
private static final int EDIT_FILTER = 4;
|
private static final int EDIT_FILTER = 4;
|
||||||
private static final int DELETE_FILTER = 5;
|
private static final int DELETE_FILTER = 5;
|
||||||
private static final int SAVE_FILTER = 6;
|
private static final int SAVE_FILTER = 6;
|
||||||
|
|
||||||
|
|
||||||
private PoiUIFilter filter;
|
private PoiUIFilter filter;
|
||||||
private AmenityAdapter amenityAdapter;
|
private AmenityAdapter amenityAdapter;
|
||||||
|
@ -110,7 +110,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
|
|
||||||
private SearchAmenityTask currentSearchTask = null;
|
private SearchAmenityTask currentSearchTask = null;
|
||||||
private AccessibilityAssistant accessibilityAssistant;
|
private AccessibilityAssistant accessibilityAssistant;
|
||||||
|
|
||||||
private OsmandApplication app;
|
private OsmandApplication app;
|
||||||
private MenuItem showFilterItem;
|
private MenuItem showFilterItem;
|
||||||
private MenuItem showOnMapItem;
|
private MenuItem showOnMapItem;
|
||||||
|
@ -144,16 +144,16 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
imm.showSoftInput(searchFilter, InputMethodManager.SHOW_IMPLICIT);
|
imm.showSoftInput(searchFilter, InputMethodManager.SHOW_IMPLICIT);
|
||||||
} else {
|
} else {
|
||||||
if(filter != null) {
|
if (filter != null) {
|
||||||
searchFilter.setText(filter.getSavedFilterByName() == null ? "" :
|
searchFilter.setText(filter.getSavedFilterByName() == null ? "" :
|
||||||
filter.getSavedFilterByName());
|
filter.getSavedFilterByName());
|
||||||
}
|
}
|
||||||
searchFilterLayout.setVisibility(View.GONE);
|
searchFilterLayout.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
showOnMapItem = menu.add(0, SHOW_ON_MAP, 0, R.string.shared_string_show_on_map);
|
showOnMapItem = menu.add(0, SHOW_ON_MAP, 0, R.string.shared_string_show_on_map);
|
||||||
MenuItemCompat.setShowAsAction(showOnMapItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
MenuItemCompat.setShowAsAction(showOnMapItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||||
showOnMapItem = showOnMapItem.setIcon(getMyApplication().getIconsCache().getIcon(
|
showOnMapItem = showOnMapItem.setIcon(getMyApplication().getIconsCache().getIcon(
|
||||||
|
@ -187,7 +187,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
// Issue 2657
|
// Issue 2657
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
if (!(currentSearchTask == null || currentSearchTask.getStatus() == Status.FINISHED)) {
|
if (!(currentSearchTask == null || currentSearchTask.getStatus() == Status.FINISHED)) {
|
||||||
currentSearchTask.cancel(true);
|
currentSearchTask.cancel(true);
|
||||||
|
@ -209,7 +209,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
.show();
|
.show();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ((isNameSearch() && !Algorithms.objectEquals(filter.getFilterByName(), query)) ) {
|
if ((isNameSearch() && !Algorithms.objectEquals(filter.getFilterByName(), query))) {
|
||||||
filter.clearPreviousZoom();
|
filter.clearPreviousZoom();
|
||||||
filter.setFilterByName(query);
|
filter.setFilterByName(query);
|
||||||
runNewSearchQuery(location, NEW_SEARCH_INIT);
|
runNewSearchQuery(location, NEW_SEARCH_INIT);
|
||||||
|
@ -263,10 +263,10 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
searchFilter.setHint(R.string.filter_poi_hint);
|
searchFilter.setHint(R.string.filter_poi_hint);
|
||||||
((ImageView)findViewById(R.id.search_icon)).setImageDrawable(
|
((ImageView) findViewById(R.id.search_icon)).setImageDrawable(
|
||||||
getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_filter_dark));
|
getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_filter_dark));
|
||||||
((ImageView) findViewById(R.id.options)).
|
((ImageView) findViewById(R.id.options)).
|
||||||
setImageDrawable(getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_overflow_menu_white));
|
setImageDrawable(getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_overflow_menu_white));
|
||||||
findViewById(R.id.options).setOnClickListener(new View.OnClickListener() {
|
findViewById(R.id.options).setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -275,7 +275,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
});
|
});
|
||||||
updateIntent(getIntent());
|
updateIntent(getIntent());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateIntent(Intent intent) {
|
public void updateIntent(Intent intent) {
|
||||||
Bundle bundle = intent.getExtras();
|
Bundle bundle = intent.getExtras();
|
||||||
if (bundle.containsKey(SEARCH_LAT) && bundle.containsKey(SEARCH_LON)) {
|
if (bundle.containsKey(SEARCH_LAT) && bundle.containsKey(SEARCH_LON)) {
|
||||||
|
@ -288,7 +288,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
String filterId = bundle.getString(AMENITY_FILTER);
|
String filterId = bundle.getString(AMENITY_FILTER);
|
||||||
this.filter = app.getPoiFilters().getFilterById(filterId);
|
this.filter = app.getPoiFilters().getFilterById(filterId);
|
||||||
if (filter != null) {
|
if (filter != null) {
|
||||||
if(filter.isEmpty() && !isNameSearch()) {
|
if (filter.isEmpty() && !isNameSearch()) {
|
||||||
showEditActivity(filter);
|
showEditActivity(filter);
|
||||||
} else {
|
} else {
|
||||||
filter.clearPreviousZoom();
|
filter.clearPreviousZoom();
|
||||||
|
@ -296,17 +296,17 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
runNewSearchQuery(location, NEW_SEARCH_INIT);
|
runNewSearchQuery(location, NEW_SEARCH_INIT);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
amenityAdapter.setNewModel(Collections.<Amenity> emptyList());
|
amenityAdapter.setNewModel(Collections.<Amenity>emptyList());
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onNewIntent(Intent intent) {
|
protected void onNewIntent(Intent intent) {
|
||||||
super.onNewIntent(intent);
|
super.onNewIntent(intent);
|
||||||
updateIntent(intent);
|
updateIntent(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
|
@ -316,7 +316,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
String text = filter.getFilterByName() != null ? filter.getFilterByName() : "";
|
String text = filter.getFilterByName() != null ? filter.getFilterByName() : "";
|
||||||
searchFilter.setText(text);
|
searchFilter.setText(text);
|
||||||
searchFilterLayout.setVisibility(text.length() > 0 || isNameSearch() ? View.VISIBLE : View.GONE);
|
searchFilterLayout.setVisibility(text.length() > 0 || isNameSearch() ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
app.getLocationProvider().removeCompassListener(app.getLocationProvider().getNavigationInfo());
|
app.getLocationProvider().removeCompassListener(app.getLocationProvider().getNavigationInfo());
|
||||||
app.getLocationProvider().addCompassListener(this);
|
app.getLocationProvider().addCompassListener(this);
|
||||||
app.getLocationProvider().registerOrUnregisterCompassListener(true);
|
app.getLocationProvider().registerOrUnregisterCompassListener(true);
|
||||||
|
@ -329,20 +329,20 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
}
|
}
|
||||||
updateLocation(location);
|
updateLocation(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changeFilter(CharSequence s) {
|
private void changeFilter(CharSequence s) {
|
||||||
String queue = s.toString().trim();
|
String queue = s.toString().trim();
|
||||||
// if (!isNameSearch() ) {
|
// if (!isNameSearch() ) {
|
||||||
amenityAdapter.getFilter().filter(queue);
|
amenityAdapter.getFilter().filter(queue);
|
||||||
String cfilter = filter == null || filter.getFilterByName() == null ? "" :
|
String cfilter = filter == null || filter.getFilterByName() == null ? "" :
|
||||||
filter.getFilterByName().toLowerCase();
|
filter.getFilterByName().toLowerCase();
|
||||||
if(!isNameSearch() && !queue.toString().toLowerCase().startsWith(cfilter)) {
|
if (!isNameSearch() && !queue.toString().toLowerCase().startsWith(cfilter)) {
|
||||||
filter.setFilterByName(queue.toString());
|
filter.setFilterByName(queue.toString());
|
||||||
runNewSearchQuery(location, SEARCH_AGAIN);
|
runNewSearchQuery(location, SEARCH_AGAIN);
|
||||||
}
|
}
|
||||||
updateButtonState(false);
|
updateButtonState(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void showOptionsMenu(View v) {
|
private void showOptionsMenu(View v) {
|
||||||
// Show menu with search all, name finder, name finder poi
|
// Show menu with search all, name finder, name finder poi
|
||||||
|
@ -364,21 +364,21 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
addFilter(optionsMenu, getString(R.string.shared_string_is_open));
|
addFilter(optionsMenu, getString(R.string.shared_string_is_open));
|
||||||
addFilter(optionsMenu, getString(R.string.shared_string_is_open_24_7));
|
addFilter(optionsMenu, getString(R.string.shared_string_is_open_24_7));
|
||||||
Map<String, PoiType> poiAdditionals = f.getPoiAdditionals();
|
Map<String, PoiType> poiAdditionals = f.getPoiAdditionals();
|
||||||
if(poiAdditionals != null) {
|
if (poiAdditionals != null) {
|
||||||
TreeMap<String, PoiType> adds = new TreeMap<String, PoiType>();
|
TreeMap<String, PoiType> adds = new TreeMap<String, PoiType>();
|
||||||
for(PoiType vtype : poiAdditionals.values()) {
|
for (PoiType vtype : poiAdditionals.values()) {
|
||||||
if(vtype.isTopVisible()) {
|
if (vtype.isTopVisible()) {
|
||||||
adds.put(vtype.getTranslation().replace(' ', ':').toLowerCase(), vtype);
|
adds.put(vtype.getTranslation().replace(' ', ':').toLowerCase(), vtype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(String vtype : adds.keySet()) {
|
for (String vtype : adds.keySet()) {
|
||||||
addFilter(optionsMenu, vtype);
|
addFilter(optionsMenu, vtype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
optionsMenu.show();
|
optionsMenu.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addFilter(PopupMenu optionsMenu, final String value) {
|
private void addFilter(PopupMenu optionsMenu, final String value) {
|
||||||
IconsCache iconsCache = getMyApplication().getIconsCache();
|
IconsCache iconsCache = getMyApplication().getIconsCache();
|
||||||
MenuItem item = optionsMenu.getMenu().add(getString(R.string.search_poi_filter) + ": " + value)
|
MenuItem item = optionsMenu.getMenu().add(getString(R.string.search_poi_filter) + ": " + value)
|
||||||
|
@ -386,7 +386,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
if(searchFilterLayout.getVisibility() == View.GONE) {
|
if (searchFilterLayout.getVisibility() == View.GONE) {
|
||||||
searchFilterLayout.setVisibility(View.VISIBLE);
|
searchFilterLayout.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
searchFilter.setText((searchFilter.getText().toString() + " " + value.replace(' ', '_').toLowerCase()).trim());
|
searchFilter.setText((searchFilter.getText().toString() + " " + value.replace(' ', '_').toLowerCase()).trim());
|
||||||
|
@ -399,16 +399,16 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
Intent newIntent = new Intent(this, EditPOIFilterActivity.class);
|
Intent newIntent = new Intent(this, EditPOIFilterActivity.class);
|
||||||
// folder selected
|
// folder selected
|
||||||
newIntent.putExtra(EditPOIFilterActivity.AMENITY_FILTER, poi.getFilterId());
|
newIntent.putExtra(EditPOIFilterActivity.AMENITY_FILTER, poi.getFilterId());
|
||||||
if(location != null) {
|
if (location != null) {
|
||||||
newIntent.putExtra(SearchActivity.SEARCH_LAT, location.getLatitude());
|
newIntent.putExtra(SearchActivity.SEARCH_LAT, location.getLatitude());
|
||||||
newIntent.putExtra(SearchActivity.SEARCH_LON, location.getLongitude());
|
newIntent.putExtra(SearchActivity.SEARCH_LON, location.getLongitude());
|
||||||
}
|
}
|
||||||
if(searchNearBy) {
|
if (searchNearBy) {
|
||||||
newIntent.putExtra(SearchActivity.SEARCH_NEARBY, true);
|
newIntent.putExtra(SearchActivity.SEARCH_NEARBY, true);
|
||||||
}
|
}
|
||||||
startActivityForResult(newIntent, RESULT_REQUEST_CODE);
|
startActivityForResult(newIntent, RESULT_REQUEST_CODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
if (requestCode == RESULT_REQUEST_CODE && resultCode == EditPOIFilterActivity.EDIT_ACTIVITY_RESULT_OK) {
|
if (requestCode == RESULT_REQUEST_CODE && resultCode == EditPOIFilterActivity.EDIT_ACTIVITY_RESULT_OK) {
|
||||||
|
@ -445,10 +445,10 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
name = "'" + filter.getFilterByName() + "'";
|
name = "'" + filter.getFilterByName() + "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(name.length() >= maxLength) {
|
if (name.length() >= maxLength) {
|
||||||
name = name.substring(0, maxLength) + getString(R.string.shared_string_ellipsis);
|
name = name.substring(0, maxLength) + getString(R.string.shared_string_ellipsis);
|
||||||
}
|
}
|
||||||
if(filter instanceof NominatimPoiFilter && !((NominatimPoiFilter) filter).isPlacesQuery()) {
|
if (filter instanceof NominatimPoiFilter && !((NominatimPoiFilter) filter).isPlacesQuery()) {
|
||||||
// nothing to add
|
// nothing to add
|
||||||
} else {
|
} else {
|
||||||
name += " " + filter.getSearchArea(next);
|
name += " " + filter.getSearchArea(next);
|
||||||
|
@ -458,9 +458,9 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
if (searchPOILevel != null) {
|
if (searchPOILevel != null) {
|
||||||
int title = location == null ? R.string.search_poi_location : R.string.search_POI_level_btn;
|
int title = location == null ? R.string.search_poi_location : R.string.search_POI_level_btn;
|
||||||
boolean taskAlreadyFinished = currentSearchTask == null || currentSearchTask.getStatus() != Status.RUNNING;
|
boolean taskAlreadyFinished = currentSearchTask == null || currentSearchTask.getStatus() != Status.RUNNING;
|
||||||
boolean enabled = taskAlreadyFinished && location != null &&
|
boolean enabled = taskAlreadyFinished && location != null &&
|
||||||
filter != null && filter.isSearchFurtherAvailable();
|
filter != null && filter.isSearchFurtherAvailable();
|
||||||
if(isNameSearch() && !Algorithms.objectEquals(searchFilter.getText().toString(), filter.getFilterByName())) {
|
if (isNameSearch() && !Algorithms.objectEquals(searchFilter.getText().toString(), filter.getFilterByName())) {
|
||||||
title = R.string.search_button;
|
title = R.string.search_button;
|
||||||
// Issue #2667 (2)
|
// Issue #2667 (2)
|
||||||
if (currentSearchTask == null) {
|
if (currentSearchTask == null) {
|
||||||
|
@ -486,7 +486,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
public boolean isOfflineSearchByNameFilter() {
|
public boolean isOfflineSearchByNameFilter() {
|
||||||
return filter != null && PoiUIFilter.BY_NAME_FILTER_ID.equals(filter.getFilterId());
|
return filter != null && PoiUIFilter.BY_NAME_FILTER_ID.equals(filter.getFilterId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNameSearch() {
|
public boolean isNameSearch() {
|
||||||
return isNominatimFilter() || isOfflineSearchByNameFilter();
|
return isNominatimFilter() || isOfflineSearchByNameFilter();
|
||||||
}
|
}
|
||||||
|
@ -576,7 +576,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
app.getLocationProvider().removeCompassListener(this);
|
app.getLocationProvider().removeCompassListener(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDetachedFromWindow() {
|
public void onDetachedFromWindow() {
|
||||||
accessibilityAssistant.forgetFocus();
|
accessibilityAssistant.forgetFocus();
|
||||||
|
@ -600,7 +600,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
MapActivity.launchMapActivityMoveToTop(this);
|
MapActivity.launchMapActivityMoveToTop(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static final int SEARCH_AGAIN = 1;
|
private static final int SEARCH_AGAIN = 1;
|
||||||
private static final int NEW_SEARCH_INIT = 2;
|
private static final int NEW_SEARCH_INIT = 2;
|
||||||
private static final int SEARCH_FURTHER = 3;
|
private static final int SEARCH_FURTHER = 3;
|
||||||
|
@ -618,7 +618,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
}
|
}
|
||||||
|
|
||||||
net.osmand.Location getSearchedLocation() {
|
net.osmand.Location getSearchedLocation() {
|
||||||
return searchLocation ;
|
return searchLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -655,7 +655,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
amenityAdapter.setNewModel(result);
|
amenityAdapter.setNewModel(result);
|
||||||
if(showOnMapItem != null) {
|
if (showOnMapItem != null) {
|
||||||
showOnMapItem.setEnabled(amenityAdapter.getCount() > 0);
|
showOnMapItem.setEnabled(amenityAdapter.getCount() > 0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -896,7 +896,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
});
|
});
|
||||||
b.show();
|
b.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
int itemId = item.getItemId();
|
int itemId = item.getItemId();
|
||||||
|
@ -928,7 +928,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void removePoiFilter() {
|
private void removePoiFilter() {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
builder.setMessage(R.string.edit_filter_delete_dialog_title);
|
builder.setMessage(R.string.edit_filter_delete_dialog_title);
|
||||||
|
@ -936,7 +936,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
builder.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
|
||||||
if (app.getPoiFilters().removePoiFilter(filter)) {
|
if (app.getPoiFilters().removePoiFilter(filter)) {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
SearchPOIActivity.this,
|
SearchPOIActivity.this,
|
||||||
|
@ -949,12 +949,12 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
});
|
});
|
||||||
builder.create().show();
|
builder.create().show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void savePoiFilter() {
|
public void savePoiFilter() {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
builder.setTitle(R.string.edit_filter_save_as_menu_item);
|
builder.setTitle(R.string.edit_filter_save_as_menu_item);
|
||||||
final EditText editText = new EditText(this);
|
final EditText editText = new EditText(this);
|
||||||
if(filter.isStandardFilter()) {
|
if (filter.isStandardFilter()) {
|
||||||
editText.setText((filter.getName() + " " + searchFilter.getText()).trim());
|
editText.setText((filter.getName() + " " + searchFilter.getText()).trim());
|
||||||
} else {
|
} else {
|
||||||
editText.setText(filter.getName());
|
editText.setText(filter.getName());
|
||||||
|
@ -967,10 +967,10 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
builder.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
PoiUIFilter nFilter = new PoiUIFilter(editText.getText().toString(),
|
PoiUIFilter nFilter = new PoiUIFilter(editText.getText().toString(),
|
||||||
null,
|
null,
|
||||||
filter.getAcceptedTypes(), (OsmandApplication) getApplication());
|
filter.getAcceptedTypes(), (OsmandApplication) getApplication());
|
||||||
if(searchFilter.getText().toString().length() > 0) {
|
if (searchFilter.getText().toString().length() > 0) {
|
||||||
nFilter.setSavedFilterByName(searchFilter.getText().toString());
|
nFilter.setSavedFilterByName(searchFilter.getText().toString());
|
||||||
}
|
}
|
||||||
if (app.getPoiFilters().createPoiFilter(nFilter)) {
|
if (app.getPoiFilters().createPoiFilter(nFilter)) {
|
||||||
|
@ -983,7 +983,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
builder.create().show();
|
builder.create().show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue