Loading core/java/android/webkit/WebSettings.java +36 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.webkit; import android.content.Context; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.os.Build; import android.os.Handler; Loading Loading @@ -193,12 +194,20 @@ public class WebSettings { // with Google' and the browser. static GoogleLocationSettingManager sGoogleLocationSettingManager; // private WebSettings, not accessible by the host activity private int mDoubleTapToastCount = 3; private static final String PREF_FILE = "WebViewSettings"; private static final String DOUBLE_TAP_TOAST_COUNT = "double_tap_toast_count"; // Class to handle messages before WebCore is ready. private class EventHandler { // Message id for syncing static final int SYNC = 0; // Message id for setting priority static final int PRIORITY = 1; // Message id for writing double-tap toast count static final int SET_DOUBLE_TAP_TOAST_COUNT = 2; // Actual WebCore thread handler private Handler mHandler; Loading @@ -224,6 +233,16 @@ public class WebSettings { setRenderPriority(); break; } case SET_DOUBLE_TAP_TOAST_COUNT: { SharedPreferences.Editor editor = mContext .getSharedPreferences(PREF_FILE, Context.MODE_PRIVATE).edit(); editor.putInt(DOUBLE_TAP_TOAST_COUNT, mDoubleTapToastCount); editor.commit(); break; } } } }; Loading Loading @@ -1311,6 +1330,19 @@ public class WebSettings { } } int getDoubleTapToastCount() { return mDoubleTapToastCount; } void setDoubleTapToastCount(int count) { if (mDoubleTapToastCount != count) { mDoubleTapToastCount = count; // write the settings in the non-UI thread mEventHandler.sendMessage(Message.obtain(null, EventHandler.SET_DOUBLE_TAP_TOAST_COUNT)); } } /** * Transfer messages from the queue to the new WebCoreThread. Called from * WebCore thread. Loading @@ -1323,6 +1355,10 @@ public class WebSettings { } sGoogleLocationSettingManager = new GoogleLocationSettingManager(mContext); sGoogleLocationSettingManager.start(); SharedPreferences sp = mContext.getSharedPreferences(PREF_FILE, Context.MODE_PRIVATE); mDoubleTapToastCount = sp.getInt(DOUBLE_TAP_TOAST_COUNT, mDoubleTapToastCount); nativeSync(frame.mNativeFrame); mSyncPending = false; mEventHandler.createHandler(); Loading core/java/android/webkit/WebView.java +10 −1 Original line number Diff line number Diff line Loading @@ -3750,6 +3750,13 @@ public class WebView extends AbsoluteLayout && !mZoomButtonsController.isVisible() && mMinZoomScale < mMaxZoomScale) { mZoomButtonsController.setVisible(true); int count = settings.getDoubleTapToastCount(); if (mInZoomOverview && count > 0) { settings.setDoubleTapToastCount(count--); Toast.makeText(mContext, com.android.internal.R.string.double_tap_toast, Toast.LENGTH_SHORT).show(); } } } Loading Loading @@ -4522,7 +4529,8 @@ public class WebView extends AbsoluteLayout mZoomCenterY = mLastTouchY; mInZoomOverview = !mInZoomOverview; // remove the zoom control after double tap if (getSettings().getBuiltInZoomControls()) { WebSettings settings = getSettings(); if (settings.getBuiltInZoomControls()) { if (mZoomButtonsController.isVisible()) { mZoomButtonsController.setVisible(false); } Loading @@ -4534,6 +4542,7 @@ public class WebView extends AbsoluteLayout mZoomControls.hide(); } } settings.setDoubleTapToastCount(0); if (mInZoomOverview) { // Force the titlebar fully reveal in overview mode if (mScrollY < getTitleHeight()) mScrollY = 0; Loading core/res/res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -1391,6 +1391,9 @@ <!-- Title of the WebView save password dialog. If the user enters a password in a form on a website, a dialog will come up asking if they want to save the password. --> <string name="save_password_label">Confirm</string> <!-- Toast for double-tap --> <string name="double_tap_toast">Tip: double-tap to zoom in and out.</string> <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permlab_readHistoryBookmarks">read Browser\'s history and bookmarks</string> Loading Loading
core/java/android/webkit/WebSettings.java +36 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.webkit; import android.content.Context; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.os.Build; import android.os.Handler; Loading Loading @@ -193,12 +194,20 @@ public class WebSettings { // with Google' and the browser. static GoogleLocationSettingManager sGoogleLocationSettingManager; // private WebSettings, not accessible by the host activity private int mDoubleTapToastCount = 3; private static final String PREF_FILE = "WebViewSettings"; private static final String DOUBLE_TAP_TOAST_COUNT = "double_tap_toast_count"; // Class to handle messages before WebCore is ready. private class EventHandler { // Message id for syncing static final int SYNC = 0; // Message id for setting priority static final int PRIORITY = 1; // Message id for writing double-tap toast count static final int SET_DOUBLE_TAP_TOAST_COUNT = 2; // Actual WebCore thread handler private Handler mHandler; Loading @@ -224,6 +233,16 @@ public class WebSettings { setRenderPriority(); break; } case SET_DOUBLE_TAP_TOAST_COUNT: { SharedPreferences.Editor editor = mContext .getSharedPreferences(PREF_FILE, Context.MODE_PRIVATE).edit(); editor.putInt(DOUBLE_TAP_TOAST_COUNT, mDoubleTapToastCount); editor.commit(); break; } } } }; Loading Loading @@ -1311,6 +1330,19 @@ public class WebSettings { } } int getDoubleTapToastCount() { return mDoubleTapToastCount; } void setDoubleTapToastCount(int count) { if (mDoubleTapToastCount != count) { mDoubleTapToastCount = count; // write the settings in the non-UI thread mEventHandler.sendMessage(Message.obtain(null, EventHandler.SET_DOUBLE_TAP_TOAST_COUNT)); } } /** * Transfer messages from the queue to the new WebCoreThread. Called from * WebCore thread. Loading @@ -1323,6 +1355,10 @@ public class WebSettings { } sGoogleLocationSettingManager = new GoogleLocationSettingManager(mContext); sGoogleLocationSettingManager.start(); SharedPreferences sp = mContext.getSharedPreferences(PREF_FILE, Context.MODE_PRIVATE); mDoubleTapToastCount = sp.getInt(DOUBLE_TAP_TOAST_COUNT, mDoubleTapToastCount); nativeSync(frame.mNativeFrame); mSyncPending = false; mEventHandler.createHandler(); Loading
core/java/android/webkit/WebView.java +10 −1 Original line number Diff line number Diff line Loading @@ -3750,6 +3750,13 @@ public class WebView extends AbsoluteLayout && !mZoomButtonsController.isVisible() && mMinZoomScale < mMaxZoomScale) { mZoomButtonsController.setVisible(true); int count = settings.getDoubleTapToastCount(); if (mInZoomOverview && count > 0) { settings.setDoubleTapToastCount(count--); Toast.makeText(mContext, com.android.internal.R.string.double_tap_toast, Toast.LENGTH_SHORT).show(); } } } Loading Loading @@ -4522,7 +4529,8 @@ public class WebView extends AbsoluteLayout mZoomCenterY = mLastTouchY; mInZoomOverview = !mInZoomOverview; // remove the zoom control after double tap if (getSettings().getBuiltInZoomControls()) { WebSettings settings = getSettings(); if (settings.getBuiltInZoomControls()) { if (mZoomButtonsController.isVisible()) { mZoomButtonsController.setVisible(false); } Loading @@ -4534,6 +4542,7 @@ public class WebView extends AbsoluteLayout mZoomControls.hide(); } } settings.setDoubleTapToastCount(0); if (mInZoomOverview) { // Force the titlebar fully reveal in overview mode if (mScrollY < getTitleHeight()) mScrollY = 0; Loading
core/res/res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -1391,6 +1391,9 @@ <!-- Title of the WebView save password dialog. If the user enters a password in a form on a website, a dialog will come up asking if they want to save the password. --> <string name="save_password_label">Confirm</string> <!-- Toast for double-tap --> <string name="double_tap_toast">Tip: double-tap to zoom in and out.</string> <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permlab_readHistoryBookmarks">read Browser\'s history and bookmarks</string> Loading