本文整理汇总了Java中android.gesture.GestureLibraries类的典型用法代码示例。如果您正苦于以下问题:Java GestureLibraries类的具体用法?Java GestureLibraries怎么用?Java GestureLibraries使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GestureLibraries类属于android.gesture包,在下文中一共展示了GestureLibraries类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.gesture.GestureLibraries; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.gestures_list);
mAdapter = new GesturesAdapter(this);
setListAdapter(mAdapter);
if (sStore == null) {
sStore = GestureLibraries.fromFile(mStoreFile);
}
mEmpty = (TextView) findViewById(android.R.id.empty);
loadGestures();
registerForContextMenu(getListView());
}
示例2: onCreate
import android.gesture.GestureLibraries; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.save_gesture);
Log.d(TAG, "path = " + Environment.getExternalStorageDirectory().getAbsolutePath());
openOptionsMenu();
gLib = GestureLibraries.fromFile(getExternalFilesDir(null) + "/" + "gesture.txt");
gLib.load();
GestureOverlayView gestures = (GestureOverlayView) findViewById(R.id.save_gesture);
gestures.addOnGestureListener(mGestureListener);
resetEverything();
}
示例3: listBanav
import android.gesture.GestureLibraries; //导入依赖的package包/类
/**
* badha gestures laine emne list ma mukse
*/
private void listBanav() {
try {
mGestureList = new ArrayList<GestureHolder>();
gLib = GestureLibraries.fromFile(getExternalFilesDir(null) + "/" + "gesture.txt");
gLib.load();
Set<String> gestureSet = gLib.getGestureEntries();
for(String gestureNaam: gestureSet){
ArrayList<Gesture> list = gLib.getGestures(gestureNaam);
for(Gesture g : list) {
mGestureList.add(new GestureHolder(g, gestureNaam));
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
示例4: initGesture
import android.gesture.GestureLibraries; //导入依赖的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();
}
}
});
}
示例5: addGesture
import android.gesture.GestureLibraries; //导入依赖的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);
}
}
示例6: removeGesture
import android.gesture.GestureLibraries; //导入依赖的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;
}
示例7: getOverlayContentView
import android.gesture.GestureLibraries; //导入依赖的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;
}
示例8: onCreate
import android.gesture.GestureLibraries; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.create_gesture);
path =getIntent().getExtras().getString("path");
mDoneButton = findViewById(R.id.done);
if (sStore == null) {
sStore = GestureLibraries.fromFile(mStoreFile);
}
GestureOverlayView overlay = (GestureOverlayView) findViewById(R.id.gestures_overlay);
overlay.addOnGestureListener(new GesturesProcessor());
}
示例9: onCreate
import android.gesture.GestureLibraries; //导入依赖的package包/类
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
//
Gson gson = new Gson();
SharedPreferences prefs = getSharedPreferences("MyPref", MODE_PRIVATE);
String wrapperStr = prefs.getString("memMap", null);
MapWrapper wrapper = gson.fromJson(wrapperStr, MapWrapper.class);
this.keys = wrapper.getKeys();
this.values = wrapper.getValues(keys);
//
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_hand_writing_train);
generateHashMap(memMap, keys,values);
keyList.addAll(myNewHashMap.keySet());
valueList.addAll(myNewHashMap.values());
textView2 = (TextView)findViewById(R.id.textView2);
textView2.setText("The first one of map : "+myNewHashMap.get(keyList.get(0))+", write "+keyList.get(0));
MediaPlayer.create(handWritingTrain.this,audio[keyList.get(0)]).start();
textView4 = (TextView)findViewById(R.id.textView4);
gestureResult = (TextView)findViewById(R.id.gestureresult);
gestureOverlayView = (GestureOverlayView)findViewById(R.id.gestures);
gestureLibrary = GestureLibraries.fromRawResource(this, R.raw.gestures);
gestureLibrary.load();
gestureOverlayView.addOnGesturePerformedListener(gesturePerformedListener);
}
示例10: init
import android.gesture.GestureLibraries; //导入依赖的package包/类
private void init() {
iLanguage();
app = (ApplicationUtil) GestureActivity.this.getApplication();
tvShow = (TextView) findViewById(R.id.tv_show);
tvShow.setText(strShow);
tvGestureGuide = (TextView) findViewById(R.id.tv_gesture_guide);
tvGestureGuide.setText(strGestureGuide);
final List<String> lLetter = new ArrayList<>();
List<String> lString = new ArrayList<>();
lLetter.add("c");
lString.add(strCmd);
lLetter.add("t");
lString.add(strTaskManager);
lLetter.add("e/z");
lString.add(strExplorer);
lLetter.add("s");
lString.add(strDeviceManager);
lLetter.add("d");
lString.add(strDiskManager);
lLetter.add("r");
lString.add(strRegistryEditor);
lLetter.add("j");
lString.add(strCalculator);
lLetter.add("n");
lString.add(strNotepad);
lLetter.add("h/p");
lString.add(strPaint);
lLetter.add("w/x");
lString.add(strWrite);
lLetter.add("b/l");
lString.add(strBrowser);
govTouch = (GestureOverlayView) findViewById(R.id.gov_touch);
govTouch.setGestureStrokeType(GestureOverlayView.GESTURE_STROKE_TYPE_MULTIPLE);
govTouch.setFadeOffset(1500);
govTouch.setGestureColor(Color.WHITE);
govTouch.setGestureStrokeWidth(20);
govTouch.addOnGesturePerformedListener(new GestureOverlayView.OnGesturePerformedListener() {
@Override
public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {
ArrayList<Prediction> predictions = mGestureLib
.recognize(gesture);
if (predictions.size() > 0) {
Prediction prediction = predictions.get(0);
if (prediction.score > 1.0) {
String tmp = GestureUtil.getCommand(prediction.name);
if (!tmp.equals("")) {
sendMessage("remote", tmp);
}
}
}
}
});
if (mGestureLib == null) {
mGestureLib = GestureLibraries.fromRawResource(this, R.raw.gestures);
mGestureLib.load();
}
btnGestureProblem = (LinearLayout) findViewById(R.id.btn_gesture_problem);
btnGestureProblem.setOnClickListener(this);
btnBack = (Button) findViewById(R.id.btn_back);
btnBack.setOnClickListener(this);
}
示例11: TouchGesturesLoader
import android.gesture.GestureLibraries; //导入依赖的package包/类
public TouchGesturesLoader(Context context) {
super(context);
this.mLibrary = GestureLibraries.fromFile(GestureManager.TOUCH_GESTURES_FILE);
this.mListener = new TouchGesturesChangedListener();
this.mWidth = context.getResources().getDimensionPixelSize(R.dimen.gesture_icon_width);
this.mHeight = context.getResources().getDimensionPixelSize(R.dimen.gesture_icon_height);
this.mColor = context.getResources().getColor(R.color.accent);
this.mInset = context.getResources().getDimensionPixelOffset(R.dimen.gesture_thumbnail_inset);
}
示例12: onCreate
import android.gesture.GestureLibraries; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_overlay_new);
blurBackground();
mOverlay = (GestureOverlayView) findViewById(R.id.gesture_overlay);
if (mLibrary == null) {
mLibrary = GestureLibraries.fromFile(GestureManager.TOUCH_GESTURES_FILE);
}
if (!mLibrary.load()) {
finish();
}
}
示例13: onCreate
import android.gesture.GestureLibraries; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_unlockwithgesture);
GestureOverlayView view = (GestureOverlayView) findViewById(R.id.gestureOverlayView);
view.addOnGestureListener(new GestureProcessor());
File gestureFile = new File(Environment.getDataDirectory() + "/data/" + getPackageName(), AppLockApplication.GESTUREFILE);
library = GestureLibraries.fromFile(gestureFile);
Bundle bundle = getIntent().getExtras();
mPackage = bundle.getString(Intent.EXTRA_TEXT);
unlockSelf = bundle.getBoolean(AppLockApplication.UNLOCK_SELF);
changeLock = false;
changeLock = bundle.getBoolean(AppLockApplication.CHANGELOCK);
}
示例14: onCreate
import android.gesture.GestureLibraries; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
changeLock = getIntent().getBooleanExtra(AppLockApplication.CHANGELOCK, false);
String message = changeLock ? getString(R.string.change_gesture) : getString(R.string.create_gesture);
setContentView(R.layout.layout_unlockwithgesture);
File gestureFile = new File(Environment.getDataDirectory() + "/data/" + getPackageName(), AppLockApplication.GESTUREFILE);
GestureOverlayView gestureOverlayView = (GestureOverlayView) findViewById(R.id.gestureOverlayView);
gestureOverlayView.addOnGestureListener(new GestureProcessor());
findViewById(R.id.id_ll_icon).setVisibility(View.GONE);
findViewById(R.id.id_btn_forgot_gesture).setVisibility(View.GONE);
((TextView)findViewById(R.id.tv_unlock_message)).setText(message);
first = true;
library = GestureLibraries.fromFile(gestureFile);
}
示例15: onCreate
import android.gesture.GestureLibraries; //导入依赖的package包/类
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.gesture_detect);
gestureOverlayView = (GestureOverlayView)findViewById(R.id.gestures);
gestureLibrary = GestureLibraries.fromFile(Environment.getExternalStorageDirectory()+"/Ultra Explorer/gestures");
gestureLibrary.load();
gestureOverlayView.addOnGesturePerformedListener(gesturePerformedListener);
}