Home | History | Annotate | Download | only in internal
      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 package com.android.inputmethod.keyboard.internal;
     18 
     19 import com.android.inputmethod.keyboard.Key;
     20 import com.android.inputmethod.keyboard.MoreKeysPanel;
     21 import com.android.inputmethod.keyboard.PointerTracker;
     22 
     23 import javax.annotation.Nonnull;
     24 import javax.annotation.Nullable;
     25 
     26 public interface DrawingProxy {
     27     /**
     28      * Called when a key is being pressed.
     29      * @param key the {@link Key} that is being pressed.
     30      * @param withPreview true if key popup preview should be displayed.
     31      */
     32     public void onKeyPressed(@Nonnull Key key, boolean withPreview);
     33 
     34     /**
     35      * Called when a key is being released.
     36      * @param key the {@link Key} that is being released.
     37      * @param withAnimation when true, key popup preview should be dismissed with animation.
     38      */
     39     public void onKeyReleased(@Nonnull Key key, boolean withAnimation);
     40 
     41     /**
     42      * Start showing more keys keyboard of a key that is being long pressed.
     43      * @param key the {@link Key} that is being long pressed and showing more keys keyboard.
     44      * @param tracker the {@link PointerTracker} that detects this long pressing.
     45      * @return {@link MoreKeysPanel} that is being shown. null if there is no need to show more keys
     46      *     keyboard.
     47      */
     48     @Nullable
     49     public MoreKeysPanel showMoreKeysKeyboard(@Nonnull Key key, @Nonnull PointerTracker tracker);
     50 
     51     /**
     52      * Start a while-typing-animation.
     53      * @param fadeInOrOut {@link #FADE_IN} starts while-typing-fade-in animation.
     54      * {@link #FADE_OUT} starts while-typing-fade-out animation.
     55      */
     56     public void startWhileTypingAnimation(int fadeInOrOut);
     57     public static final int FADE_IN = 0;
     58     public static final int FADE_OUT = 1;
     59 
     60     /**
     61      * Show sliding-key input preview.
     62      * @param tracker the {@link PointerTracker} that is currently doing the sliding-key input.
     63      * null to dismiss the sliding-key input preview.
     64      */
     65     public void showSlidingKeyInputPreview(@Nullable PointerTracker tracker);
     66 
     67     /**
     68      * Show gesture trails.
     69      * @param tracker the {@link PointerTracker} whose gesture trail will be shown.
     70      * @param showsFloatingPreviewText when true, a gesture floating preview text will be shown
     71      * with this <code>tracker</code>'s trail.
     72      */
     73     public void showGestureTrail(@Nonnull PointerTracker tracker, boolean showsFloatingPreviewText);
     74 
     75     /**
     76      * Dismiss a gesture floating preview text without delay.
     77      */
     78     public void dismissGestureFloatingPreviewTextWithoutDelay();
     79 }
     80