blob: ec2e78c9df2f383e3329ba0192416544073d0c31 [file] [log] [blame]
Yang Li35aa84b2009-05-18 18:29:05 -07001/*
Romain Guy0a637162009-05-29 14:43:54 -07002 * Copyright (C) 2009 The Android Open Source Project
Yang Li35aa84b2009-05-18 18:29:05 -07003 *
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
Romain Guy0a637162009-05-29 14:43:54 -070017
Romain Guydb567c32009-05-21 16:23:21 -070018package android.gesture;
Yang Li35aa84b2009-05-18 18:29:05 -070019
Yang Li35aa84b2009-05-18 18:29:05 -070020import java.util.Set;
Romain Guy0a637162009-05-29 14:43:54 -070021import java.util.ArrayList;
Yang Li35aa84b2009-05-18 18:29:05 -070022
Romain Guy0a637162009-05-29 14:43:54 -070023public abstract class GestureLibrary {
24 protected final GestureStore mStore;
Romain Guyc5347272009-05-20 10:37:13 -070025
Romain Guy0a637162009-05-29 14:43:54 -070026 protected GestureLibrary() {
27 mStore = new GestureStore();
Yang Li35aa84b2009-05-18 18:29:05 -070028 }
29
Romain Guy0a637162009-05-29 14:43:54 -070030 public abstract boolean save();
31
32 public abstract boolean load();
33
34 public boolean isReadOnly() {
35 return false;
36 }
37
Dianne Hackborn7f205432009-07-28 00:13:47 -070038 /** @hide */
Romain Guy0a637162009-05-29 14:43:54 -070039 public Learner getLearner() {
40 return mStore.getLearner();
41 }
42
Yang Li35aa84b2009-05-18 18:29:05 -070043 public void setOrientationStyle(int style) {
Romain Guy0a637162009-05-29 14:43:54 -070044 mStore.setOrientationStyle(style);
Yang Li35aa84b2009-05-18 18:29:05 -070045 }
46
47 public int getOrientationStyle() {
Romain Guy0a637162009-05-29 14:43:54 -070048 return mStore.getOrientationStyle();
Yang Li35aa84b2009-05-18 18:29:05 -070049 }
50
Yang Liac6a4b82009-05-21 16:08:35 -070051 public void setSequenceType(int type) {
Romain Guy0a637162009-05-29 14:43:54 -070052 mStore.setSequenceType(type);
Yang Li35aa84b2009-05-18 18:29:05 -070053 }
54
Yang Liac6a4b82009-05-21 16:08:35 -070055 public int getSequenceType() {
Romain Guy0a637162009-05-29 14:43:54 -070056 return mStore.getSequenceType();
Yang Li35aa84b2009-05-18 18:29:05 -070057 }
58
Yang Li35aa84b2009-05-18 18:29:05 -070059 public Set<String> getGestureEntries() {
Romain Guy0a637162009-05-29 14:43:54 -070060 return mStore.getGestureEntries();
Yang Li35aa84b2009-05-18 18:29:05 -070061 }
62
Yang Li35aa84b2009-05-18 18:29:05 -070063 public ArrayList<Prediction> recognize(Gesture gesture) {
Romain Guy0a637162009-05-29 14:43:54 -070064 return mStore.recognize(gesture);
Yang Li35aa84b2009-05-18 18:29:05 -070065 }
66
Yang Li35aa84b2009-05-18 18:29:05 -070067 public void addGesture(String entryName, Gesture gesture) {
Romain Guy0a637162009-05-29 14:43:54 -070068 mStore.addGesture(entryName, gesture);
Yang Li35aa84b2009-05-18 18:29:05 -070069 }
70
Yang Li35aa84b2009-05-18 18:29:05 -070071 public void removeGesture(String entryName, Gesture gesture) {
Romain Guy0a637162009-05-29 14:43:54 -070072 mStore.removeGesture(entryName, gesture);
Yang Li35aa84b2009-05-18 18:29:05 -070073 }
74
Romain Guydb567c32009-05-21 16:23:21 -070075 public void removeEntry(String entryName) {
Romain Guy0a637162009-05-29 14:43:54 -070076 mStore.removeEntry(entryName);
Yang Li35aa84b2009-05-18 18:29:05 -070077 }
78
Yang Li35aa84b2009-05-18 18:29:05 -070079 public ArrayList<Gesture> getGestures(String entryName) {
Romain Guy0a637162009-05-29 14:43:54 -070080 return mStore.getGestures(entryName);
Romain Guyf40f0742009-05-28 21:12:01 -070081 }
Yang Li35aa84b2009-05-18 18:29:05 -070082}