Refine search
RationaleDialogConfig(Bundle bundle) { positiveButton = bundle.getString(KEY_POSITIVE_BUTTON); negativeButton = bundle.getString(KEY_NEGATIVE_BUTTON); rationaleMsg = bundle.getString(KEY_RATIONALE_MESSAGE); theme = bundle.getInt(KEY_THEME); requestCode = bundle.getInt(KEY_REQUEST_CODE); permissions = bundle.getStringArray(KEY_PERMISSIONS); }
@Override public Message getDialogHandlerMessage() { Message msg = Message.obtain(); msg.what = DialogHandler.MSG_SHOW_SYNC_ERROR_DIALOG; Bundle b = new Bundle(); b.putInt("dialogType", getArguments().getInt("dialogType")); b.putString("dialogMessage", getArguments().getString("dialogMessage")); msg.setData(b); return msg; }
@Test public void getWrongType() { bundle.putFloat("foo", 5f); assertThat(bundle.getCharArray("foo")).isNull(); assertThat(bundle.getInt("foo")).isEqualTo(0); assertThat(bundle.getIntArray("foo")).isNull(); assertThat(bundle.getIntegerArrayList("foo")).isNull(); assertThat(bundle.getShort("foo")).isEqualTo((short) 0); assertThat(bundle.getShortArray("foo")).isNull(); assertThat(bundle.getBoolean("foo")).isFalse(); assertThat(bundle.getBooleanArray("foo")).isNull(); assertThat(bundle.getLong("foo")).isEqualTo(0); assertThat(bundle.getLongArray("foo")).isNull(); assertThat(bundle.getFloatArray("foo")).isNull(); assertThat(bundle.getDouble("foo")).isEqualTo(0.0); assertThat(bundle.getDoubleArray("foo")).isNull(); assertThat(bundle.getString("foo")).isNull(); assertThat(bundle.getStringArray("foo")).isNull(); assertThat(bundle.getStringArrayList("foo")).isNull(); assertThat(bundle.getBundle("foo")).isNull(); assertThat((Parcelable) bundle.getParcelable("foo")).isNull(); assertThat(bundle.getParcelableArray("foo")).isNull(); assertThat(bundle.getParcelableArrayList("foo")).isNull(); bundle.putInt("foo", 1); assertThat(bundle.getFloat("foo")).isEqualTo(0.0f); }
innerBundle1.putInt("inner", 1); b.putInt("intValue", 7); b.putLong("longValue", 5000000000l); b.putDouble("doubleValue", 3.14); assertEquals(7, finalBundle.getInt("intValue")); assertEquals(5000000000l, finalBundle.getLong("longValue")); assertEquals(3.14, finalBundle.getDouble("doubleValue"), TestUtils.DOUBLE_EQUALS_DELTA); assertEquals("hello world", finalBundle.getString("stringValue")); assertEquals(1, finalInnerBundle.getInt("inner")); finalBundle = finalInnerBundle.getBundle("nested bundle"); assertEquals("2", finalBundle.getString("inner"));
private void processOptions(@NonNull Bundle bundle) { mCompressQuality = bundle.getInt(UCrop.Options.EXTRA_COMPRESSION_QUALITY, UCropActivity.DEFAULT_COMPRESS_QUALITY); mGestureCropImageView.setMaxBitmapSize(bundle.getInt(UCrop.Options.EXTRA_MAX_BITMAP_SIZE, CropImageView.DEFAULT_MAX_BITMAP_SIZE)); mGestureCropImageView.setMaxScaleMultiplier(bundle.getFloat(UCrop.Options.EXTRA_MAX_SCALE_MULTIPLIER, CropImageView.DEFAULT_MAX_SCALE_MULTIPLIER)); mGestureCropImageView.setImageToWrapCropBoundsAnimDuration(bundle.getInt(UCrop.Options.EXTRA_IMAGE_TO_CROP_BOUNDS_ANIM_DURATION, CropImageView.DEFAULT_IMAGE_TO_CROP_BOUNDS_ANIM_DURATION)); mOverlayView.setDimmedColor(bundle.getInt(UCrop.Options.EXTRA_DIMMED_LAYER_COLOR, getResources().getColor(R.color.ucrop_color_default_dimmed))); mOverlayView.setCircleDimmedLayer(bundle.getBoolean(UCrop.Options.EXTRA_CIRCLE_DIMMED_LAYER, OverlayView.DEFAULT_CIRCLE_DIMMED_LAYER)); mOverlayView.setCropFrameColor(bundle.getInt(UCrop.Options.EXTRA_CROP_FRAME_COLOR, getResources().getColor(R.color.ucrop_color_default_crop_frame))); mOverlayView.setCropFrameStrokeWidth(bundle.getInt(UCrop.Options.EXTRA_CROP_FRAME_STROKE_WIDTH, getResources().getDimensionPixelSize(R.dimen.ucrop_default_crop_frame_stoke_width))); mOverlayView.setCropGridRowCount(bundle.getInt(UCrop.Options.EXTRA_CROP_GRID_ROW_COUNT, OverlayView.DEFAULT_CROP_GRID_ROW_COUNT)); mOverlayView.setCropGridColumnCount(bundle.getInt(UCrop.Options.EXTRA_CROP_GRID_COLUMN_COUNT, OverlayView.DEFAULT_CROP_GRID_COLUMN_COUNT)); mOverlayView.setCropGridColor(bundle.getInt(UCrop.Options.EXTRA_CROP_GRID_COLOR, getResources().getColor(R.color.ucrop_color_default_crop_grid))); mOverlayView.setCropGridStrokeWidth(bundle.getInt(UCrop.Options.EXTRA_CROP_GRID_STROKE_WIDTH, getResources().getDimensionPixelSize(R.dimen.ucrop_default_crop_grid_stoke_width))); float aspectRatioY = bundle.getFloat(UCrop.EXTRA_ASPECT_RATIO_Y, 0); int aspectRationSelectedByDefault = bundle.getInt(UCrop.Options.EXTRA_ASPECT_RATIO_SELECTED_BY_DEFAULT, 0); ArrayList<AspectRatio> aspectRatioList = bundle.getParcelableArrayList(UCrop.Options.EXTRA_ASPECT_RATIO_OPTIONS); int maxSizeX = bundle.getInt(UCrop.EXTRA_MAX_SIZE_X, 0); int maxSizeY = bundle.getInt(UCrop.EXTRA_MAX_SIZE_Y, 0);
@Override public Message getDialogHandlerMessage() { Message msg = Message.obtain(); msg.what = DialogHandler.MSG_SHOW_MEDIA_CHECK_COMPLETE_DIALOG; Bundle b = new Bundle(); b.putStringArrayList("nohave", getArguments().getStringArrayList("nohave")); b.putStringArrayList("unused", getArguments().getStringArrayList("unused")); b.putStringArrayList("invalid", getArguments().getStringArrayList("invalid")); b.putInt("dialogType", getArguments().getInt("dialogType")); msg.setData(b); return msg; } }
assertEquals(originalBundle.getShort(SHORT_KEY), cachedBundle.getShort(SHORT_KEY)); assertArrayEquals(originalBundle.getShortArray(SHORT_ARRAY_KEY), cachedBundle.getShortArray(SHORT_ARRAY_KEY)); assertEquals(originalBundle.getInt(INT_KEY), cachedBundle.getInt(INT_KEY)); assertArrayEquals(originalBundle.getIntArray(INT_ARRAY_KEY), cachedBundle.getIntArray(INT_ARRAY_KEY)); assertEquals(originalBundle.getLong(LONG_KEY), cachedBundle.getLong(LONG_KEY)); assertEquals(originalBundle.getChar(CHAR_KEY), cachedBundle.getChar(CHAR_KEY)); assertArrayEquals(originalBundle.getCharArray(CHAR_ARRAY_KEY), cachedBundle.getCharArray(CHAR_ARRAY_KEY)); assertEquals(originalBundle.getString(STRING_KEY), cachedBundle.getString(STRING_KEY)); assertListEquals(originalBundle.getStringArrayList(STRING_LIST_KEY), cachedBundle.getStringArrayList( STRING_LIST_KEY));
@Override public void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); // Restore UI state from the savedInstanceState. // This bundle has also been passed to onCreate. boolean myBoolean = savedInstanceState.getBoolean("MyBoolean"); double myDouble = savedInstanceState.getDouble("myDouble"); int myInt = savedInstanceState.getInt("MyInt"); String myString = savedInstanceState.getString("MyString"); }
@Test public void testMultipleCaches() { Bundle bundle1 = new Bundle(), bundle2 = new Bundle(); bundle1.putInt(INT_KEY, 10); bundle1.putString(STRING_KEY, "ABC"); bundle2.putInt(INT_KEY, 100); bundle2.putString(STRING_KEY, "xyz"); ensureApplicationContext(); LegacyTokenHelper cache1 = new LegacyTokenHelper(RuntimeEnvironment.application); LegacyTokenHelper cache2 = new LegacyTokenHelper( RuntimeEnvironment.application, "CustomCache"); cache1.save(bundle1); cache2.save(bundle2); // Get new references to make sure we are getting persisted data. // Reverse the cache references for fun. cache1 = new LegacyTokenHelper(RuntimeEnvironment.application, "CustomCache"); cache2 = new LegacyTokenHelper(RuntimeEnvironment.application); Bundle newBundle1 = cache1.load(), newBundle2 = cache2.load(); assertEquals(bundle2.getInt(INT_KEY), newBundle1.getInt(INT_KEY)); assertEquals(bundle2.getString(STRING_KEY), newBundle1.getString(STRING_KEY)); assertEquals(bundle1.getInt(INT_KEY), newBundle2.getInt(INT_KEY)); assertEquals(bundle1.getString(STRING_KEY), newBundle2.getString(STRING_KEY)); }
public void initializeView() { Bundle bundle = getArguments(); backgroundColor = bundle.getInt(BACKGROUND_COLOR); buttonsColor = bundle.getInt(BUTTONS_COLOR); image = bundle.getInt(IMAGE, 0); title = bundle.getString(TITLE); description = bundle.getString(DESCRIPTION); neededPermissions = bundle.getStringArray(NEEDED_PERMISSIONS); possiblePermissions = bundle.getStringArray(POSSIBLE_PERMISSIONS); updateViewWithValues(); }
private void onRestore(Bundle savedInstanceState) { mAction = savedInstanceState.getString(KEY_ACTION); mGalleryInfo = savedInstanceState.getParcelable(KEY_GALLERY_INFO); mGid = savedInstanceState.getLong(KEY_GID); mToken = savedInstanceState.getString(KEY_TOKEN); mGalleryDetail = savedInstanceState.getParcelable(KEY_GALLERY_DETAIL); mRequestId = savedInstanceState.getInt(KEY_REQUEST_ID); }
private void restoreInstanceState(@NonNull Bundle savedInstanceState) { viewState = savedInstanceState.getBundle(KEY_VIEW_STATE); if (viewState != null) { viewState.setClassLoader(getClass().getClassLoader()); } instanceId = savedInstanceState.getString(KEY_INSTANCE_ID); targetInstanceId = savedInstanceState.getString(KEY_TARGET_INSTANCE_ID); requestedPermissions.addAll(savedInstanceState.getStringArrayList(KEY_REQUESTED_PERMISSIONS)); overriddenPushHandler = ControllerChangeHandler.fromBundle(savedInstanceState.getBundle(KEY_OVERRIDDEN_PUSH_HANDLER)); overriddenPopHandler = ControllerChangeHandler.fromBundle(savedInstanceState.getBundle(KEY_OVERRIDDEN_POP_HANDLER)); needsAttach = savedInstanceState.getBoolean(KEY_NEEDS_ATTACH); retainViewMode = RetainViewMode.values()[savedInstanceState.getInt(KEY_RETAIN_VIEW_MODE, 0)]; List<Bundle> childBundles = savedInstanceState.getParcelableArrayList(KEY_CHILD_ROUTERS); for (Bundle childBundle : childBundles) { ControllerHostedRouter childRouter = new ControllerHostedRouter(); childRouter.restoreInstanceState(childBundle); childRouters.add(childRouter); } this.savedInstanceState = savedInstanceState.getBundle(KEY_SAVED_STATE); if (this.savedInstanceState != null) { this.savedInstanceState.setClassLoader(getClass().getClassLoader()); } performOnRestoreInstanceState(); }
private void onRestore(@NonNull Bundle savedInstanceState) { mValid = savedInstanceState.getBoolean(KEY_VALID); mError = savedInstanceState.getString(KEY_ERROR); mAction = savedInstanceState.getString(KEY_ACTION); mGid = savedInstanceState.getLong(KEY_GID, -1); mPToken = savedInstanceState.getString(KEY_PTOKEN, null); mPage = savedInstanceState.getInt(KEY_PAGE, -1); }
private ProcessRecord performStartProcessLocked(int vuid, int vpid, ApplicationInfo info, String processName) { ProcessRecord app = new ProcessRecord(info, processName, vuid, vpid); Bundle extras = new Bundle(); BundleCompat.putBinder(extras, "_VA_|_binder_", app); extras.putInt("_VA_|_vuid_", vuid); extras.putString("_VA_|_process_", processName); extras.putString("_VA_|_pkg_", info.packageName); Bundle res = ProviderCall.call(VASettings.getStubAuthority(vpid), "_VA_|_init_process_", null, extras); if (res == null) { return null; } int pid = res.getInt("_VA_|_pid_"); IBinder clientBinder = BundleCompat.getBinder(res, "_VA_|_client_"); attachClient(pid, clientBinder); return app; }