summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2011-07-19 10:58:05 -0700
committerJohn Reck <jreck@google.com>2011-07-20 17:47:45 -0700
commit30b065e9c311ab1a8973caeb85a0861c8802b043 (patch)
treef152b0975c2a219cd6f83a6565b084b9f097bb60
parentd58feb0b606a9619e50c9a68cb49712783b959eb (diff)
downloadpackages_apps_browser-30b065e9c311ab1a8973caeb85a0861c8802b043.zip
packages_apps_browser-30b065e9c311ab1a8973caeb85a0861c8802b043.tar.gz
packages_apps_browser-30b065e9c311ab1a8973caeb85a0861c8802b043.tar.bz2
ActionBar change for phones
Bug: 5022239 Change-Id: I0ccf131468cd129f4770ef85bde8d023670c33c8
-rw-r--r--res/layout/tab_bar.xml5
-rw-r--r--res/values-sw600dp/styles.xml2
-rw-r--r--res/values/styles.xml9
-rw-r--r--src/com/android/browser/Controller.java26
4 files changed, 31 insertions, 11 deletions
diff --git a/res/layout/tab_bar.xml b/res/layout/tab_bar.xml
index 1710218..2790362 100644
--- a/res/layout/tab_bar.xml
+++ b/res/layout/tab_bar.xml
@@ -14,9 +14,8 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tabbarcontent"
android:layout_width="match_parent"
- android:layout_height="56dip"
+ android:layout_height="?android:attr/actionBarSize"
android:orientation="horizontal"
- style="@style/ActionBarStyle"
>
<com.android.browser.TabScrollView
android:id="@+id/tabs"
@@ -31,4 +30,4 @@
android:layout_height="44dip"
style="@style/HoloButton"
android:background="@drawable/add_tab_selector" />
-</merge> \ No newline at end of file
+</merge>
diff --git a/res/values-sw600dp/styles.xml b/res/values-sw600dp/styles.xml
index 1bd6172..41e09ae 100644
--- a/res/values-sw600dp/styles.xml
+++ b/res/values-sw600dp/styles.xml
@@ -20,7 +20,7 @@
<item name="android:windowActionBar">true</item>
<item name="android:windowNoTitle">false</item>
<item name="android:actionBarStyle">@style/ActionBarStyle</item>
- <item name="android:actionButtonStyle">@style/ActionButton</item>
+ <item name="android:actionBarSize">56dip</item>
</style>
<style name="Suggestions" parent="@android:style/Widget.Holo.AutoCompleteTextView">
</style>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 061d600..76a698e 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -23,9 +23,8 @@
<item name="android:colorBackground">#FFFFFFFF</item>
<item name="android:windowActionBar">true</item>
<item name="android:windowNoTitle">false</item>
- <item name="android:windowActionBarOverlay">true</item>
+ <item name="android:windowActionBarOverlay">false</item>
<item name="android:actionBarStyle">@style/ActionBarStyle</item>
- <item name="android:actionButtonStyle">@style/ActionButton</item>
</style>
<style name="DialogWhenLarge" parent="@android:style/Theme.Holo.DialogWhenLarge" >
<item name="android:windowActionBar">false</item>
@@ -40,14 +39,10 @@
<item name="android:backgroundDimEnabled">false</item>
<item name="android:windowIsTranslucent">true</item>
</style>
- <style name="ActionBarStyle">
- <item name="android:height">56dip</item>
+ <style name="ActionBarStyle" parent="@android:style/Widget.Holo.ActionBar">
<item name="android:background">@drawable/bg_browsertabs</item>
<item name="android:displayOptions"></item>
</style>
- <style name="ActionButton">
- <item name="android:background">?android:attr/selectableItemBackground</item>
- </style>
<style name="Suggestions" parent="@android:style/Widget.Holo.AutoCompleteTextView">
<item name="android:popupBackground">#D0000000</item>
<item name="android:dropDownVerticalOffset">0dip</item>
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index 8a4433e..03e2d8b 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -30,6 +30,7 @@ import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Configuration;
+import android.content.res.TypedArray;
import android.database.ContentObserver;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
@@ -208,6 +209,8 @@ public class Controller
private DataController mDataController;
private CrashRecoveryHandler mCrashRecoveryHandler;
+ private boolean mSimulateActionBarOverlayMode;
+
private static class ClearThumbnails extends AsyncTask<File, Void, Void> {
@Override
public Void doInBackground(File... files) {
@@ -261,6 +264,7 @@ public class Controller
mSystemAllowGeolocationOrigins.start();
retainIconsOnStartup();
+ mSimulateActionBarOverlayMode = !BrowserActivity.isTablet(mActivity);
}
void start(final Bundle icicle, final Intent intent) {
@@ -1792,11 +1796,28 @@ public class Controller
mActivity.startActivity(intent);
}
+ int getActionModeHeight() {
+ TypedArray actionBarSizeTypedArray = mActivity.obtainStyledAttributes(
+ new int[] { android.R.attr.actionBarSize });
+ int size = (int) actionBarSizeTypedArray.getDimension(0, 0f);
+ actionBarSizeTypedArray.recycle();
+ return size;
+ }
+
// action mode
void onActionModeStarted(ActionMode mode) {
mUi.onActionModeStarted(mode);
mActionMode = mode;
+ if (mSimulateActionBarOverlayMode) {
+ WebView web = getCurrentWebView();
+ // Simulate overlay mode by scrolling the webview the amount it will be
+ // pushed down. Actual overlay mode doesn't work for us as otherwise
+ // the CAB will, well, overlay the content, which breaks things like
+ // find on page.
+ int scrollBy = getActionModeHeight();
+ web.scrollBy(0, scrollBy);
+ }
}
/*
@@ -1825,6 +1846,11 @@ public class Controller
if (!isInCustomActionMode()) return;
mUi.onActionModeFinished(mInLoad);
mActionMode = null;
+ if (mSimulateActionBarOverlayMode) {
+ WebView web = getCurrentWebView();
+ int scrollBy = getActionModeHeight();
+ web.scrollBy(0, -scrollBy);
+ }
}
boolean isInLoad() {