@Override public void onRestoreInstanceState(Parcelable state) { if (state instanceof Bundle) { Bundle bundle = (Bundle) state; this.roundedCorners = bundle.getBoolean(RoundableView.KEY); this.showOutline = bundle.getBoolean(OutlineableView.KEY); this.bootstrapSize = bundle.getFloat(BootstrapSizeView.KEY); Serializable direction = bundle.getSerializable(KEY_DIRECTION); if (direction instanceof ExpandDirection) { expandDirection = (ExpandDirection) direction; } } super.onRestoreInstanceState(state); }
@Override public void onRestoreInstanceState(Parcelable state) { if (state instanceof Bundle) { Bundle bundle = (Bundle) state; normalizedScale = bundle.getFloat("saveScale"); m = bundle.getFloatArray("matrix"); prevMatrix.setValues(m); prevMatchViewHeight = bundle.getFloat("matchViewHeight"); prevMatchViewWidth = bundle.getFloat("matchViewWidth"); prevViewHeight = bundle.getInt("viewHeight"); prevViewWidth = bundle.getInt("viewWidth"); imageRenderedAtLeastOnce = bundle.getBoolean("imageRendered"); viewSizeChangeFixedPixel = (FixedPixel) bundle.getSerializable("viewSizeChangeFixedPixel"); orientationChangeFixedPixel = (FixedPixel) bundle.getSerializable("orientationChangeFixedPixel"); int oldOrientation = bundle.getInt("orientation"); if (orientation != oldOrientation) { orientationJustChanged = true; } super.onRestoreInstanceState(bundle.getParcelable("instanceState")); return; } super.onRestoreInstanceState(state); }
@Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.wel_fragment_parallax_full_screen, container, false); Bundle args = getArguments(); frameLayout = (FrameLayout) view.findViewById(R.id.wel_parallax_frame); if (args == null) return view; startFactor = args.getFloat(KEY_START_FACTOR, startFactor); endFactor = args.getFloat(KEY_END_FACTOR, endFactor); parallaxRecursive = args.getBoolean(KEY_PARALLAX_RECURSIVE, parallaxRecursive); inflater.inflate(args.getInt(KEY_LAYOUT_ID), frameLayout, true); return view; }
@Override public void onRestoreInstanceState(Parcelable state) { if (state instanceof Bundle) { Bundle bundle = (Bundle) state; this.rounded = bundle.getBoolean(RoundableView.KEY); this.bootstrapSize = bundle.getFloat(BootstrapSizeView.KEY); Serializable brand = bundle.getSerializable(BootstrapBrand.KEY); if (brand instanceof BootstrapBrand) { bootstrapBrand = (BootstrapBrand) brand; } state = bundle.getParcelable(TAG); } super.onRestoreInstanceState(state); updateBootstrapState(); }
@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); }
@Override public void onRestoreInstanceState(Parcelable state) { if (state instanceof Bundle) { Bundle bundle = (Bundle) state; this.hasBorder = bundle.getBoolean(BorderView.KEY_DISPLAYED); this.bootstrapSize = bundle.getFloat(BootstrapSizeView.KEY); Serializable brand = bundle.getSerializable(BootstrapBrandView.KEY); if (brand instanceof BootstrapBrand) { this.bootstrapBrand = (BootstrapBrand) brand; } state = bundle.getParcelable(TAG); } super.onRestoreInstanceState(state); updateImageState(); }
assertEquals(originalBundle.getLong(LONG_KEY), cachedBundle.getLong(LONG_KEY)); assertArrayEquals(originalBundle.getLongArray(LONG_ARRAY_KEY), cachedBundle.getLongArray(LONG_ARRAY_KEY)); assertEquals(originalBundle.getFloat(FLOAT_KEY), cachedBundle.getFloat(FLOAT_KEY), TestUtils.DOUBLE_EQUALS_DELTA); assertArrayEquals(originalBundle.getFloatArray(FLOAT_ARRAY_KEY), cachedBundle.getFloatArray(FLOAT_ARRAY_KEY)); assertEquals(originalBundle.getDouble(DOUBLE_KEY), cachedBundle.getDouble(DOUBLE_KEY), TestUtils.DOUBLE_EQUALS_DELTA);
@Override protected void onRestoreInstanceState(Parcelable state) { Bundle savedState = (Bundle) state; Parcelable superState = savedState.getParcelable(STATE_PARENT); super.onRestoreInstanceState(superState); mAngle = savedState.getFloat(STATE_ANGLE); mPointerColor.setColor(calculateColor(mAngle)); } }
@Override public void onRestoreInstanceState(Parcelable state) { if (state instanceof Bundle) { Bundle bundle = (Bundle) state; this.roundedCorners = bundle.getBoolean(RoundableView.KEY); this.showOutline = bundle.getBoolean(OutlineableView.KEY); this.parentIndex = bundle.getInt(KEY_INDEX); this.bootstrapSize = bundle.getFloat(BootstrapSizeView.KEY); if (bootstrapBadge != null) { setBadgeText(bundle.getString(BadgeContainerView.KEY)); } Serializable m = bundle.getSerializable(KEY_MODE); if (m instanceof ButtonMode) { buttonMode = (ButtonMode) m; } } super.onRestoreInstanceState(state); }
@Override public void onRestoreInstanceState(Parcelable state) { if (state instanceof Bundle) { Bundle bundle = (Bundle) state; Serializable brand = bundle.getSerializable(BootstrapBrand.KEY); if (brand instanceof BootstrapBrand) { bootstrapBrand = (BootstrapBrand) brand; } this.userProgress = bundle.getInt(KEY_USER_PROGRESS); this.drawnProgress = bundle.getInt(KEY_DRAWN_PROGRESS); this.striped = bundle.getBoolean(KEY_STRIPED); this.animated = bundle.getBoolean(KEY_ANIMATED); this.rounded = bundle.getBoolean(RoundableView.KEY); this.bootstrapSize = bundle.getFloat(BootstrapSizeView.KEY); state = bundle.getParcelable(TAG); } super.onRestoreInstanceState(state); updateBootstrapState(); setProgress(userProgress); }
@Override protected void onRestoreInstanceState(Parcelable state) { if (state instanceof Bundle) { final Bundle bundle = (Bundle) state; strokeWidth = bundle.getFloat(INSTANCE_STROKE_WIDTH); suffixTextSize = bundle.getFloat(INSTANCE_SUFFIX_TEXT_SIZE); suffixTextPadding = bundle.getFloat(INSTANCE_SUFFIX_TEXT_PADDING); bottomTextSize = bundle.getFloat(INSTANCE_BOTTOM_TEXT_SIZE); bottomText = bundle.getString(INSTANCE_BOTTOM_TEXT); textSize = bundle.getFloat(INSTANCE_TEXT_SIZE); textColor = bundle.getInt(INSTANCE_TEXT_COLOR); setMax(bundle.getInt(INSTANCE_MAX)); setProgress(bundle.getInt(INSTANCE_PROGRESS)); finishedStrokeColor = bundle.getInt(INSTANCE_FINISHED_STROKE_COLOR); unfinishedStrokeColor = bundle .getInt(INSTANCE_UNFINISHED_STROKE_COLOR); suffixText = bundle.getString(INSTANCE_SUFFIX); initPainters(); super.onRestoreInstanceState(bundle.getParcelable(INSTANCE_STATE)); return; } super.onRestoreInstanceState(state); } }
@Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.wel_fragment_parallax, container, false); Bundle args = getArguments(); frameLayout = (FrameLayout) view.findViewById(R.id.wel_parallax_frame); titleView = (TextView) view.findViewById(R.id.wel_title); descriptionView = (TextView) view.findViewById(R.id.wel_description); if (args == null) return view; startFactor = args.getFloat(KEY_START_FACTOR, startFactor); endFactor = args.getFloat(KEY_END_FACTOR, endFactor); parallaxRecursive = args.getBoolean(KEY_PARALLAX_RECURSIVE, parallaxRecursive); inflater.inflate(args.getInt(KEY_LAYOUT_ID), frameLayout, true); if (args.getString(KEY_TITLE) != null) titleView.setText(args.getString(KEY_TITLE)); if (args.getString(KEY_DESCRIPTION) != null) descriptionView.setText(args.getString(KEY_DESCRIPTION)); int headerColor = args.getInt(KEY_HEADER_COLOR, WelcomeUtils.NO_COLOR_SET); if (headerColor != WelcomeUtils.NO_COLOR_SET) titleView.setTextColor(headerColor); int descriptionColor = args.getInt(KEY_DESCRIPTION_COLOR, WelcomeUtils.NO_COLOR_SET); if (descriptionColor != WelcomeUtils.NO_COLOR_SET) descriptionView.setTextColor(descriptionColor); WelcomeUtils.setTypeface(titleView, args.getString(KEY_HEADER_TYPEFACE_PATH), getActivity()); WelcomeUtils.setTypeface(descriptionView, args.getString(KEY_DESCRIPTION_TYPEFACE_PATH), getActivity()); return view; }
@Override protected void onRestoreInstanceState(Parcelable state) { if (state instanceof Bundle) { final Bundle bundle = (Bundle) state; mTextColor = bundle.getInt(INSTANCE_TEXT_COLOR); mTextSize = bundle.getFloat(INSTANCE_TEXT_SIZE); mReachedBarHeight = bundle.getFloat(INSTANCE_REACHED_BAR_HEIGHT); mUnreachedBarHeight = bundle.getFloat(INSTANCE_UNREACHED_BAR_HEIGHT); mReachedBarColor = bundle.getInt(INSTANCE_REACHED_BAR_COLOR); mUnreachedBarColor = bundle.getInt(INSTANCE_UNREACHED_BAR_COLOR); initializePainters(); setMax(bundle.getInt(INSTANCE_MAX)); setProgress(bundle.getInt(INSTANCE_PROGRESS)); setPrefix(bundle.getString(INSTANCE_PREFIX)); setSuffix(bundle.getString(INSTANCE_SUFFIX)); setProgressTextVisibility(bundle.getBoolean(INSTANCE_TEXT_VISIBILITY) ? ProgressTextVisibility.Visible : ProgressTextVisibility.Invisible); super.onRestoreInstanceState(bundle.getParcelable(INSTANCE_STATE)); return; } super.onRestoreInstanceState(state); }
@Override protected void onRestoreInstanceState(Parcelable state) { if (state instanceof Bundle) { final Bundle bundle = (Bundle) state; mTextColor = bundle.getInt(INSTANCE_TEXT_COLOR); mTextSize = bundle.getFloat(INSTANCE_TEXT_SIZE); mReachedBarHeight = bundle.getFloat(INSTANCE_REACHED_BAR_HEIGHT); mUnreachedBarHeight = bundle.getFloat(INSTANCE_UNREACHED_BAR_HEIGHT); mReachedBarColor = bundle.getInt(INSTANCE_REACHED_BAR_COLOR); mUnreachedBarColor = bundle.getInt(INSTANCE_UNREACHED_BAR_COLOR); initializePainters(); setMax(bundle.getInt(INSTANCE_MAX)); setProgress(bundle.getInt(INSTANCE_PROGRESS)); setPrefix(bundle.getString(INSTANCE_PREFIX)); setSuffix(bundle.getString(INSTANCE_SUFFIX)); setProgressTextVisibility(bundle.getBoolean(INSTANCE_TEXT_VISIBILITY) ? ProgressTextVisibility.VISIBLE : ProgressTextVisibility.INVISIBLE); super.onRestoreInstanceState(bundle.getParcelable(INSTANCE_STATE)); return; } super.onRestoreInstanceState(state); }
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)); float aspectRatioX = bundle.getFloat(UCrop.EXTRA_ASPECT_RATIO_X, 0); float aspectRatioY = bundle.getFloat(UCrop.EXTRA_ASPECT_RATIO_Y, 0);
scaleFactor = bundle.getFloat(DecodeThread.BARCODE_SCALED_FACTOR);
assertThat(meta.getFloat("org.robolectric.metaFloat")).isEqualTo(1.23f);
Bundle extras = getIntent().getExtras(); if(extras !=null) { float foo = extras.getFloat("foo"); String bar = extras.getString("bar"); }