Browse Source

Fix search suggestions and tweak result list appearance.

pull/11/head
Eric Kok 11 years ago
parent
commit
0208dab429
  1. 2
      core/res/layout/list_item_searchresult.xml
  2. 10
      core/res/menu/activity_search.xml
  3. 9
      core/res/xml/searchable.xml
  4. 7
      core/src/org/transdroid/core/app/search/SearchHelper.java

2
core/res/layout/list_item_searchresult.xml

@ -51,7 +51,7 @@ @@ -51,7 +51,7 @@
android:layout_height="wrap_content"
android:layout_alignBaseline="@id/leechers_text"
android:layout_toRightOf="@id/size_text"
android:layout_marginRight="@dimen/margin_default"
android:layout_marginLeft="@dimen/margin_default"
android:textIsSelectable="false"
android:textSize="@dimen/text_small" />

10
core/res/menu/activity_search.xml

@ -1,15 +1,15 @@ @@ -1,15 +1,15 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/action_refresh"
android:icon="?attr/ic_action_refresh"
android:showAsAction="always"
android:title="@string/action_refresh"/>
<item
android:id="@+id/action_search"
android:icon="?attr/ic_action_search"
android:showAsAction="collapseActionView|ifRoom"
android:title="@string/action_search"/>
<item
android:id="@+id/action_refresh"
android:icon="?attr/ic_action_refresh"
android:showAsAction="always"
android:title="@string/action_refresh"/>
<item
android:id="@+id/action_downloadsearch"
android:showAsAction="always"

9
core/res/xml/searchable.xml

@ -1,8 +1,7 @@ @@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="@string/search_torrentsearch"
android:hint="@string/search_hint"
android:searchSuggestAuthority="org.transdroid.core.gui.search.SearchHistoryProvider"
android:searchSuggestSelection=" ? " />
android:label="@string/search_torrentsearch"
android:searchSuggestAuthority="org.transdroid.core.gui.search.TorrentSearchHistoryProvider"
android:searchSuggestThreshold="0"
android:searchSuggestSelection=" ?" />

7
core/src/org/transdroid/core/app/search/SearchHelper.java

@ -81,7 +81,8 @@ public class SearchHelper { @@ -81,7 +81,8 @@ public class SearchHelper {
* @param query The search query to pass to the torrent site
* @param site The site to search, as retrieved from the TorrentSitesProvider, or null if the Torrent Search package
* @param sortBy.name() The sort order to request from the torrent site, if supported
* @return A list of torrent search results as POJOs, or null if the Torrent Search package is not installed
* @return A list of torrent search results as POJOs, or null if the Torrent Search package is not installed or
* there is no internet connection
*/
public ArrayList<SearchResult> search(String query, SearchSite site, SearchSortOrder sortBy) {
@ -95,6 +96,10 @@ public class SearchHelper { @@ -95,6 +96,10 @@ public class SearchHelper {
cursor = context.getContentResolver().query(uri, null, "SITE = ?", new String[] { site.getKey() },
sortBy.name());
}
if (cursor == null) {
// The content provider could not load any content (for example when there is no connection)
return null;
}
if (cursor.moveToFirst()) {
ArrayList<SearchResult> results = new ArrayList<SearchResult>();
do {

Loading…
Cancel
Save