Example usage for android.gesture GestureOverlayView addOnGesturePerformedListener

List of usage examples for android.gesture GestureOverlayView addOnGesturePerformedListener

Introduction

In this page you can find the example usage for android.gesture GestureOverlayView addOnGesturePerformedListener.

Prototype

public void addOnGesturePerformedListener(OnGesturePerformedListener listener) 

Source Link

Usage

From source file:org.liberty.android.fantastischmemo.ui.QACardActivity.java

private void loadGestures() {
    gestureLibrary = GestureLibraries.fromRawResource(this, R.raw.gestures);
    if (!gestureLibrary.load()) {
        Log.e(TAG, "Gestures can not be load");
    }/* w ww  . jav a 2 s  . c  om*/

    GestureOverlayView gestureOverlay = (GestureOverlayView) findViewById(R.id.gesture_overlay);
    gestureOverlay.addOnGesturePerformedListener(onGesturePerformedListener);

    // Set if gestures are enabled if set on preference
    gestureOverlay.setEnabled(option.getGestureEnabled());
}

From source file:gr.scify.newsum.ui.SearchViewActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if ((getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) != Configuration.SCREENLAYOUT_SIZE_NORMAL
            & (getResources().getConfiguration().screenLayout
                    & Configuration.SCREENLAYOUT_SIZE_MASK) != Configuration.SCREENLAYOUT_SIZE_SMALL) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

    }//from   ww  w  . j  a  v  a 2 s.c om
    SharedPreferences usertheme = getSharedPreferences("theme", 0);
    int newTheme = usertheme.getInt("theme", 2);
    Utils.onActivityCreateSetTheme(this, newTheme);

    SharedPreferences userlang = getSharedPreferences("lang", 0);
    String newlang = userlang.getString("lang", Locale.getDefault().getLanguage());
    Setlanguage.updateLanguage(getApplicationContext(), newlang);

    GestureOverlayView gestureOverlayView = new GestureOverlayView(this);
    View inflate = getLayoutInflater().inflate(R.layout.view, null);
    gestureOverlayView.addView(inflate);
    gestureOverlayView.addOnGesturePerformedListener(this);
    gestureOverlayView.setGestureColor(Color.TRANSPARENT);
    gestureOverlayView.setUncertainGestureColor(Color.TRANSPARENT);
    gestureLib = GestureLibraries.fromRawResource(this, R.raw.gestures);
    if (!gestureLib.load()) {
        finish();
    }
    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    setContentView(gestureOverlayView);
    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title);

    ImageView title_image = (ImageView) findViewById(R.id.title_image);
    title_image.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent browse = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.scify)));
            startActivity(browse);
        }

    });

    // setContentView(R.layout.view);
    // TODO: Add Loading dialog

    SharedPreferences setvmassage = getSharedPreferences("dialog", 0);
    boolean dialogShown = setvmassage.getBoolean("dialogShown", false);

    if (!dialogShown) {
        // prepare the alert box
        AlertDialog.Builder alertbox = new AlertDialog.Builder(this);
        alertbox.setMessage(R.string.view_massage);
        alertbox.setNeutralButton(R.string.ok, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface arg0, int arg1) {

            }
        });
        alertbox.setCancelable(false);
        alertbox.show();

        SharedPreferences.Editor editor = setvmassage.edit();
        editor.putBoolean("dialogShown", true);
        editor.commit();
    }

    // Init waiting dialog
    showWaitingDialog();

    initLayoutAndControls();

}

From source file:gr.scify.newsum.ui.ViewActivity.java

protected void initGestures() {
    GestureOverlayView gestureOverlayView = new GestureOverlayView(this);
    View inflate = getLayoutInflater().inflate(R.layout.view, null);
    gestureOverlayView.addView(inflate);
    gestureOverlayView.addOnGesturePerformedListener(this);
    gestureOverlayView.setGestureColor(Color.TRANSPARENT);
    gestureOverlayView.setUncertainGestureColor(Color.TRANSPARENT);
    gestureLib = GestureLibraries.fromRawResource(this, R.raw.gestures);
    if (!gestureLib.load()) {
        finish();/*from  w ww.  j av a 2  s . c  o m*/
    }
    setContentView(gestureOverlayView);
    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title);

    ImageView title_image = (ImageView) findViewById(R.id.title_image);
    title_image.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent browse = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.scify)));
            startActivity(browse);
        }

    });

    // Allow links to be followed into browser
    final TextView tx = (TextView) findViewById(R.id.textView1);
    tx.setMovementMethod(LinkMovementMethod.getInstance());
}

From source file:com.android.mms.ui.ComposeMessageActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    mIsSmsEnabled = MmsConfig.isSmsEnabled(this);
    super.onCreate(savedInstanceState);

    resetConfiguration(getResources().getConfiguration());

    SharedPreferences prefs = PreferenceManager
            .getDefaultSharedPreferences((Context) ComposeMessageActivity.this);
    mGestureSensitivity = prefs.getInt(MessagingPreferenceActivity.GESTURE_SENSITIVITY_VALUE, 3);
    mEnableEmoticons = prefs.getBoolean(MessagingPreferenceActivity.ENABLE_EMOTICONS, true);
    boolean showGesture = prefs.getBoolean(MessagingPreferenceActivity.SHOW_GESTURE, false);
    int unicodeStripping = prefs.getInt(MessagingPreferenceActivity.UNICODE_STRIPPING_VALUE,
            MessagingPreferenceActivity.UNICODE_STRIPPING_LEAVE_INTACT);
    mInputMethod = Integer.parseInt(prefs.getString(MessagingPreferenceActivity.INPUT_TYPE,
            Integer.toString(InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE)));

    mLibrary = TemplateGesturesLibrary.getStore(this);

    int layout = R.layout.compose_message_activity;

    GestureOverlayView gestureOverlayView = new GestureOverlayView(this);
    View inflate = getLayoutInflater().inflate(layout, null);
    gestureOverlayView.addView(inflate);
    gestureOverlayView.setEventsInterceptionEnabled(true);
    gestureOverlayView.setGestureVisible(showGesture);
    gestureOverlayView.addOnGesturePerformedListener(this);
    setContentView(gestureOverlayView);//from w w w  .  j  a v  a2s . c  o m
    setProgressBarVisibility(false);

    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
            | WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);

    // Initialize members for UI elements.
    initResourceRefs();

    LengthFilter lengthFilter = new LengthFilter(MmsConfig.getMaxTextLimit());
    mTextEditor.setFilters(new InputFilter[] { lengthFilter });

    if (unicodeStripping != MessagingPreferenceActivity.UNICODE_STRIPPING_LEAVE_INTACT) {
        boolean stripNonDecodableOnly = unicodeStripping == MessagingPreferenceActivity.UNICODE_STRIPPING_NON_DECODABLE;
        mUnicodeFilter = new UnicodeFilter(stripNonDecodableOnly);
    }

    mContentResolver = getContentResolver();
    mBackgroundQueryHandler = new BackgroundQueryHandler(mContentResolver);

    initialize(savedInstanceState, 0);

    mMultiSensorManager = new MultiSensorManager((Context) ComposeMessageActivity.this, this);

    if (TRACE) {
        android.os.Debug.startMethodTracing("compose");
    }
}