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