List of usage examples for android.content Intent getBooleanExtra
public boolean getBooleanExtra(String name, boolean defaultValue)
From source file:com.google.android.apps.santatracker.launch.StartupActivity.java
/** * Checks to see if the intent (voice command) has already been processed * * @param intent current intent (voice command) * @return true if the intent (voice command) has already been processed *//*from ww w .j a v a 2 s . com*/ private boolean isAlreadyHandled(Intent intent) { return intent.getBooleanExtra(INTENT_HANDLED, false); }
From source file:com.klinker.android.twitter.activities.tweet_viewer.TweetPager.java
public void getFromIntent() { Intent from = getIntent(); name = from.getStringExtra("name"); screenName = from.getStringExtra("screenname"); tweet = from.getStringExtra("tweet"); time = from.getLongExtra("time", 0); retweeter = from.getStringExtra("retweeter"); webpage = from.getStringExtra("webpage"); tweetId = from.getLongExtra("tweetid", 0); picture = from.getBooleanExtra("picture", false); proPic = from.getStringExtra("proPic"); secondAcc = from.getBooleanExtra("second_account", false); animatedGif = from.getStringExtra("animated_gif"); try {/*from w w w.j av a 2 s. c o m*/ users = from.getStringExtra("users").split(" "); } catch (Exception e) { users = null; } try { hashtags = from.getStringExtra("hashtags").split(" "); } catch (Exception e) { hashtags = null; } try { linkString = from.getStringExtra("other_links"); otherLinks = linkString.split(" "); } catch (Exception e) { otherLinks = null; } if (screenName.equals(settings.myScreenName)) { isMyTweet = true; } else if (screenName.equals(retweeter)) { isMyRetweet = true; } tweet = restoreLinks(tweet); if (hashtags != null) { // we will add them to the auto complete new Thread(new Runnable() { @Override public void run() { ArrayList<String> tags = new ArrayList<String>(); if (hashtags != null) { for (String s : hashtags) { if (!s.equals("")) { tags.add("#" + s); } } } HashtagDataSource source = HashtagDataSource.getInstance(context); for (String s : tags) { Log.v("talon_hashtag", "trend: " + s); if (s.contains("#")) { // we want to add it to the auto complete Log.v("talon_hashtag", "adding: " + s); source.deleteTag(s); source.createTag(s); } } } }).start(); } }
From source file:com.github.sryze.wirebug.MainActivity.java
@Override protected void onResume() { super.onResume(); boolean isConnected = NetworkUtils.isConnectedToWifi(connectivityManager); connectedView.setVisibility(isConnected ? View.VISIBLE : View.GONE); notConnectedView.setVisibility(isConnected ? View.GONE : View.VISIBLE); boolean isEnabled = DebugManager.isTcpDebuggingEnabled(); updateInstructions(isEnabled);/*from www. j a v a 2s .com*/ updateStatus(); toggleDebuggingButton.setOnCheckedChangeListener(null); toggleDebuggingButton.setChecked(isEnabled); toggleDebuggingButton.setOnCheckedChangeListener(enableSwitchChangeListener); networkStateChangedReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Log.d(TAG, "Received network state changed broadcast"); NetworkInfo networkInfo = intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO); switch (networkInfo.getState()) { case CONNECTED: connectedView.setVisibility(View.VISIBLE); notConnectedView.setVisibility(View.INVISIBLE); break; case DISCONNECTED: connectedView.setVisibility(View.GONE); notConnectedView.setVisibility(View.VISIBLE); break; } updateConnectionInfo(); } }; registerReceiver(networkStateChangedReceiver, new IntentFilter(WifiManager.NETWORK_STATE_CHANGED_ACTION)); debugStatusChangedReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Log.d(TAG, "Received debug state change broadcast"); boolean isEnabled = intent.getBooleanExtra(DebugStatusService.EXTRA_IS_ENABLED, false); updateInstructions(isEnabled); toggleDebuggingButton.setOnCheckedChangeListener(null); toggleDebuggingButton.setChecked(isEnabled); toggleDebuggingButton.setOnCheckedChangeListener(enableSwitchChangeListener); } }; registerReceiver(debugStatusChangedReceiver, new IntentFilter(DebugStatusService.ACTION_STATUS_CHANGED)); }
From source file:com.klinker.android.twitter.ui.tweet_viewer.TweetPager.java
public void getFromIntent() { Intent from = getIntent(); name = from.getStringExtra("name"); screenName = from.getStringExtra("screenname"); tweet = from.getStringExtra("tweet"); time = from.getLongExtra("time", 0); retweeter = from.getStringExtra("retweeter"); webpage = from.getStringExtra("webpage"); tweetId = from.getLongExtra("tweetid", 0); picture = from.getBooleanExtra("picture", false); proPic = from.getStringExtra("proPic"); try {// w w w . j av a2 s . c om users = from.getStringExtra("users").split(" "); } catch (Exception e) { users = null; } try { hashtags = from.getStringExtra("hashtags").split(" "); } catch (Exception e) { hashtags = null; } try { linkString = from.getStringExtra("other_links"); otherLinks = linkString.split(" "); } catch (Exception e) { otherLinks = null; } if (screenName.equals(settings.myScreenName)) { isMyTweet = true; } else if (screenName.equals(retweeter)) { isMyRetweet = true; } tweet = restoreLinks(tweet); if (hashtags != null) { // we will add them to the auto complete new Thread(new Runnable() { @Override public void run() { ArrayList<String> tags = new ArrayList<String>(); if (hashtags != null) { for (String s : hashtags) { if (!s.equals("")) { tags.add("#" + s); } } } HashtagDataSource source = HashtagDataSource.getInstance(context); for (String s : tags) { Log.v("talon_hashtag", "trend: " + s); if (s.contains("#")) { // we want to add it to the auto complete Log.v("talon_hashtag", "adding: " + s); source.deleteTag(s); source.createTag(s); } } } }).start(); } }
From source file:com.concentricsky.android.khanacademy.app.VideoListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_video_list); Intent intent = getIntent(); topicId = savedInstanceState != null && savedInstanceState.containsKey(PARAM_TOPIC_ID) ? savedInstanceState.getString(PARAM_TOPIC_ID) : intent != null && intent.hasExtra(PARAM_TOPIC_ID) ? intent.getStringExtra(PARAM_TOPIC_ID) : null; isShowingDownloadedVideosOnly = savedInstanceState != null && savedInstanceState.containsKey(PARAM_SHOW_DL_ONLY) ? savedInstanceState.getBoolean(PARAM_SHOW_DL_ONLY) : intent != null && intent.hasExtra(PARAM_SHOW_DL_ONLY) ? intent.getBooleanExtra(PARAM_SHOW_DL_ONLY, false) : false;// w w w. java 2 s.com }
From source file:com.psiphon3.psiphonlibrary.TunnelManager.java
private void getTunnelConfig(Intent intent) { m_tunnelConfig.handshakePendingIntent = intent .getParcelableExtra(TunnelManager.DATA_TUNNEL_CONFIG_HANDSHAKE_PENDING_INTENT); m_tunnelConfig.notificationPendingIntent = intent .getParcelableExtra(TunnelManager.DATA_TUNNEL_CONFIG_NOTIFICATION_PENDING_INTENT); m_tunnelConfig.wholeDevice = intent.getBooleanExtra(TunnelManager.DATA_TUNNEL_CONFIG_WHOLE_DEVICE, false); m_tunnelConfig.egressRegion = intent.getStringExtra(TunnelManager.DATA_TUNNEL_CONFIG_EGRESS_REGION); m_tunnelConfig.disableTimeouts = intent.getBooleanExtra(TunnelManager.DATA_TUNNEL_CONFIG_DISABLE_TIMEOUTS, false);/*w w w . j a va 2 s. co m*/ }
From source file:com.honglang.zxing.CaptureActivity.java
@Override protected void onResume() { super.onResume(); // CameraManager must be initialized here, not in onCreate(). This is // necessary because we don't // want to open the camera driver and measure the screen size if we're // going to show the help on // first launch. That led to bugs where the scanning rectangle was the // wrong size and partially // off screen. cameraManager = new CameraManager(getApplication()); viewfinderView = (ViewfinderView) findViewById(R.id.viewfinder_view); viewfinderView.setCameraManager(cameraManager); // resultView = findViewById(R.id.result_view); statusView = (TextView) findViewById(R.id.status_view); handler = null;/*from w w w .j ava 2 s. c om*/ lastResult = null; resetStatusView(); SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view); SurfaceHolder surfaceHolder = surfaceView.getHolder(); if (hasSurface) { // The activity was paused but not stopped, so the surface still // exists. Therefore // surfaceCreated() won't be called, so init the camera here. initCamera(surfaceHolder); } else { // Install the callback and wait for surfaceCreated() to init the // camera. surfaceHolder.addCallback(this); } beepManager.updatePrefs(); ambientLightManager.start(cameraManager); inactivityTimer.onResume(); Intent intent = getIntent(); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); copyToClipboard = prefs.getBoolean(PreferencesActivity.KEY_COPY_TO_CLIPBOARD, true) && (intent == null || intent.getBooleanExtra(Intents.Scan.SAVE_HISTORY, true)); source = IntentSource.NONE; decodeFormats = null; characterSet = null; if (intent != null) { String action = intent.getAction(); String dataString = intent.getDataString(); if (Intents.Scan.ACTION.equals(action)) { // Scan the formats the intent requested, and return the result // to the calling activity. source = IntentSource.NATIVE_APP_INTENT; decodeFormats = DecodeFormatManager.parseDecodeFormats(intent); decodeHints = DecodeHintManager.parseDecodeHints(intent); if (intent.hasExtra(Intents.Scan.WIDTH) && intent.hasExtra(Intents.Scan.HEIGHT)) { int width = intent.getIntExtra(Intents.Scan.WIDTH, 0); int height = intent.getIntExtra(Intents.Scan.HEIGHT, 0); if (width > 0 && height > 0) { cameraManager.setManualFramingRect(width, height); } } String customPromptMessage = intent.getStringExtra(Intents.Scan.PROMPT_MESSAGE); if (customPromptMessage != null) { statusView.setText(customPromptMessage); } } else if (dataString != null && dataString.contains("http://www.google") && dataString.contains("/m/products/scan")) { // Scan only products and send the result to mobile Product // Search. source = IntentSource.PRODUCT_SEARCH_LINK; sourceUrl = dataString; decodeFormats = DecodeFormatManager.PRODUCT_FORMATS; } else if (isZXingURL(dataString)) { // Scan formats requested in query string (all formats if none // specified). // If a return URL is specified, send the results there. // Otherwise, handle it ourselves. source = IntentSource.ZXING_LINK; sourceUrl = dataString; Uri inputUri = Uri.parse(dataString); // scanFromWebPageManager = new // ScanFromWebPageManager(inputUri); decodeFormats = DecodeFormatManager.parseDecodeFormats(inputUri); // Allow a sub-set of the hints to be specified by the caller. decodeHints = DecodeHintManager.parseDecodeHints(inputUri); } characterSet = intent.getStringExtra(Intents.Scan.CHARACTER_SET); } }
From source file:com.mozilla.SUTAgentAndroid.SUTAgentAndroid.java
private void monitorBatteryState() { battReceiver = new BroadcastReceiver() { public void onReceive(Context context, Intent intent) { StringBuilder sb = new StringBuilder(); int rawlevel = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1); // charge level from 0 to scale inclusive int scale = intent.getIntExtra(BatteryManager.EXTRA_SCALE, -1); // Max value for charge level int status = intent.getIntExtra(BatteryManager.EXTRA_STATUS, -1); int health = intent.getIntExtra(BatteryManager.EXTRA_HEALTH, -1); boolean present = intent.getBooleanExtra(BatteryManager.EXTRA_PRESENT, false); int plugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1); //0 if the device is not plugged in; 1 if plugged into an AC power adapter; 2 if plugged in via USB. // int voltage = intent.getIntExtra(BatteryManager.EXTRA_VOLTAGE, -1); // voltage in millivolts nBatteryTemp = intent.getIntExtra(BatteryManager.EXTRA_TEMPERATURE, -1); // current battery temperature in tenths of a degree Centigrade // String technology = intent.getStringExtra(BatteryManager.EXTRA_TECHNOLOGY); nChargeLevel = -1; // percentage, or -1 for unknown if (rawlevel >= 0 && scale > 0) { nChargeLevel = (rawlevel * 100) / scale; }/*from ww w . j a va 2 s . c om*/ if (plugged > 0) sACStatus = "ONLINE"; else sACStatus = "OFFLINE"; if (present == false) sb.append("NO BATTERY"); else { if (nChargeLevel < 10) sb.append("Critical"); else if (nChargeLevel < 33) sb.append("LOW"); else if (nChargeLevel > 80) sb.append("HIGH"); } if (BatteryManager.BATTERY_HEALTH_OVERHEAT == health) { sb.append("Overheated "); sb.append((((float) (nBatteryTemp)) / 10)); sb.append("(C)"); } else { switch (status) { case BatteryManager.BATTERY_STATUS_UNKNOWN: // old emulator; maybe also when plugged in with no battery if (present == true) sb.append(" UNKNOWN"); break; case BatteryManager.BATTERY_STATUS_CHARGING: sb.append(" CHARGING"); break; case BatteryManager.BATTERY_STATUS_DISCHARGING: sb.append(" DISCHARGING"); break; case BatteryManager.BATTERY_STATUS_NOT_CHARGING: sb.append(" NOTCHARGING"); break; case BatteryManager.BATTERY_STATUS_FULL: sb.append(" FULL"); break; default: if (present == true) sb.append("Unknown"); break; } } sPowerStatus = sb.toString(); } }; IntentFilter battFilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED); registerReceiver(battReceiver, battFilter); }