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