android: add custom browse row layout

This commit is contained in:
Daniel Erat 2011-03-15 07:11:51 -07:00
parent 970b8e6971
commit 509bd14bf5
3 changed files with 17 additions and 4 deletions

View File

@ -0,0 +1,11 @@
<!-- cribbed from simple_list_item_1 -->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="center_vertical"
android:paddingLeft="6dip"
android:minHeight="?android:attr/listPreferredItemHeight"
android:singleLine="true"
/>

View File

@ -76,7 +76,9 @@ public class BrowseActivity extends ListActivity {
@Override
public void onBlobDownloadComplete(final String blobRef, final InputStream stream) {
try {
JSONObject object = (JSONObject) new JSONTokener(Util.slurp(stream)).nextValue();
String data = Util.slurp(stream);
Log.d(TAG, "got search results: " + data);
JSONObject object = (JSONObject) new JSONTokener(data).nextValue();
JSONArray array = object.getJSONArray("results");
if (array == null) {
Log.e(TAG, "search results are missing results key");
@ -241,9 +243,9 @@ public class BrowseActivity extends ListActivity {
mAdapter = new SimpleAdapter(
this,
mEntries,
android.R.layout.simple_list_item_1,
R.layout.browse_row,
new String[]{ KEY_TITLE },
new int[]{ android.R.id.text1 });
new int[]{ android.R.id.title });
setListAdapter(mAdapter);
}

View File

@ -121,7 +121,7 @@ public class DownloadService extends Service {
if (response.getStatusLine().getStatusCode() != 200) {
Log.e(TAG,
"got status code " + response.getStatusLine().getStatusCode() +
"while downloading " + mBlobRef);
" while downloading " + mBlobRef);
handleFailure();
return;
}