diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2014-06-01 15:35:43 +0200 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2014-06-01 15:35:43 +0200 |
| commit | 33f6b9cbb81a42c1cd1b43d5aec4af97ab075609 (patch) | |
| tree | d554c50f78c7155f71a9d7cd1cb38804a8e422ab /main | |
| parent | 2ccec30e6d84950b2d0626994bcd74faebaf6634 (diff) | |
| download | cgeo-33f6b9cbb81a42c1cd1b43d5aec4af97ab075609.zip cgeo-33f6b9cbb81a42c1cd1b43d5aec4af97ab075609.tar.gz cgeo-33f6b9cbb81a42c1cd1b43d5aec4af97ab075609.tar.bz2 | |
new: icons in search suggestions
Diffstat (limited to 'main')
| -rw-r--r-- | main/src/cgeo/geocaching/DataStore.java | 5 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/search/SearchSuggestionCursor.java | 10 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/search/SuggestionProvider.java | 2 |
3 files changed, 11 insertions, 6 deletions
diff --git a/main/src/cgeo/geocaching/DataStore.java b/main/src/cgeo/geocaching/DataStore.java index 103c356..6b0f641 100644 --- a/main/src/cgeo/geocaching/DataStore.java +++ b/main/src/cgeo/geocaching/DataStore.java @@ -3101,7 +3101,7 @@ public class DataStore { private static void findCaches(final SearchSuggestionCursor resultCursor, final String selectionArg) { final Cursor cursor = database.query( dbTableCaches, - new String[] { "geocode", "name" }, + new String[] { "geocode", "name", "type" }, "geocode IS NOT NULL AND geocode != '' AND (geocode LIKE ? OR name LIKE ? OR owner LIKE ?)", new String[] { selectionArg, selectionArg, selectionArg }, null, @@ -3110,7 +3110,8 @@ public class DataStore { while (cursor.moveToNext()) { final String geocode = cursor.getString(0); final String cacheName = cursor.getString(1); - resultCursor.addCache(geocode, cacheName); + final String type = cursor.getString(2); + resultCursor.addCache(geocode, cacheName, type); } cursor.close(); } diff --git a/main/src/cgeo/geocaching/search/SearchSuggestionCursor.java b/main/src/cgeo/geocaching/search/SearchSuggestionCursor.java index f058c1d..350e23a 100644 --- a/main/src/cgeo/geocaching/search/SearchSuggestionCursor.java +++ b/main/src/cgeo/geocaching/search/SearchSuggestionCursor.java @@ -1,6 +1,7 @@ package cgeo.geocaching.search; import cgeo.geocaching.Intents; +import cgeo.geocaching.enumerations.CacheType; import org.eclipse.jdt.annotation.NonNull; @@ -25,16 +26,19 @@ public class SearchSuggestionCursor extends MatrixCursor { SearchManager.SUGGEST_COLUMN_TEXT_1, SearchManager.SUGGEST_COLUMN_TEXT_2, SearchManager.SUGGEST_COLUMN_INTENT_ACTION, - SearchManager.SUGGEST_COLUMN_QUERY }); + SearchManager.SUGGEST_COLUMN_QUERY, + SearchManager.SUGGEST_COLUMN_ICON_1 }); } - public void addCache(@NonNull final String geocode, @NonNull final String name) { + public void addCache(@NonNull final String geocode, @NonNull final String name, final String type) { + final int icon = CacheType.getById(type).markerId; addRow(new String[] { String.valueOf(rowId), name, geocode, Intents.ACTION_GEOCACHE, - geocode + geocode, + String.valueOf(icon) }); rowId++; } diff --git a/main/src/cgeo/geocaching/search/SuggestionProvider.java b/main/src/cgeo/geocaching/search/SuggestionProvider.java index d8f95b6..f60a43e 100644 --- a/main/src/cgeo/geocaching/search/SuggestionProvider.java +++ b/main/src/cgeo/geocaching/search/SuggestionProvider.java @@ -36,7 +36,7 @@ public class SuggestionProvider extends ContentProvider { private static Cursor getLastOpenedCaches() { final SearchSuggestionCursor resultCursor = new SearchSuggestionCursor(); for (final Geocache geocache : DataStore.getLastOpenedCaches()) { - resultCursor.addCache(geocache.getGeocode(), geocache.getName()); + resultCursor.addCache(geocache.getGeocode(), geocache.getName(), geocache.getType().id); } return resultCursor; } |
