diff options
author | Jeff Sharkey <jsharkey@android.com> | 2012-05-03 18:08:24 -0700 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2012-05-04 11:32:39 -0700 |
commit | 3843960b466dbcd1733648095e750ccb3fa6d184 (patch) | |
tree | 0bf9e9fced362962ccec3d88138bd2e6992ab720 /ui/src/com/android/providers/downloads/ui/DownloadAdapter.java | |
parent | 15ea8d69f74735e2013cc11bc4899e0edc945b8a (diff) | |
download | android_packages_providers_DownloadProvider-3843960b466dbcd1733648095e750ccb3fa6d184.tar.gz android_packages_providers_DownloadProvider-3843960b466dbcd1733648095e750ccb3fa6d184.tar.bz2 android_packages_providers_DownloadProvider-3843960b466dbcd1733648095e750ccb3fa6d184.zip |
Updated layout for download items.
Switch to using GridLayout, because it's awesome. Also move status
display to right-hand side, showing date when in completed state.
Bug: 6378944
Change-Id: I540633010ed4aeeae299cedf7a49fdb81e65b431
Diffstat (limited to 'ui/src/com/android/providers/downloads/ui/DownloadAdapter.java')
-rw-r--r-- | ui/src/com/android/providers/downloads/ui/DownloadAdapter.java | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/ui/src/com/android/providers/downloads/ui/DownloadAdapter.java b/ui/src/com/android/providers/downloads/ui/DownloadAdapter.java index 27967f8a..9ce2a986 100644 --- a/ui/src/com/android/providers/downloads/ui/DownloadAdapter.java +++ b/ui/src/com/android/providers/downloads/ui/DownloadAdapter.java @@ -107,8 +107,15 @@ public class DownloadAdapter extends CursorAdapter { setTextForView(convertView, R.id.download_title, title); setTextForView(convertView, R.id.domain, mCursor.getString(mDescriptionColumnId)); setTextForView(convertView, R.id.size_text, getSizeText()); - setTextForView(convertView, R.id.status_text, mResources.getString(getStatusStringId())); - setTextForView(convertView, R.id.last_modified_date, getDateString()); + + final int status = mCursor.getInt(mStatusColumnId); + final CharSequence statusText; + if (status == DownloadManager.STATUS_SUCCESSFUL) { + statusText = getDateString(); + } else { + statusText = mResources.getString(getStatusStringId(status)); + } + setTextForView(convertView, R.id.status_text, statusText); ((DownloadItem) convertView).getCheckBox() .setChecked(mDownloadList.isDownloadSelected(downloadId)); @@ -141,8 +148,8 @@ public class DownloadAdapter extends CursorAdapter { return sizeText; } - private int getStatusStringId() { - switch (mCursor.getInt(mStatusColumnId)) { + private int getStatusStringId(int status) { + switch (status) { case DownloadManager.STATUS_FAILED: return R.string.download_error; @@ -189,7 +196,7 @@ public class DownloadAdapter extends CursorAdapter { iconView.setVisibility(View.VISIBLE); } - private void setTextForView(View parent, int textViewId, String text) { + private void setTextForView(View parent, int textViewId, CharSequence text) { TextView view = (TextView) parent.findViewById(textViewId); view.setText(text); } |