• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2015 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.hardware.input.cts;
18 
19 import android.app.Activity;
20 import android.os.Bundle;
21 import android.view.KeyEvent;
22 import android.view.MotionEvent;
23 
24 public class InputCtsActivity extends Activity {
25     private static final String TAG = "InputCtsActivity";
26 
27     private InputCallback mInputCallback;
28 
29     @Override
onCreate(Bundle savedInstanceState)30     public void onCreate(Bundle savedInstanceState) {
31         super.onCreate(savedInstanceState);
32     }
33 
34     @Override
dispatchGenericMotionEvent(MotionEvent ev)35     public boolean dispatchGenericMotionEvent(MotionEvent ev) {
36         if (mInputCallback != null) {
37             mInputCallback.onMotionEvent(ev);
38         }
39         return true;
40     }
41 
42     @Override
dispatchTouchEvent(MotionEvent ev)43     public boolean dispatchTouchEvent(MotionEvent ev) {
44         if (mInputCallback != null) {
45             mInputCallback.onMotionEvent(ev);
46         }
47         return true;
48     }
49 
50     @Override
dispatchTrackballEvent(MotionEvent ev)51     public boolean dispatchTrackballEvent(MotionEvent ev) {
52         if (mInputCallback != null) {
53             mInputCallback.onMotionEvent(ev);
54         }
55         return true;
56     }
57 
58     @Override
dispatchKeyEvent(KeyEvent ev)59     public boolean dispatchKeyEvent(KeyEvent ev) {
60         if (mInputCallback != null) {
61             mInputCallback.onKeyEvent(ev);
62         }
63         return true;
64     }
65 
setInputCallback(InputCallback callback)66     public void setInputCallback(InputCallback callback) {
67         mInputCallback = callback;
68     }
69 }
70