AbstractDrawingPreview.java revision 2ecbfe8e93f8d8fce0adc47659b5d2f52cb68849
1/* 2 * Copyright (C) 2012 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 * use this file except in compliance with the License. You may obtain a copy of 6 * 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, WITHOUT 12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 * License for the specific language governing permissions and limitations under 14 * the License. 15 */ 16 17package com.android.inputmethod.keyboard.internal; 18 19import android.graphics.Canvas; 20 21import com.android.inputmethod.keyboard.PointerTracker; 22 23/** 24 * Abstract base class for previews that are drawn on PreviewPlacerView, e.g., 25 * GestureFloatingPrevewText, GestureTrail, and SlidingKeyInputPreview. 26 */ 27public abstract class AbstractDrawingPreview { 28 private boolean mPreviewEnabled; 29 30 public void setPreviewEnabled(final boolean enabled) { 31 mPreviewEnabled = enabled; 32 } 33 34 public boolean isPreviewEnabled() { 35 return mPreviewEnabled; 36 } 37 38 /** 39 * Draws the preview 40 * @param canvas The canvas where the preview is drawn. 41 */ 42 public abstract void drawPreview(final Canvas canvas); 43 44 /** 45 * Set the position of the preview. 46 * @param pt The new location of the preview is based on the points in PointerTracker pt. 47 */ 48 public abstract void setPreviewPosition(final PointerTracker pt); 49} 50