diff options
-rw-r--r-- | core/java/android/webkit/WebView.java | 43 | ||||
-rw-r--r-- | core/java/android/webkit/WebViewCore.java | 29 |
2 files changed, 45 insertions, 27 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 29af64efb281..cccdf377a89e 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -27,7 +27,6 @@ import android.content.DialogInterface; import android.content.DialogInterface.OnCancelListener; import android.content.Intent; import android.content.IntentFilter; -import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.res.Configuration; import android.database.DataSetObserver; @@ -59,7 +58,6 @@ import android.os.Message; import android.os.StrictMode; import android.provider.Settings; import android.speech.tts.TextToSpeech; -import android.text.TextUtils; import android.util.AttributeSet; import android.util.EventLog; import android.util.Log; @@ -126,7 +124,8 @@ import java.util.regex.Pattern; import javax.microedition.khronos.egl.EGL10; import javax.microedition.khronos.egl.EGLContext; import javax.microedition.khronos.egl.EGLDisplay; -import static javax.microedition.khronos.egl.EGL10.*; + +import static javax.microedition.khronos.egl.EGL10.EGL_DEFAULT_DISPLAY; /** * <p>A View that displays web pages. This class is the basis upon which you @@ -333,6 +332,7 @@ public class WebView extends AbsoluteLayout ViewGroup.OnHierarchyChangeListener { private class InnerGlobalLayoutListener implements ViewTreeObserver.OnGlobalLayoutListener { + @Override public void onGlobalLayout() { if (isShown()) { setGLRectViewport(); @@ -341,6 +341,7 @@ public class WebView extends AbsoluteLayout } private class InnerScrollChangedListener implements ViewTreeObserver.OnScrollChangedListener { + @Override public void onScrollChanged() { if (isShown()) { setGLRectViewport(); @@ -1242,7 +1243,7 @@ public class WebView extends AbsoluteLayout PackageManager pm = mContext.getPackageManager(); for (String name : sGoogleApps) { try { - PackageInfo pInfo = pm.getPackageInfo(name, + pm.getPackageInfo(name, PackageManager.GET_ACTIVITIES | PackageManager.GET_SERVICES); installedPackages.add(name); } catch (PackageManager.NameNotFoundException e) { @@ -1414,23 +1415,27 @@ public class WebView extends AbsoluteLayout .setMessage(com.android.internal.R.string.save_password_message) .setPositiveButton(com.android.internal.R.string.save_password_notnow, new DialogInterface.OnClickListener() { + @Override public void onClick(DialogInterface dialog, int which) { resumeMsg.sendToTarget(); } }) .setNeutralButton(com.android.internal.R.string.save_password_remember, new DialogInterface.OnClickListener() { + @Override public void onClick(DialogInterface dialog, int which) { remember.sendToTarget(); } }) .setNegativeButton(com.android.internal.R.string.save_password_never, new DialogInterface.OnClickListener() { + @Override public void onClick(DialogInterface dialog, int which) { neverRemember.sendToTarget(); } }) .setOnCancelListener(new OnCancelListener() { + @Override public void onCancel(DialogInterface dialog) { resumeMsg.sendToTarget(); } @@ -1516,6 +1521,7 @@ public class WebView extends AbsoluteLayout * * @deprecated This method is now obsolete. */ + @Deprecated public int getVisibleTitleHeight() { checkThread(); return getVisibleTitleHeightImpl(); @@ -1854,6 +1860,7 @@ public class WebView extends AbsoluteLayout // contains valid data. final File temp = new File(dest.getPath() + ".writing"); new Thread(new Runnable() { + @Override public void run() { FileOutputStream out = null; try { @@ -1923,6 +1930,7 @@ public class WebView extends AbsoluteLayout final FileInputStream in = new FileInputStream(src); final Bundle copy = new Bundle(b); new Thread(new Runnable() { + @Override public void run() { try { final Picture p = Picture.createFromStream(in); @@ -1930,6 +1938,7 @@ public class WebView extends AbsoluteLayout // Post a runnable on the main thread to update the // history picture fields. mPrivateHandler.post(new Runnable() { + @Override public void run() { restoreHistoryPictureFields(p, copy); } @@ -2658,8 +2667,8 @@ public class WebView extends AbsoluteLayout int slop = viewToContentDimension(mNavSlop); cursorBounds.inset(-slop, -slop); if (cursorBounds.contains(contentX, contentY)) { - contentX = (int) cursorBounds.centerX(); - contentY = (int) cursorBounds.centerY(); + contentX = cursorBounds.centerX(); + contentY = cursorBounds.centerY(); } } } @@ -5054,6 +5063,7 @@ public class WebView extends AbsoluteLayout mWebSettings = getSettings(); } + @Override public void run() { ArrayList<String> pastEntries = new ArrayList<String>(); @@ -5716,6 +5726,7 @@ public class WebView extends AbsoluteLayout * @deprecated WebView no longer needs to implement * ViewGroup.OnHierarchyChangeListener. This method does nothing now. */ + @Override // Cannot add @hide as this can always be accessed via the interface. @Deprecated public void onChildViewAdded(View parent, View child) {} @@ -5724,6 +5735,7 @@ public class WebView extends AbsoluteLayout * @deprecated WebView no longer needs to implement * ViewGroup.OnHierarchyChangeListener. This method does nothing now. */ + @Override // Cannot add @hide as this can always be accessed via the interface. @Deprecated public void onChildViewRemoved(View p, View child) {} @@ -5732,6 +5744,7 @@ public class WebView extends AbsoluteLayout * @deprecated WebView should not have implemented * ViewTreeObserver.OnGlobalFocusChangeListener. This method does nothing now. */ + @Override // Cannot add @hide as this can always be accessed via the interface. @Deprecated public void onGlobalFocusChanged(View oldFocus, View newFocus) { @@ -6168,9 +6181,10 @@ public class WebView extends AbsoluteLayout } if (DEBUG_TOUCH_HIGHLIGHT) { if (getSettings().getNavDump()) { - mTouchHighlightX = (int) x + mScrollX; - mTouchHighlightY = (int) y + mScrollY; + mTouchHighlightX = x + mScrollX; + mTouchHighlightY = y + mScrollY; mPrivateHandler.postDelayed(new Runnable() { + @Override public void run() { mTouchHighlightX = mTouchHighlightY = 0; invalidate(); @@ -6762,8 +6776,6 @@ public class WebView extends AbsoluteLayout int oldY = mScrollY; int rangeX = computeMaxScrollX(); int rangeY = computeMaxScrollY(); - int overscrollDistance = mOverscrollDistance; - // Check for the original scrolling layer in case we change // directions. mTouchMode might be TOUCH_DRAG_MODE if we have // reached the edge of a layer but mScrollingLayer will be non-zero @@ -7476,8 +7488,8 @@ public class WebView extends AbsoluteLayout return false; } mDragFromTextInput = true; - event.offsetLocation((float) (mWebTextView.getLeft() - mScrollX), - (float) (mWebTextView.getTop() - mScrollY)); + event.offsetLocation((mWebTextView.getLeft() - mScrollX), + (mWebTextView.getTop() - mScrollY)); boolean result = onTouchEvent(event); mDragFromTextInput = false; return result; @@ -9032,7 +9044,7 @@ public class WebView extends AbsoluteLayout if (position < 0 || position >= getCount()) { return null; } - return (Container) getItem(position); + return getItem(position); } @Override @@ -9131,6 +9143,7 @@ public class WebView extends AbsoluteLayout } } + @Override public void run() { final ListView listView = (ListView) LayoutInflater.from(mContext) .inflate(com.android.internal.R.layout.select_dialog, null); @@ -9141,6 +9154,7 @@ public class WebView extends AbsoluteLayout if (mMultiple) { b.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { + @Override public void onClick(DialogInterface dialog, int which) { mWebViewCore.sendMessage( EventHub.LISTBOX_CHOICES, @@ -9149,6 +9163,7 @@ public class WebView extends AbsoluteLayout }}); b.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { + @Override public void onClick(DialogInterface dialog, int which) { mWebViewCore.sendMessage( EventHub.SINGLE_LISTBOX_CHOICE, -2, 0); @@ -9172,6 +9187,7 @@ public class WebView extends AbsoluteLayout } } else { listView.setOnItemClickListener(new OnItemClickListener() { + @Override public void onItemClick(AdapterView<?> parent, View v, int position, long id) { // Rather than sending the message right away, send it @@ -9192,6 +9208,7 @@ public class WebView extends AbsoluteLayout } } mListBoxDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { + @Override public void onCancel(DialogInterface dialog) { mWebViewCore.sendMessage( EventHub.SINGLE_LISTBOX_CHOICE, -2, 0); diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java index d99e264a632b..cb0c7a1b611c 100644 --- a/core/java/android/webkit/WebViewCore.java +++ b/core/java/android/webkit/WebViewCore.java @@ -37,18 +37,14 @@ import android.view.KeyEvent; import android.view.MotionEvent; import android.view.SurfaceView; import android.view.View; -import android.webkit.DeviceMotionService; -import android.webkit.DeviceMotionAndOrientationManager; -import android.webkit.DeviceOrientationService; -import android.webkit.JniUtil; + +import junit.framework.Assert; import java.util.ArrayList; import java.util.Collection; import java.util.Map; import java.util.Set; -import junit.framework.Assert; - /** * @hide */ @@ -382,6 +378,7 @@ public final class WebViewCore { mCallbackProxy.onExceededDatabaseQuota(url, databaseIdentifier, currentQuota, estimatedSize, getUsedQuota(), new WebStorage.QuotaUpdater() { + @Override public void updateQuota(long quota) { nativeSetNewStorageLimit(quota); } @@ -396,6 +393,7 @@ public final class WebViewCore { protected void reachedMaxAppCacheSize(long spaceNeeded) { mCallbackProxy.onReachedMaxAppCacheSize(spaceNeeded, getUsedQuota(), new WebStorage.QuotaUpdater() { + @Override public void updateQuota(long quota) { nativeSetNewStorageLimit(quota); } @@ -404,6 +402,7 @@ public final class WebViewCore { protected void populateVisitedLinks() { ValueCallback callback = new ValueCallback<String[]>() { + @Override public void onReceiveValue(String[] value) { sendMessage(EventHub.POPULATE_VISITED_LINKS, (Object)value); } @@ -420,14 +419,15 @@ public final class WebViewCore { protected void geolocationPermissionsShowPrompt(String origin) { mCallbackProxy.onGeolocationPermissionsShowPrompt(origin, new GeolocationPermissions.Callback() { - public void invoke(String origin, boolean allow, boolean remember) { - GeolocationPermissionsData data = new GeolocationPermissionsData(); - data.mOrigin = origin; - data.mAllow = allow; - data.mRemember = remember; - // Marshall to WebCore thread. - sendMessage(EventHub.GEOLOCATION_PERMISSIONS_PROVIDE, data); - } + @Override + public void invoke(String origin, boolean allow, boolean remember) { + GeolocationPermissionsData data = new GeolocationPermissionsData(); + data.mOrigin = origin; + data.mAllow = allow; + data.mRemember = remember; + // Marshall to WebCore thread. + sendMessage(EventHub.GEOLOCATION_PERMISSIONS_PROVIDE, data); + } }); } @@ -677,6 +677,7 @@ public final class WebViewCore { private static final int REDUCE_PRIORITY = 1; private static final int RESUME_PRIORITY = 2; + @Override public void run() { Looper.prepare(); Assert.assertNull(sWebCoreHandler); |