diff options
author | Leon Scroggins <scroggo@google.com> | 2010-12-17 15:25:33 -0500 |
---|---|---|
committer | Leon Scroggins <scroggo@google.com> | 2010-12-17 15:25:33 -0500 |
commit | 905250c0e82e89a08b9e4670f1e3a806cb4d2fb8 (patch) | |
tree | 79c703c01bd29dc6d682028803c9a275161e2f01 /src/com | |
parent | e6e1c9169b485a8e06b0114d7ced7198f9a60a51 (diff) | |
download | packages_apps_Browser-905250c0e82e89a08b9e4670f1e3a806cb4d2fb8.zip packages_apps_Browser-905250c0e82e89a08b9e4670f1e3a806cb4d2fb8.tar.gz packages_apps_Browser-905250c0e82e89a08b9e4670f1e3a806cb4d2fb8.tar.bz2 |
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
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/browser/AddBookmarkPage.java | 19 | ||||
-rw-r--r-- | src/com/android/browser/BreadCrumbView.java | 13 |
2 files changed, 25 insertions, 7 deletions
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 @@ public class AddBookmarkPage extends Activity 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 @@ public class AddBookmarkPage extends Activity 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 @@ public class AddBookmarkPage extends Activity 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 @@ public class AddBookmarkPage extends Activity 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); diff --git a/src/com/android/browser/BreadCrumbView.java b/src/com/android/browser/BreadCrumbView.java index 643bfc7..113d55b 100644 --- a/src/com/android/browser/BreadCrumbView.java +++ b/src/com/android/browser/BreadCrumbView.java @@ -135,13 +135,14 @@ public class BreadCrumbView extends LinearLayout implements OnClickListener { } } - public void pushView(String name, Object data) { - pushView(name, true, data); + public View pushView(String name, Object data) { + return pushView(name, true, data); } - public void pushView(String name, boolean canGoBack, Object data) { + public View pushView(String name, boolean canGoBack, Object data) { Crumb crumb = new Crumb(name, canGoBack, data); pushCrumb(crumb); + return crumb.crumbView; } public void pushView(View view, Object data) { @@ -160,7 +161,7 @@ public class BreadCrumbView extends LinearLayout implements OnClickListener { mBackButton.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT)); mBackButton.setOnClickListener(this); - mBackButton.setVisibility(View.INVISIBLE); + mBackButton.setVisibility(View.GONE); addView(mBackButton, 0); } @@ -196,7 +197,7 @@ public class BreadCrumbView extends LinearLayout implements OnClickListener { if (top != null && top.canGoBack) { mBackButton.setVisibility(View.VISIBLE); } else { - mBackButton.setVisibility(View.INVISIBLE); + mBackButton.setVisibility(View.GONE); } } updateVisible(); @@ -241,7 +242,7 @@ public class BreadCrumbView extends LinearLayout implements OnClickListener { } if (mUseBackButton) { boolean canGoBack = getTopCrumb() != null ? getTopCrumb().canGoBack : false; - mBackButton.setVisibility(canGoBack ? View.VISIBLE : View.INVISIBLE); + mBackButton.setVisibility(canGoBack ? View.VISIBLE : View.GONE); } else { mBackButton.setVisibility(View.GONE); } |