Yang Li | 35aa84b | 2009-05-18 18:29:05 -0700 | [diff] [blame] | 1 | /* |
Romain Guy | 0a63716 | 2009-05-29 14:43:54 -0700 | [diff] [blame] | 2 | * Copyright (C) 2009 The Android Open Source Project |
Yang Li | 35aa84b | 2009-05-18 18:29:05 -0700 | [diff] [blame] | 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 | |
Romain Guy | 0a63716 | 2009-05-29 14:43:54 -0700 | [diff] [blame] | 17 | |
Romain Guy | db567c3 | 2009-05-21 16:23:21 -0700 | [diff] [blame] | 18 | package android.gesture; |
Yang Li | 35aa84b | 2009-05-18 18:29:05 -0700 | [diff] [blame] | 19 | |
Yang Li | 35aa84b | 2009-05-18 18:29:05 -0700 | [diff] [blame] | 20 | import java.util.Set; |
Romain Guy | 0a63716 | 2009-05-29 14:43:54 -0700 | [diff] [blame] | 21 | import java.util.ArrayList; |
Yang Li | 35aa84b | 2009-05-18 18:29:05 -0700 | [diff] [blame] | 22 | |
Romain Guy | 0a63716 | 2009-05-29 14:43:54 -0700 | [diff] [blame] | 23 | public abstract class GestureLibrary { |
| 24 | protected final GestureStore mStore; |
Romain Guy | c534727 | 2009-05-20 10:37:13 -0700 | [diff] [blame] | 25 | |
Romain Guy | 0a63716 | 2009-05-29 14:43:54 -0700 | [diff] [blame] | 26 | protected GestureLibrary() { |
| 27 | mStore = new GestureStore(); |
Yang Li | 35aa84b | 2009-05-18 18:29:05 -0700 | [diff] [blame] | 28 | } |
| 29 | |
Romain Guy | 0a63716 | 2009-05-29 14:43:54 -0700 | [diff] [blame] | 30 | public abstract boolean save(); |
| 31 | |
| 32 | public abstract boolean load(); |
| 33 | |
| 34 | public boolean isReadOnly() { |
| 35 | return false; |
| 36 | } |
| 37 | |
Dianne Hackborn | 7f20543 | 2009-07-28 00:13:47 -0700 | [diff] [blame^] | 38 | /** @hide */ |
Romain Guy | 0a63716 | 2009-05-29 14:43:54 -0700 | [diff] [blame] | 39 | public Learner getLearner() { |
| 40 | return mStore.getLearner(); |
| 41 | } |
| 42 | |
Yang Li | 35aa84b | 2009-05-18 18:29:05 -0700 | [diff] [blame] | 43 | public void setOrientationStyle(int style) { |
Romain Guy | 0a63716 | 2009-05-29 14:43:54 -0700 | [diff] [blame] | 44 | mStore.setOrientationStyle(style); |
Yang Li | 35aa84b | 2009-05-18 18:29:05 -0700 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | public int getOrientationStyle() { |
Romain Guy | 0a63716 | 2009-05-29 14:43:54 -0700 | [diff] [blame] | 48 | return mStore.getOrientationStyle(); |
Yang Li | 35aa84b | 2009-05-18 18:29:05 -0700 | [diff] [blame] | 49 | } |
| 50 | |
Yang Li | ac6a4b8 | 2009-05-21 16:08:35 -0700 | [diff] [blame] | 51 | public void setSequenceType(int type) { |
Romain Guy | 0a63716 | 2009-05-29 14:43:54 -0700 | [diff] [blame] | 52 | mStore.setSequenceType(type); |
Yang Li | 35aa84b | 2009-05-18 18:29:05 -0700 | [diff] [blame] | 53 | } |
| 54 | |
Yang Li | ac6a4b8 | 2009-05-21 16:08:35 -0700 | [diff] [blame] | 55 | public int getSequenceType() { |
Romain Guy | 0a63716 | 2009-05-29 14:43:54 -0700 | [diff] [blame] | 56 | return mStore.getSequenceType(); |
Yang Li | 35aa84b | 2009-05-18 18:29:05 -0700 | [diff] [blame] | 57 | } |
| 58 | |
Yang Li | 35aa84b | 2009-05-18 18:29:05 -0700 | [diff] [blame] | 59 | public Set<String> getGestureEntries() { |
Romain Guy | 0a63716 | 2009-05-29 14:43:54 -0700 | [diff] [blame] | 60 | return mStore.getGestureEntries(); |
Yang Li | 35aa84b | 2009-05-18 18:29:05 -0700 | [diff] [blame] | 61 | } |
| 62 | |
Yang Li | 35aa84b | 2009-05-18 18:29:05 -0700 | [diff] [blame] | 63 | public ArrayList<Prediction> recognize(Gesture gesture) { |
Romain Guy | 0a63716 | 2009-05-29 14:43:54 -0700 | [diff] [blame] | 64 | return mStore.recognize(gesture); |
Yang Li | 35aa84b | 2009-05-18 18:29:05 -0700 | [diff] [blame] | 65 | } |
| 66 | |
Yang Li | 35aa84b | 2009-05-18 18:29:05 -0700 | [diff] [blame] | 67 | public void addGesture(String entryName, Gesture gesture) { |
Romain Guy | 0a63716 | 2009-05-29 14:43:54 -0700 | [diff] [blame] | 68 | mStore.addGesture(entryName, gesture); |
Yang Li | 35aa84b | 2009-05-18 18:29:05 -0700 | [diff] [blame] | 69 | } |
| 70 | |
Yang Li | 35aa84b | 2009-05-18 18:29:05 -0700 | [diff] [blame] | 71 | public void removeGesture(String entryName, Gesture gesture) { |
Romain Guy | 0a63716 | 2009-05-29 14:43:54 -0700 | [diff] [blame] | 72 | mStore.removeGesture(entryName, gesture); |
Yang Li | 35aa84b | 2009-05-18 18:29:05 -0700 | [diff] [blame] | 73 | } |
| 74 | |
Romain Guy | db567c3 | 2009-05-21 16:23:21 -0700 | [diff] [blame] | 75 | public void removeEntry(String entryName) { |
Romain Guy | 0a63716 | 2009-05-29 14:43:54 -0700 | [diff] [blame] | 76 | mStore.removeEntry(entryName); |
Yang Li | 35aa84b | 2009-05-18 18:29:05 -0700 | [diff] [blame] | 77 | } |
| 78 | |
Yang Li | 35aa84b | 2009-05-18 18:29:05 -0700 | [diff] [blame] | 79 | public ArrayList<Gesture> getGestures(String entryName) { |
Romain Guy | 0a63716 | 2009-05-29 14:43:54 -0700 | [diff] [blame] | 80 | return mStore.getGestures(entryName); |
Romain Guy | f40f074 | 2009-05-28 21:12:01 -0700 | [diff] [blame] | 81 | } |
Yang Li | 35aa84b | 2009-05-18 18:29:05 -0700 | [diff] [blame] | 82 | } |