am f8d8b46a: Add a tip toast for double tap.
Merge commit 'f8d8b46a2c684d51cd661a9d479dd895420a90b2' into eclair-plus-aosp * commit 'f8d8b46a2c684d51cd661a9d479dd895420a90b2': Add a tip toast for double tap.
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
package android.webkit;
|
package android.webkit;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
@@ -193,12 +194,20 @@ public class WebSettings {
|
|||||||
// with Google' and the browser.
|
// with Google' and the browser.
|
||||||
static GoogleLocationSettingManager sGoogleLocationSettingManager;
|
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.
|
// Class to handle messages before WebCore is ready.
|
||||||
private class EventHandler {
|
private class EventHandler {
|
||||||
// Message id for syncing
|
// Message id for syncing
|
||||||
static final int SYNC = 0;
|
static final int SYNC = 0;
|
||||||
// Message id for setting priority
|
// Message id for setting priority
|
||||||
static final int PRIORITY = 1;
|
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
|
// Actual WebCore thread handler
|
||||||
private Handler mHandler;
|
private Handler mHandler;
|
||||||
|
|
||||||
@@ -224,6 +233,16 @@ public class WebSettings {
|
|||||||
setRenderPriority();
|
setRenderPriority();
|
||||||
break;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -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
|
* Transfer messages from the queue to the new WebCoreThread. Called from
|
||||||
* WebCore thread.
|
* WebCore thread.
|
||||||
@@ -1323,6 +1355,10 @@ public class WebSettings {
|
|||||||
}
|
}
|
||||||
sGoogleLocationSettingManager = new GoogleLocationSettingManager(mContext);
|
sGoogleLocationSettingManager = new GoogleLocationSettingManager(mContext);
|
||||||
sGoogleLocationSettingManager.start();
|
sGoogleLocationSettingManager.start();
|
||||||
|
SharedPreferences sp = mContext.getSharedPreferences(PREF_FILE,
|
||||||
|
Context.MODE_PRIVATE);
|
||||||
|
mDoubleTapToastCount = sp.getInt(DOUBLE_TAP_TOAST_COUNT,
|
||||||
|
mDoubleTapToastCount);
|
||||||
nativeSync(frame.mNativeFrame);
|
nativeSync(frame.mNativeFrame);
|
||||||
mSyncPending = false;
|
mSyncPending = false;
|
||||||
mEventHandler.createHandler();
|
mEventHandler.createHandler();
|
||||||
|
|||||||
@@ -3750,6 +3750,13 @@ public class WebView extends AbsoluteLayout
|
|||||||
&& !mZoomButtonsController.isVisible()
|
&& !mZoomButtonsController.isVisible()
|
||||||
&& mMinZoomScale < mMaxZoomScale) {
|
&& mMinZoomScale < mMaxZoomScale) {
|
||||||
mZoomButtonsController.setVisible(true);
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4522,7 +4529,8 @@ public class WebView extends AbsoluteLayout
|
|||||||
mZoomCenterY = mLastTouchY;
|
mZoomCenterY = mLastTouchY;
|
||||||
mInZoomOverview = !mInZoomOverview;
|
mInZoomOverview = !mInZoomOverview;
|
||||||
// remove the zoom control after double tap
|
// remove the zoom control after double tap
|
||||||
if (getSettings().getBuiltInZoomControls()) {
|
WebSettings settings = getSettings();
|
||||||
|
if (settings.getBuiltInZoomControls()) {
|
||||||
if (mZoomButtonsController.isVisible()) {
|
if (mZoomButtonsController.isVisible()) {
|
||||||
mZoomButtonsController.setVisible(false);
|
mZoomButtonsController.setVisible(false);
|
||||||
}
|
}
|
||||||
@@ -4534,6 +4542,7 @@ public class WebView extends AbsoluteLayout
|
|||||||
mZoomControls.hide();
|
mZoomControls.hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
settings.setDoubleTapToastCount(0);
|
||||||
if (mInZoomOverview) {
|
if (mInZoomOverview) {
|
||||||
// Force the titlebar fully reveal in overview mode
|
// Force the titlebar fully reveal in overview mode
|
||||||
if (mScrollY < getTitleHeight()) mScrollY = 0;
|
if (mScrollY < getTitleHeight()) mScrollY = 0;
|
||||||
|
|||||||
@@ -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. -->
|
<!-- 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>
|
<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
|
<!-- Title of an application permission, listed so the user can choose whether
|
||||||
they want to allow the application to do this. -->
|
they want to allow the application to do this. -->
|
||||||
<string name="permlab_readHistoryBookmarks">read Browser\'s history and bookmarks</string>
|
<string name="permlab_readHistoryBookmarks">read Browser\'s history and bookmarks</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user