1 /* 2 * Copyright (C) 2009 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 18 package android.gesture; 19 20 import java.util.Set; 21 import java.util.ArrayList; 22 23 public abstract class GestureLibrary { 24 protected final GestureStore mStore; 25 26 protected GestureLibrary() { 27 mStore = new GestureStore(); 28 } 29 30 public abstract boolean save(); 31 32 public abstract boolean load(); 33 34 public boolean isReadOnly() { 35 return false; 36 } 37 38 /** @hide */ 39 public Learner getLearner() { 40 return mStore.getLearner(); 41 } 42 43 public void setOrientationStyle(int style) { 44 mStore.setOrientationStyle(style); 45 } 46 47 public int getOrientationStyle() { 48 return mStore.getOrientationStyle(); 49 } 50 51 public void setSequenceType(int type) { 52 mStore.setSequenceType(type); 53 } 54 55 public int getSequenceType() { 56 return mStore.getSequenceType(); 57 } 58 59 public Set<String> getGestureEntries() { 60 return mStore.getGestureEntries(); 61 } 62 63 public ArrayList<Prediction> recognize(Gesture gesture) { 64 return mStore.recognize(gesture); 65 } 66 67 public void addGesture(String entryName, Gesture gesture) { 68 mStore.addGesture(entryName, gesture); 69 } 70 71 public void removeGesture(String entryName, Gesture gesture) { 72 mStore.removeGesture(entryName, gesture); 73 } 74 75 public void removeEntry(String entryName) { 76 mStore.removeEntry(entryName); 77 } 78 79 public ArrayList<Gesture> getGestures(String entryName) { 80 return mStore.getGestures(entryName); 81 } 82 } 83