implement filter poi by name

git-svn-id: https://osmand.googlecode.com/svn/trunk@356 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
Victor Shcherb 2010-07-15 21:54:00 +00:00
parent 7edc854da3
commit c01a387121
5 changed files with 64 additions and 14 deletions

View file

@ -8,25 +8,16 @@ package com.osmand;
*/ */
public class ToDoConstants { public class ToDoConstants {
/**
* Write activity to show something about authors / donation ....
*/
public int DESCRIBE_ABOUT_AUTHORS = 8;
// TODO ANDROID // TODO ANDROID
// for 0.3 // for 0.3
// 68. Implement service to app work with screen offline // 68. Implement service to app work with screen offline
// (introduce special settings how often update location to monitoring & audio guidance & add new item to status bar) // (introduce special settings how often update location to monitoring & audio guidance & add new item to status bar)
// Improvement : Show stops in the transport route on the map // Improvement : Show stops in the transport route on the map
// Improvement : redesign poi selecting (show on map ) // Improvement : redesign poi selecting (show on map )
/// Better : improve zooming (better zoom out)
// BUG animated move more precise check final location
// BUG 9!
// BUG delete file if download failed !!! (check it)
// BUG add button show my location // BUG add button show my location
// TODO update site with voice information
// 43. Enable poi filter by name (find lake by name or shop) - case sensitive search DB - make only search filter (on UI)!
// Not clear if it is really needed // Not clear if it is really needed
@ -54,6 +45,7 @@ public class ToDoConstants {
// BUGS Swing // BUGS Swing
// DONE ANDROID : // DONE ANDROID :
// 43. Enable poi filter by name (find lake by name or shop) - case sensitive search DB - make only search filter (on UI)!
// 45. Get clear <Use internet> settings. Move that setting on top settings screen. // 45. Get clear <Use internet> settings. Move that setting on top settings screen.
// That setting should rule all activities that use internet. It should ask whenever internet is used // That setting should rule all activities that use internet. It should ask whenever internet is used
// (would you like to use internet for that operation - if using internet is not checked). // (would you like to use internet for that operation - if using internet is not checked).

View file

@ -7,7 +7,10 @@
<Button android:text="@string/show_poi_on_map" android:id="@+id/ShowOnMap" android:layout_height="wrap_content" android:layout_width="wrap_content"></Button> <Button android:text="@string/show_poi_on_map" android:id="@+id/ShowOnMap" android:layout_height="wrap_content" android:layout_width="wrap_content"></Button>
<Button android:text="@string/search_POI_level_btn" android:id="@+id/SearchPOILevelButton" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_weight="1"></Button> <Button android:text="@string/search_POI_level_btn" android:id="@+id/SearchPOILevelButton" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_weight="1"></Button>
<TextView android:layout_width="wrap_content" android:text="" android:id="@+id/SearchAreaText" android:layout_height="wrap_content"/> <TextView android:layout_width="wrap_content" android:text="" android:id="@+id/SearchAreaText" android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/SearchFilterLayout" android:visibility="invisible">
<TextView android:layout_width="wrap_content" android:text="@string/search_poi_filter" android:id="@+id/TextView" android:layout_height="wrap_content"/>
<EditText android:layout_marginLeft = "5dp" android:layout_marginRight = "5dp" android:layout_width="fill_parent" android:text="" android:id="@+id/SearchFilter" android:layout_height="wrap_content"/>
</LinearLayout> </LinearLayout>
<ListView android:id="@android:id/list" android:layout_width="fill_parent" <ListView android:id="@android:id/list" android:layout_width="fill_parent"
android:layout_height="fill_parent"></ListView> android:layout_height="fill_parent"></ListView>

View file

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="hide_poi_filter">Скрыть фильтр</string>
<string name="show_poi_filter">Показать фильтр</string>
<string name="search_poi_filter">Фильтр</string>
<string name="menu_mute_off">Без звука</string> <string name="menu_mute_off">Без звука</string>
<string name="menu_mute_on">Звук</string> <string name="menu_mute_on">Звук</string>
<string name="voice_not_use">Не использовать</string> <string name="voice_not_use">Не использовать</string>

View file

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="hide_poi_filter">Hide filter</string>
<string name="show_poi_filter">Show filter</string>
<string name="search_poi_filter">Filter</string>
<string name="menu_mute_off">Mute off</string> <string name="menu_mute_off">Mute off</string>
<string name="menu_mute_on">Mute</string> <string name="menu_mute_on">Mute</string>
<string name="voice_not_use">Not use</string> <string name="voice_not_use">Not use</string>

View file

@ -28,14 +28,19 @@ import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu;
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.AdapterView; import android.widget.AdapterView;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
@ -74,6 +79,8 @@ public class SearchPOIActivity extends ListActivity implements SensorEventListen
private PoiFilter filter; private PoiFilter filter;
private AmenityAdapter amenityAdapter; private AmenityAdapter amenityAdapter;
private TextView searchArea; private TextView searchArea;
private EditText searchFilter;
private View searchFilterLayout;
private boolean searchNearBy = false; private boolean searchNearBy = false;
private Location location = null; private Location location = null;
@ -85,6 +92,7 @@ public class SearchPOIActivity extends ListActivity implements SensorEventListen
private Handler uiHandler; private Handler uiHandler;
@Override @Override
public void onCreate(Bundle icicle) { public void onCreate(Bundle icicle) {
super.onCreate(icicle); super.onCreate(icicle);
@ -92,6 +100,8 @@ public class SearchPOIActivity extends ListActivity implements SensorEventListen
uiHandler = new Handler(); uiHandler = new Handler();
searchPOILevel = (Button) findViewById(R.id.SearchPOILevelButton); searchPOILevel = (Button) findViewById(R.id.SearchPOILevelButton);
searchArea = (TextView) findViewById(R.id.SearchAreaText); searchArea = (TextView) findViewById(R.id.SearchAreaText);
searchFilter = (EditText) findViewById(R.id.SearchFilter);
searchFilterLayout = findViewById(R.id.SearchFilterLayout);
searchPOILevel.setOnClickListener(new OnClickListener() { searchPOILevel.setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -102,6 +112,22 @@ public class SearchPOIActivity extends ListActivity implements SensorEventListen
} }
}); });
searchFilter.addTextChangedListener(new TextWatcher(){
@Override
public void afterTextChanged(Editable s) {
amenityAdapter.getFilter().filter(s);
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
});
Bundle bundle = this.getIntent().getExtras(); Bundle bundle = this.getIntent().getExtras();
String filterId = bundle.getString(AMENITY_FILTER); String filterId = bundle.getString(AMENITY_FILTER);
@ -201,6 +227,29 @@ public class SearchPOIActivity extends ListActivity implements SensorEventListen
} }
@Override
public boolean onCreateOptionsMenu(Menu menu) {
boolean m = super.onCreateOptionsMenu(menu);
final MenuItem me = menu.add(R.string.show_poi_filter);
me.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener(){
@Override
public boolean onMenuItemClick(MenuItem item) {
if(searchFilterLayout.getVisibility() == View.INVISIBLE){
searchFilterLayout.setVisibility(View.VISIBLE);
me.setTitle(R.string.hide_poi_filter);
} else {
searchFilter.setText(""); //$NON-NLS-1$
searchFilterLayout.setVisibility(View.INVISIBLE);
me.setTitle(R.string.show_poi_filter);
}
return true;
}
});
return m;
}
// Working with location listeners // Working with location listeners
private LocationListener networkListener = new LocationListener(){ private LocationListener networkListener = new LocationListener(){
@Override @Override