本文整理汇总了Java中android.gesture.GestureLibrary类的典型用法代码示例。如果您正苦于以下问题:Java GestureLibrary类的具体用法?Java GestureLibrary怎么用?Java GestureLibrary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GestureLibrary类属于android.gesture包,在下文中一共展示了GestureLibrary类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: addGesture
import android.gesture.GestureLibrary; //导入依赖的package包/类
@SuppressWarnings({"UnusedDeclaration"})
public void addGesture(View v) {
if (mGesture != null) {
final TextView input = (TextView) findViewById(R.id.gesture_name);
final CharSequence name = input.getText();
if (name.length() == 0) {
input.setError(getString(R.string.error_missing_name));
return;
}
final GestureLibrary store = GestureBuilderActivity.getStore();
store.addGesture(name.toString(), mGesture);
store.save();
setResult(RESULT_OK);
final String path = new File(Environment.getExternalStorageDirectory(),
"gestures").getAbsolutePath();
Toast.makeText(this, getString(R.string.save_success, path), Toast.LENGTH_LONG).show();
} else {
setResult(RESULT_CANCELED);
}
finish();
}
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:27,代码来源:CreateGestureActivity.java
示例2: initGesture
import android.gesture.GestureLibrary; //导入依赖的package包/类
private void initGesture() {
final GestureLibrary gestureLibrary = GestureLibraries.fromRawResource(
context, R.raw.gestures);
gestureLibrary.load();
gestureOverlayView
.addOnGesturePerformedListener(new OnGesturePerformedListener() {
@Override
public void onGesturePerformed(GestureOverlayView overlay,
Gesture gesture) {
ArrayList<Prediction> arrayList = gestureLibrary
.recognize(gesture);
Prediction prediction = arrayList.get(0);
if (prediction.score >= 3.0) {
if (prediction.name.equals("back")) {
Toast.makeText(context, "退出",
Toast.LENGTH_SHORT).show();
finish();
}
} else {
Toast.makeText(context, "手势不存在", Toast.LENGTH_SHORT)
.show();
}
}
});
}
开发者ID:chenyufeng1991,项目名称:BaiduMap-TrafficAssistant,代码行数:32,代码来源:MainActivity.java
示例3: addGesture
import android.gesture.GestureLibrary; //导入依赖的package包/类
public void addGesture(View v) {
if (mGesture != null) {
final TextView input = (TextView) findViewById(R.id.gesture_command);
final CharSequence name = input.getText();
if (name.length() == 0) {
input.setError(getString(R.string.error_missing_name_str));
return;
}
final GestureLibrary store = GestureBuilderActivity.getStore();
store.addGesture(name.toString(), mGesture);
store.save();
setResult(RESULT_OK);
final String path = new File(Environment.getExternalStorageDirectory(),
"gestures").getAbsolutePath();
Toast.makeText(this, getString(R.string.save_success_str, path), Toast.LENGTH_LONG).show();
} else {
setResult(RESULT_CANCELED);
}
finish();
}
开发者ID:pot8oe,项目名称:mythmote,代码行数:26,代码来源:CreateGestureActivity.java
示例4: addGesture
import android.gesture.GestureLibrary; //导入依赖的package包/类
/**
* Stores the given gesture.
*
* @param name The name of the gesture
* @param gesture The gesture
* @param action The action to perform when the touch gesture is performed
*/
public void addGesture(String name, Gesture gesture, AbstractAction action) {
GestureLibrary fileLib = GestureLibraries.fromFile(TOUCH_GESTURES_FILE);
if (fileLib.load()) {
fileLib.addGesture(name, gesture);
fileLib.save();
this.mMap.put(name, action);
saveHashMap();
DeLog.d(TAG, "Gesture " + name + " saved");
sendGestureChangedBroadcast();
} else {
DeLog.e(TAG, "Couldn't save gesture " + name);
}
}
开发者ID:alexstyl,项目名称:Touch-Control,代码行数:23,代码来源:GestureManager.java
示例5: removeGesture
import android.gesture.GestureLibrary; //导入依赖的package包/类
/**
* Removes the gesture with the given name from the manager
*
* @param name The name of the entry to remove
* @return Whether it manages to remove an entry or not
*/
public boolean removeGesture(String name) {
boolean res = false;
GestureLibrary fileLib = GestureLibraries.fromFile(TOUCH_GESTURES_FILE);
if (fileLib.load()) {
fileLib.removeEntry(name);
fileLib.save();
res = null != this.mMap.remove(name);
saveHashMap();
DeLog.d(TAG, "Gesture " + name + " removed");
sendGestureChangedBroadcast();
} else {
DeLog.e(TAG, "Couldn't save gesture " + name);
}
return res;
}
开发者ID:alexstyl,项目名称:Touch-Control,代码行数:24,代码来源:GestureManager.java
示例6: getOverlayContentView
import android.gesture.GestureLibrary; //导入依赖的package包/类
/**
* Add the content view of the activity into a GestureOverlayView and return the new view
*
* @param contentView the original content view of the activity
* @param packageName the package name of the app who uses this library
* @param rawId the resource identifier of the gesture file in your raw folder
* @return the new contentView wrapped in a GestureOverlayView
*/
public static View getOverlayContentView(final View contentView, final String packageName,
int rawId) {
//load the gestures
final GestureLibrary gestureLib = GestureLibraries
.fromRawResource(contentView.getContext(), rawId);
if (!gestureLib.load()) {
Log.w(TAG, "could not load gestures");
return contentView;
}
GestureOverlayView gestureOverlayView = new GestureOverlayView(contentView.getContext());
gestureOverlayView.setGestureColor(Color.TRANSPARENT);
gestureOverlayView.setUncertainGestureColor(Color.TRANSPARENT);
gestureOverlayView.addView(contentView);
gestureOverlayView
.addOnGesturePerformedListener(new GestureOverlayView.OnGesturePerformedListener() {
@Override
public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {
//load all gestures
ArrayList<Prediction> predictions = gestureLib.recognize(gesture);
//the only received prediction should be "netural"
for (Prediction prediction : predictions) {
if (prediction.score > 1.0) {
showDialog(contentView.getContext(), packageName);
}
}
}
});
return gestureOverlayView;
}
开发者ID:Netural,项目名称:AboutApp,代码行数:39,代码来源:AboutAppOverlay.java
示例7: addGesture
import android.gesture.GestureLibrary; //导入依赖的package包/类
public void addGesture(View v) {
if (mGesture != null) {
final TextView input = (TextView) findViewById(R.id.gesture_name);
final CharSequence name = input.getText();
if (name.length() == 0) {
input.setError(getString(R.string.error_missing_name));
return;
}
final GestureLibrary store = SettingsUtil.getGestureLibrary(this);
store.addGesture(name.toString(), mGesture);
store.save();
setResult(RESULT_OK);
final String path = SettingsUtil.getGestureFile(this)
.getAbsolutePath();
Toast.makeText(this, getString(R.string.save_success, path),
Toast.LENGTH_LONG).show();
} else {
setResult(RESULT_CANCELED);
}
finish();
}
开发者ID:AndrewMurrell,项目名称:minak,代码行数:27,代码来源:SettingsCreateGestureActivity.java
示例8: doInBackground
import android.gesture.GestureLibrary; //导入依赖的package包/类
@Override
protected Integer doInBackground(Void... params) {
if (isCancelled()) return STATUS_CANCELLED;
if (!Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
return STATUS_NO_STORAGE;
}
final GestureLibrary store = sStore;
if (store.load()) {
for (String name : store.getGestureEntries()) {
if (isCancelled()) break;
for (Gesture gesture : store.getGestures(name)) {
final Bitmap bitmap = gesture.toBitmap(mThumbnailSize, mThumbnailSize,
mThumbnailInset, mPathColor);
final NamedGesture namedGesture = new NamedGesture();
namedGesture.gesture = gesture;
namedGesture.name = name;
mAdapter.addBitmap(namedGesture.gesture.getID(), bitmap);
publishProgress(namedGesture);
}
}
return STATUS_SUCCESS;
}
return STATUS_NOT_LOADED;
}
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:31,代码来源:GestureBuilderActivity.java
示例9: type
import android.gesture.GestureLibrary; //导入依赖的package包/类
public static SubjectFactory<GestureLibrarySubject, GestureLibrary> type() {
return new SubjectFactory<GestureLibrarySubject, GestureLibrary>() {
@Override
public GestureLibrarySubject getSubject(FailureStrategy fs, GestureLibrary that) {
return new GestureLibrarySubject(fs, that);
}
};
}
开发者ID:pkware,项目名称:truth-android,代码行数:9,代码来源:GestureLibrarySubject.java
示例10: printLibrary
import android.gesture.GestureLibrary; //导入依赖的package包/类
private void printLibrary(GestureLibrary lib) {
Set<String> nameEntries = lib.getGestureEntries();
for (String name : nameEntries) {
for (Gesture gesture : lib.getGestures(name)) {
DeLog.v(TAG, name + " " + gesture);
}
}
}
开发者ID:alexstyl,项目名称:Touch-Control,代码行数:9,代码来源:GestureManager.java
示例11: doInBackground
import android.gesture.GestureLibrary; //导入依赖的package包/类
@Override
protected Integer doInBackground(Void... params) {
if (isCancelled())
return STATUS_CANCELLED;
if (!Environment.MEDIA_MOUNTED.equals(Environment
.getExternalStorageState())) {
return STATUS_NO_STORAGE;
}
final GestureLibrary store = SettingsUtil.getGestureLibrary(mThis);
if (store.load()) {
for (String name : store.getGestureEntries()) {
if (isCancelled())
break;
for (Gesture gesture : store.getGestures(name)) {
final Bitmap bitmap = gesture.toBitmap(mThumbnailSize,
mThumbnailSize, mThumbnailInset, mPathColor);
final NamedGesture namedGesture = new NamedGesture();
namedGesture.gesture = gesture;
namedGesture.name = name;
mAdapter.addBitmap(namedGesture.gesture.getID(), bitmap);
publishProgress(namedGesture);
}
}
return STATUS_SUCCESS;
}
return STATUS_NOT_LOADED;
}
开发者ID:AndrewMurrell,项目名称:minak,代码行数:34,代码来源:SettingsActivity.java
示例12: getStore
import android.gesture.GestureLibrary; //导入依赖的package包/类
static GestureLibrary getStore() {
return sStore;
}
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:4,代码来源:GestureBuilderActivity.java
示例13: GestureLibrarySubject
import android.gesture.GestureLibrary; //导入依赖的package包/类
protected GestureLibrarySubject(FailureStrategy failureStrategy, GestureLibrary subject) {
super(failureStrategy, subject);
}
开发者ID:pkware,项目名称:truth-android,代码行数:4,代码来源:GestureLibrarySubject.java
示例14: getGestureLibrary
import android.gesture.GestureLibrary; //导入依赖的package包/类
public static GestureLibrary getGestureLibrary(Context context) {
if (sGestureLibrary == null)
sGestureLibrary = GestureLibraries.fromFile(getGestureFile(context));
return sGestureLibrary;
}
开发者ID:AndrewMurrell,项目名称:minak,代码行数:6,代码来源:SettingsUtil.java
示例15: getStore
import android.gesture.GestureLibrary; //导入依赖的package包/类
static GestureLibrary getStore(){
return sStore;
}
开发者ID:kshark27,项目名称:UltraExplorer,代码行数:4,代码来源:CreateGestureActivity.java
示例16: GestureLibraryAssert
import android.gesture.GestureLibrary; //导入依赖的package包/类
public GestureLibraryAssert(GestureLibrary actual) {
super(actual, GestureLibraryAssert.class);
}
开发者ID:square,项目名称:assertj-android,代码行数:4,代码来源:GestureLibraryAssert.java
注:本文中的android.gesture.GestureLibrary类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论