Home | History | Annotate | Download | only in keyboard
      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;
     18 
     19 import android.graphics.Matrix;
     20 import android.graphics.RectF;
     21 
     22 /**
     23  * This interface defines how UI operations required for {@link TextDecorator} are delegated to
     24  * the actual UI implementation class.
     25  */
     26 public interface TextDecoratorUiOperator {
     27     /**
     28      * Called to notify that the UI is ready to be disposed.
     29      */
     30     void disposeUi();
     31 
     32     /**
     33      * Called when the UI should become invisible.
     34      */
     35     void hideUi();
     36 
     37     /**
     38      * Called to set the new click handler.
     39      * @param onClickListener the callback object whose {@link Runnable#run()} should be called when
     40      * the indicator is clicked.
     41      */
     42     void setOnClickListener(final Runnable onClickListener);
     43 
     44     /**
     45      * Called when the layout should be updated.
     46      * @param matrix The matrix that transforms the local coordinates into the screen coordinates.
     47      * @param composingTextBounds The bounding box of the composing text, in local coordinates.
     48      * @param useRtlLayout {@code true} if the indicator should be optimized for RTL layout.
     49      */
     50     void layoutUi(final Matrix matrix, final RectF composingTextBounds, final boolean useRtlLayout);
     51 }
     52