List of usage examples for android.os Bundle getBoolean
public boolean getBoolean(String key)
From source file:com.fanfou.app.opensource.update.AppVersionInfo.java
public static AppVersionInfo parseBundle(final Bundle bundle) { final AppVersionInfo info = new AppVersionInfo(); info.versionCode = bundle.getInt("versionCode"); info.versionName = bundle.getString("versionName"); info.releaseDate = bundle.getString("releaseDate"); info.changelog = bundle.getString("changelog"); info.downloadUrl = bundle.getString("downloadUrl"); info.versionType = bundle.getString("versionType"); info.packageName = bundle.getString("packageName"); info.forceUpdate = bundle.getBoolean("forceUpdate"); if (info.versionCode > 0) { return info; } else {//from w w w. jav a 2 s . c o m return null; } }
From source file:androidx.core.app.NotificationManagerCompat.java
/** * Returns true if this notification should use the side channel for delivery. */// w w w. j av a 2 s . com private static boolean useSideChannelForNotification(Notification notification) { Bundle extras = NotificationCompat.getExtras(notification); return extras != null && extras.getBoolean(EXTRA_USE_SIDE_CHANNEL); }
From source file:com.facebook.LegacyTokenHelper.java
public static AccessTokenSource getSource(Bundle bundle) { Validate.notNull(bundle, "bundle"); if (bundle.containsKey(TOKEN_SOURCE_KEY)) { return (AccessTokenSource) bundle.getSerializable(TOKEN_SOURCE_KEY); } else {//from w w w . j a va 2 s.c om boolean isSSO = bundle.getBoolean(IS_SSO_KEY); return isSSO ? AccessTokenSource.FACEBOOK_APPLICATION_WEB : AccessTokenSource.WEB_VIEW; } }
From source file:com.facebook.share.internal.ShareInternalUtility.java
/** * Determines whether the native dialog completed normally (without error or exception). * * @param result the bundle passed back to onActivityResult * @return true if the native dialog completed normally *///from w w w. j ava 2 s .c o m public static boolean getNativeDialogDidComplete(Bundle result) { if (result.containsKey(NativeProtocol.RESULT_ARGS_DIALOG_COMPLETE_KEY)) { return result.getBoolean(NativeProtocol.RESULT_ARGS_DIALOG_COMPLETE_KEY); } return result.getBoolean(NativeProtocol.EXTRA_DIALOG_COMPLETE_KEY, false); }
From source file:com.amazon.cordova.plugin.PushPlugin.java
private static JSONObject convertBundleToJson(Bundle extras) { if (extras == null) { return null; }// w w w .ja v a 2s .co m try { JSONObject json; json = new JSONObject().put(EVENT, MESSAGE); JSONObject jsondata = new JSONObject(); Iterator<String> it = extras.keySet().iterator(); while (it.hasNext()) { String key = it.next(); Object value = extras.get(key); // System data from Android if (key.equals(FOREGROUND)) { json.put(key, extras.getBoolean(FOREGROUND)); } else if (key.equals(COLDSTART)) { json.put(key, extras.getBoolean(COLDSTART)); } else { // we encourage put the message content into message value // when server send out notification if (key.equals(MESSAGE)) { json.put(key, value); } if (value instanceof String) { // Try to figure out if the value is another JSON object String strValue = (String) value; if (strValue.startsWith("{")) { try { JSONObject json2 = new JSONObject(strValue); jsondata.put(key, json2); } catch (Exception e) { jsondata.put(key, value); } // Try to figure out if the value is another JSON // array } else if (strValue.startsWith("[")) { try { JSONArray json2 = new JSONArray(strValue); jsondata.put(key, json2); } catch (Exception e) { jsondata.put(key, value); } } else { jsondata.put(key, value); } } } // while } json.put(PAYLOAD, jsondata); LOG.v(TAG, "extrasToJSON: " + json.toString()); return json; } catch (JSONException e) { LOG.e(TAG, "extrasToJSON: JSON exception"); } return null; }
From source file:org.anhonesteffort.flock.registration.model.FlockAccount.java
public static Optional<FlockAccount> build(Bundle bundledAccount) throws JsonParseException { if (bundledAccount == null || bundledAccount.getString(KEY_ACCOUNT_ID) == null) return Optional.absent(); Integer planType = bundledAccount.getInt(KEY_SUBSCRIPTION_PLAN_TYPE); String serializedPlan = bundledAccount.getString(KEY_SUBSCRIPTION_PLAN); SubscriptionPlan subscriptionPlan = SubscriptionPlan.buildFromSerialized(planType, serializedPlan); return Optional.of(new FlockAccount(bundledAccount.getString(KEY_ACCOUNT_ID), bundledAccount.getInt(KEY_VERSION), bundledAccount.getString(KEY_SALT), bundledAccount.getString(KEY_PASSWORD_SHA512), bundledAccount.getString(KEY_STRIPE_CUSTOMER_ID), new Date(bundledAccount.getLong(KEY_CREATE_DATE)), bundledAccount.getBoolean(KEY_LAST_STRIPE_CHARGE_FAILED), bundledAccount.getBoolean(KEY_AUTO_RENEW_ENABLED), subscriptionPlan)); }
From source file:com.android.quickreturnlistview.sample_app.DefaultFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); ((TextView) mQuickReturnView.findViewById(R.id.stickyTV)).setText("Default"); mListView = (QuickReturnListView) getListView(); Bundle args = getArguments(); if (args != null) { boolean animated = args.getBoolean("animated"); mListView.setAnimatedReturn(animated); }/*www .ja v a 2 s . c o m*/ mListView.setQuickReturnView(mQuickReturnView); String[] array = new String[] { "Android 1", "Android 2", "Android 3", "Android 4", "Android 5", "Android 6", "Android 7", "Android 8", "Android 9", "Android 10", "Android 11", "Android 12", "Android 13", "Android 14", "Android 15", "Android 16" }; setListAdapter(new ArrayAdapter<String>(getActivity(), R.layout.list_item, R.id.text1, array)); }
From source file:am.roadpolice.roadpolice.ActionDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { String[] options;/* w ww . ja v a 2s .c o m*/ // Get Arguments passed from ViolationInfo Activity. // Depending on payed status, construct options. Bundle bundle = getArguments(); boolean isPayed = bundle.getBoolean(EXTRA_IS_PAYED); if (isPayed) { options = new String[2]; options[0] = getString(R.string.txtWatchOnline); options[1] = getString(R.string.txtWatch); } else { options = new String[3]; options[0] = getString(R.string.txtWatchOnline); options[1] = getString(R.string.txtWatch); options[2] = getString(R.string.txtPayOnline); } mPin = bundle.getString(EXTRA_PIN); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(R.string.txtChooseAnOption); builder.setItems(options, actionListener); builder.setNegativeButton(R.string.txtCancel, null); return builder.create(); }
From source file:com.amalgam.app.SupportProgressDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { Bundle args = getArguments(); String title = args.getString(ARGS_TITLE); String message = args.getString(ARGS_MESSAGE); boolean indeterminate = args.getBoolean(ARGS_INDETERMINATE); ProgressDialog dialog = new ProgressDialog(getActivity()); if (title != null) { dialog.setTitle(title);/* w w w . j a v a 2 s. c om*/ } dialog.setMessage(message); dialog.setIndeterminate(indeterminate); return dialog; }
From source file:com.commontime.plugin.notification.Notification.java
private static JSONObject convertBundleToJson(Bundle extras) { try {//from w w w . jav a 2 s . c om JSONObject json; json = new JSONObject().put("event", "message"); Iterator<String> it = extras.keySet().iterator(); while (it.hasNext()) { String key = it.next(); Object value = extras.get(key); // System data from Android if (key.equals("from") || key.equals("collapse_key")) { json.put(key, value); } else if (key.equals("foreground")) { json.put(key, extras.getBoolean("foreground")); } else if (key.equals("coldstart")) { json.put(key, extras.getBoolean("coldstart")); } else if (key.equals("title")) { json.put(key, extras.getString("title")); } else if (key.equals("message")) { json.put(key, extras.getString("message")); } else if (key.equals("payload")) { createPayloadObject(json, (String) value); } else { if (value instanceof String) { createPayloadObject(json, (String) value); } } } // while json.put("service", "GCM"); return json; } catch (JSONException e) { } return null; }