Narrative to go with search results

This commit is contained in:
Ciaran Gultnieks 2011-01-17 22:05:31 +00:00
parent 6cae359505
commit 3d913be808
2 changed files with 13 additions and 0 deletions

View File

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="searchres_napps">Found %1$d applications matching \'%2$s\':</string>
<string name="searchres_oneapp">Found one application matching \'%s\':</string>
<string name="searchres_noapps">No applications were found matching \'%s\'</string>
<string name="SignatureMismatch">The new version is signed with a different key to the old one. To install the new version, the old one must be uninstalled first. Please do this and try again. (Note that uninstalling will erase any internal data stored by the application)</string>
<string name="version">Version</string>
<string name="n_versions_available">%d versions available</string>

View File

@ -27,6 +27,7 @@ import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ListView;
import android.widget.TextView;
public class SearchResults extends ListActivity {
@ -45,6 +46,15 @@ public class SearchResults extends ListActivity {
String query = intent.getStringExtra(SearchManager.QUERY);
DB db = new DB(this);
Vector<DB.App> apps = db.getApps(null, query, false);
TextView tv = (TextView) findViewById(R.id.description);
String headertext;
if(apps.size()==0)
headertext = String.format(getString(R.string.searchres_noapps),query);
else if(apps.size()==1)
headertext = String.format(getString(R.string.searchres_oneapp),query);
else
headertext = String.format(getString(R.string.searchres_napps),apps.size(),query);
tv.setText(headertext);
Log.d("FDroid", "Search for '" + query + "' returned "
+ apps.size() + " results");
for (DB.App app : apps) {