Java Code Examples for android.os.bundle#putFloat()
The following examples show how to use
android.os.bundle#putFloat() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SampleActionBarActivity.java From UltimateAndroid with Apache License 2.0 | 6 votes |
@Override public void onClick(View v) { switch (v.getId()) { case R.id.button: SampleSupportDialogFragment fragment = new SampleSupportDialogFragment(); Bundle args = new Bundle(); args.putInt( SupportBlurDialogFragment.BUNDLE_KEY_BLUR_RADIUS, mBlurRadiusSeekbar.getProgress() ); args.putFloat( SupportBlurDialogFragment.BUNDLE_KEY_DOWN_SCALE_FACTOR, mDownScaleFactorSeekbar.getProgress() ); fragment.setArguments(args); fragment.debug(mDebugMode.isChecked()); fragment.show(getSupportFragmentManager(), "blur_sample"); break; default: break; } }
Example 2
Source File: SVBar.java From android-grid-wichterle with Apache License 2.0 | 6 votes |
@Override protected Parcelable onSaveInstanceState() { Parcelable superState = super.onSaveInstanceState(); Bundle state = new Bundle(); state.putParcelable(STATE_PARENT, superState); state.putFloatArray(STATE_COLOR, mHSVColor); float[] hsvColor = new float[3]; Color.colorToHSV(mColor, hsvColor); if (hsvColor[1] < hsvColor[2]) { state.putFloat(STATE_SATURATION, hsvColor[1]); } else { state.putFloat(STATE_VALUE, hsvColor[2]); } return state; }
Example 3
Source File: BlurDialogActivity.java From UltimateAndroid with Apache License 2.0 | 6 votes |
@Override public void onClick(View v) { switch (v.getId()) { case R.id.button: SampleDialogFragment fragment = new SampleDialogFragment(); Bundle args = new Bundle(); args.putInt( SupportBlurDialogFragment.BUNDLE_KEY_BLUR_RADIUS, mBlurRadiusSeekbar.getProgress() ); args.putFloat( SupportBlurDialogFragment.BUNDLE_KEY_DOWN_SCALE_FACTOR, mDownScaleFactorSeekbar.getProgress() ); fragment.setArguments(args); fragment.debug(mDebugMode.isChecked()); fragment.show(getFragmentManager(), "blur_sample"); break; default: break; } }
Example 4
Source File: OverlayPinchImageView.java From Augendiagnose with GNU General Public License v2.0 | 6 votes |
@NonNull @Override protected final Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); bundle.putParcelable("instanceState", super.onSaveInstanceState()); bundle.putFloat("mOverlayX", this.mOverlayX); bundle.putFloat("mOverlayY", this.mOverlayY); bundle.putFloat("mOverlayScaleFactor", this.mOverlayScaleFactor); bundle.putFloat("mPupilOverlayX", this.mPupilOverlayX); bundle.putFloat("mPupilOverlayY", this.mPupilOverlayY); bundle.putFloat("mPupilOverlayScaleFactor", this.mPupilOverlayScaleFactor); bundle.putBooleanArray("mShowOverlay", this.mShowOverlay); bundle.putBoolean("mLocked", this.mLocked); bundle.putSerializable("mPinchMode", mPinchMode); bundle.putFloat("mBrightness", this.mBrightness); bundle.putFloat("mContrast", this.mContrast); bundle.putFloat("mSaturation", this.mSaturation); bundle.putFloat("mColorTemperature", this.mColorTemperature); bundle.putInt("mOverlayColor", mOverlayColor); bundle.putParcelable("mMetadata", mMetadata); return bundle; }
Example 5
Source File: BasePhotoFragment.java From ZoomPreviewPicture with Apache License 2.0 | 6 votes |
public static BasePhotoFragment getInstance(Class<? extends BasePhotoFragment> fragmentClass, IThumbViewInfo item, boolean currentIndex, boolean isSingleFling, boolean isDrag, float sensitivity) { BasePhotoFragment fragment; try { fragment = fragmentClass.newInstance(); } catch (Exception e) { fragment = new BasePhotoFragment(); } Bundle bundle = new Bundle(); bundle.putParcelable(BasePhotoFragment.KEY_PATH, item); bundle.putBoolean(BasePhotoFragment.KEY_TRANS_PHOTO, currentIndex); bundle.putBoolean(BasePhotoFragment.KEY_SING_FILING, isSingleFling); bundle.putBoolean(BasePhotoFragment.KEY_DRAG, isDrag); bundle.putFloat(BasePhotoFragment.KEY_SEN, sensitivity); fragment.setArguments(bundle); return fragment; }
Example 6
Source File: AhoyOnboarderFragment.java From ahoy-onboarding with Apache License 2.0 | 6 votes |
public static AhoyOnboarderFragment newInstance(AhoyOnboarderCard card) { Bundle args = new Bundle(); args.putString(AHOY_PAGE_TITLE, card.getTitle()); args.putString(AHOY_PAGE_DESCRIPTION, card.getDescription()); args.putInt(AHOY_PAGE_TITLE_RES_ID, card.getTitleResourceId()); args.putInt(AHOY_PAGE_DESCRIPTION_RES_ID, card.getDescriptionResourceId()); args.putInt(AHOY_PAGE_TITLE_COLOR, card.getTitleColor()); args.putInt(AHOY_PAGE_DESCRIPTION_COLOR, card.getDescriptionColor()); args.putInt(AHOY_PAGE_IMAGE_RES_ID, card.getImageResourceId()); args.putFloat(AHOY_PAGE_TITLE_TEXT_SIZE, card.getTitleTextSize()); args.putFloat(AHOY_PAGE_DESCRIPTION_TEXT_SIZE, card.getDescriptionTextSize()); args.putInt(AHOY_PAGE_BACKGROUND_COLOR, card.getBackgroundColor()); args.putInt(AHOY_PAGE_ICON_HEIGHT, card.getIconHeight()); args.putInt(AHOY_PAGE_ICON_WIDTH, card.getIconWidth()); args.putInt(AHOY_PAGE_MARGIN_LEFT, card.getMarginLeft()); args.putInt(AHOY_PAGE_MARGIN_RIGHT, card.getMarginRight()); args.putInt(AHOY_PAGE_MARGIN_TOP, card.getMarginTop()); args.putInt(AHOY_PAGE_MARGIN_BOTTOM, card.getMarginBottom()); AhoyOnboarderFragment fragment = new AhoyOnboarderFragment(); fragment.setArguments(args); return fragment; }
Example 7
Source File: MapEventSource.java From android_maplib with GNU Lesser General Public License v3.0 | 6 votes |
/** * Send layers draw finished event to all listeners */ protected void onLayerDrawFinished( int id, float percent) { if (mListeners == null) { return; } Bundle bundle = new Bundle(); bundle.putInt(BUNDLE_TYPE_KEY, EVENT_onLayerDrawFinished); bundle.putInt(BUNDLE_ID_KEY, id); bundle.putFloat(BUNDLE_DONE_KEY, percent); Message msg = new Message(); msg.setData(bundle); mHandler.sendMessage(msg); }
Example 8
Source File: MarginFragment.java From recycler-view-margin-decoration with Apache License 2.0 | 5 votes |
@Subscribe public void onMarginData( MarginData event ){ Bundle args = getArguments(); args.putFloat( KEY_SPACE, event.getSpace() ); args.putFloat( KEY_TOP_MARGIN, event.getMarginTop() ); args.putFloat( KEY_LEFT_MARGIN, event.getMarginLeft() ); args.putFloat( KEY_RIGHT_MARGIN, event.getMarginRight() ); args.putFloat( KEY_BOTTOM_MARGIN, event.getMarginBottom() ); initInstance( getView() ); }
Example 9
Source File: DecodeHandler.java From ZXing-Orient with Apache License 2.0 | 5 votes |
private static void bundleThumbnail(PlanarYUVLuminanceSource source, Bundle bundle) { int[] pixels = source.renderThumbnail(); int width = source.getThumbnailWidth(); int height = source.getThumbnailHeight(); Bitmap bitmap = Bitmap.createBitmap(pixels, 0, width, width, height, Bitmap.Config.ARGB_8888); ByteArrayOutputStream out = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.JPEG, 50, out); bundle.putByteArray(DecodeThread.BARCODE_BITMAP, out.toByteArray()); bundle.putFloat(DecodeThread.BARCODE_SCALED_FACTOR, (float) width / source.getWidth()); }
Example 10
Source File: CircleProgressView.java From ProgressView with Apache License 2.0 | 5 votes |
@Override public Parcelable onSaveInstanceState() { final Bundle bundle = new Bundle(); bundle.putParcelable(STATE, super.onSaveInstanceState()); // 保存当前样式 bundle.putInt(PROGRESS_STYLE, getProgressStyle()); bundle.putInt(RADIUS, getRadius()); bundle.putBoolean(IS_REACH_CAP_ROUND, isReachCapRound()); bundle.putInt(START_ARC, getStartArc()); bundle.putInt(INNER_BG_COLOR, getInnerBackgroundColor()); bundle.putInt(INNER_PADDING, getInnerPadding()); bundle.putInt(OUTER_COLOR, getOuterColor()); bundle.putInt(OUTER_SIZE, getOuterSize()); // 保存text信息 bundle.putInt(TEXT_COLOR, getTextColor()); bundle.putInt(TEXT_SIZE, getTextSize()); bundle.putFloat(TEXT_SKEW_X, getTextSkewX()); bundle.putBoolean(TEXT_VISIBLE, isTextVisible()); bundle.putString(TEXT_SUFFIX, getTextSuffix()); bundle.putString(TEXT_PREFIX, getTextPrefix()); // 保存已到达进度信息 bundle.putInt(REACH_BAR_COLOR, getReachBarColor()); bundle.putInt(REACH_BAR_SIZE, getReachBarSize()); // 保存未到达进度信息 bundle.putInt(NORMAL_BAR_COLOR, getNormalBarColor()); bundle.putInt(NORMAL_BAR_SIZE, getNormalBarSize()); return bundle; }
Example 11
Source File: VideoViewActivity.java From MediaPlayer-Extended with Apache License 2.0 | 5 votes |
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); if (mVideoView != null) { mVideoPosition = mVideoView.getCurrentPosition(); mVideoPlaybackSpeed = mVideoView.getPlaybackSpeed(); mVideoPlaying = mVideoView.isPlaying(); // the uri is stored in the base activity outState.putParcelable("uri", mVideoUri); outState.putInt("position", mVideoPosition); outState.putFloat("playbackSpeed", mVideoView.getPlaybackSpeed()); outState.putBoolean("playing", mVideoPlaying); } }
Example 12
Source File: UriUtils.java From DDComponentForAndroid with Apache License 2.0 | 5 votes |
/** * @param typeDef type * @param key key * @param value value */ public static void setBundleValue(Bundle bundle, Integer typeDef, String key, String value) { if (TextUtils.isEmpty(key) || TextUtils.isEmpty(value)) { return; } try { if (null != typeDef) { if (typeDef == Type.BOOLEAN.ordinal()) { bundle.putBoolean(key, Boolean.parseBoolean(value)); } else if (typeDef == Type.BYTE.ordinal()) { bundle.putByte(key, Byte.valueOf(value)); } else if (typeDef == Type.SHORT.ordinal()) { bundle.putShort(key, Short.valueOf(value)); } else if (typeDef == Type.INT.ordinal()) { bundle.putInt(key, Integer.valueOf(value)); } else if (typeDef == Type.LONG.ordinal()) { bundle.putLong(key, Long.valueOf(value)); } else if (typeDef == Type.FLOAT.ordinal()) { bundle.putFloat(key, Float.valueOf(value)); } else if (typeDef == Type.DOUBLE.ordinal()) { bundle.putDouble(key, Double.valueOf(value)); } else if (typeDef == Type.STRING.ordinal()) { bundle.putString(key, value); } else if (typeDef == Type.PARCELABLE.ordinal()) { } else if (typeDef == Type.OBJECT.ordinal()) { bundle.putString(key, value); } else { bundle.putString(key, value); } } else { bundle.putString(key, value); } } catch (Throwable ex) { } }
Example 13
Source File: TouchImageView.java From Chimee with MIT License | 5 votes |
@Override public Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); bundle.putParcelable("instanceState", super.onSaveInstanceState()); bundle.putFloat("saveScale", normalizedScale); bundle.putFloat("matchViewHeight", matchViewHeight); bundle.putFloat("matchViewWidth", matchViewWidth); bundle.putInt("viewWidth", viewWidth); bundle.putInt("viewHeight", viewHeight); matrix.getValues(m); bundle.putFloatArray("matrix", m); bundle.putBoolean("imageRendered", imageRenderedAtLeastOnce); return bundle; }
Example 14
Source File: DecodeHandler.java From AndroidHttpCapture with MIT License | 5 votes |
private static void bundleThumbnail(PlanarYUVLuminanceSource source, Bundle bundle) { int[] pixels = source.renderThumbnail(); int width = source.getThumbnailWidth(); int height = source.getThumbnailHeight(); Bitmap bitmap = Bitmap.createBitmap(pixels, 0, width, width, height, Bitmap.Config.ARGB_8888); ByteArrayOutputStream out = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.JPEG, 50, out); bundle.putByteArray(DecodeThread.BARCODE_BITMAP, out.toByteArray()); bundle.putFloat(DecodeThread.BARCODE_SCALED_FACTOR, (float) width / source.getWidth()); }
Example 15
Source File: FloatProcessor.java From LiveEventBus with Apache License 2.0 | 5 votes |
@Override public boolean writeToBundle(Bundle bundle, Object value) { if (!(value instanceof Float)) { return false; } bundle.putFloat(IpcConst.KEY_VALUE, (float) value); return true; }
Example 16
Source File: HoloCircularProgressBar.java From UltimateAndroid with Apache License 2.0 | 5 votes |
@Override protected Parcelable onSaveInstanceState() { final Bundle bundle = new Bundle(); bundle.putParcelable(INSTANCE_STATE_SAVEDSTATE, super.onSaveInstanceState()); bundle.putFloat(INSTANCE_STATE_PROGRESS, mProgress); bundle.putFloat(INSTANCE_STATE_MARKER_PROGRESS, mMarkerProgress); bundle.putInt(INSTANCE_STATE_PROGRESS_COLOR, mProgressColor); bundle.putInt(INSTANCE_STATE_PROGRESS_BACKGROUND_COLOR, mProgressBackgroundColor); return bundle; }
Example 17
Source File: DecodeHandler.java From moVirt with Apache License 2.0 | 5 votes |
private static void bundleThumbnail(PlanarYUVLuminanceSource source, Bundle bundle) { int[] pixels = source.renderThumbnail(); int width = source.getThumbnailWidth(); int height = source.getThumbnailHeight(); Bitmap bitmap = Bitmap.createBitmap(pixels, 0, width, width, height, Bitmap.Config.ARGB_8888); ByteArrayOutputStream out = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.JPEG, 50, out); bundle.putByteArray(DecodeThread.BARCODE_BITMAP, out.toByteArray()); bundle.putFloat(DecodeThread.BARCODE_SCALED_FACTOR, (float) width / source.getWidth()); }
Example 18
Source File: ArcProgressBar.java From mollyim-android with GNU General Public License v3.0 | 5 votes |
@Override protected @Nullable Parcelable onSaveInstanceState() { Parcelable superState = super.onSaveInstanceState(); Bundle bundle = new Bundle(); bundle.putParcelable(SUPER, superState); bundle.putFloat(PROGRESS, progress); return bundle; }
Example 19
Source File: FloatMeasurementView.java From openScale with GNU General Public License v3.0 | 4 votes |
@Override public void saveState(Bundle state) { state.putFloat(getKey(), value); }
Example 20
Source File: ParameterHelper.java From IPCInvoker with Apache License 2.0 | 4 votes |
public static void put(Bundle bundle, String key, Object value) { if (value instanceof Integer) { bundle.putInt(key, (Integer) value); } else if (value instanceof Float) { bundle.putFloat(key, (Float) value); } else if (value instanceof Character) { bundle.putChar(key, (Character) value); } else if (value instanceof CharSequence) { bundle.putCharSequence(key, (CharSequence) value); } else if (value instanceof Long) { bundle.putLong(key, (Long) value); } else if (value instanceof Short) { bundle.putShort(key, (Short) value); } else if (value instanceof Byte) { bundle.putByte(key, (Byte) value); } else if (value instanceof Boolean) { bundle.putBoolean(key, (Boolean) value); } else if (value instanceof Double) { bundle.putDouble(key, (Double) value); } else if (value instanceof Parcelable) { bundle.putParcelable(key, (Parcelable) value); } else if (value instanceof Bundle) { bundle.putBundle(key, (Bundle) value); } else if (value instanceof int[]) { bundle.putIntArray(key, (int[]) value); } else if (value instanceof byte[]) { bundle.putByteArray(key, (byte[]) value); } else if (value instanceof float[]) { bundle.putFloatArray(key, (float[]) value); } else if (value instanceof double[]) { bundle.putDoubleArray(key, (double[]) value); } else if (value instanceof boolean[]) { bundle.putBooleanArray(key, (boolean[]) value); } else if (value instanceof long[]) { bundle.putLongArray(key, (long[]) value); } else if (value instanceof Parcelable[]) { bundle.putParcelableArray(key, (Parcelable[]) value); } else if (value instanceof short[]) { bundle.putShortArray(key, (short[]) value); } else if (value instanceof String[]) { bundle.putStringArray(key, (String[]) value); } else { // bundle.putString(key, String.valueOf(value)); } }