List of usage examples for android.gesture GestureOverlayView addView
public void addView(View child)
Adds a child view.
From source file:Main.java
/** * add GestureOverlayView to an activity * @param activity// w ww . ja va 2 s .c o m * @return added GestureOverlayView */ public static GestureOverlayView addGestureViewToActivity(Activity activity) { View contentView = getContentView(activity); GestureOverlayView view = new GestureOverlayView(activity); view.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT, 1)); activity.setContentView(view); view.addView(contentView); // adds the PhoneGap browser view.getChildAt(0).setLayoutParams(new FrameLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT, 1)); activity.setContentView(view); view.setGestureVisible(false); return view; }
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 . ja v a2s. c o m*/ 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 ww w .j av a 2s . 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: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);// ww w . j a v a 2s. c om 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"); } }