diff options
| author | Jean-Baptiste Queru <jbq@google.com> | 2010-01-14 16:09:03 -0800 |
|---|---|---|
| committer | Jean-Baptiste Queru <jbq@google.com> | 2010-01-15 10:33:32 -0800 |
| commit | 1e5bad97ca8fb9b12501f4f747941d02f03e1362 (patch) | |
| tree | 648214cd2fd4117ff1acafe870955aecbc30754b /src/com/android/browser/BrowserDownloadAdapter.java | |
| parent | 2336dae2a336f519ce64d0d7f5837b53d0d3d2c6 (diff) | |
| download | packages_apps_Browser-1e5bad97ca8fb9b12501f4f747941d02f03e1362.tar.gz packages_apps_Browser-1e5bad97ca8fb9b12501f4f747941d02f03e1362.tar.bz2 packages_apps_Browser-1e5bad97ca8fb9b12501f4f747941d02f03e1362.zip | |
Use the private Download Manager APIs.
This boils down to using Downloads.Impl instead of Downloads
The APIs that were being used so far are going to disappear
to be replaced by a new set of APIs, but in order for the browser
to be able to continue using the old APIs a new copy of those APIs
was created "on the side" so that the browser doesn't need to
change much.
Bug: 2245521
Change-Id: I33c526331cce006710b1f934a4aeb64cdb95d62e
Diffstat (limited to 'src/com/android/browser/BrowserDownloadAdapter.java')
| -rw-r--r-- | src/com/android/browser/BrowserDownloadAdapter.java | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/com/android/browser/BrowserDownloadAdapter.java b/src/com/android/browser/BrowserDownloadAdapter.java index 85539c3f6..974e8fa6b 100644 --- a/src/com/android/browser/BrowserDownloadAdapter.java +++ b/src/com/android/browser/BrowserDownloadAdapter.java @@ -61,15 +61,15 @@ public class BrowserDownloadAdapter extends DateSortedExpandableListAdapter { public BrowserDownloadAdapter(Context context, Cursor c, int index) { super(context, c, index); - mFilenameColumnId = c.getColumnIndexOrThrow(Downloads._DATA); - mTitleColumnId = c.getColumnIndexOrThrow(Downloads.COLUMN_TITLE); - mDescColumnId = c.getColumnIndexOrThrow(Downloads.COLUMN_DESCRIPTION); - mStatusColumnId = c.getColumnIndexOrThrow(Downloads.COLUMN_STATUS); - mTotalBytesColumnId = c.getColumnIndexOrThrow(Downloads.COLUMN_TOTAL_BYTES); + mFilenameColumnId = c.getColumnIndexOrThrow(Downloads.Impl._DATA); + mTitleColumnId = c.getColumnIndexOrThrow(Downloads.Impl.COLUMN_TITLE); + mDescColumnId = c.getColumnIndexOrThrow(Downloads.Impl.COLUMN_DESCRIPTION); + mStatusColumnId = c.getColumnIndexOrThrow(Downloads.Impl.COLUMN_STATUS); + mTotalBytesColumnId = c.getColumnIndexOrThrow(Downloads.Impl.COLUMN_TOTAL_BYTES); mCurrentBytesColumnId = - c.getColumnIndexOrThrow(Downloads.COLUMN_CURRENT_BYTES); - mMimetypeColumnId = c.getColumnIndexOrThrow(Downloads.COLUMN_MIME_TYPE); - mDateColumnId = c.getColumnIndexOrThrow(Downloads.COLUMN_LAST_MODIFICATION); + c.getColumnIndexOrThrow(Downloads.Impl.COLUMN_CURRENT_BYTES); + mMimetypeColumnId = c.getColumnIndexOrThrow(Downloads.Impl.COLUMN_MIME_TYPE); + mDateColumnId = c.getColumnIndexOrThrow(Downloads.Impl.COLUMN_LAST_MODIFICATION); } @Override @@ -122,10 +122,10 @@ public class BrowserDownloadAdapter extends DateSortedExpandableListAdapter { // We have a filename, so we can build a title from that title = new File(fullFilename).getName(); ContentValues values = new ContentValues(); - values.put(Downloads.COLUMN_TITLE, title); + values.put(Downloads.Impl.COLUMN_TITLE, title); // assume "_id" is the first column for the cursor context.getContentResolver().update( - ContentUris.withAppendedId(Downloads.CONTENT_URI, + ContentUris.withAppendedId(Downloads.Impl.CONTENT_URI, getLong(0)), values, null, null); } } @@ -137,7 +137,7 @@ public class BrowserDownloadAdapter extends DateSortedExpandableListAdapter { long totalBytes = getLong(mTotalBytesColumnId); int status = getInt(mStatusColumnId); - if (Downloads.isStatusCompleted(status)) { // Download stopped + if (Downloads.Impl.isStatusCompleted(status)) { // Download stopped View v = convertView.findViewById(R.id.progress_text); v.setVisibility(View.GONE); @@ -146,7 +146,7 @@ public class BrowserDownloadAdapter extends DateSortedExpandableListAdapter { tv = (TextView) convertView.findViewById(R.id.complete_text); tv.setVisibility(View.VISIBLE); - if (Downloads.isStatusError(status)) { + if (Downloads.Impl.isStatusError(status)) { tv.setText(getErrorText(status)); } else { tv.setText(r.getString(R.string.download_success, @@ -173,15 +173,15 @@ public class BrowserDownloadAdapter extends DateSortedExpandableListAdapter { v = convertView.findViewById(R.id.complete_text); v.setVisibility(View.GONE); - if (status == Downloads.STATUS_PENDING) { + if (status == Downloads.Impl.STATUS_PENDING) { tv.setText(r.getText(R.string.download_pending)); - } else if (status == Downloads.STATUS_PENDING_PAUSED) { + } else if (status == Downloads.Impl.STATUS_PENDING_PAUSED) { tv.setText(r.getText(R.string.download_pending_network)); } else { ProgressBar pb = (ProgressBar) progress; StringBuilder sb = new StringBuilder(); - if (status == Downloads.STATUS_RUNNING) { + if (status == Downloads.Impl.STATUS_RUNNING) { sb.append(r.getText(R.string.download_running)); } else { sb.append(r.getText(R.string.download_running_paused)); @@ -214,23 +214,23 @@ public class BrowserDownloadAdapter extends DateSortedExpandableListAdapter { */ public static int getErrorText(int status) { switch (status) { - case Downloads.STATUS_NOT_ACCEPTABLE: + case Downloads.Impl.STATUS_NOT_ACCEPTABLE: return R.string.download_not_acceptable; - case Downloads.STATUS_LENGTH_REQUIRED: + case Downloads.Impl.STATUS_LENGTH_REQUIRED: return R.string.download_length_required; - case Downloads.STATUS_PRECONDITION_FAILED: + case Downloads.Impl.STATUS_PRECONDITION_FAILED: return R.string.download_precondition_failed; - case Downloads.STATUS_CANCELED: + case Downloads.Impl.STATUS_CANCELED: return R.string.download_canceled; - case Downloads.STATUS_FILE_ERROR: + case Downloads.Impl.STATUS_FILE_ERROR: return R.string.download_file_error; - case Downloads.STATUS_BAD_REQUEST: - case Downloads.STATUS_UNKNOWN_ERROR: + case Downloads.Impl.STATUS_BAD_REQUEST: + case Downloads.Impl.STATUS_UNKNOWN_ERROR: default: return R.string.download_error; } |
