List of usage examples for android.os Bundle getInt
public int getInt(String key, int defaultValue)
From source file:Main.java
public static int getRequestedZenMode(Bundle bundle) { return bundle.getInt(EXTRA_ZEN_MODE, ZEN_MODE_UNKNOWN); }
From source file:Main.java
public static boolean isValid(Bundle bundle) { return bundle.containsKey(EXTRA_ZEN_MODE) && bundle.getInt(EXTRA_ZEN_MODE, ZEN_MODE_UNKNOWN) != ZEN_MODE_UNKNOWN; }
From source file:Main.java
public static int getParameter(Intent i) { final Bundle extras = i.getExtras(); if (extras == null) return -1; return extras.getInt(KEY_PARAMETER, -1); }
From source file:androidx.media.MediaBrowserCompatUtils.java
public static boolean hasDuplicatedItems(Bundle options1, Bundle options2) { int page1 = options1 == null ? -1 : options1.getInt(MediaBrowserCompat.EXTRA_PAGE, -1); int page2 = options2 == null ? -1 : options2.getInt(MediaBrowserCompat.EXTRA_PAGE, -1); int pageSize1 = options1 == null ? -1 : options1.getInt(MediaBrowserCompat.EXTRA_PAGE_SIZE, -1); int pageSize2 = options2 == null ? -1 : options2.getInt(MediaBrowserCompat.EXTRA_PAGE_SIZE, -1); int startIndex1, startIndex2, endIndex1, endIndex2; if (page1 == -1 || pageSize1 == -1) { startIndex1 = 0;//from ww w . ja v a 2 s. co m endIndex1 = Integer.MAX_VALUE; } else { startIndex1 = pageSize1 * page1; endIndex1 = startIndex1 + pageSize1 - 1; } if (page2 == -1 || pageSize2 == -1) { startIndex2 = 0; endIndex2 = Integer.MAX_VALUE; } else { startIndex2 = pageSize2 * page2; endIndex2 = startIndex2 + pageSize2 - 1; } if (startIndex1 <= startIndex2 && startIndex2 <= endIndex1) { return true; } else if (startIndex1 <= endIndex2 && endIndex2 <= endIndex1) { return true; } return false; }
From source file:Main.java
public static int interceptIntParam(Bundle savedInstanceState, Intent intent, String paramName) { int ret = -1; if (savedInstanceState != null) { ret = savedInstanceState.getInt(paramName, -1); } else {// w w w . ja v a 2s .c o m if (intent != null) { Bundle incomming = intent.getExtras(); if (incomming != null) { ret = incomming.getInt(paramName, -1); } } } return ret; }
From source file:androidx.media.MediaBrowserCompatUtils.java
public static boolean areSameOptions(Bundle options1, Bundle options2) { if (options1 == options2) { return true; } else if (options1 == null) { return options2.getInt(MediaBrowserCompat.EXTRA_PAGE, -1) == -1 && options2.getInt(MediaBrowserCompat.EXTRA_PAGE_SIZE, -1) == -1; } else if (options2 == null) { return options1.getInt(MediaBrowserCompat.EXTRA_PAGE, -1) == -1 && options1.getInt(MediaBrowserCompat.EXTRA_PAGE_SIZE, -1) == -1; } else {//from w w w . jav a 2 s . c o m return options1.getInt(MediaBrowserCompat.EXTRA_PAGE, -1) == options2 .getInt(MediaBrowserCompat.EXTRA_PAGE, -1) && options1.getInt(MediaBrowserCompat.EXTRA_PAGE_SIZE, -1) == options2 .getInt(MediaBrowserCompat.EXTRA_PAGE_SIZE, -1); } }
From source file:org.openbitcoinwidget.WidgetProvider.java
private static boolean isWidgetShownOnLockScreen(AppWidgetManager appWidgetManager, int appWidgetId) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { // The below functionality was introduced in API version 16 (Jelly Bean) Bundle myOptions = appWidgetManager.getAppWidgetOptions(appWidgetId); // Get the value of OPTION_APPWIDGET_HOST_CATEGORY int category = myOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY, -1); // If the value is WIDGET_CATEGORY_KEYGUARD, it's a lockscreen widget return category == AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD; }//from www . j av a 2s . co m return false; }
From source file:org.anhonesteffort.flock.ErrorToaster.java
protected static void handleDisplayToastBundledError(Context context, Bundle bundle) { final int ERROR_CODE = bundle.getInt(KEY_STATUS_CODE, -1); switch (ERROR_CODE) { case CODE_UNAUTHORIZED: handleShowUnauthorizedError(context); break;// ww w .jav a2s .com case CODE_REGISTRATION_API_SERVER_ERROR: handleShowRegistrationApiServerError(context); break; case CODE_REGISTRATION_API_CLIENT_ERROR: handleShowRegistrationApiClientError(context); break; case CODE_DAV_SERVER_ERROR: handleShowDavServerError(context); break; case CODE_DAV_CLIENT_ERROR: handleShowDavClientError(context); break; case CODE_CONNECTION_ERROR: handleShowConnectionError(context); break; case CODE_CERTIFICATE_ERROR: handleShowCertificateError(context); break; case CODE_UNKNOWN_IO_ERROR: handleShowUnknownIoError(context); break; case CODE_INVALID_CIPHER_PASSPHRASE: handleShowInvalidCipherPassphraseError(context); break; case CODE_INVALID_MAC_ERROR: handleShowInvalidMacErrorError(context); break; case CODE_CRYPTO_ERROR: handleShowCryptoError(context); break; case CODE_EMPTY_DAV_URL: handleShowDavUrlEmpty(context); break; case CODE_EMPTY_ACCOUNT_ID: handleShowAccountIdEmpty(context); break; case CODE_SPACES_IN_USERNAME: handleShowSpacesInAccountId(context); break; case CODE_ILLEGAL_ACCOUNT_ID: handleShowIllegalAccountId(context); break; case CODE_ACCOUNT_ID_TAKEN: handleShowAccountIdTaken(context); break; case CODE_SHORT_PASSWORD: handleShowAccountPasswordTooShort(context); break; case CODE_PASSWORDS_DO_NOT_MATCH: handleShowPasswordsDoNotMatch(context); break; case CODE_CARD_NUMBER_INVALID: handleShowCardNumberInvalid(context); break; case CODE_CARD_EXPIRATION_INVALID: handleShowCardExpirationInvalid(context); break; case CODE_CARD_CVC_INVALID: handleShowCardCVCInvalid(context); break; case CODE_STRIPE_REJECTED_CARD: handleShowStripeRejectedCard(context); break; case CODE_STRIPE_CONNECTION_ERROR: handleShowStripeConnectionError(context); break; case CODE_STRIPE_API_ERROR: handleShowStripeApiError(context); break; case CODE_SUBSCRIPTION_EXPIRED: handleShowSubscriptionExpired(context); break; case CODE_ACCOUNT_MANAGER_ERROR: handleShowAccountManagerError(context); break; case CODE_GOOGLE_PLAY_ERROR: handleShowGooglePlayError(context); break; } }
From source file:androidx.media.MediaUtils2.java
static AudioAttributesCompat fromAudioAttributesBundle(Bundle bundle) { if (bundle == null) { return null; }// w w w .j av a2s . c o m return new AudioAttributesCompat.Builder().setUsage(bundle.getInt(AUDIO_ATTRIBUTES_USAGE, USAGE_UNKNOWN)) .setContentType(bundle.getInt(AUDIO_ATTRIBUTES_CONTENT_TYPE, CONTENT_TYPE_UNKNOWN)) .setFlags(bundle.getInt(AUDIO_ATTRIBUTES_FLAGS, 0)).build(); }
From source file:android.support.car.ui.CarNavExtender.java
/** * @return The type without having to construct an entire {@link CarNavExtender} object. *//*from ww w . ja v a 2s. c o m*/ @Type public static int getType(Notification notification) { Bundle extras = NotificationCompat.getExtras(notification); if (extras == null) { return TYPE_NORMAL; } Bundle b = extras.getBundle(EXTRA_CAR_EXTENDER); if (b == null) { return TYPE_NORMAL; } // The ternary guarantees that we return either TYPE_HERO or TYPE_NORMAL. return (b.getInt(EXTRA_TYPE, TYPE_NORMAL) == TYPE_HERO) ? TYPE_HERO : TYPE_NORMAL; }