diff options
author | John Reck <jreck@google.com> | 2012-04-12 17:27:34 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2012-04-12 17:30:09 -0700 |
commit | d18ac4b36b057a6a403cb060dfc10761b7394548 (patch) | |
tree | 66e83cef9ad5a60bc1b1848daa22c46ae6417799 /src/com/android/browser/BrowserBookmarksAdapter.java | |
parent | 80f750852edf43c6b09e5633f2c6ebdb2ed94a5b (diff) | |
download | packages_apps_Browser-d18ac4b36b057a6a403cb060dfc10761b7394548.zip packages_apps_Browser-d18ac4b36b057a6a403cb060dfc10761b7394548.tar.gz packages_apps_Browser-d18ac4b36b057a6a403cb060dfc10761b7394548.tar.bz2 |
Support BOOKMARK_TYPE
Bug: 6332869
Bug: 5494697
Bookmark type also gives us an easy way to localize Other Bookmarks
Change-Id: Iab208da0cb1b2af5d256990cdc4ab5c11821523b
Diffstat (limited to 'src/com/android/browser/BrowserBookmarksAdapter.java')
-rw-r--r-- | src/com/android/browser/BrowserBookmarksAdapter.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/com/android/browser/BrowserBookmarksAdapter.java b/src/com/android/browser/BrowserBookmarksAdapter.java index 2fd880c..fcc3f27 100644 --- a/src/com/android/browser/BrowserBookmarksAdapter.java +++ b/src/com/android/browser/BrowserBookmarksAdapter.java @@ -20,6 +20,7 @@ import android.content.Context; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; +import android.provider.BrowserContract.Bookmarks; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -52,6 +53,15 @@ public class BrowserBookmarksAdapter extends CursorAdapter { } } + CharSequence getTitle(Cursor cursor, Context context) { + int type = cursor.getInt(BookmarksLoader.COLUMN_INDEX_TYPE); + switch (type) { + case Bookmarks.BOOKMARK_TYPE_OTHER_FOLDER: + return context.getText(R.string.other_bookmarks); + } + return cursor.getString(BookmarksLoader.COLUMN_INDEX_TITLE); + } + void bindGridView(View view, Context context, Cursor cursor) { // We need to set this to handle rotation and other configuration change // events. If the padding didn't change, this is a no op. @@ -62,7 +72,7 @@ public class BrowserBookmarksAdapter extends CursorAdapter { ImageView thumb = (ImageView) view.findViewById(R.id.thumb); TextView tv = (TextView) view.findViewById(R.id.label); - tv.setText(cursor.getString(BookmarksLoader.COLUMN_INDEX_TITLE)); + tv.setText(getTitle(cursor, context)); if (cursor.getInt(BookmarksLoader.COLUMN_INDEX_IS_FOLDER) != 0) { // folder thumb.setImageResource(R.drawable.thumb_bookmark_widget_folder_holo); @@ -89,7 +99,7 @@ public class BrowserBookmarksAdapter extends CursorAdapter { ImageView favicon = (ImageView) view.findViewById(R.id.favicon); TextView tv = (TextView) view.findViewById(R.id.label); - tv.setText(cursor.getString(BookmarksLoader.COLUMN_INDEX_TITLE)); + tv.setText(getTitle(cursor, context)); if (cursor.getInt(BookmarksLoader.COLUMN_INDEX_IS_FOLDER) != 0) { // folder favicon.setImageResource(R.drawable.ic_folder_holo_dark); |