/* * Copyright (C) 2014 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.internal; import com.android.inputmethod.keyboard.Key; import com.android.inputmethod.keyboard.MoreKeysPanel; import com.android.inputmethod.keyboard.PointerTracker; import javax.annotation.Nonnull; import javax.annotation.Nullable; public interface DrawingProxy { /** * Called when a key is being pressed. * @param key the {@link Key} that is being pressed. * @param withPreview true if key popup preview should be displayed. */ public void onKeyPressed(@Nonnull Key key, boolean withPreview); /** * Called when a key is being released. * @param key the {@link Key} that is being released. * @param withAnimation when true, key popup preview should be dismissed with animation. */ public void onKeyReleased(@Nonnull Key key, boolean withAnimation); /** * Start showing more keys keyboard of a key that is being long pressed. * @param key the {@link Key} that is being long pressed and showing more keys keyboard. * @param tracker the {@link PointerTracker} that detects this long pressing. * @return {@link MoreKeysPanel} that is being shown. null if there is no need to show more keys * keyboard. */ @Nullable public MoreKeysPanel showMoreKeysKeyboard(@Nonnull Key key, @Nonnull PointerTracker tracker); /** * Start a while-typing-animation. * @param fadeInOrOut {@link #FADE_IN} starts while-typing-fade-in animation. * {@link #FADE_OUT} starts while-typing-fade-out animation. */ public void startWhileTypingAnimation(int fadeInOrOut); public static final int FADE_IN = 0; public static final int FADE_OUT = 1; /** * Show sliding-key input preview. * @param tracker the {@link PointerTracker} that is currently doing the sliding-key input. * null to dismiss the sliding-key input preview. */ public void showSlidingKeyInputPreview(@Nullable PointerTracker tracker); /** * Show gesture trails. * @param tracker the {@link PointerTracker} whose gesture trail will be shown. * @param showsFloatingPreviewText when true, a gesture floating preview text will be shown * with this tracker's trail. */ public void showGestureTrail(@Nonnull PointerTracker tracker, boolean showsFloatingPreviewText); /** * Dismiss a gesture floating preview text without delay. */ public void dismissGestureFloatingPreviewTextWithoutDelay(); }