1/*
2 * Copyright (C) 2014 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
18package android.view;
19
20import android.view.accessibility.AccessibilityEvent;
21
22/**
23 * A simple decorator stub for Window.Callback that passes through any calls
24 * to the wrapped instance as a base implementation. Call super.foo() to call into
25 * the wrapped callback for any subclasses.
26 *
27 * @hide for internal use
28 */
29public class WindowCallbackWrapper implements Window.Callback {
30    private Window.Callback mWrapped;
31
32    public WindowCallbackWrapper(Window.Callback wrapped) {
33        if (wrapped == null) {
34            throw new IllegalArgumentException("Window callback may not be null");
35        }
36        mWrapped = wrapped;
37    }
38
39    @Override
40    public boolean dispatchKeyEvent(KeyEvent event) {
41        return mWrapped.dispatchKeyEvent(event);
42    }
43
44    @Override
45    public boolean dispatchKeyShortcutEvent(KeyEvent event) {
46        return mWrapped.dispatchKeyShortcutEvent(event);
47    }
48
49    @Override
50    public boolean dispatchTouchEvent(MotionEvent event) {
51        return mWrapped.dispatchTouchEvent(event);
52    }
53
54    @Override
55    public boolean dispatchTrackballEvent(MotionEvent event) {
56        return mWrapped.dispatchTrackballEvent(event);
57    }
58
59    @Override
60    public boolean dispatchGenericMotionEvent(MotionEvent event) {
61        return mWrapped.dispatchGenericMotionEvent(event);
62    }
63
64    @Override
65    public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
66        return mWrapped.dispatchPopulateAccessibilityEvent(event);
67    }
68
69    @Override
70    public View onCreatePanelView(int featureId) {
71        return mWrapped.onCreatePanelView(featureId);
72    }
73
74    @Override
75    public boolean onCreatePanelMenu(int featureId, Menu menu) {
76        return mWrapped.onCreatePanelMenu(featureId, menu);
77    }
78
79    @Override
80    public boolean onPreparePanel(int featureId, View view, Menu menu) {
81        return mWrapped.onPreparePanel(featureId, view, menu);
82    }
83
84    @Override
85    public boolean onMenuOpened(int featureId, Menu menu) {
86        return mWrapped.onMenuOpened(featureId, menu);
87    }
88
89    @Override
90    public boolean onMenuItemSelected(int featureId, MenuItem item) {
91        return mWrapped.onMenuItemSelected(featureId, item);
92    }
93
94    @Override
95    public void onWindowAttributesChanged(WindowManager.LayoutParams attrs) {
96        mWrapped.onWindowAttributesChanged(attrs);
97    }
98
99    @Override
100    public void onContentChanged() {
101        mWrapped.onContentChanged();
102    }
103
104    @Override
105    public void onWindowFocusChanged(boolean hasFocus) {
106        mWrapped.onWindowFocusChanged(hasFocus);
107    }
108
109    @Override
110    public void onAttachedToWindow() {
111        mWrapped.onAttachedToWindow();
112    }
113
114    @Override
115    public void onDetachedFromWindow() {
116        mWrapped.onDetachedFromWindow();
117    }
118
119    @Override
120    public void onPanelClosed(int featureId, Menu menu) {
121        mWrapped.onPanelClosed(featureId, menu);
122    }
123
124    @Override
125    public boolean onSearchRequested() {
126        return mWrapped.onSearchRequested();
127    }
128
129    @Override
130    public ActionMode onWindowStartingActionMode(ActionMode.Callback callback) {
131        return mWrapped.onWindowStartingActionMode(callback);
132    }
133
134    @Override
135    public void onActionModeStarted(ActionMode mode) {
136        mWrapped.onActionModeStarted(mode);
137    }
138
139    @Override
140    public void onActionModeFinished(ActionMode mode) {
141        mWrapped.onActionModeFinished(mode);
142    }
143}
144
145