Search in sources :

Example 1 with GestureLibrary

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();
}
Also used : GestureLibrary(android.gesture.GestureLibrary)

Example 2 with GestureLibrary

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;
}
Also used : Window(android.view.Window) Rect(android.graphics.Rect) GestureLibrary(android.gesture.GestureLibrary) Gesture(android.gesture.Gesture) View(android.view.View) TextView(android.widget.TextView) ListView(android.widget.ListView)

Example 3 with GestureLibrary

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;
        }
    }
}
Also used : GestureLibrary(android.gesture.GestureLibrary) GestureOverlayView(android.gesture.GestureOverlayView) Intent(android.content.Intent) TextView(android.widget.TextView)

Aggregations

GestureLibrary (android.gesture.GestureLibrary)3 TextView (android.widget.TextView)2 Intent (android.content.Intent)1 Gesture (android.gesture.Gesture)1 GestureOverlayView (android.gesture.GestureOverlayView)1 Rect (android.graphics.Rect)1 View (android.view.View)1 Window (android.view.Window)1 ListView (android.widget.ListView)1