aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <cbaines8@gmail.com>2012-03-09 12:35:17 +0000
committerChristopher Baines <cbaines8@gmail.com>2012-03-09 12:35:17 +0000
commit606d952ef33ee74dbb303a8870451252d7785f32 (patch)
tree1bf140512141ce8618105068b5152b231e9351d1
parentc2b3891c783dee1b4ef6fd70432aa7ef5e55c0d7 (diff)
downloadsouthamptonuniversitymap-606d952ef33ee74dbb303a8870451252d7785f32.tar
southamptonuniversitymap-606d952ef33ee74dbb303a8870451252d7785f32.tar.gz
More search improvements.
-rw-r--r--AndroidManifest.xml8
-rw-r--r--gen/net/cbaines/suma/R.java61
-rw-r--r--res/layout/search_activity.xml (renamed from res/layout/find_activity.xml)6
-rw-r--r--res/values/strings.xml2
-rw-r--r--res/xml/searchable.xml5
-rw-r--r--src/net/cbaines/suma/MapActivity.java67
-rw-r--r--src/net/cbaines/suma/MapContentProvider.java120
-rw-r--r--src/net/cbaines/suma/SearchActivity.java12
8 files changed, 192 insertions, 89 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index f5ad217..865ce32 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -53,6 +53,10 @@
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
+
+ <meta-data
+ android:name="android.app.searchable"
+ android:resource="@xml/searchable" />
</activity>
<activity android:name=".SearchActivity" >
<intent-filter>
@@ -170,6 +174,10 @@
<provider
android:name=".MapContentProvider"
android:authorities="net.cbaines.suma.provider" />
+
+ <path-permission
+ android:pathPrefix="/search_suggest_query"
+ android:readPermission="android.permission.GLOBAL_SEARCH" />
</application>
</manifest> \ No newline at end of file
diff --git a/gen/net/cbaines/suma/R.java b/gen/net/cbaines/suma/R.java
index 7f232e9..efd9cfe 100644
--- a/gen/net/cbaines/suma/R.java
+++ b/gen/net/cbaines/suma/R.java
@@ -83,8 +83,8 @@ public final class R {
public static final int busStopTimes=0x7f0a0023;
public static final int busTimeContentLayout=0x7f0a0022;
public static final int centerLoadBar=0x7f0a0024;
- public static final int check1=0x7f0a003a;
- public static final int childname=0x7f0a0039;
+ public static final int check1=0x7f0a0039;
+ public static final int childname=0x7f0a0038;
public static final int donateBitcoinAddress=0x7f0a002e;
public static final int donateButton=0x7f0a0003;
public static final int donateDialogErrorMessage=0x7f0a002d;
@@ -92,42 +92,41 @@ public final class R {
public static final int donateDialogMessageLayout=0x7f0a002c;
public static final int donateDialogProgress=0x7f0a002b;
public static final int favouriteCheckBox=0x7f0a0020;
- public static final int favouriteDialogMessage=0x7f0a0034;
- public static final int favouriteListItems=0x7f0a0035;
- public static final int findContentLayout=0x7f0a0030;
- public static final int findListItems=0x7f0a0032;
- public static final int findLoadBar=0x7f0a0031;
+ public static final int favouriteDialogMessage=0x7f0a0030;
+ public static final int favouriteListItems=0x7f0a0031;
+ public static final int findContentLayout=0x7f0a0032;
+ public static final int findListItems=0x7f0a0034;
+ public static final int findLoadBar=0x7f0a0033;
public static final int helpExpandableListView=0x7f0a0002;
public static final int layout_root=0x7f0a0027;
public static final int linearLayout1=0x7f0a001a;
public static final int linearLayout2=0x7f0a0029;
- public static final int mapview=0x7f0a0033;
- public static final int menu_about=0x7f0a0048;
- public static final int menu_favourites=0x7f0a0049;
- public static final int menu_find=0x7f0a0044;
- public static final int menu_find_my_location=0x7f0a0046;
- public static final int menu_next_stop=0x7f0a0043;
- public static final int menu_preferences=0x7f0a0045;
- public static final int menu_previous_stop=0x7f0a0041;
- public static final int menu_refresh_bus=0x7f0a0040;
- public static final int menu_refresh_stop=0x7f0a0042;
- public static final int menu_view=0x7f0a0047;
+ public static final int mapview=0x7f0a002f;
+ public static final int menu_about=0x7f0a0047;
+ public static final int menu_favourites=0x7f0a0048;
+ public static final int menu_find=0x7f0a0043;
+ public static final int menu_find_my_location=0x7f0a0045;
+ public static final int menu_next_stop=0x7f0a0042;
+ public static final int menu_preferences=0x7f0a0044;
+ public static final int menu_previous_stop=0x7f0a0040;
+ public static final int menu_refresh_bus=0x7f0a003f;
+ public static final int menu_refresh_stop=0x7f0a0041;
+ public static final int menu_view=0x7f0a0046;
public static final int radio_u1=0x7f0a001b;
public static final int radio_u1n=0x7f0a001c;
public static final int radio_u2=0x7f0a001d;
public static final int radio_u6=0x7f0a001e;
public static final int radio_u9=0x7f0a001f;
- public static final int searchBar=0x7f0a002f;
public static final int textView1=0x7f0a0000;
public static final int textView2=0x7f0a0001;
- public static final int textView3=0x7f0a003d;
- public static final int textView4=0x7f0a003e;
- public static final int toastViewLinearLayout=0x7f0a0036;
- public static final int toastViewSubMessage=0x7f0a0038;
- public static final int toastViewText=0x7f0a0037;
- public static final int view_list=0x7f0a003b;
- public static final int welcomeDialogButton=0x7f0a003c;
- public static final int welcomeDialogMessage=0x7f0a003f;
+ public static final int textView3=0x7f0a003c;
+ public static final int textView4=0x7f0a003d;
+ public static final int toastViewLinearLayout=0x7f0a0035;
+ public static final int toastViewSubMessage=0x7f0a0037;
+ public static final int toastViewText=0x7f0a0036;
+ public static final int view_list=0x7f0a003a;
+ public static final int welcomeDialogButton=0x7f0a003b;
+ public static final int welcomeDialogMessage=0x7f0a003e;
}
public static final class layout {
public static final int about_dialog=0x7f030000;
@@ -138,9 +137,9 @@ public final class R {
public static final int bus_stop_activity=0x7f030005;
public static final int bus_stop_dialog=0x7f030006;
public static final int donate_dialog=0x7f030007;
- public static final int find_activity=0x7f030008;
- public static final int map_activity=0x7f030009;
- public static final int poi_dialog=0x7f03000a;
+ public static final int map_activity=0x7f030008;
+ public static final int poi_dialog=0x7f030009;
+ public static final int search_activity=0x7f03000a;
public static final int toast_view=0x7f03000b;
public static final int view_child_row=0x7f03000c;
public static final int view_dialog=0x7f03000d;
@@ -229,7 +228,6 @@ public final class R {
public static final int favourites_help_message=0x7f070019;
public static final int find_help_message=0x7f070014;
public static final int findmylocation_help_message=0x7f070016;
- public static final int map_activity_search_hint=0x7f07000d;
public static final int map_activity_toast_help_message=0x7f070056;
/** Help Messages
*/
@@ -270,6 +268,7 @@ public final class R {
public static final int preferences_uni_link_live_bus_times=0x7f070028;
public static final int preferences_uni_link_live_bus_times_disabled=0x7f07002a;
public static final int preferences_uni_link_live_bus_times_enabled=0x7f070029;
+ public static final int search_settings_description=0x7f07000d;
public static final int view_help_message=0x7f070017;
public static final int welcome_dialog_button_text=0x7f07005e;
public static final int welcome_dialog_copyright=0x7f070010;
diff --git a/res/layout/find_activity.xml b/res/layout/search_activity.xml
index 6b19c67..6e6bcd3 100644
--- a/res/layout/find_activity.xml
+++ b/res/layout/search_activity.xml
@@ -6,12 +6,6 @@
android:orientation="vertical"
android:theme="@android:style/Theme.NoTitleBar" >
- <EditText
- android:id="@+id/searchBar"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:inputType="textNoSuggestions" />
-
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/findContentLayout"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1009d3f..6ddf6a3 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -18,7 +18,7 @@
<string name="pref_bus_stop">Bus Stops</string>
<string name="menu_about">About</string>
<string name="menu_favourites">Favourites</string>
- <string name="map_activity_search_hint">Search for buildings, and bus stops</string>
+ <string name="search_settings_description">Southampton University Map</string>
<!-- Welcome Dialog -->
<string name="welcome_dialog_title">Southampton University Map App</string>
diff --git a/res/xml/searchable.xml b/res/xml/searchable.xml
index 7262b3d..d6dedc8 100644
--- a/res/xml/searchable.xml
+++ b/res/xml/searchable.xml
@@ -1,12 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
- android:hint="@string/map_activity_search_hint"
+ android:hint="@string/search_settings_description"
android:includeInGlobalSearch="true"
android:label="@string/app_name"
- android:searchSettingsDescription="@string/map_activity_search_hint"
+ android:searchSettingsDescription="@string/search_settings_description"
android:searchSuggestAuthority="net.cbaines.suma.provider"
android:searchSuggestIntentAction="android.intent.action.VIEW"
- android:searchSuggestIntentData="content://net.cbaines.suma.provider/building"
android:searchSuggestSelection=" ?"
android:searchSuggestThreshold="1" >
diff --git a/src/net/cbaines/suma/MapActivity.java b/src/net/cbaines/suma/MapActivity.java
index 8ed8e9e..3b8efe5 100644
--- a/src/net/cbaines/suma/MapActivity.java
+++ b/src/net/cbaines/suma/MapActivity.java
@@ -42,6 +42,7 @@ import org.osmdroid.views.util.constants.MapViewConstants;
import android.app.AlertDialog;
import android.app.Dialog;
+import android.app.SearchManager;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
@@ -186,6 +187,19 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
instance = this;
+ Intent intent = getIntent();
+ Bundle extras = intent.getExtras();
+
+ if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
+ String query = intent.getStringExtra(SearchManager.QUERY);
+
+ Intent searchIntent = new Intent(instance, SearchActivity.class);
+ searchIntent.setAction(Intent.ACTION_SEARCH);
+ searchIntent.putExtra(SearchManager.QUERY, query);
+ startActivity(searchIntent);
+
+ }
+
Log.i(TAG, "Begining loading database " + (System.currentTimeMillis() - startTime));
DatabaseHelper helper = getHelper();
@@ -263,50 +277,59 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
mapController = mapView.getController();
mResourceProxy = new DefaultResourceProxyImpl(getApplicationContext());
- GeoPoint userLocation = null;
+ GeoPoint startLocation = null;
- Bundle extras = getIntent().getExtras();
if (getIntent().getDataString() != null) {
+ String dataString = getIntent().getDataString();
- Log.i(TAG, "getIntent().getDataString() " + getIntent().getDataString());
+ Log.i(TAG, "getIntent().getDataString() " + dataString);
- String str = getIntent().getDataString().substring(4, getIntent().getDataString().length());
- String[] strParts = str.split(",");
+ if (dataString.startsWith("content")) {
- int lat = Util.doubleToIntE6(Double.valueOf(strParts[0]));
- int lng;
+ Uri data = intent.getData();
- if (strParts[1].contains("?")) {
- String zoom = strParts[1].substring(strParts[1].indexOf("?") + 3, strParts[1].length());
- String strLng = strParts[1].substring(0, strParts[1].indexOf("?") - 1);
- lng = Util.doubleToIntE6(Double.valueOf(strLng));
+ Log.i("Data: ", data.toString());
- mapController.setZoom(Integer.valueOf(zoom));
+ startLocation = new GeoPoint(50935551, -1393488);
} else {
- lng = Util.doubleToIntE6(Double.valueOf(strParts[1]));
- mapController.setZoom(15);
- }
- userLocation = new GeoPoint(lat, lng);
+ String str = getIntent().getDataString().substring(4, getIntent().getDataString().length());
+ String[] strParts = str.split(",");
+ int lat = Util.doubleToIntE6(Double.valueOf(strParts[0]));
+ int lng;
+
+ if (strParts[1].contains("?")) {
+ String zoom = strParts[1].substring(strParts[1].indexOf("?") + 3, strParts[1].length());
+ String strLng = strParts[1].substring(0, strParts[1].indexOf("?") - 1);
+ lng = Util.doubleToIntE6(Double.valueOf(strLng));
+
+ mapController.setZoom(Integer.valueOf(zoom));
+ } else {
+ lng = Util.doubleToIntE6(Double.valueOf(strParts[1]));
+ mapController.setZoom(15);
+ }
+
+ startLocation = new GeoPoint(lat, lng);
+ }
} else if (extras != null && extras.containsKey("poiPoint")) {
String poiPoint = getIntent().getExtras().getString("poiPoint");
Log.i(TAG, "poiPoint " + poiPoint);
String[] bits = poiPoint.split(",");
- userLocation = new GeoPoint(Double.valueOf(bits[0]), Double.valueOf(bits[1]));
+ startLocation = new GeoPoint(Double.valueOf(bits[0]), Double.valueOf(bits[1]));
mapController.setZoom(20);
} else {
- userLocation = myLocationOverlay.getMyLocation();
- if (userLocation == null) {
- userLocation = new GeoPoint(50935551, -1393488); // ECS
+ startLocation = myLocationOverlay.getMyLocation();
+ if (startLocation == null) {
+ startLocation = new GeoPoint(50935551, -1393488); // ECS
}
mapController.setZoom(15);
}
- mapController.setCenter(userLocation);
+ mapController.setCenter(startLocation);
final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
String appVersion = sharedPrefs.getString(APP_VERSION, APP_NOT_INSTALLED);
@@ -857,7 +880,7 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
// Handle item selection
switch (item.getItemId()) {
case R.id.menu_find:
- onSearchRequested();
+ onSearchRequested();
return true;
case R.id.menu_preferences:
Intent settingsActivity = new Intent(getBaseContext(), PreferencesActivity.class);
diff --git a/src/net/cbaines/suma/MapContentProvider.java b/src/net/cbaines/suma/MapContentProvider.java
index a2b42c3..d920b21 100644
--- a/src/net/cbaines/suma/MapContentProvider.java
+++ b/src/net/cbaines/suma/MapContentProvider.java
@@ -48,6 +48,10 @@ public class MapContentProvider extends ContentProvider {
// + "/building");
// MIME types used for searching words or looking up a single definition
+ public static final String ALLS_MIME_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE
+ + "/vnd.net.cbaines.suma.provider.all";
+ public static final String ALL_MIME_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE
+ + "/vnd.net.cbaines.suma.provider.all";
public static final String BUILDINGS_MIME_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE
+ "/vnd.net.cbaines.suma.provider.building";
public static final String BUILDING_MIME_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE
@@ -68,16 +72,18 @@ public class MapContentProvider extends ContentProvider {
private DatabaseHelper helper;
// UriMatcher stuff
- private static final int SEARCH_BUILDINGS = 0;
- private static final int GET_BUILDING = 1;
- private static final int SEARCH_BUS_STOPS = 2;
- private static final int GET_BUS_STOP = 3;
- private static final int SEARCH_SITES = 4;
- private static final int GET_SITE = 5;
- private static final int SEARCH_BUSES = 6;
- private static final int GET_BUS = 7;
- private static final int SEARCH_SUGGEST = 8;
- private static final int REFRESH_SHORTCUT = 9;
+ private static final int SEARCH_ALL = 0;
+ private static final int GET_ALL = 1;
+ private static final int SEARCH_BUILDINGS = 2;
+ private static final int GET_BUILDING = 3;
+ private static final int SEARCH_BUS_STOPS = 4;
+ private static final int GET_BUS_STOP = 5;
+ private static final int SEARCH_SITES = 6;
+ private static final int GET_SITE = 7;
+ private static final int SEARCH_BUSES = 8;
+ private static final int GET_BUS = 9;
+ private static final int SEARCH_SUGGEST = 10;
+ private static final int REFRESH_SHORTCUT = 11;
private static final UriMatcher sURIMatcher = buildUriMatcher();
/**
@@ -87,6 +93,8 @@ public class MapContentProvider extends ContentProvider {
private static UriMatcher buildUriMatcher() {
UriMatcher matcher = new UriMatcher(UriMatcher.NO_MATCH);
// to get definitions...
+ matcher.addURI(AUTHORITY, "all", SEARCH_BUILDINGS);
+ matcher.addURI(AUTHORITY, "all/*", GET_BUILDING);
matcher.addURI(AUTHORITY, "building", SEARCH_BUILDINGS);
matcher.addURI(AUTHORITY, "building/*", GET_BUILDING);
matcher.addURI(AUTHORITY, "bus-stop", SEARCH_BUS_STOPS);
@@ -141,6 +149,21 @@ public class MapContentProvider extends ContentProvider {
} catch (SQLException e1) {
e1.printStackTrace();
}
+ case SEARCH_ALL:
+ if (selectionArgs == null) {
+ throw new IllegalArgumentException("selectionArgs must be provided for the Uri: " + uri);
+ }
+ try {
+ return searchAll(selectionArgs[0]);
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ case GET_ALL:
+ try {
+ return getAll(uri);
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
case SEARCH_BUILDINGS:
if (selectionArgs == null) {
throw new IllegalArgumentException("selectionArgs must be provided for the Uri: " + uri);
@@ -170,6 +193,13 @@ public class MapContentProvider extends ContentProvider {
private Cursor getSuggestions(String query) throws SQLException {
Log.v(TAG, "Got query for " + query);
+ String[] columnNames = { BaseColumns._ID, SearchManager.SUGGEST_COLUMN_ICON_1,
+ SearchManager.SUGGEST_COLUMN_TEXT_1, SearchManager.SUGGEST_COLUMN_TEXT_2,
+ SearchManager.SUGGEST_COLUMN_INTENT_DATA };
+
+ MatrixCursor cursor = new MatrixCursor(columnNames);
+ int id = 0;
+
Dao<Building, String> buildingDao = helper.getBuildingDao();
QueryBuilder<Building, String> qb = buildingDao.queryBuilder();
@@ -180,14 +210,37 @@ public class MapContentProvider extends ContentProvider {
List<Building> buildings = buildingDao.query(preparedQuery);
Log.v(TAG, "Returning " + buildings.size() + " buildings");
- String[] columnNames = { BaseColumns._ID, SearchManager.SUGGEST_COLUMN_TEXT_1 };
-
- MatrixCursor cursor = new MatrixCursor(columnNames, buildings.size());
-
- int id = 0;
for (Building building : buildings) {
- Log.v(TAG, "Building " + id + ", " + building.name);
- Object[] values = { id++, building.name };
+ // Log.v(TAG, "Building " + id + ", " + building.name);
+ Object[] values = {
+ id++,
+ R.drawable.building,
+ building.name,
+ building.id,
+ "geo:" + Util.E6IntToDouble(building.point.getLatitudeE6()) + ","
+ + Util.E6IntToDouble(building.point.getLongitudeE6()) + "?z=18" };
+ cursor.addRow(values);
+ }
+
+ Dao<BusStop, String> busStopDao = helper.getBusStopDao();
+
+ QueryBuilder<BusStop, String> busStopQB = busStopDao.queryBuilder();
+ busStopQB.where().like(BusStop.ID_FIELD_NAME, "%" + query + "%").or()
+ .like(BusStop.DESCRIPTION_FIELD_NAME, "%" + query + "%");
+ PreparedQuery<BusStop> busStopPreparedQuery = busStopQB.prepare();
+
+ List<BusStop> busStops = busStopDao.query(busStopPreparedQuery);
+ Log.v(TAG, "Returning " + busStops.size() + " busStops");
+
+ for (BusStop busStop : busStops) {
+ // Log.v(TAG, "Building " + id + ", " + building.name);
+ Object[] values = {
+ id++,
+ R.drawable.busstop,
+ busStop.description,
+ busStop.id,
+ "geo:" + Util.E6IntToDouble(busStop.point.getLatitudeE6()) + ","
+ + Util.E6IntToDouble(busStop.point.getLongitudeE6()) + "?z=18" };
cursor.addRow(values);
}
@@ -223,6 +276,35 @@ public class MapContentProvider extends ContentProvider {
return cursor;
}
+ private Cursor searchAll(String query) throws SQLException {
+ Dao<Building, String> buildingDao = helper.getBuildingDao();
+
+ QueryBuilder<Building, String> qb = buildingDao.queryBuilder();
+ qb.where().eq(Building.ID_FIELD_NAME, "%" + query + "%").or().eq(Building.NAME_FIELD_NAME, "%" + query + "%");
+ PreparedQuery<Building> preparedQuery = qb.prepare();
+
+ AndroidCompiledStatement compiledStatement = (AndroidCompiledStatement) preparedQuery.compile(helper
+ .getConnectionSource().getReadOnlyConnection(), StatementType.SELECT);
+ Cursor cursor = compiledStatement.getCursor();
+
+ return cursor;
+ }
+
+ private Cursor getAll(Uri uri) throws SQLException {
+ String buildingID = uri.getLastPathSegment();
+ Dao<Building, String> buildingDao = helper.getBuildingDao();
+
+ QueryBuilder<Building, String> qb = buildingDao.queryBuilder();
+ qb.where().eq(Building.ID_FIELD_NAME, buildingID);
+ PreparedQuery<Building> preparedQuery = qb.prepare();
+
+ AndroidCompiledStatement compiledStatement = (AndroidCompiledStatement) preparedQuery.compile(helper
+ .getConnectionSource().getReadOnlyConnection(), StatementType.SELECT);
+ Cursor cursor = compiledStatement.getCursor();
+
+ return cursor;
+ }
+
private Cursor refreshShortcut(Uri uri) throws SQLException {
/*
* This won't be called with the current implementation, but if we
@@ -254,6 +336,10 @@ public class MapContentProvider extends ContentProvider {
@Override
public String getType(Uri uri) {
switch (sURIMatcher.match(uri)) {
+ case SEARCH_ALL:
+ return ALLS_MIME_TYPE;
+ case GET_ALL:
+ return ALL_MIME_TYPE;
case SEARCH_BUILDINGS:
return BUILDINGS_MIME_TYPE;
case GET_BUILDING:
diff --git a/src/net/cbaines/suma/SearchActivity.java b/src/net/cbaines/suma/SearchActivity.java
index f7f5e55..850996a 100644
--- a/src/net/cbaines/suma/SearchActivity.java
+++ b/src/net/cbaines/suma/SearchActivity.java
@@ -43,7 +43,6 @@ import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemLongClickListener;
-import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.ProgressBar;
@@ -61,7 +60,6 @@ public class SearchActivity extends OrmLiteBaseActivity<DatabaseHelper> implemen
public static final String ORIGIN = "o";
public static final int MAP_ACTIVITY = 0;
- private EditText searchBar;
private ListView listItems;
private ProgressBar progBar;
private LinearLayout findContentLayout;
@@ -245,18 +243,14 @@ public class SearchActivity extends OrmLiteBaseActivity<DatabaseHelper> implemen
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.find_activity);
+ setContentView(R.layout.search_activity);
Log.i(TAG, "FindActivity started");
- searchBar = (EditText) findViewById(R.id.searchBar);
- searchBar.addTextChangedListener(this);
-
Intent intent = getIntent();
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
- String query = intent.getStringExtra(SearchManager.QUERY);
- Log.i(TAG, "Searching for " + query);
- searchBar.setText(query);
+ searchTerm = intent.getStringExtra(SearchManager.QUERY);
+ Log.i(TAG, "Searching for " + searchTerm);
}
listItems = (ListView) findViewById(R.id.findListItems);