List of usage examples for android.content Intent getBooleanExtra
public boolean getBooleanExtra(String name, boolean defaultValue)
From source file:com.projectgoth.mywebrtcdemo.ConnectActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Get setting keys. PreferenceManager.setDefaultValues(this, R.xml.preferences, false); sharedPref = PreferenceManager.getDefaultSharedPreferences(this); keyprefVideoCallEnabled = getString(R.string.pref_videocall_key); keyprefResolution = getString(R.string.pref_resolution_key); keyprefFps = getString(R.string.pref_fps_key); keyprefCaptureQualitySlider = getString(R.string.pref_capturequalityslider_key); keyprefVideoBitrateType = getString(R.string.pref_startvideobitrate_key); keyprefVideoBitrateValue = getString(R.string.pref_startvideobitratevalue_key); keyprefVideoCodec = getString(R.string.pref_videocodec_key); keyprefHwCodecAcceleration = getString(R.string.pref_hwcodec_key); keyprefCaptureToTexture = getString(R.string.pref_capturetotexture_key); keyprefAudioBitrateType = getString(R.string.pref_startaudiobitrate_key); keyprefAudioBitrateValue = getString(R.string.pref_startaudiobitratevalue_key); keyprefAudioCodec = getString(R.string.pref_audiocodec_key); keyprefNoAudioProcessingPipeline = getString(R.string.pref_noaudioprocessing_key); keyprefAecDump = getString(R.string.pref_aecdump_key); keyprefOpenSLES = getString(R.string.pref_opensles_key); keyprefDisplayHud = getString(R.string.pref_displayhud_key); keyprefTracing = getString(R.string.pref_tracing_key); keyprefRoomServerUrl = getString(R.string.pref_room_server_url_key); keyprefRoom = getString(R.string.pref_room_key); keyprefRoomList = getString(R.string.pref_room_list_key); setContentView(R.layout.activity_connect); roomEditText = (EditText) findViewById(R.id.room_edittext); roomEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override//from w w w . j a va 2s . c o m public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) { if (i == EditorInfo.IME_ACTION_DONE) { addRoomButton.performClick(); return true; } return false; } }); roomEditText.requestFocus(); roomListView = (ListView) findViewById(R.id.room_listview); roomListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); addRoomButton = (ImageButton) findViewById(R.id.add_room_button); addRoomButton.setOnClickListener(addRoomListener); removeRoomButton = (ImageButton) findViewById(R.id.remove_room_button); removeRoomButton.setOnClickListener(removeRoomListener); connectButton = (ImageButton) findViewById(R.id.connect_button); connectButton.setOnClickListener(connectListener); connectLoopbackButton = (ImageButton) findViewById(R.id.connect_loopback_button); connectLoopbackButton.setOnClickListener(connectListener); // If an implicit VIEW intent is launching the app, go directly to that URL. final Intent intent = getIntent(); if ("android.intent.action.VIEW".equals(intent.getAction()) && !commandLineRun) { commandLineRun = true; boolean loopback = intent.getBooleanExtra(CallActivity.EXTRA_LOOPBACK, false); int runTimeMs = intent.getIntExtra(CallActivity.EXTRA_RUNTIME, 0); String room = sharedPref.getString(keyprefRoom, ""); roomEditText.setText(room); connectToRoom(loopback, runTimeMs); return; } }
From source file:com.avalond.ad_blocak.vpn.AdVpnService.java
private void connectivityChanged(Intent intent) { if (intent.getIntExtra(ConnectivityManager.EXTRA_NETWORK_TYPE, 0) == ConnectivityManager.TYPE_VPN) { Log.i(TAG, "Ignoring connectivity changed for our own network"); return;/* w ww . j a va 2 s . c om*/ } if (!ConnectivityManager.CONNECTIVITY_ACTION.equals(intent.getAction())) { Log.e(TAG, "Got bad intent on connectivity changed " + intent.getAction()); } if (intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, false)) { Log.i(TAG, "Connectivity changed to no connectivity, wait for a network"); waitForNetVpn(); } else { Log.i(TAG, "Network changed, try to reconnect"); reconnect(); } }
From source file:com.tarun.smartwomen.WebViewDemoActivity.java
@SuppressLint({ "JavascriptInterface", "SetJavaScriptEnabled" }) @Override/*from w ww. j a v a 2 s. co m*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.mainn); Intent intent = getIntent(); reg = intent.getBooleanExtra("reg", false); i = (ImageView) findViewById(R.id.hj); try { big = new GifAnimationDrawable(getResources().openRawResource(R.raw.anim2)); // big.setOneShot(true); android.util.Log.v("GifAnimationDrawable", "===>Four"); } catch (IOException ioe) { } i.setImageDrawable(big); big.setVisible(true, true); sp = getSharedPreferences("your_prefs", Activity.MODE_PRIVATE); // historyStack = new LinkedList<Link>(); webview = (WebView) findViewById(R.id.webkit); WebSettings webSettings = webview.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setDomStorageEnabled(true); // webview.addJavascriptInterface(new WebViewDemoActivity(), "Android"); // webview.getSettings().setJavaScriptEnabled(true); webview.getSettings().setBuiltInZoomControls(true); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) { // webview.getSettings().setPluginState(PluginState.ON); // webview.getSettings().setJavaScriptEnabled(true); } else { // IMPORTANT!! this method is no longer available since Android 4.3 // so the code doesn't compile anymore // webview.getSettings().setPluginsEnabled(true); } // Internet ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService( Context.CONNECTIVITY_SERVICE); connected = false; if ((null != connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE) && connectivityManager .getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState() == NetworkInfo.State.CONNECTED) || (null != connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI) && connectivityManager .getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState() == NetworkInfo.State.CONNECTED)) { // we are connected to a network connected = true; } if (connected == false) { /* * Toast.makeText(Rss.this, * "Connect to internet and Restart Application", * Toast.LENGTH_SHORT).show(); */ webview.setVisibility(View.INVISIBLE); AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(WebViewDemoActivity.this); // alertDialogBuilder.setTitle("Please connect to Internet"); alertDialogBuilder.setMessage( "In order to provide the freshest recipes and juicing information this app must be connected to the internet, please check your internet settings"); // set positive button: Yes message alertDialogBuilder.setNegativeButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // cancel the alert box and put a Toast to the user startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); } }); AlertDialog alertDialog = alertDialogBuilder.create(); // show alert alertDialog.show(); } // downloads // webview.setDownloadListener(new CustomDownloadListener()); webview.setWebViewClient(new CustomWebViewClient()); webview.setWebChromeClient(new WebChromeClient() { @Override public void onProgressChanged(WebView view, int progress) { } @Override public void onReceivedTitle(WebView view, String title) { } @Override public void onReceivedIcon(WebView view, Bitmap icon) { } }); // http://stackoverflow.com/questions/2083909/android-webview-refusing-user-input webview.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_UP: if (!v.hasFocus()) { v.requestFocus(); } break; } return false; } }); if (reg == true) { if (Locale.getDefault().getLanguage().equals("es")) { webview.loadUrl("http://om-msmartwoman.com/member/register"); // webview.loadUrl("http://live-juice-guru.gotpantheon.com/user/login"); } else { webview.loadUrl("http://om-msmartwoman.com/member/register"); } webview.requestFocus(); } else { uhdj = sp.getString("your_int_key", "0"); Log.e("Url is here ..............................", uhdj); // Welcome page loaded from assets directory if (Locale.getDefault().getLanguage().equals("es")) { webview.loadUrl(uhdj); // webview.loadUrl("http://live-juice-guru.gotpantheon.com/user/login"); } else { webview.loadUrl(uhdj); } webview.requestFocus(); } }
From source file:com.alex.smartwomanmiddleeastfem.WebViewDemoActivity.java
@SuppressLint({ "JavascriptInterface", "SetJavaScriptEnabled" }) @Override//from w ww . ja va 2 s . co m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.mainn); Intent intent = getIntent(); reg = intent.getBooleanExtra("reg", false); i = (ImageView) findViewById(R.id.hj); try { big = new GifAnimationDrawable(getResources().openRawResource(R.raw.anim2)); // big.setOneShot(true); android.util.Log.v("GifAnimationDrawable", "===>Four"); } catch (IOException ioe) { } i.setImageDrawable(big); big.setVisible(true, true); sp = getSharedPreferences("your_prefs", Activity.MODE_PRIVATE); // historyStack = new LinkedList<Link>(); webview = (WebView) findViewById(R.id.webkit); WebSettings webSettings = webview.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setDomStorageEnabled(true); // webview.addJavascriptInterface(new WebViewDemoActivity(), "Android"); // webview.getSettings().setJavaScriptEnabled(true); webview.getSettings().setBuiltInZoomControls(true); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) { // webview.getSettings().setPluginState(PluginState.ON); // webview.getSettings().setJavaScriptEnabled(true); } else { // IMPORTANT!! this method is no longer available since Android 4.3 // so the code doesn't compile anymore // webview.getSettings().setPluginsEnabled(true); } // Internet ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService( Context.CONNECTIVITY_SERVICE); connected = false; if ((null != connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE) && connectivityManager .getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState() == NetworkInfo.State.CONNECTED) || (null != connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI) && connectivityManager .getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState() == NetworkInfo.State.CONNECTED)) { // we are connected to a network connected = true; } if (connected == false) { /* * Toast.makeText(Rss.this, * "Connect to internet and Restart Application", * Toast.LENGTH_SHORT).show(); */ webview.setVisibility(View.INVISIBLE); AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(WebViewDemoActivity.this); // alertDialogBuilder.setTitle("Please connect to Internet"); alertDialogBuilder.setMessage( "Through our app offers some offline features, in order to stay actively connected to the SmartWoman community in realtime, you need an internet connection, tap here to check your settings or wait until you have connection."); // set positive button: Yes message alertDialogBuilder.setNegativeButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // cancel the alert box and put a Toast to the user startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); } }); AlertDialog alertDialog = alertDialogBuilder.create(); // show alert alertDialog.show(); } // downloads // webview.setDownloadListener(new CustomDownloadListener()); webview.setWebViewClient(new CustomWebViewClient()); webview.setWebChromeClient(new WebChromeClient() { @Override public void onProgressChanged(WebView view, int progress) { } @Override public void onReceivedTitle(WebView view, String title) { } @Override public void onReceivedIcon(WebView view, Bitmap icon) { } }); // http://stackoverflow.com/questions/2083909/android-webview-refusing-user-input webview.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_UP: if (!v.hasFocus()) { v.requestFocus(); } break; } return false; } }); if (reg == true) { if (Locale.getDefault().getLanguage().equals("es")) { webview.loadUrl("http://www.qa-msmartwoman.com/member/register"); // webview.loadUrl("http://live-juice-guru.gotpantheon.com/user/login"); } else { webview.loadUrl("http://www.qa-msmartwoman.com/member/register"); } webview.requestFocus(); } else { uhdj = sp.getString("your_int_key", "0"); // Log.e("Url is here ..............................", uhdj); // Welcome page loaded from assets directory if (Locale.getDefault().getLanguage().equals("es")) { webview.loadUrl(uhdj); // webview.loadUrl("http://live-juice-guru.gotpantheon.com/user/login"); } else { webview.loadUrl(uhdj); } webview.requestFocus(); } }
From source file:me.piebridge.prevent.framework.SystemReceiver.java
protected void onPackageAdded(Intent intent) { String packageName = PackageUtils.getPackageName(intent); SafeActionUtils.onPackageChanged(packageName); if (BuildConfig.APPLICATION_ID.equals(packageName) && !intent.getBooleanExtra(Intent.EXTRA_REPLACING, false)) { SystemHook.setSupported(true);//from w ww.j a v a2 s. c o m PreventListUtils.getInstance().save(mContext, mPreventPackages.keySet(), false); Configuration configuration = new Configuration(new Bundle()); configuration.setForceStopTimeout(forceStopTimeout); configuration.setDestroyProcesses(SystemHook.isDestroyProcesses()); configuration.setLockSyncSettings(SystemHook.isLockSyncSettings()); configuration.setAutoPrevent(autoPrevent); configuration.setStopSignatureApps(SystemHook.isStopSignatureApps()); configuration.setUseAppStandby(SystemHook.isUseAppStandby()); PreventListUtils.getInstance().save(mContext, configuration, false); } else if (!intent.getBooleanExtra(Intent.EXTRA_REPLACING, false) && autoPrevent) { mPreventPackages.put(packageName, true); showUpdated(packageName, mPreventPackages.size()); PreventListUtils.getInstance().save(mContext, mPreventPackages.keySet(), true); } }
From source file:com.java2s.intents4.IntentsDemo4Activity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { if (requestCode == MY_REQUEST_CODE && resultCode == RESULT_OK) { yesReally = intent.getBooleanExtra("yesReally", false); if (!yesReally) { mimeTypeText.requestFocus(); }//from w w w .j a v a 2s.c o m if (yesReally) { finishTest(savedIntent); } } }
From source file:com.github.jobs.ui.activity.HomeActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode != SEARCH_REQUEST || resultCode != Activity.RESULT_OK) { return;// w w w. j ava 2 s . com } SearchPack searchPack = new SearchPack(); searchPack.setSearch(data.getStringExtra(SearchDialog.EXTRA_DESCRIPTION)); searchPack.setLocation(data.getStringExtra(SearchDialog.EXTRA_LOCATION)); searchPack.setFullTime(data.getBooleanExtra(SearchDialog.EXTRA_FULL_TIME, true)); showTabs(); if (!mSearchJobFragmentAdapter.containsSearch(searchPack)) { mSearchJobFragmentAdapter.addSearch(searchPack); if (mState.searchPacks == null) { mState.searchPacks = new ArrayList<SearchPack>(); } mState.searchPacks.add(searchPack); mIndicator.notifyDataSetChanged(); } int position = mSearchJobFragmentAdapter.positionFor(searchPack); selectTab(position); }
From source file:com.facebook.AppEventsLogger.java
/** * Source Application setters and getters *//*from w ww.j av a2s . c o m*/ private static void setSourceApplication(Activity activity) { ComponentName callingApplication = activity.getCallingActivity(); if (callingApplication != null) { String callingApplicationPackage = callingApplication.getPackageName(); if (callingApplicationPackage.equals(activity.getPackageName())) { // open by own app. resetSourceApplication(); return; } sourceApplication = callingApplicationPackage; } // Tap icon to open an app will still get the old intent if the activity was opened by an intent before. // Introduce an extra field in the intent to force clear the sourceApplication. Intent openIntent = activity.getIntent(); if (openIntent == null || openIntent.getBooleanExtra(SOURCE_APPLICATION_HAS_BEEN_SET_BY_THIS_INTENT, false)) { resetSourceApplication(); return; } Bundle applinkData = AppLinks.getAppLinkData(openIntent); if (applinkData == null) { resetSourceApplication(); return; } isOpenedByApplink = true; Bundle applinkReferrerData = applinkData.getBundle("referer_app_link"); if (applinkReferrerData == null) { sourceApplication = null; return; } String applinkReferrerPackage = applinkReferrerData.getString("package"); sourceApplication = applinkReferrerPackage; // Mark this intent has been used to avoid use this intent again and again. openIntent.putExtra(SOURCE_APPLICATION_HAS_BEEN_SET_BY_THIS_INTENT, true); return; }
From source file:net.oschina.app.ui.MainActivity.java
/** * ??intent/*from w w w.j a v a 2 s.co m*/ * * @author ?? 2015-1-28 ?3:48:44 * * @return void * @param intent */ private void handleIntent(Intent intent) { if (intent == null) return; String action = intent.getAction(); if (action != null && action.equals(Intent.ACTION_VIEW)) { UIHelper.showUrlRedirect(this, intent.getDataString()); } else if (intent.getBooleanExtra("NOTICE", false)) { notifitcationBarClick(intent); } }
From source file:au.org.ala.fielddata.mobile.MobileFieldDataDashboard.java
private void listenForSurveyDownload() { broadcastReceiver = new BroadcastReceiver() { @Override/*from ww w.j a v a2 s . com*/ public void onReceive(Context context, Intent intent) { boolean success = intent.getBooleanExtra(SurveyDownloadService.RESULT_EXTRA, false); if (success) { Toast.makeText(MobileFieldDataDashboard.this, "Surveys refreshed", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(MobileFieldDataDashboard.this, "Refresh failed - please check your network", Toast.LENGTH_LONG).show(); } reloadTabs(); setSupportProgressBarIndeterminateVisibility(false); stopListeningForSurveyDownload(); } }; IntentFilter downloadFilter = new IntentFilter(SurveyDownloadService.FINISHED_ACTION); LocalBroadcastManager.getInstance(this).registerReceiver(broadcastReceiver, downloadFilter); }