add edit filter activity
git-svn-id: https://osmand.googlecode.com/svn/trunk@196 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
parent
c7b8711743
commit
77f68ca6ee
9 changed files with 193 additions and 29 deletions
|
@ -10,6 +10,6 @@
|
||||||
|
|
||||||
|
|
||||||
<TextView android:id="@+id/filter_poi_label"
|
<TextView android:id="@+id/filter_poi_label"
|
||||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||||
android:textSize="25px"></TextView>
|
android:textSize="25px"></TextView>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
8
OsmAnd/res/menu/edit_filter_menu.xml
Normal file
8
OsmAnd/res/menu/edit_filter_menu.xml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<group android:menuCategory="container" android:id="@+id/edit_filter_context_menu">
|
||||||
|
<item android:title="@string/edit_filter_save_as_menu_item" android:id="@+id/edit_filter_save_as" android:icon="@android:drawable/ic_menu_save"></item>
|
||||||
|
<item android:title="@string/edit_filter_delete_menu_item" android:id="@+id/edit_filter_delete" android:icon="@android:drawable/ic_menu_delete"></item>
|
||||||
|
</group>
|
||||||
|
</menu>
|
|
@ -10,4 +10,5 @@
|
||||||
<item android:id="@+id/map_show_settings" android:title="@string/settings_Button" android:icon="@android:drawable/ic_menu_preferences"></item>
|
<item android:id="@+id/map_show_settings" android:title="@string/settings_Button" android:icon="@android:drawable/ic_menu_preferences"></item>
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
|
|
|
@ -216,4 +216,10 @@
|
||||||
<string name="default_buttons_commit">Сохранить</string>
|
<string name="default_buttons_commit">Сохранить</string>
|
||||||
<string name="default_buttons_reset">Сброс</string>
|
<string name="default_buttons_reset">Сброс</string>
|
||||||
<string name="filter_current_poiButton">Фильтровать</string>
|
<string name="filter_current_poiButton">Фильтровать</string>
|
||||||
|
<string name="edit_filter_delete_menu_item">Удалить</string>
|
||||||
|
<string name="edit_filter_save_as_menu_item">Сохранить как</string>
|
||||||
|
<string name="edit_filter_delete_dialog_title">Вы действительно хотите удалить текущий фильтр?</string>
|
||||||
|
<string name="edit_filter_delete_message">Фильтр {0} удален</string>
|
||||||
|
<string name="edit_filter_create_message">Фильтр {0} создан</string>
|
||||||
|
<string name="default_buttons_selectall">Выделить все</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -218,4 +218,10 @@
|
||||||
<string name="default_buttons_commit">Commit</string>
|
<string name="default_buttons_commit">Commit</string>
|
||||||
<string name="default_buttons_reset">Reset</string>
|
<string name="default_buttons_reset">Reset</string>
|
||||||
<string name="filter_current_poiButton">Filter</string>
|
<string name="filter_current_poiButton">Filter</string>
|
||||||
|
<string name="edit_filter_delete_menu_item">Delete</string>
|
||||||
|
<string name="edit_filter_save_as_menu_item">Save As</string>
|
||||||
|
<string name="edit_filter_delete_dialog_title">Are you sure about deleting selected filter?</string>
|
||||||
|
<string name="edit_filter_delete_message">Filter {0} has been deleted</string>
|
||||||
|
<string name="edit_filter_create_message">Filter {0} has been created</string>
|
||||||
|
<string name="default_buttons_selectall">Select All</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.osmand;
|
package com.osmand;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -107,7 +108,7 @@ public class PoiFilter {
|
||||||
* @return null if all subtypes are accepted/ empty list if type is not accepted at all
|
* @return null if all subtypes are accepted/ empty list if type is not accepted at all
|
||||||
*/
|
*/
|
||||||
public List<String> getAcceptedSubtypes(AmenityType type){
|
public List<String> getAcceptedSubtypes(AmenityType type){
|
||||||
if(acceptedTypes.containsKey(type)){
|
if(!acceptedTypes.containsKey(type)){
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
return acceptedTypes.get(type);
|
return acceptedTypes.get(type);
|
||||||
|
@ -136,7 +137,7 @@ public class PoiFilter {
|
||||||
|
|
||||||
public void setTypeToAccept(AmenityType type, boolean accept){
|
public void setTypeToAccept(AmenityType type, boolean accept){
|
||||||
if(accept){
|
if(accept){
|
||||||
acceptedTypes.put(type, null);
|
acceptedTypes.put(type, new ArrayList<String>());
|
||||||
} else {
|
} else {
|
||||||
acceptedTypes.remove(type);
|
acceptedTypes.remove(type);
|
||||||
}
|
}
|
||||||
|
@ -177,7 +178,6 @@ public class PoiFilter {
|
||||||
}
|
}
|
||||||
b.append(")"); //$NON-NLS-1$
|
b.append(")"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
b.append(")"); //$NON-NLS-1$
|
b.append(")"); //$NON-NLS-1$
|
||||||
return b.toString();
|
return b.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,10 +128,13 @@ public class PoiFiltersHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean removePoiFilter(Context ctx, PoiFilter filter){
|
public static boolean removePoiFilter(Context ctx, PoiFilter filter){
|
||||||
|
if(filter.getFilterId().equals(PoiFilter.CUSTOM_FILTER_ID)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
PoiFilterDbHelper helper = new PoiFilterDbHelper(ctx);
|
PoiFilterDbHelper helper = new PoiFilterDbHelper(ctx);
|
||||||
boolean res = helper.deleteFilter(filter);
|
boolean res = helper.deleteFilter(filter);
|
||||||
if(res){
|
if(res){
|
||||||
getUserDefinedPoiFilters(ctx).remove(filter);
|
cacheUserDefinedFilters.remove(filter);
|
||||||
}
|
}
|
||||||
helper.close();
|
helper.close();
|
||||||
return res;
|
return res;
|
||||||
|
@ -141,13 +144,16 @@ public class PoiFiltersHelper {
|
||||||
PoiFilterDbHelper helper = new PoiFilterDbHelper(ctx);
|
PoiFilterDbHelper helper = new PoiFilterDbHelper(ctx);
|
||||||
boolean res = helper.addFilter(filter, helper.getWritableDatabase(), false);
|
boolean res = helper.addFilter(filter, helper.getWritableDatabase(), false);
|
||||||
if(res){
|
if(res){
|
||||||
getUserDefinedPoiFilters(ctx).add(filter);
|
cacheUserDefinedFilters.add(filter);
|
||||||
}
|
}
|
||||||
helper.close();
|
helper.close();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean editPoiFilter(Context ctx, PoiFilter filter){
|
public static boolean editPoiFilter(Context ctx, PoiFilter filter){
|
||||||
|
if(filter.getFilterId().equals(PoiFilter.CUSTOM_FILTER_ID)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
PoiFilterDbHelper helper = new PoiFilterDbHelper(ctx);
|
PoiFilterDbHelper helper = new PoiFilterDbHelper(ctx);
|
||||||
boolean res = helper.editFilter(filter);
|
boolean res = helper.editFilter(filter);
|
||||||
helper.close();
|
helper.close();
|
||||||
|
|
|
@ -3,23 +3,34 @@
|
||||||
*/
|
*/
|
||||||
package com.osmand.activities;
|
package com.osmand.activities;
|
||||||
|
|
||||||
|
import java.text.MessageFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.ListActivity;
|
import android.app.ListActivity;
|
||||||
import android.app.AlertDialog.Builder;
|
import android.app.AlertDialog.Builder;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.ImageView;
|
import android.widget.EditText;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.ScrollView;
|
import android.widget.ScrollView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.osmand.OsmandSettings;
|
||||||
import com.osmand.PoiFilter;
|
import com.osmand.PoiFilter;
|
||||||
import com.osmand.PoiFiltersHelper;
|
import com.osmand.PoiFiltersHelper;
|
||||||
import com.osmand.R;
|
import com.osmand.R;
|
||||||
|
@ -44,8 +55,10 @@ public class EditPOIFilterActivity extends ListActivity {
|
||||||
filterLevel.setOnClickListener(new OnClickListener() {
|
filterLevel.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
// TODO
|
OsmandSettings.setPoiFilterForMap(EditPOIFilterActivity.this, filter.getFilterId());
|
||||||
|
OsmandSettings.setShowPoiOverMap(EditPOIFilterActivity.this, true);
|
||||||
|
Intent newIntent = new Intent(EditPOIFilterActivity.this, MapActivity.class);
|
||||||
|
startActivity(newIntent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -56,19 +69,129 @@ public class EditPOIFilterActivity extends ListActivity {
|
||||||
setListAdapter(new AmenityAdapter(AmenityType.getCategories()));
|
setListAdapter(new AmenityAdapter(AmenityType.getCategories()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showDialog(AmenityType amenity) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
MenuInflater inflater = getMenuInflater();
|
||||||
|
inflater.inflate(R.menu.edit_filter_menu, menu);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
if (item.getItemId() == R.id.edit_filter_delete) {
|
||||||
|
EditPOIFilterActivity.this.finish();
|
||||||
|
Builder builder = new AlertDialog.Builder(this);
|
||||||
|
builder.setMessage(R.string.edit_filter_delete_dialog_title);
|
||||||
|
builder.setNegativeButton(R.string.default_buttons_no, null);
|
||||||
|
builder.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
if (PoiFiltersHelper.removePoiFilter(EditPOIFilterActivity.this, filter)) {
|
||||||
|
Toast.makeText(
|
||||||
|
EditPOIFilterActivity.this,
|
||||||
|
MessageFormat.format(EditPOIFilterActivity.this.getText(R.string.edit_filter_delete_message).toString(),
|
||||||
|
filter.getName()), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
builder.create().show();
|
||||||
|
return true;
|
||||||
|
} else if (item.getItemId() == R.id.edit_filter_save_as) {
|
||||||
|
Builder builder = new AlertDialog.Builder(this);
|
||||||
|
builder.setTitle(R.string.edit_filter_save_as_menu_item);
|
||||||
|
final EditText editText = new EditText(this);
|
||||||
|
builder.setView(editText);
|
||||||
|
builder.setNegativeButton(R.string.default_buttons_cancel, null);
|
||||||
|
builder.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
PoiFilter nFilter = new PoiFilter(editText.getText().toString(), null, filter.getAcceptedTypes());
|
||||||
|
if (PoiFiltersHelper.createPoiFilter(EditPOIFilterActivity.this, nFilter)) {
|
||||||
|
Toast.makeText(
|
||||||
|
EditPOIFilterActivity.this,
|
||||||
|
MessageFormat.format(EditPOIFilterActivity.this.getText(R.string.edit_filter_create_message).toString(),
|
||||||
|
editText.getText().toString()), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
EditPOIFilterActivity.this.finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
builder.create().show();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showDialog(final AmenityType amenity) {
|
||||||
Builder builder = new AlertDialog.Builder(this);
|
Builder builder = new AlertDialog.Builder(this);
|
||||||
ScrollView scroll = new ScrollView(this);
|
ScrollView scroll = new ScrollView(this);
|
||||||
ListView listView = new ListView(this);
|
ListView listView = new ListView(this);
|
||||||
|
final List<String> accepted = new ArrayList<String>();
|
||||||
|
final LinkedHashSet<String> subCategories = new LinkedHashSet<String>(AmenityType.getSubCategories(amenity));
|
||||||
|
List<String> subtypes = filter.getAcceptedSubtypes(amenity);
|
||||||
|
boolean allSubTypesAccepted = subtypes == null;
|
||||||
|
LinkedHashSet<String> acceptedCategories = subtypes == null ? null : new LinkedHashSet<String>(subtypes);
|
||||||
|
if (subtypes != null) {
|
||||||
|
for (String s : acceptedCategories) {
|
||||||
|
if (!subCategories.contains(s)) {
|
||||||
|
subCategories.add(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final String[] array = subCategories.toArray(new String[0]);
|
||||||
|
boolean[] selected = new boolean[array.length];
|
||||||
|
for (int i = 0; i < selected.length; i++) {
|
||||||
|
if (allSubTypesAccepted) {
|
||||||
|
selected[i] = true;
|
||||||
|
accepted.add(array[i]);
|
||||||
|
} else {
|
||||||
|
selected[i] = acceptedCategories.contains(array[i]);
|
||||||
|
if (selected[i]) {
|
||||||
|
accepted.add(array[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
scroll.addView(listView);
|
scroll.addView(listView);
|
||||||
builder.setView(scroll);
|
builder.setView(scroll);
|
||||||
builder.setNegativeButton("Close", null);
|
builder.setNegativeButton(EditPOIFilterActivity.this.getText(R.string.default_buttons_cancel), new DialogInterface.OnClickListener() {
|
||||||
builder.setNeutralButton("Select all", null);
|
|
||||||
builder.setMultiChoiceItems(AmenityType.getSubCategories(amenity).toArray(new String[0]), null, null);
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
if (subCategories.size() == accepted.size()) {
|
||||||
|
filter.selectSubTypesToAccept(amenity, null);
|
||||||
|
} else {
|
||||||
|
filter.selectSubTypesToAccept(amenity, accepted);
|
||||||
|
}
|
||||||
|
PoiFiltersHelper.editPoiFilter(EditPOIFilterActivity.this, filter);
|
||||||
|
((AmenityAdapter) EditPOIFilterActivity.this.getListAdapter()).notifyDataSetInvalidated();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
builder.setNeutralButton(EditPOIFilterActivity.this.getText(R.string.default_buttons_selectall), new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
filter.selectSubTypesToAccept(amenity, null);
|
||||||
|
PoiFiltersHelper.editPoiFilter(EditPOIFilterActivity.this, filter);
|
||||||
|
((AmenityAdapter) EditPOIFilterActivity.this.getListAdapter()).notifyDataSetInvalidated();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
builder.setMultiChoiceItems(array, selected, new DialogInterface.OnMultiChoiceClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int item, boolean isChecked) {
|
||||||
|
if (isChecked && !accepted.contains(array[item])) {
|
||||||
|
accepted.add(array[item]);
|
||||||
|
} else if (!isChecked && accepted.contains(array[item])) {
|
||||||
|
accepted.remove(array[item]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
builder.show();
|
builder.show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class AmenityAdapter extends ArrayAdapter<AmenityType> {
|
class AmenityAdapter extends ArrayAdapter<AmenityType> {
|
||||||
AmenityAdapter(AmenityType[] amenityTypes) {
|
AmenityAdapter(AmenityType[] amenityTypes) {
|
||||||
|
@ -92,7 +215,7 @@ public class EditPOIFilterActivity extends ListActivity {
|
||||||
return (row);
|
return (row);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addRowListener(final AmenityType model,final TextView text, final CheckBox check) {
|
private void addRowListener(final AmenityType model, final TextView text, final CheckBox check) {
|
||||||
text.setOnClickListener(new OnClickListener() {
|
text.setOnClickListener(new OnClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -105,10 +228,12 @@ public class EditPOIFilterActivity extends ListActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if(check.isChecked()) {
|
if (check.isChecked()) {
|
||||||
|
filter.setTypeToAccept(model, true);
|
||||||
showDialog(model);
|
showDialog(model);
|
||||||
} else {
|
} else {
|
||||||
filter.setTypeToAccept(model,false);
|
filter.setTypeToAccept(model, false);
|
||||||
|
PoiFiltersHelper.editPoiFilter(EditPOIFilterActivity.this, filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -39,9 +39,7 @@ public class SearchPoiFilterActivity extends ListActivity {
|
||||||
super.onCreate(icicle);
|
super.onCreate(icicle);
|
||||||
setContentView(R.layout.searchpoilist);
|
setContentView(R.layout.searchpoilist);
|
||||||
|
|
||||||
List<PoiFilter> filters = new ArrayList<PoiFilter>(PoiFiltersHelper.getUserDefinedPoiFilters(this)) ;
|
|
||||||
filters.addAll(PoiFiltersHelper.getOsmDefinedPoiFilters(this));
|
|
||||||
setListAdapter(new AmenityAdapter(filters));
|
|
||||||
typeFace = Typeface.create((String)null, Typeface.ITALIC);
|
typeFace = Typeface.create((String)null, Typeface.ITALIC);
|
||||||
|
|
||||||
// ListActivity has a ListView, which you can get with:
|
// ListActivity has a ListView, which you can get with:
|
||||||
|
@ -52,22 +50,35 @@ public class SearchPoiFilterActivity extends ListActivity {
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemLongClick(AdapterView<?> av, View v, int pos, long id) {
|
public boolean onItemLongClick(AdapterView<?> av, View v, int pos, long id) {
|
||||||
PoiFilter poi = ((AmenityAdapter) getListAdapter()).getItem(pos);
|
PoiFilter poi = ((AmenityAdapter) getListAdapter()).getItem(pos);
|
||||||
if(!poi.isStandardFilter()) {
|
showEditActivity(poi);
|
||||||
Bundle bundle = new Bundle();
|
|
||||||
Intent newIntent = new Intent(SearchPoiFilterActivity.this, EditPOIFilterActivity.class);
|
|
||||||
// folder selected
|
|
||||||
bundle.putString(SearchPOIActivity.AMENITY_FILTER, poi.getFilterId());
|
|
||||||
newIntent.putExtras(bundle);
|
|
||||||
startActivityForResult(newIntent, 0);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
List<PoiFilter> filters = new ArrayList<PoiFilter>(PoiFiltersHelper.getUserDefinedPoiFilters(this)) ;
|
||||||
|
filters.addAll(PoiFiltersHelper.getOsmDefinedPoiFilters(this));
|
||||||
|
setListAdapter(new AmenityAdapter(filters));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showEditActivity(PoiFilter poi) {
|
||||||
|
if(!poi.isStandardFilter()) {
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
Intent newIntent = new Intent(SearchPoiFilterActivity.this, EditPOIFilterActivity.class);
|
||||||
|
// folder selected
|
||||||
|
bundle.putString(SearchPOIActivity.AMENITY_FILTER, poi.getFilterId());
|
||||||
|
newIntent.putExtras(bundle);
|
||||||
|
startActivityForResult(newIntent, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
public void onListItemClick(ListView parent, View v, int position, long id) {
|
public void onListItemClick(ListView parent, View v, int position, long id) {
|
||||||
PoiFilter filter = ((AmenityAdapter) getListAdapter()).getItem(position);
|
PoiFilter filter = ((AmenityAdapter) getListAdapter()).getItem(position);
|
||||||
|
if(filter.getFilterId().equals(PoiFilter.CUSTOM_FILTER_ID)){
|
||||||
|
showEditActivity(filter);
|
||||||
|
return;
|
||||||
|
}
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
Intent newIntent = new Intent(SearchPoiFilterActivity.this, SearchPOIActivity.class);
|
Intent newIntent = new Intent(SearchPoiFilterActivity.this, SearchPOIActivity.class);
|
||||||
bundle.putString(SearchPOIActivity.AMENITY_FILTER, filter.getFilterId());
|
bundle.putString(SearchPOIActivity.AMENITY_FILTER, filter.getFilterId());
|
||||||
|
@ -76,6 +87,7 @@ public class SearchPoiFilterActivity extends ListActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class AmenityAdapter extends ArrayAdapter<PoiFilter> {
|
class AmenityAdapter extends ArrayAdapter<PoiFilter> {
|
||||||
AmenityAdapter(List<PoiFilter> list) {
|
AmenityAdapter(List<PoiFilter> list) {
|
||||||
super(SearchPoiFilterActivity.this, R.layout.searchpoi_list, list);
|
super(SearchPoiFilterActivity.this, R.layout.searchpoi_list, list);
|
||||||
|
|
Loading…
Reference in a new issue