1// Copyright 2014 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5package org.chromium.android_webview; 6 7import android.content.res.Configuration; 8import android.graphics.Canvas; 9import android.graphics.Paint; 10import android.graphics.Rect; 11import android.view.KeyEvent; 12import android.view.MotionEvent; 13import android.view.View; 14import android.view.inputmethod.EditorInfo; 15import android.view.inputmethod.InputConnection; 16 17/** 18 * An interface that defines a subset of the {@link View} functionality. 19 * 20 * <p>This interface allows us to hook up drawing and input related methods to the 21 * {@link AwContents}'s consumer in embedded mode, and to the {@link FullScreenView} 22 * in fullscreen mode. 23 */ 24interface AwViewMethods { 25 26 /** 27 * @see android.view.View#onDraw 28 */ 29 void onDraw(Canvas canvas); 30 31 /** 32 * @see android.view.View#onMeasure 33 */ 34 void onMeasure(int widthMeasureSpec, int heightMeasureSpec); 35 36 /** 37 * @see android.view.View#requestFocus 38 */ 39 void requestFocus(); 40 41 /** 42 * @see android.view.View#setLayerType 43 */ 44 void setLayerType(int layerType, Paint paint); 45 46 /** 47 * @see android.view.View#onCreateInputConnection 48 */ 49 InputConnection onCreateInputConnection(EditorInfo outAttrs); 50 51 /** 52 * @see android.view.View#onKeyUp 53 */ 54 boolean onKeyUp(int keyCode, KeyEvent event); 55 56 /** 57 * @see android.view.View#dispatchKeyEvent 58 */ 59 boolean dispatchKeyEvent(KeyEvent event); 60 61 /** 62 * @see android.view.View#onTouchEvent 63 */ 64 boolean onTouchEvent(MotionEvent event); 65 66 /** 67 * @see android.view.View#onHoverEvent 68 */ 69 boolean onHoverEvent(MotionEvent event); 70 71 /** 72 * @see android.view.View#onGenericMotionEvent 73 */ 74 boolean onGenericMotionEvent(MotionEvent event); 75 76 /** 77 * @see android.view.View#onConfigurationChanged 78 */ 79 void onConfigurationChanged(Configuration newConfig); 80 81 /** 82 * @see android.view.View#onAttachedToWindow 83 */ 84 void onAttachedToWindow(); 85 86 /** 87 * @see android.view.View#onDetachedFromWindow 88 */ 89 void onDetachedFromWindow(); 90 91 /** 92 * @see android.view.View#onWindowFocusChanged 93 */ 94 void onWindowFocusChanged(boolean hasWindowFocus); 95 96 /** 97 * @see android.view.View#onFocusChanged 98 */ 99 void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect); 100 101 /** 102 * @see android.view.View#onSizeChanged 103 */ 104 void onSizeChanged(int w, int h, int ow, int oh); 105 106 /** 107 * @see android.view.View#onVisibilityChanged 108 */ 109 void onVisibilityChanged(View changedView, int visibility); 110 111 /** 112 * @see android.view.View#onWindowVisibilityChanged 113 */ 114 void onWindowVisibilityChanged(int visibility); 115} 116