use of android.gesture.GestureLibrary in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class GestureAnywhereCreateGestureActivity method addGesture.
@SuppressWarnings({ "UnusedDeclaration" })
public void addGesture(View v) {
if (mGesture != null) {
if (TextUtils.isEmpty(mName) || TextUtils.isEmpty(mUri)) {
return;
}
final GestureLibrary store = GestureAnywhereBuilderActivity.getStore();
final String gestureName = mName + "|" + mUri;
if (mIsExistingGesture) {
store.removeEntry(gestureName);
}
store.addGesture(gestureName, mGesture);
store.save();
setResult(RESULT_OK);
} else {
setResult(RESULT_CANCELED);
}
finish();
}
use of android.gesture.GestureLibrary in project AnyMemo by helloworld1.
the class GestureSelectionDialogFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.gesture_selection_dialog, container, false);
gestureList = (ListView) v.findViewById(R.id.gesture_list);
enableGestureCheckbox = (CheckBox) v.findViewById(R.id.enable_gestures);
enableGestureCheckbox.setChecked(option.getGestureEnabled());
enableGestureCheckbox.setOnCheckedChangeListener(enableGestureCheckboxChangeListener);
gestureAdapter = new GesturesAdapter(mActivity);
gestureList.setAdapter(gestureAdapter);
GestureLibrary gestureLibrary = GestureLibraries.fromRawResource(mActivity, R.raw.gestures);
gestureLibrary.load();
for (String gestureEntry : gestureLibrary.getGestureEntries()) {
for (Gesture gesture : gestureLibrary.getGestures(gestureEntry)) {
NamedGesture namedGesture = new NamedGesture();
namedGesture.name = gestureEntry;
namedGesture.gesture = gesture;
// do not want to use.
if (gestureNameDescriptionMap.containsKey(gestureEntry)) {
gestureAdapter.add(namedGesture);
}
}
}
setStyle(0, STYLE_NO_TITLE);
Rect displayRectangle = new Rect();
Window window = mActivity.getWindow();
window.getDecorView().getWindowVisibleDisplayFrame(displayRectangle);
v.setMinimumWidth((int) (displayRectangle.width() * 0.9f));
return v;
}
use of android.gesture.GestureLibrary in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class GestureAnywhereCreateGestureActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ga_create_gesture);
mDoneButton = findViewById(R.id.done);
final Intent intent = getIntent();
mUri = intent.getStringExtra("uri");
mName = intent.getStringExtra("name");
((TextView) findViewById(R.id.gesture_name)).setText(mName);
GestureOverlayView overlay = (GestureOverlayView) findViewById(R.id.gestures_overlay);
overlay.addOnGestureListener(new GesturesProcessor());
final GestureLibrary store = GestureAnywhereBuilderActivity.getStore();
final String gestureName = mName + '|' + mUri;
for (String entry : store.getGestureEntries()) {
if (gestureName.equals(entry)) {
mGesture = store.getGestures(entry).get(0);
mIsExistingGesture = true;
break;
}
}
}
Aggregations