OSDN Git Service

Use the common method for updating the title.
authorLeon Scroggins <scroggo@google.com>
Thu, 21 Jan 2010 21:25:26 +0000 (16:25 -0500)
committerLeon Scroggins <scroggo@google.com>
Thu, 21 Jan 2010 21:26:46 +0000 (16:26 -0500)
Depends on a change in frameworks/base

src/com/android/browser/BrowserDownloadAdapter.java

index 974e8fa..2a3b69c 100644 (file)
@@ -17,8 +17,6 @@
  
 package com.android.browser;
 
-import android.content.ContentUris;
-import android.content.ContentValues;
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.PackageManager;
@@ -38,7 +36,6 @@ import android.widget.ProgressBar;
 import android.widget.RelativeLayout;
 import android.widget.TextView;
 
-import java.io.File;
 import java.text.DateFormat;
 import java.util.Date;
 import java.util.List;
@@ -120,13 +117,8 @@ public class BrowserDownloadAdapter extends DateSortedExpandableListAdapter {
                 title = r.getString(R.string.download_unknown_filename);
             } else {
                 // We have a filename, so we can build a title from that
-                title = new File(fullFilename).getName();
-                ContentValues values = new ContentValues();
-                values.put(Downloads.Impl.COLUMN_TITLE, title);
-                // assume "_id" is the first column for the cursor 
-                context.getContentResolver().update(
-                        ContentUris.withAppendedId(Downloads.Impl.CONTENT_URI,
-                        getLong(0)), values, null, null);
+                title = Downloads.Impl.createTitleFromFilename(context, fullFilename,
+                        getLong(0));
             }
         }
         tv.setText(title);