1/*
2 * Copyright (C) 2011 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
17package android.support.v4.view;
18
19import android.view.KeyEvent;
20import android.view.View;
21
22/**
23 * Helper for accessing features in {@link KeyEvent} introduced after
24 * API level 4 in a backwards compatible fashion.
25 *
26 * @deprecated Use {@link KeyEvent} directly.
27 */
28@Deprecated
29public final class KeyEventCompat {
30    /**
31     * @deprecated Call {@link KeyEvent#normalizeMetaState(int)} directly. This method will
32     * be removed in a future release.
33     */
34    @Deprecated
35    public static int normalizeMetaState(int metaState) {
36        return KeyEvent.normalizeMetaState(metaState);
37    }
38
39    /**
40     * @deprecated Call {@link KeyEvent#metaStateHasModifiers(int, int)} directly. This method will
41     * be removed in a future release.
42     */
43    @Deprecated
44    public static boolean metaStateHasModifiers(int metaState, int modifiers) {
45        return KeyEvent.metaStateHasModifiers(metaState, modifiers);
46    }
47
48    /**
49     * @deprecated Call {@link KeyEvent#metaStateHasNoModifiers(int)} directly. This method will be
50     * removed in a future release.
51     */
52    @Deprecated
53    public static boolean metaStateHasNoModifiers(int metaState) {
54        return KeyEvent.metaStateHasNoModifiers(metaState);
55    }
56
57    /**
58     * @deprecated Call {@link KeyEvent#hasModifiers(int)} directly. This method will be removed in
59     * a future release.
60     */
61    @Deprecated
62    public static boolean hasModifiers(KeyEvent event, int modifiers) {
63        return event.hasModifiers(modifiers);
64    }
65
66    /**
67     * @deprecated Call {@link KeyEvent#hasNoModifiers()} directly. This method will be removed in a
68     * future release.
69     */
70    @Deprecated
71    public static boolean hasNoModifiers(KeyEvent event) {
72        return event.hasNoModifiers();
73    }
74
75    /**
76     * @deprecated Call {@link KeyEvent#startTracking()} directly. This method will be removed in a
77     * future release.
78     */
79    @Deprecated
80    public static void startTracking(KeyEvent event) {
81        event.startTracking();
82    }
83
84    /**
85     * @deprecated Call {@link KeyEvent#isTracking()} directly. This method will be removed in a
86     * future release.
87     */
88    @Deprecated
89    public static boolean isTracking(KeyEvent event) {
90        return event.isTracking();
91    }
92
93    /**
94     * @deprecated Call {@link View#getKeyDispatcherState()} directly. This method will be removed
95     * in a future release.
96     */
97    @Deprecated
98    public static Object getKeyDispatcherState(View view) {
99        return view.getKeyDispatcherState();
100    }
101
102    /**
103     * @deprecated Call
104     * {@link KeyEvent#dispatch(KeyEvent.Callback, KeyEvent.DispatcherState, Object)} directly.
105     * This method will be removed in a future release.
106     */
107    @Deprecated
108    public static boolean dispatch(KeyEvent event, KeyEvent.Callback receiver, Object state,
109                Object target) {
110        return event.dispatch(receiver, (KeyEvent.DispatcherState) state, target);
111    }
112
113    /**
114     * @deprecated Call {@link KeyEvent#isCtrlPressed()} directly. This method will be removed
115     * in a future release.
116     */
117    @Deprecated
118    public static boolean isCtrlPressed(KeyEvent event) {
119        return event.isCtrlPressed();
120    }
121
122    private KeyEventCompat() {}
123}
124