Example usage for android.gesture GestureLibraries fromRawResource

List of usage examples for android.gesture GestureLibraries fromRawResource

Introduction

In this page you can find the example usage for android.gesture GestureLibraries fromRawResource.

Prototype

public static GestureLibrary fromRawResource(Context context, @RawRes int resourceId) 

Source Link

Usage

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 www .ja  v a 2 s  .  co  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:net.cloudpath.xpressconnect.screens.ScreenBase.java

protected void onCreate(Bundle paramBundle) {
      this.mInstanceSaved = false;
      this.me = this;
      this.mParcelHelper = new ParcelHelper("", this);
      this.mWelcome = ((TabTextView) findViewById(this.mParcelHelper.getItemId("xpc_welcomeText")));
      this.mConfigure = ((TabTextView) findViewById(this.mParcelHelper.getItemId("xpc_configureText")));
      this.mConnect = ((TabTextView) findViewById(this.mParcelHelper.getItemId("xpc_connectText")));
      this.mAuthenticate = ((TabTextView) findViewById(this.mParcelHelper.getItemId("xpc_authenticateText")));
      this.mValidate = ((TabTextView) findViewById(this.mParcelHelper.getItemId("xpc_validateText")));
      this.mConnected = ((TabTextView) findViewById(this.mParcelHelper.getItemId("xpc_connectedText")));
      setTitle(getResources().getString(this.mParcelHelper.getIdentifier("xpc_app_name", "string")) + "  ("
              + Build.MODEL + ")");
      this.backgroundLayout = ((ViewGroup) findViewById(this.mParcelHelper.getItemId("xpc_BackgroundLayout")));
      this.workareaLayout = ((ViewGroup) findViewById(this.mParcelHelper.getItemId("xpc_rightColumnInner")));
      this.networkTitle = ((TextView) findViewById(this.mParcelHelper.getItemId("xpc_networkWelcomeText")));
      this.brandingImg = ((ImageView) findViewById(this.mParcelHelper.getItemId("xpc_BrandingImg")));
      this.licensee = ((TextView) findViewById(this.mParcelHelper.getItemId("xpc_licensee")));
      this.licensedToText = ((TextView) findViewById(this.mParcelHelper.getItemId("xpc_licensedToText")));
      this.topSeperator = ((ImageView) findViewById(this.mParcelHelper.getItemId("xpc_topSeperator")));
      this.bottomSeperator = ((ImageView) findViewById(this.mParcelHelper.getItemId("xpc_bottomSeperator")));
      if (this.licensee != null)
          this.licensee.setVisibility(4);
      if (this.licensedToText != null)
          this.licensedToText.setVisibility(4);
      this.mGlobals = new GetGlobals(this);
      if (this.mGlobals != null) {
          this.mGlobals.setCallbacks(this);
          this.mGlobals.bindService();
      }/*from ww  w . ja v a2s  .c  o m*/
      if (haveTabs())
          setWelcomeActive();
      this.mServiceBound = false;
      super.onCreate(paramBundle);
      this.mLibrary = GestureLibraries.fromRawResource(this, this.mParcelHelper.getIdentifier("gestures", "raw"));
      if (this.mLibrary.load()) {
          this.gestures = ((GestureOverlayView) findViewById(this.mParcelHelper.getItemId("xpc_gestures")));
          if (this.gestures != null)
              this.gestures.addOnGesturePerformedListener(this);
      }
      while (true) {
          Log.d("XPC", "++++ Startup complete.");
          return;
          this.gestures = null;
          Util.log(this.mLogger, "Couldn't load gesture library.  Gestures will be disabled.");
      }
  }

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");
    }/*from   ww  w  . ja  v  a2 s  .  co m*/

    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:de.enlightened.peris.PerisMain.java

private void enableGestures() {
    this.gLib = GestureLibraries.fromRawResource(this, R.raw.gestures);
    if (!this.gLib.load()) {
        Log.w(TAG, "could not load gesture library");
        finish();//from   w  w w. j a va2 s. c o m
    }

    this.gestures = (GestureOverlayView) findViewById(R.id.gestures);
    this.gestures.addOnGesturePerformedListener(this.handleGestureListener);

    if (this.application.getSession().getServer().serverColor.contains("#")) {
        this.gestures.setUncertainGestureColor(Color.TRANSPARENT);
        this.gestures.setGestureColor(
                Color.parseColor(this.application.getSession().getServer().serverColor.replace("#", "#33")));
    }

    this.gestures.setEnabled(false);
}