Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.webkit; |
| 18 | |
Tima Vaisburd | cf49a23 | 2017-03-28 11:35:58 -0700 | [diff] [blame] | 19 | import android.annotation.NonNull; |
| 20 | import android.annotation.Nullable; |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 21 | import android.annotation.SystemApi; |
Hui Shu | f119c52 | 2015-10-08 10:07:13 -0700 | [diff] [blame] | 22 | import android.content.Intent; |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 23 | import android.content.res.Configuration; |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 24 | import android.graphics.Bitmap; |
| 25 | import android.graphics.Canvas; |
John Reck | a5408e6 | 2012-03-16 14:18:44 -0700 | [diff] [blame] | 26 | import android.graphics.Paint; |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 27 | import android.graphics.Picture; |
| 28 | import android.graphics.Rect; |
| 29 | import android.graphics.drawable.Drawable; |
Selim Gurun | 4c8093a | 2015-03-10 17:40:06 -0700 | [diff] [blame] | 30 | import android.net.Uri; |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 31 | import android.net.http.SslCertificate; |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 32 | import android.os.Bundle; |
Selim Gurun | e319dad | 2016-03-17 01:40:40 +0000 | [diff] [blame] | 33 | import android.os.Handler; |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 34 | import android.os.Message; |
Selim Gurun | da7d642 | 2013-09-06 14:39:05 -0700 | [diff] [blame] | 35 | import android.print.PrintDocumentAdapter; |
Tao Bai | a571733 | 2017-03-30 14:58:53 -0700 | [diff] [blame] | 36 | import android.util.SparseArray; |
Hui Shu | ecdce96 | 2016-02-04 15:00:19 -0800 | [diff] [blame] | 37 | import android.view.DragEvent; |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 38 | import android.view.KeyEvent; |
| 39 | import android.view.MotionEvent; |
| 40 | import android.view.View; |
| 41 | import android.view.ViewGroup.LayoutParams; |
| 42 | import android.view.accessibility.AccessibilityEvent; |
| 43 | import android.view.accessibility.AccessibilityNodeInfo; |
Ben Murdoch | e3f9071 | 2013-06-05 14:19:48 +0100 | [diff] [blame] | 44 | import android.view.accessibility.AccessibilityNodeProvider; |
Tao Bai | a571733 | 2017-03-30 14:58:53 -0700 | [diff] [blame] | 45 | import android.view.autofill.AutofillValue; |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 46 | import android.view.inputmethod.EditorInfo; |
| 47 | import android.view.inputmethod.InputConnection; |
Tima Vaisburd | cf49a23 | 2017-03-28 11:35:58 -0700 | [diff] [blame] | 48 | import android.view.textclassifier.TextClassifier; |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 49 | import android.webkit.WebView.HitTestResult; |
| 50 | import android.webkit.WebView.PictureListener; |
Tobias Sargeant | a8352f4 | 2015-03-03 18:07:40 +0000 | [diff] [blame] | 51 | import android.webkit.WebView.VisualStateCallback; |
| 52 | |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 53 | |
John Reck | 926cf56 | 2012-06-14 10:00:31 -0700 | [diff] [blame] | 54 | import java.io.BufferedWriter; |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 55 | import java.io.File; |
| 56 | import java.util.Map; |
| 57 | |
| 58 | /** |
| 59 | * WebView backend provider interface: this interface is the abstract backend to a WebView |
| 60 | * instance; each WebView object is bound to exactly one WebViewProvider object which implements |
| 61 | * the runtime behavior of that WebView. |
| 62 | * |
| 63 | * All methods must behave as per their namesake in {@link WebView}, unless otherwise noted. |
| 64 | * |
| 65 | * @hide Not part of the public API; only required by system implementors. |
| 66 | */ |
Ignacio Solla | 451e338 | 2014-11-10 10:35:54 +0000 | [diff] [blame] | 67 | @SystemApi |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 68 | public interface WebViewProvider { |
| 69 | //------------------------------------------------------------------------- |
| 70 | // Main interface for backend provider of the WebView class. |
| 71 | //------------------------------------------------------------------------- |
| 72 | /** |
| 73 | * Initialize this WebViewProvider instance. Called after the WebView has fully constructed. |
| 74 | * @param javaScriptInterfaces is a Map of interface names, as keys, and |
| 75 | * object implementing those interfaces, as values. |
Nate Fischer | 0a6140d | 2017-09-05 12:37:49 -0700 | [diff] [blame] | 76 | * @param privateBrowsing If {@code true} the web view will be initialized in private / |
| 77 | * incognito mode. |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 78 | */ |
| 79 | public void init(Map<String, Object> javaScriptInterfaces, |
| 80 | boolean privateBrowsing); |
| 81 | |
Paul Miller | c8694a0 | 2015-06-05 11:23:03 -0700 | [diff] [blame] | 82 | // Deprecated - should never be called |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 83 | public void setHorizontalScrollbarOverlay(boolean overlay); |
| 84 | |
Paul Miller | c8694a0 | 2015-06-05 11:23:03 -0700 | [diff] [blame] | 85 | // Deprecated - should never be called |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 86 | public void setVerticalScrollbarOverlay(boolean overlay); |
| 87 | |
Paul Miller | c8694a0 | 2015-06-05 11:23:03 -0700 | [diff] [blame] | 88 | // Deprecated - should never be called |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 89 | public boolean overlayHorizontalScrollbar(); |
| 90 | |
Paul Miller | c8694a0 | 2015-06-05 11:23:03 -0700 | [diff] [blame] | 91 | // Deprecated - should never be called |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 92 | public boolean overlayVerticalScrollbar(); |
| 93 | |
| 94 | public int getVisibleTitleHeight(); |
| 95 | |
| 96 | public SslCertificate getCertificate(); |
| 97 | |
| 98 | public void setCertificate(SslCertificate certificate); |
| 99 | |
| 100 | public void savePassword(String host, String username, String password); |
| 101 | |
| 102 | public void setHttpAuthUsernamePassword(String host, String realm, |
| 103 | String username, String password); |
| 104 | |
| 105 | public String[] getHttpAuthUsernamePassword(String host, String realm); |
| 106 | |
| 107 | /** |
| 108 | * See {@link WebView#destroy()}. |
| 109 | * As well as releasing the internal state and resources held by the implementation, |
| 110 | * the provider should null all references it holds on the WebView proxy class, and ensure |
| 111 | * no further method calls are made to it. |
| 112 | */ |
| 113 | public void destroy(); |
| 114 | |
| 115 | public void setNetworkAvailable(boolean networkUp); |
| 116 | |
| 117 | public WebBackForwardList saveState(Bundle outState); |
| 118 | |
| 119 | public boolean savePicture(Bundle b, final File dest); |
| 120 | |
| 121 | public boolean restorePicture(Bundle b, File src); |
| 122 | |
| 123 | public WebBackForwardList restoreState(Bundle inState); |
| 124 | |
| 125 | public void loadUrl(String url, Map<String, String> additionalHttpHeaders); |
| 126 | |
| 127 | public void loadUrl(String url); |
| 128 | |
| 129 | public void postUrl(String url, byte[] postData); |
| 130 | |
| 131 | public void loadData(String data, String mimeType, String encoding); |
| 132 | |
| 133 | public void loadDataWithBaseURL(String baseUrl, String data, |
| 134 | String mimeType, String encoding, String historyUrl); |
| 135 | |
Ben Murdoch | a5cdd51 | 2013-07-17 16:25:07 +0100 | [diff] [blame] | 136 | public void evaluateJavaScript(String script, ValueCallback<String> resultCallback); |
| 137 | |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 138 | public void saveWebArchive(String filename); |
| 139 | |
| 140 | public void saveWebArchive(String basename, boolean autoname, ValueCallback<String> callback); |
| 141 | |
| 142 | public void stopLoading(); |
| 143 | |
| 144 | public void reload(); |
| 145 | |
| 146 | public boolean canGoBack(); |
| 147 | |
| 148 | public void goBack(); |
| 149 | |
| 150 | public boolean canGoForward(); |
| 151 | |
| 152 | public void goForward(); |
| 153 | |
| 154 | public boolean canGoBackOrForward(int steps); |
| 155 | |
| 156 | public void goBackOrForward(int steps); |
| 157 | |
| 158 | public boolean isPrivateBrowsingEnabled(); |
| 159 | |
| 160 | public boolean pageUp(boolean top); |
| 161 | |
| 162 | public boolean pageDown(boolean bottom); |
| 163 | |
Tobias Sargeant | a8352f4 | 2015-03-03 18:07:40 +0000 | [diff] [blame] | 164 | public void insertVisualStateCallback(long requestId, VisualStateCallback callback); |
| 165 | |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 166 | public void clearView(); |
| 167 | |
| 168 | public Picture capturePicture(); |
| 169 | |
Selim Gurun | 23a1af6 | 2014-03-14 16:52:45 -0700 | [diff] [blame] | 170 | public PrintDocumentAdapter createPrintDocumentAdapter(String documentName); |
Selim Gurun | 2167c0b | 2013-08-05 15:23:09 -0700 | [diff] [blame] | 171 | |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 172 | public float getScale(); |
| 173 | |
| 174 | public void setInitialScale(int scaleInPercent); |
| 175 | |
| 176 | public void invokeZoomPicker(); |
| 177 | |
| 178 | public HitTestResult getHitTestResult(); |
| 179 | |
| 180 | public void requestFocusNodeHref(Message hrefMsg); |
| 181 | |
| 182 | public void requestImageRef(Message msg); |
| 183 | |
| 184 | public String getUrl(); |
| 185 | |
| 186 | public String getOriginalUrl(); |
| 187 | |
| 188 | public String getTitle(); |
| 189 | |
| 190 | public Bitmap getFavicon(); |
| 191 | |
| 192 | public String getTouchIconUrl(); |
| 193 | |
| 194 | public int getProgress(); |
| 195 | |
| 196 | public int getContentHeight(); |
| 197 | |
| 198 | public int getContentWidth(); |
| 199 | |
| 200 | public void pauseTimers(); |
| 201 | |
| 202 | public void resumeTimers(); |
| 203 | |
| 204 | public void onPause(); |
| 205 | |
| 206 | public void onResume(); |
| 207 | |
| 208 | public boolean isPaused(); |
| 209 | |
| 210 | public void freeMemory(); |
| 211 | |
| 212 | public void clearCache(boolean includeDiskFiles); |
| 213 | |
| 214 | public void clearFormData(); |
| 215 | |
| 216 | public void clearHistory(); |
| 217 | |
| 218 | public void clearSslPreferences(); |
| 219 | |
| 220 | public WebBackForwardList copyBackForwardList(); |
| 221 | |
Victoria Lease | d405a43 | 2012-03-22 15:53:48 -0700 | [diff] [blame] | 222 | public void setFindListener(WebView.FindListener listener); |
Victoria Lease | abeb6a7 | 2012-03-05 16:29:12 -0800 | [diff] [blame] | 223 | |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 224 | public void findNext(boolean forward); |
| 225 | |
| 226 | public int findAll(String find); |
| 227 | |
Victoria Lease | abeb6a7 | 2012-03-05 16:29:12 -0800 | [diff] [blame] | 228 | public void findAllAsync(String find); |
| 229 | |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 230 | public boolean showFindDialog(String text, boolean showIme); |
| 231 | |
| 232 | public void clearMatches(); |
| 233 | |
| 234 | public void documentHasImages(Message response); |
| 235 | |
| 236 | public void setWebViewClient(WebViewClient client); |
| 237 | |
Nate Fischer | 6e58584 | 2016-09-29 18:30:58 -0700 | [diff] [blame] | 238 | public WebViewClient getWebViewClient(); |
| 239 | |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 240 | public void setDownloadListener(DownloadListener listener); |
| 241 | |
| 242 | public void setWebChromeClient(WebChromeClient client); |
| 243 | |
Nate Fischer | 6e58584 | 2016-09-29 18:30:58 -0700 | [diff] [blame] | 244 | public WebChromeClient getWebChromeClient(); |
| 245 | |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 246 | public void setPictureListener(PictureListener listener); |
| 247 | |
| 248 | public void addJavascriptInterface(Object obj, String interfaceName); |
| 249 | |
| 250 | public void removeJavascriptInterface(String interfaceName); |
| 251 | |
Selim Gurun | 4c8093a | 2015-03-10 17:40:06 -0700 | [diff] [blame] | 252 | public WebMessagePort[] createWebMessageChannel(); |
| 253 | |
| 254 | public void postMessageToMainFrame(WebMessage message, Uri targetOrigin); |
| 255 | |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 256 | public WebSettings getSettings(); |
| 257 | |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 258 | public void setMapTrackballToArrowKeys(boolean setMap); |
| 259 | |
| 260 | public void flingScroll(int vx, int vy); |
| 261 | |
| 262 | public View getZoomControls(); |
| 263 | |
| 264 | public boolean canZoomIn(); |
| 265 | |
| 266 | public boolean canZoomOut(); |
| 267 | |
Marcin Kosiba | 3ee06ef | 2014-07-15 17:59:51 +0100 | [diff] [blame] | 268 | public boolean zoomBy(float zoomFactor); |
| 269 | |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 270 | public boolean zoomIn(); |
| 271 | |
| 272 | public boolean zoomOut(); |
| 273 | |
John Reck | 926cf56 | 2012-06-14 10:00:31 -0700 | [diff] [blame] | 274 | public void dumpViewHierarchyWithProperties(BufferedWriter out, int level); |
| 275 | |
| 276 | public View findHierarchyView(String className, int hashCode); |
| 277 | |
Tobias Sargeant | d10e4af | 2017-01-19 14:03:09 +0000 | [diff] [blame] | 278 | public void setRendererPriorityPolicy(int rendererRequestedPriority, boolean waivedWhenNotVisible); |
| 279 | |
| 280 | public int getRendererRequestedPriority(); |
| 281 | |
| 282 | public boolean getRendererPriorityWaivedWhenNotVisible(); |
| 283 | |
Tima Vaisburd | cf49a23 | 2017-03-28 11:35:58 -0700 | [diff] [blame] | 284 | @SuppressWarnings("unused") |
| 285 | public default void setTextClassifier(@Nullable TextClassifier textClassifier) {} |
| 286 | |
| 287 | @NonNull |
| 288 | public default TextClassifier getTextClassifier() { return TextClassifier.NO_OP; } |
| 289 | |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 290 | //------------------------------------------------------------------------- |
Ben Murdoch | 52c9f7f | 2013-01-18 00:50:37 +0000 | [diff] [blame] | 291 | // Provider internal methods |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 292 | //------------------------------------------------------------------------- |
| 293 | |
| 294 | /** |
| 295 | * @return the ViewDelegate implementation. This provides the functionality to back all of |
| 296 | * the name-sake functions from the View and ViewGroup base classes of WebView. |
| 297 | */ |
| 298 | /* package */ ViewDelegate getViewDelegate(); |
| 299 | |
| 300 | /** |
| 301 | * @return a ScrollDelegate implementation. Normally this would be same object as is |
| 302 | * returned by getViewDelegate(). |
| 303 | */ |
| 304 | /* package */ ScrollDelegate getScrollDelegate(); |
| 305 | |
Ben Murdoch | 52c9f7f | 2013-01-18 00:50:37 +0000 | [diff] [blame] | 306 | /** |
| 307 | * Only used by FindActionModeCallback to inform providers that the find dialog has |
| 308 | * been dismissed. |
| 309 | */ |
| 310 | public void notifyFindDialogDismissed(); |
| 311 | |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 312 | //------------------------------------------------------------------------- |
| 313 | // View / ViewGroup delegation methods |
| 314 | //------------------------------------------------------------------------- |
| 315 | |
| 316 | /** |
| 317 | * Provides mechanism for the name-sake methods declared in View and ViewGroup to be delegated |
| 318 | * into the WebViewProvider instance. |
Nate Fischer | 7051dd1 | 2017-10-26 14:51:25 -0700 | [diff] [blame] | 319 | * NOTE: For many of these methods, the WebView will provide a super.Foo() call before or after |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 320 | * making the call into the provider instance. This is done for convenience in the common case |
| 321 | * of maintaining backward compatibility. For remaining super class calls (e.g. where the |
| 322 | * provider may need to only conditionally make the call based on some internal state) see the |
| 323 | * {@link WebView.PrivateAccess} callback class. |
| 324 | */ |
| 325 | // TODO: See if the pattern of the super-class calls can be rationalized at all, and document |
| 326 | // the remainder on the methods below. |
| 327 | interface ViewDelegate { |
| 328 | public boolean shouldDelayChildPressedState(); |
| 329 | |
Selim Gurun | 50b26a5 | 2015-06-01 16:26:10 -0700 | [diff] [blame] | 330 | public void onProvideVirtualStructure(android.view.ViewStructure structure); |
Selim Gurun | 1b650cb | 2015-04-06 20:13:37 -0700 | [diff] [blame] | 331 | |
Felipe Leme | ef33526 | 2018-03-07 11:49:44 -0800 | [diff] [blame] | 332 | default void onProvideAutofillVirtualStructure( |
| 333 | @SuppressWarnings("unused") android.view.ViewStructure structure, |
| 334 | @SuppressWarnings("unused") int flags) { |
Felipe Leme | 1ca634a | 2016-11-28 17:21:21 -0800 | [diff] [blame] | 335 | } |
| 336 | |
Felipe Leme | ef33526 | 2018-03-07 11:49:44 -0800 | [diff] [blame] | 337 | default void autofill(@SuppressWarnings("unused") SparseArray<AutofillValue> values) { |
| 338 | } |
| 339 | |
| 340 | default boolean isVisibleToUserForAutofill(@SuppressWarnings("unused") int virtualId) { |
| 341 | return true; // true is the default value returned by View.isVisibleToUserForAutofill() |
Tao Bai | a571733 | 2017-03-30 14:58:53 -0700 | [diff] [blame] | 342 | } |
| 343 | |
Ben Murdoch | e3f9071 | 2013-06-05 14:19:48 +0100 | [diff] [blame] | 344 | public AccessibilityNodeProvider getAccessibilityNodeProvider(); |
| 345 | |
Marcin Kosiba | 3e853fb | 2015-01-08 12:45:40 +0000 | [diff] [blame] | 346 | public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info); |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 347 | |
Marcin Kosiba | 3e853fb | 2015-01-08 12:45:40 +0000 | [diff] [blame] | 348 | public void onInitializeAccessibilityEvent(AccessibilityEvent event); |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 349 | |
Marcin Kosiba | 3e853fb | 2015-01-08 12:45:40 +0000 | [diff] [blame] | 350 | public boolean performAccessibilityAction(int action, Bundle arguments); |
alanv | 448902d | 2012-05-16 20:27:47 -0700 | [diff] [blame] | 351 | |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 352 | public void setOverScrollMode(int mode); |
| 353 | |
| 354 | public void setScrollBarStyle(int style); |
| 355 | |
| 356 | public void onDrawVerticalScrollBar(Canvas canvas, Drawable scrollBar, int l, int t, |
| 357 | int r, int b); |
| 358 | |
| 359 | public void onOverScrolled(int scrollX, int scrollY, boolean clampedX, boolean clampedY); |
| 360 | |
| 361 | public void onWindowVisibilityChanged(int visibility); |
| 362 | |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 363 | public void onDraw(Canvas canvas); |
| 364 | |
| 365 | public void setLayoutParams(LayoutParams layoutParams); |
| 366 | |
| 367 | public boolean performLongClick(); |
| 368 | |
| 369 | public void onConfigurationChanged(Configuration newConfig); |
| 370 | |
| 371 | public InputConnection onCreateInputConnection(EditorInfo outAttrs); |
| 372 | |
Hui Shu | ecdce96 | 2016-02-04 15:00:19 -0800 | [diff] [blame] | 373 | public boolean onDragEvent(DragEvent event); |
| 374 | |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 375 | public boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event); |
| 376 | |
| 377 | public boolean onKeyDown(int keyCode, KeyEvent event); |
| 378 | |
| 379 | public boolean onKeyUp(int keyCode, KeyEvent event); |
| 380 | |
| 381 | public void onAttachedToWindow(); |
| 382 | |
| 383 | public void onDetachedFromWindow(); |
| 384 | |
Tima Vaisburd | 134752b | 2017-04-06 15:50:05 -0700 | [diff] [blame] | 385 | public default void onMovedToDisplay(int displayId, Configuration config) {} |
| 386 | |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 387 | public void onVisibilityChanged(View changedView, int visibility); |
| 388 | |
| 389 | public void onWindowFocusChanged(boolean hasWindowFocus); |
| 390 | |
| 391 | public void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect); |
| 392 | |
| 393 | public boolean setFrame(int left, int top, int right, int bottom); |
| 394 | |
| 395 | public void onSizeChanged(int w, int h, int ow, int oh); |
| 396 | |
| 397 | public void onScrollChanged(int l, int t, int oldl, int oldt); |
| 398 | |
| 399 | public boolean dispatchKeyEvent(KeyEvent event); |
| 400 | |
| 401 | public boolean onTouchEvent(MotionEvent ev); |
| 402 | |
| 403 | public boolean onHoverEvent(MotionEvent event); |
| 404 | |
| 405 | public boolean onGenericMotionEvent(MotionEvent event); |
| 406 | |
| 407 | public boolean onTrackballEvent(MotionEvent ev); |
| 408 | |
| 409 | public boolean requestFocus(int direction, Rect previouslyFocusedRect); |
| 410 | |
| 411 | public void onMeasure(int widthMeasureSpec, int heightMeasureSpec); |
| 412 | |
| 413 | public boolean requestChildRectangleOnScreen(View child, Rect rect, boolean immediate); |
| 414 | |
| 415 | public void setBackgroundColor(int color); |
John Reck | a5408e6 | 2012-03-16 14:18:44 -0700 | [diff] [blame] | 416 | |
| 417 | public void setLayerType(int layerType, Paint paint); |
Ben Murdoch | e623e24 | 2012-09-07 20:47:07 +0100 | [diff] [blame] | 418 | |
| 419 | public void preDispatchDraw(Canvas canvas); |
Ben Murdoch | 7302f4f | 2014-07-03 14:47:44 +0100 | [diff] [blame] | 420 | |
| 421 | public void onStartTemporaryDetach(); |
| 422 | |
| 423 | public void onFinishTemporaryDetach(); |
Hui Shu | f119c52 | 2015-10-08 10:07:13 -0700 | [diff] [blame] | 424 | |
| 425 | public void onActivityResult(int requestCode, int resultCode, Intent data); |
Selim Gurun | e319dad | 2016-03-17 01:40:40 +0000 | [diff] [blame] | 426 | |
| 427 | public Handler getHandler(Handler originalHandler); |
| 428 | |
| 429 | public View findFocus(View originalFocusedView); |
Changwan Ryu | 15e9afc | 2018-03-06 15:55:19 -0800 | [diff] [blame] | 430 | |
| 431 | @SuppressWarnings("unused") |
| 432 | default boolean onCheckIsTextEditor() { |
| 433 | return false; |
| 434 | } |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 435 | } |
| 436 | |
| 437 | interface ScrollDelegate { |
| 438 | // These methods are declared protected in the ViewGroup base class. This interface |
| 439 | // exists to promote them to public so they may be called by the WebView proxy class. |
| 440 | // TODO: Combine into ViewDelegate? |
| 441 | /** |
| 442 | * See {@link android.webkit.WebView#computeHorizontalScrollRange} |
| 443 | */ |
| 444 | public int computeHorizontalScrollRange(); |
| 445 | |
| 446 | /** |
| 447 | * See {@link android.webkit.WebView#computeHorizontalScrollOffset} |
| 448 | */ |
| 449 | public int computeHorizontalScrollOffset(); |
| 450 | |
| 451 | /** |
| 452 | * See {@link android.webkit.WebView#computeVerticalScrollRange} |
| 453 | */ |
| 454 | public int computeVerticalScrollRange(); |
| 455 | |
| 456 | /** |
| 457 | * See {@link android.webkit.WebView#computeVerticalScrollOffset} |
| 458 | */ |
| 459 | public int computeVerticalScrollOffset(); |
| 460 | |
| 461 | /** |
| 462 | * See {@link android.webkit.WebView#computeVerticalScrollExtent} |
| 463 | */ |
| 464 | public int computeVerticalScrollExtent(); |
| 465 | |
| 466 | /** |
| 467 | * See {@link android.webkit.WebView#computeScroll} |
| 468 | */ |
| 469 | public void computeScroll(); |
| 470 | } |
| 471 | } |