Improvements to add bookmark dialog.
Bug:2953515
Use the folder icon for folders.
Center the header views in the choose folder view.
Change-Id: Ia19d81131a177aa3fce02645c411011e40e21bc4
diff --git a/src/com/android/browser/AddBookmarkPage.java b/src/com/android/browser/AddBookmarkPage.java
index e03c0f6..f5b677a 100644
--- a/src/com/android/browser/AddBookmarkPage.java
+++ b/src/com/android/browser/AddBookmarkPage.java
@@ -110,6 +110,8 @@
private CustomListView mListView;
private boolean mSaveToHomeScreen;
private long mRootFolder;
+ private TextView mTopLevelLabel;
+ private Drawable mHeaderIcon;
private static class Folder {
String Name;
@@ -157,6 +159,16 @@
if (mIsFolderNamerShowing) {
completeOrCancelFolderNaming(true);
}
+ setShowBookmarkIcon(level == 1);
+ }
+
+ /**
+ * Show or hide the icon for bookmarks next to "Bookmarks" in the crumb view.
+ * @param show True if the icon should visible, false otherwise.
+ */
+ private void setShowBookmarkIcon(boolean show) {
+ Drawable drawable = show ? mHeaderIcon: null;
+ mTopLevelLabel.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
}
@Override
@@ -579,7 +591,10 @@
mCrumbs.setUseBackButton(true);
mCrumbs.setController(this);
String name = getString(R.string.bookmarks);
- mCrumbs.pushView(name, false, new Folder(name, mRootFolder));
+ mTopLevelLabel = (TextView) mCrumbs.pushView(name, false, new Folder(name, mRootFolder));
+ // To better match the other folders.
+ mTopLevelLabel.setCompoundDrawablePadding(6);
+ mHeaderIcon = getResources().getDrawable(R.drawable.ic_folder_bookmark_widget_holo_dark);
mCrumbHolder = findViewById(R.id.crumb_holder);
mCrumbs.setMaxVisible(MAX_CRUMBS_SHOWN);
@@ -594,6 +609,8 @@
if (mCurrentFolder != mRootFolder) {
// Find all the folders
manager.initLoader(LOADER_ID_ALL_FOLDERS, null, this);
+ } else {
+ setShowBookmarkIcon(true);
}
// Find the contents of the current folder
manager.initLoader(LOADER_ID_FOLDER_CONTENTS, null, this);