I'm working on a Gesture based application launcher.I need to add custom gestures from the application to the gesture library. I tried the method with Gesture builder and copying it to res/raw, It worked. But i need to add more Gestures through my applications add gesture menu..help
Asked
Active
Viewed 979 times
1 Answers
2
I'm not sure what you want, but if you need keep and modify GestureLibrary
you can read and write it at filesystem like this:
final String fileName = "gestures";
final String dir = Environment.getExternalStorageDirectory();
final File storeFile = new File(dir, fileName);
final GestureLibrary gesturelib = GestureLibraries.fromFile(storeFile);
Code of creating gestures you can get from GestureBuilder
example (Sorry, I found only this source, but it copy well-known example with changed names of variables) and read about in how-to.
Or about what gestures you asked?

nfirex
- 1,523
- 18
- 24
-
When I draw a circle by hand with the gesture builder, it is far from the perfect shape. I want a way to clean the path, so that the GestureLibrary works with smaller and better references. I expected that the shape to be described with a Bézier curve in an XML file, but it is binary. – rds Dec 26 '12 at 21:15
-
@rds You need to read/parse `Gestures` with a readable format? `Gesture` keep 'GestureStroke' (I think it can be discribed only with strokes) inside that using for creating `Bitmap`. You can look at in source (`toBitmap()`-method): https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/java/android/gesture/Gesture.java You can construct `Gesture` with `GestureStroke`s use `addStroke()`-method. You need special parser-converter to create `Gesture` from special data. I don't know any, but you easy can create one (xml2gesture) :). – nfirex Dec 26 '12 at 21:37
-
It can be usefull. How GestureLibrary work with gesture-files: http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.1.1_r1/android/gesture/GestureStore.java#GestureStore.readFormatV1%28java.io.DataInputStream%29 http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.1.1_r1/android/gesture/GestureStore.java#GestureStore.save%28java.io.OutputStream%2Cboolean%29 At top of the source placed structure of file. – nfirex Dec 27 '12 at 08:58
-
The answer per se is not what I was expecting, but the pointers to the source code are useful. – rds Jan 02 '13 at 10:40