summaryrefslogtreecommitdiffstats
path: root/src/com
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 /src/com
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
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/browser/Controller.java26
1 files changed, 26 insertions, 0 deletions
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() {