2011-04-27 05:14:45 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2011 The Android Open Source Project
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package com.android.inputmethod.keyboard;
|
|
|
|
|
2011-08-29 08:02:52 +00:00
|
|
|
import android.view.View;
|
2011-04-27 05:14:45 +00:00
|
|
|
|
2012-12-03 02:47:52 +00:00
|
|
|
public interface MoreKeysPanel {
|
2011-08-29 08:02:52 +00:00
|
|
|
public interface Controller {
|
2012-12-03 06:49:10 +00:00
|
|
|
/**
|
|
|
|
* Add the {@link MoreKeysPanel} to the target view.
|
|
|
|
* @param panel
|
|
|
|
*/
|
|
|
|
public void onShowMoreKeysPanel(final MoreKeysPanel panel);
|
|
|
|
|
|
|
|
/**
|
2012-12-03 02:47:52 +00:00
|
|
|
* Remove the current {@link MoreKeysPanel} from the target view.
|
2012-12-03 06:49:10 +00:00
|
|
|
*/
|
|
|
|
public boolean onDismissMoreKeysPanel();
|
2012-12-10 20:38:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Instructs the parent to cancel the panel (e.g., when entering a different input mode).
|
|
|
|
*/
|
|
|
|
public void onCancelMoreKeysPanel();
|
2011-08-29 08:02:52 +00:00
|
|
|
}
|
|
|
|
|
2011-04-27 05:14:45 +00:00
|
|
|
/**
|
2012-12-03 06:49:10 +00:00
|
|
|
* Initializes the layout and event handling of this {@link MoreKeysPanel} and calls the
|
|
|
|
* controller's onShowMoreKeysPanel to add the panel's container view.
|
2011-08-31 06:26:32 +00:00
|
|
|
*
|
2012-12-03 06:49:10 +00:00
|
|
|
* @param parentView the parent view of this {@link MoreKeysPanel}
|
|
|
|
* @param controller the controller that can dismiss this {@link MoreKeysPanel}
|
|
|
|
* @param pointX x coordinate of this {@link MoreKeysPanel}
|
|
|
|
* @param pointY y coordinate of this {@link MoreKeysPanel}
|
|
|
|
* @param listener the listener that will receive keyboard action from this
|
|
|
|
* {@link MoreKeysPanel}.
|
|
|
|
*/
|
|
|
|
// TODO: Currently the MoreKeysPanel is inside a container view that is added to the parent.
|
|
|
|
// Consider the simpler approach of placing the MoreKeysPanel itself into the parent view.
|
|
|
|
public void showMoreKeysPanel(View parentView, Controller controller, int pointX,
|
|
|
|
int pointY, KeyboardActionListener listener);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Dismisses the more keys panel and calls the controller's onDismissMoreKeysPanel to remove
|
|
|
|
* the panel's container view.
|
2011-04-27 05:14:45 +00:00
|
|
|
*/
|
2012-12-03 06:49:10 +00:00
|
|
|
public boolean dismissMoreKeysPanel();
|
2011-04-27 05:14:45 +00:00
|
|
|
|
2012-12-03 02:47:52 +00:00
|
|
|
/**
|
|
|
|
* Process a move event on the more keys panel.
|
|
|
|
*
|
|
|
|
* @param x translated x coordinate of the touch point
|
|
|
|
* @param y translated y coordinate of the touch point
|
|
|
|
* @param pointerId pointer id touch point
|
|
|
|
* @param eventTime timestamp of touch point
|
|
|
|
*/
|
|
|
|
public void onMoveEvent(final int x, final int y, final int pointerId, final long eventTime);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Process a down event on the more keys panel.
|
|
|
|
*
|
|
|
|
* @param x translated x coordinate of the touch point
|
|
|
|
* @param y translated y coordinate of the touch point
|
|
|
|
* @param pointerId pointer id touch point
|
|
|
|
* @param eventTime timestamp of touch point
|
|
|
|
*/
|
|
|
|
public void onDownEvent(final int x, final int y, final int pointerId, final long eventTime);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Process an up event on the more keys panel.
|
|
|
|
*
|
|
|
|
* @param x translated x coordinate of the touch point
|
|
|
|
* @param y translated y coordinate of the touch point
|
|
|
|
* @param pointerId pointer id touch point
|
|
|
|
* @param eventTime timestamp of touch point
|
|
|
|
*/
|
|
|
|
public void onUpEvent(final int x, final int y, final int pointerId, final long eventTime);
|
|
|
|
|
2011-04-27 05:14:45 +00:00
|
|
|
/**
|
2011-08-31 06:26:32 +00:00
|
|
|
* Translate X-coordinate of touch event to the local X-coordinate of this
|
|
|
|
* {@link MoreKeysPanel}.
|
|
|
|
*
|
2011-07-11 01:09:15 +00:00
|
|
|
* @param x the global X-coordinate
|
2011-08-31 06:26:32 +00:00
|
|
|
* @return the local X-coordinate to this {@link MoreKeysPanel}
|
2011-04-27 05:14:45 +00:00
|
|
|
*/
|
2011-07-11 01:09:15 +00:00
|
|
|
public int translateX(int x);
|
2011-04-27 05:14:45 +00:00
|
|
|
|
|
|
|
/**
|
2011-08-31 06:26:32 +00:00
|
|
|
* Translate Y-coordinate of touch event to the local Y-coordinate of this
|
|
|
|
* {@link MoreKeysPanel}.
|
|
|
|
*
|
2011-07-11 01:09:15 +00:00
|
|
|
* @param y the global Y-coordinate
|
2011-08-31 06:26:32 +00:00
|
|
|
* @return the local Y-coordinate to this {@link MoreKeysPanel}
|
2011-04-27 05:14:45 +00:00
|
|
|
*/
|
2011-07-11 01:09:15 +00:00
|
|
|
public int translateY(int y);
|
2012-12-03 06:49:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the view containing the more keys panel.
|
|
|
|
*/
|
|
|
|
public View getContainerView();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return whether the panel is currently being shown.
|
|
|
|
*/
|
|
|
|
public boolean isShowingInParent();
|
2011-04-27 05:14:45 +00:00
|
|
|
}
|