Merge "Transfer data from BP1 to BP2"
diff --git a/res/layout/bookmark_grid_row.xml b/res/layout/bookmark_grid_row.xml
index 669cff3..5dc3a76 100644
--- a/res/layout/bookmark_grid_row.xml
+++ b/res/layout/bookmark_grid_row.xml
@@ -18,7 +18,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:paddingLeft="10dp"
- android:paddingRight="10dp">
+ android:paddingLeft="@dimen/combo_rowPadding"
+ android:paddingRight="@dimen/combo_rowPadding">
</LinearLayout>
diff --git a/res/layout/bookmark_thumbnail.xml b/res/layout/bookmark_thumbnail.xml
index fcff322..cd7b9be 100644
--- a/res/layout/bookmark_thumbnail.xml
+++ b/res/layout/bookmark_thumbnail.xml
@@ -18,7 +18,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
- android:padding="8dip"
+ android:padding="@dimen/combo_horizontalSpacing"
android:background="@drawable/bookmark_thumb_selector"
>
diff --git a/res/menu-w720dp/bookmark.xml b/res/menu-w720dp/bookmark.xml
new file mode 100644
index 0000000..0adadac
--- /dev/null
+++ b/res/menu-w720dp/bookmark.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+ android:id="@+id/add_bookmark"
+ android:icon="@drawable/ic_bookmark_off_holo_dark"
+ android:title="@string/add_new_bookmark"
+ android:showAsAction="always|withText" />
+ <item
+ android:id="@+id/go_home"
+ android:icon="@drawable/ic_home_holo_dark"
+ android:showAsAction="always" />
+ <item
+ android:id="@+id/thumbnail_view"
+ android:title="@string/bookmark_thumbnail_view"/>
+ <item
+ android:id="@+id/list_view"
+ android:title="@string/bookmark_list_view"/>
+ <item
+ android:id="@+id/preferences_menu_id"
+ android:title="@string/menu_preferences"
+ android:alphabeticShortcut="p" />
+</menu>
diff --git a/res/menu/bookmark.xml b/res/menu/bookmark.xml
index 5517ab9..3d248b4 100644
--- a/res/menu/bookmark.xml
+++ b/res/menu/bookmark.xml
@@ -19,7 +19,7 @@
android:id="@+id/add_bookmark"
android:icon="@drawable/ic_bookmark_off_holo_dark"
android:title="@string/add_new_bookmark"
- android:showAsAction="always|withText" />
+ android:showAsAction="always" />
<item
android:id="@+id/go_home"
android:icon="@drawable/ic_home_holo_dark"
diff --git a/res/values-w600dp-port/dimensions.xml b/res/values-w600dp-port/dimensions.xml
index 7c0d447..3ba38fe 100644
--- a/res/values-w600dp-port/dimensions.xml
+++ b/res/values-w600dp-port/dimensions.xml
@@ -16,4 +16,5 @@
<dimen name="widgetVerticalSpacing">6dip</dimen>
<dimen name="combo_paddingLeftRight">16dip</dimen>
<dimen name="combo_horizontalSpacing">8dip</dimen>
+ <dimen name="combo_rowPadding">10dip</dimen>
</resources>
diff --git a/res/values-w600dp/dimensions.xml b/res/values-w600dp/dimensions.xml
index eae9b0e..82fc37e 100644
--- a/res/values-w600dp/dimensions.xml
+++ b/res/values-w600dp/dimensions.xml
@@ -26,7 +26,8 @@
<!-- For the combined Bookmarks History view -->
<dimen name="combo_paddingTop">50dip</dimen>
<dimen name="combo_paddingLeftRight">134dip</dimen>
- <dimen name="combo_horizontalSpacing">20dip</dimen>
+ <dimen name="combo_horizontalSpacing">8dip</dimen>
+ <dimen name="combo_rowPadding">10dip</dimen>
<dimen name="qc_radius_start">50dip</dimen>
<dimen name="qc_radius_increment">70dip</dimen>
<dimen name="qc_slop">15dip</dimen>
diff --git a/res/values-w720dp/dimensions.xml b/res/values-w720dp/dimensions.xml
new file mode 100644
index 0000000..dcb5927
--- /dev/null
+++ b/res/values-w720dp/dimensions.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2011 The Android Open Source Project Licensed under the
+ Apache License, Version 2.0 (the "License"); you may not use this file
+ except in compliance with the License. You may obtain a copy of the
+ License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+ CONDITIONS OF ANY KIND, either express or implied. See the License for
+ the specific language governing permissions and limitations under the
+ License.
+-->
+<resources
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- The width of a selected tab -->
+ <dimen name="tab_width_selected">280dp</dimen>
+ <!-- The width of an unselected tab -->
+ <dimen name="tab_width_unselected">240dp</dimen>
+</resources>
diff --git a/res/values/dimensions.xml b/res/values/dimensions.xml
index 28b9e8b..a3404a3 100644
--- a/res/values/dimensions.xml
+++ b/res/values/dimensions.xml
@@ -13,9 +13,9 @@
<resources
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- The width of a selected tab -->
- <dimen name="tab_width_selected">280dp</dimen>
+ <dimen name="tab_width_selected">200dp</dimen>
<!-- The width of an unselected tab -->
- <dimen name="tab_width_unselected">240dp</dimen>
+ <dimen name="tab_width_unselected">160dp</dimen>
<dimen name="tab_height">44dp</dimen>
<dimen name="tab_overlap">8dp</dimen>
<dimen name="tab_addoverlap">14dp</dimen>
@@ -55,8 +55,9 @@
<dimen name="widgetVerticalSpacing">12dip</dimen>
<!-- For the combined Bookmarks History view -->
<dimen name="combo_paddingTop">10dip</dimen>
- <dimen name="combo_paddingLeftRight">8dip</dimen>
+ <dimen name="combo_paddingLeftRight">0dip</dimen>
<dimen name="combo_horizontalSpacing">6dip</dimen>
+ <dimen name="combo_rowPadding">0dip</dimen>
<dimen name="tab_view_thumbnail_height">76dip</dimen>
<!-- Preference activity side margins -->
<dimen name="preference_screen_side_margin">0dp</dimen>
diff --git a/src/com/android/browser/BrowserBookmarksPage.java b/src/com/android/browser/BrowserBookmarksPage.java
index 6843dcf..962d21c 100644
--- a/src/com/android/browser/BrowserBookmarksPage.java
+++ b/src/com/android/browser/BrowserBookmarksPage.java
@@ -560,6 +560,7 @@
int paddingTop = (int) res.getDimension(R.dimen.combo_paddingTop);
mRoot.setPadding(paddingLeftRight, paddingTop,
paddingLeftRight, 0);
+ getActivity().invalidateOptionsMenu();
}
@Override
diff --git a/src/com/android/browser/TabBar.java b/src/com/android/browser/TabBar.java
index a574d26..6c3949a 100644
--- a/src/com/android/browser/TabBar.java
+++ b/src/com/android/browser/TabBar.java
@@ -24,6 +24,7 @@
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.content.Context;
+import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
@@ -65,8 +66,8 @@
private TabControl mTabControl;
private XLargeUi mUi;
- private final int mTabWidthSelected;
- private final int mTabWidthUnselected;
+ private int mTabWidthSelected;
+ private int mTabWidthUnselected;
private TabScrollView mTabs;
@@ -138,6 +139,16 @@
mFocusPaint.setColor(res.getColor(R.color.tabFocusHighlight));
}
+ @Override
+ public void onConfigurationChanged(Configuration config) {
+ super.onConfigurationChanged(config);
+ Resources res = mActivity.getResources();
+ mTabWidthSelected = (int) res.getDimension(R.dimen.tab_width_selected);
+ mTabWidthUnselected = (int) res.getDimension(R.dimen.tab_width_unselected);
+ // force update of tab bar
+ mTabs.updateLayout();
+ }
+
void setUseQuickControls(boolean useQuickControls) {
mUseQuickControls = useQuickControls;
mNewTab.setVisibility(mUseQuickControls ? View.GONE
@@ -404,14 +415,18 @@
R.style.TabTitleSelected : R.style.TabTitleUnselected);
setHorizontalFadingEdgeEnabled(!mSelected);
super.setActivated(selected);
- LayoutParams lp = (LinearLayout.LayoutParams) getLayoutParams();
- lp.width = selected ? mTabWidthSelected : mTabWidthUnselected;
- lp.height = LayoutParams.MATCH_PARENT;
- setLayoutParams(lp);
+ updateLayoutParams();
setFocusable(!selected);
postInvalidate();
}
+ public void updateLayoutParams() {
+ LayoutParams lp = (LinearLayout.LayoutParams) getLayoutParams();
+ lp.width = mSelected ? mTabWidthSelected : mTabWidthUnselected;
+ lp.height = LayoutParams.MATCH_PARENT;
+ setLayoutParams(lp);
+ }
+
void setDisplayTitle(String title) {
mTitle.setText(title);
}
diff --git a/src/com/android/browser/TabScrollView.java b/src/com/android/browser/TabScrollView.java
index d0648b7..f43d6d6 100644
--- a/src/com/android/browser/TabScrollView.java
+++ b/src/com/android/browser/TabScrollView.java
@@ -16,6 +16,8 @@
package com.android.browser;
+import com.android.browser.TabBar.TabView;
+
import android.animation.ObjectAnimator;
import android.content.Context;
import android.util.AttributeSet;
@@ -85,6 +87,16 @@
ensureChildVisible(getSelectedTab());
}
+ // in case of a configuration change, adjust tab width
+ protected void updateLayout() {
+ final int count = mContentView.getChildCount();
+ for (int i = 0; i < count; i++) {
+ final TabView tv = (TabView) mContentView.getChildAt(i);
+ tv.updateLayoutParams();
+ }
+ ensureChildVisible(getSelectedTab());
+ }
+
void setSelectedTab(int position) {
View v = getSelectedTab();
if (v != null) {