summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeon Scroggins <scroggo@google.com>2010-12-17 15:25:33 -0500
committerLeon Scroggins <scroggo@google.com>2010-12-17 15:25:33 -0500
commit905250c0e82e89a08b9e4670f1e3a806cb4d2fb8 (patch)
tree79c703c01bd29dc6d682028803c9a275161e2f01
parente6e1c9169b485a8e06b0114d7ced7198f9a60a51 (diff)
downloadpackages_apps_Browser-905250c0e82e89a08b9e4670f1e3a806cb4d2fb8.tar.gz
packages_apps_Browser-905250c0e82e89a08b9e4670f1e3a806cb4d2fb8.tar.bz2
packages_apps_Browser-905250c0e82e89a08b9e4670f1e3a806cb4d2fb8.zip
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
-rw-r--r--res/layout/browser_add_bookmark.xml10
-rw-r--r--res/layout/folder_list_item.xml2
-rw-r--r--res/layout/new_folder_layout.xml2
-rw-r--r--src/com/android/browser/AddBookmarkPage.java19
-rw-r--r--src/com/android/browser/BreadCrumbView.java13
5 files changed, 35 insertions, 11 deletions
diff --git a/res/layout/browser_add_bookmark.xml b/res/layout/browser_add_bookmark.xml
index a8a87be24..27b8e858e 100644
--- a/res/layout/browser_add_bookmark.xml
+++ b/res/layout/browser_add_bookmark.xml
@@ -22,13 +22,16 @@
<RelativeLayout android:id="@+id/crumb_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:minHeight="?android:attr/listPreferredItemHeight"
+ android:gravity="center_vertical"
android:visibility="gone"
>
<com.android.browser.BreadCrumbView android:id="@+id/crumbs"
android:layout_width="wrap_content"
- android:layout_height="wrap_content"
+ android:layout_height="?android:attr/listPreferredItemHeight"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/add_divider"
+ android:layout_centerVertical="true"
/>
<TextView
android:id="@+id/add_new_folder"
@@ -40,17 +43,20 @@
android:gravity="center_vertical"
android:text="@string/new_folder"
android:visibility="gone"
+ android:layout_centerVertical="true"
android:textAppearance="?android:attr/textAppearanceMedium" />
<ImageView android:id="@+id/add_divider"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/add_new_folder"
android:src="@drawable/crumb_divider"
+ android:layout_centerVertical="true"
/>
</RelativeLayout>
<TextView android:id="@+id/fake_title"
android:layout_width="wrap_content"
- android:layout_height="?android:attr/listPreferredItemHeight"
+ android:layout_height="wrap_content"
+ android:minHeight="?android:attr/listPreferredItemHeight"
android:drawableLeft="@drawable/ic_list_bookmark"
android:text="@string/bookmark_this_page"
android:layout_gravity="left"
diff --git a/res/layout/folder_list_item.xml b/res/layout/folder_list_item.xml
index 56c597bd2..5d77fd9a4 100644
--- a/res/layout/folder_list_item.xml
+++ b/res/layout/folder_list_item.xml
@@ -25,7 +25,7 @@
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeight"
- android:src="@drawable/ic_go_normal_white" />
+ android:src="@drawable/ic_folder_bookmark_widget_holo_dark" />
<TextView
android:id="@android:id/text1"
android:layout_width="match_parent"
diff --git a/res/layout/new_folder_layout.xml b/res/layout/new_folder_layout.xml
index a503adcd7..4ce0adece 100644
--- a/res/layout/new_folder_layout.xml
+++ b/res/layout/new_folder_layout.xml
@@ -26,7 +26,7 @@
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeight"
- android:src="@drawable/ic_go_normal_white" />
+ android:src="@drawable/ic_folder_bookmark_widget_holo_dark" />
<EditText
android:id="@+id/folder_namer"
android:layout_width="match_parent"
diff --git a/src/com/android/browser/AddBookmarkPage.java b/src/com/android/browser/AddBookmarkPage.java
index e03c0f643..f5b677a66 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 643bfc764..113d55b40 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);
}