• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
17 package com.android.inputmethod.keyboard;
18 
19 import android.view.View;
20 
21 public interface MoreKeysPanel {
22     public interface Controller {
23         /**
24          * Add the {@link MoreKeysPanel} to the target view.
25          * @param panel
26          */
onShowMoreKeysPanel(final MoreKeysPanel panel)27         public void onShowMoreKeysPanel(final MoreKeysPanel panel);
28 
29         /**
30          * Remove the current {@link MoreKeysPanel} from the target view.
31          */
onDismissMoreKeysPanel()32         public boolean onDismissMoreKeysPanel();
33 
34         /**
35          * Instructs the parent to cancel the panel (e.g., when entering a different input mode).
36          */
onCancelMoreKeysPanel()37         public void onCancelMoreKeysPanel();
38     }
39 
40     /**
41      * Initializes the layout and event handling of this {@link MoreKeysPanel} and calls the
42      * controller's onShowMoreKeysPanel to add the panel's container view.
43      *
44      * @param parentView the parent view of this {@link MoreKeysPanel}
45      * @param controller the controller that can dismiss this {@link MoreKeysPanel}
46      * @param pointX x coordinate of this {@link MoreKeysPanel}
47      * @param pointY y coordinate of this {@link MoreKeysPanel}
48      * @param listener the listener that will receive keyboard action from this
49      * {@link MoreKeysPanel}.
50      */
51     // TODO: Currently the MoreKeysPanel is inside a container view that is added to the parent.
52     // Consider the simpler approach of placing the MoreKeysPanel itself into the parent view.
showMoreKeysPanel(View parentView, Controller controller, int pointX, int pointY, KeyboardActionListener listener)53     public void showMoreKeysPanel(View parentView, Controller controller, int pointX,
54             int pointY, KeyboardActionListener listener);
55 
56     /**
57      * Dismisses the more keys panel and calls the controller's onDismissMoreKeysPanel to remove
58      * the panel's container view.
59      */
dismissMoreKeysPanel()60     public boolean dismissMoreKeysPanel();
61 
62     /**
63      * Process a move event on the more keys panel.
64      *
65      * @param x translated x coordinate of the touch point
66      * @param y translated y coordinate of the touch point
67      * @param pointerId pointer id touch point
68      * @param eventTime timestamp of touch point
69      */
onMoveEvent(final int x, final int y, final int pointerId, final long eventTime)70     public void onMoveEvent(final int x, final int y, final int pointerId, final long eventTime);
71 
72     /**
73      * Process a down event on the more keys panel.
74      *
75      * @param x translated x coordinate of the touch point
76      * @param y translated y coordinate of the touch point
77      * @param pointerId pointer id touch point
78      * @param eventTime timestamp of touch point
79      */
onDownEvent(final int x, final int y, final int pointerId, final long eventTime)80     public void onDownEvent(final int x, final int y, final int pointerId, final long eventTime);
81 
82     /**
83      * Process an up event on the more keys panel.
84      *
85      * @param x translated x coordinate of the touch point
86      * @param y translated y coordinate of the touch point
87      * @param pointerId pointer id touch point
88      * @param eventTime timestamp of touch point
89      */
onUpEvent(final int x, final int y, final int pointerId, final long eventTime)90     public void onUpEvent(final int x, final int y, final int pointerId, final long eventTime);
91 
92     /**
93      * Translate X-coordinate of touch event to the local X-coordinate of this
94      * {@link MoreKeysPanel}.
95      *
96      * @param x the global X-coordinate
97      * @return the local X-coordinate to this {@link MoreKeysPanel}
98      */
translateX(int x)99     public int translateX(int x);
100 
101     /**
102      * Translate Y-coordinate of touch event to the local Y-coordinate of this
103      * {@link MoreKeysPanel}.
104      *
105      * @param y the global Y-coordinate
106      * @return the local Y-coordinate to this {@link MoreKeysPanel}
107      */
translateY(int y)108     public int translateY(int y);
109 
110     /**
111      * Return the view containing the more keys panel.
112      */
getContainerView()113     public View getContainerView();
114 
115     /**
116      * Return whether the panel is currently being shown.
117      */
isShowingInParent()118     public boolean isShowingInParent();
119 }
120