Java Code Examples for android.os.Bundle.putFloat()

The following are Jave code examples for showing how to use putFloat() of the android.os.Bundle class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: JKCloud   File: NumberProgressBar.java   View Source Code Vote up 6 votes
@Override
protected Parcelable onSaveInstanceState() {
    final Bundle bundle = new Bundle();
    bundle.putParcelable(INSTANCE_STATE, super.onSaveInstanceState());
    bundle.putInt(INSTANCE_TEXT_COLOR, getTextColor());
    bundle.putFloat(INSTANCE_TEXT_SIZE, getProgressTextSize());
    bundle.putFloat(INSTANCE_REACHED_BAR_HEIGHT, getReachedBarHeight());
    bundle.putFloat(INSTANCE_UNREACHED_BAR_HEIGHT, getUnreachedBarHeight());
    bundle.putInt(INSTANCE_REACHED_BAR_COLOR, getReachedBarColor());
    bundle.putInt(INSTANCE_UNREACHED_BAR_COLOR, getUnreachedBarColor());
    bundle.putInt(INSTANCE_MAX, getMax());
    bundle.putInt(INSTANCE_PROGRESS, getProgress());
    bundle.putString(INSTANCE_SUFFIX, getSuffix());
    bundle.putString(INSTANCE_PREFIX, getPrefix());
    return bundle;
}
 
Example 2
Project: aarLibrary   File: NumberProgressBar.java   View Source Code Vote up 6 votes
@Override
protected Parcelable onSaveInstanceState() {
    final Bundle bundle = new Bundle();
    bundle.putParcelable(INSTANCE_STATE, super.onSaveInstanceState());
    bundle.putInt(INSTANCE_TEXT_COLOR, getTextColor());
    bundle.putFloat(INSTANCE_TEXT_SIZE, getProgressTextSize());
    bundle.putFloat(INSTANCE_REACHED_BAR_HEIGHT, getReachedBarHeight());
    bundle.putFloat(INSTANCE_UNREACHED_BAR_HEIGHT, getUnreachedBarHeight());
    bundle.putInt(INSTANCE_REACHED_BAR_COLOR, getReachedBarColor());
    bundle.putInt(INSTANCE_UNREACHED_BAR_COLOR, getUnreachedBarColor());
    bundle.putInt(INSTANCE_MAX, getMax());
    bundle.putInt(INSTANCE_PROGRESS, getProgress());
    bundle.putString(INSTANCE_SUFFIX, getSuffix());
    bundle.putString(INSTANCE_PREFIX, getPrefix());
    bundle.putBoolean(INSTANCE_TEXT_VISIBILITY, getProgressTextVisibility());
    return bundle;
}
 
Example 3
Project: xlight_android_native   File: SVBar.java   View Source Code Vote up 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 4
Project: OSchina_resources_android   File: TouchImageView.java   View Source Code Vote up 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 5
Project: RLibrary   File: DecodeHandler.java   View Source Code Vote up 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 6
Project: PlusGram   File: ColorPickerView.java   View Source Code Vote up 5 votes
@Override
protected Parcelable onSaveInstanceState() {
    Parcelable superState = super.onSaveInstanceState();

    Bundle state = new Bundle();
    state.putParcelable(STATE_PARENT, superState);
    state.putFloat(STATE_ANGLE, mAngle);
    state.putInt(STATE_OLD_COLOR, mCenterOldColor);
    state.putBoolean(STATE_SHOW_OLD_COLOR, mShowCenterOldColor);

    return state;
}
 
Example 7
Project: BlogBookApp   File: SpaceNavigationView.java   View Source Code Vote up 5 votes
/**
 * Save badges and current position
 *
 * @param outState bundle to saveInstance
 */
public void onSaveInstanceState(Bundle outState) {
    outState.putInt(CURRENT_SELECTED_ITEM_BUNDLE_KEY, currentSelectedItem);
    outState.putInt(CENTRE_BUTTON_ICON_KEY, centreButtonIcon);
    outState.putInt(SPACE_BACKGROUND_COLOR_KEY, spaceBackgroundColor);
    outState.putBoolean(BADGE_FULL_TEXT_KEY, shouldShowBadgeWithNinePlus);
    outState.putFloat(VISIBILITY, this.getTranslationY());

    if (badgeSaveInstanceHashMap.size() > 0)
        outState.putSerializable(BADGES_ITEM_BUNDLE_KEY, badgeSaveInstanceHashMap);
    if (changedItemAndIconHashMap.size() > 0)
        outState.putSerializable(CHANGED_ICON_AND_TEXT_BUNDLE_KEY, changedItemAndIconHashMap);
}
 
Example 8
Project: LeCatApp   File: DecodeHandler.java   View Source Code Vote up 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 9
Project: CustomAndroidOneSheeld   File: ColorDetectionShield.java   View Source Code Vote up 5 votes
public void showPreview(float x, float y, int width, int height) throws RemoteException {
    Message msg = Message.obtain(null, CameraHeadService.SHOW_PREVIEW);
    msg.replyTo = mMessenger;
    Bundle b = new Bundle();
    b.putFloat("x", x);
    b.putFloat("y", y);
    b.putInt("w", width);
    b.putInt("h", height);
    msg.setData(b);
    if (mService != null)
        mService.send(msg);
    else
        bindService();

}
 
Example 10
Project: tvConnect_android   File: DecodeHandler.java   View Source Code Vote up 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 11
Project: microMathematics   File: SaturationBar.java   View Source Code Vote up 5 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);
	state.putFloat(STATE_SATURATION, hsvColor[1]);

	return state;
}
 
Example 12
Project: CXJPadProject   File: TouchImageView.java   View Source Code Vote up 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 13
Project: AttitudeView   File: AttitudeView.java   View Source Code Vote up 5 votes
@Override
protected Parcelable onSaveInstanceState() {
    Bundle b = new Bundle();
    b.putParcelable("instanceState", super.onSaveInstanceState());
    b.putFloat("degrees", mPitch);

    return b;
}
 
Example 14
Project: AndroidBackendlessChat   File: TouchImageView.java   View Source Code Vote up 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 15
Project: PaoMovie   File: CircleProgress.java   View Source Code Vote up 5 votes
@Override
protected Parcelable onSaveInstanceState() {
    final Bundle bundle = new Bundle();
    bundle.putParcelable(INSTANCE_STATE, super.onSaveInstanceState());
    bundle.putInt(INSTANCE_TEXT_COLOR, getTextColor());
    bundle.putFloat(INSTANCE_TEXT_SIZE, getTextSize());
    bundle.putInt(INSTANCE_FINISHED_STROKE_COLOR, getFinishedColor());
    bundle.putInt(INSTANCE_UNFINISHED_STROKE_COLOR, getUnfinishedColor());
    bundle.putInt(INSTANCE_MAX, getMax());
    bundle.putInt(INSTANCE_PROGRESS, getProgress());
    bundle.putString(INSTANCE_SUFFIX, getSuffixText());
    bundle.putString(INSTANCE_PREFIX, getPrefixText());
    return bundle;
}
 
Example 16
Project: yphoto   File: TouchImageView.java   View Source Code Vote up 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 17
Project: GitHub   File: Injector.java   View Source Code Vote up 4 votes
public void putFloat(Bundle state, String key, float x) {
    state.putFloat(key + baseKey, x);
}
 
Example 18
Project: android-state   File: InjectionHelper.java   View Source Code Vote up 4 votes
public void putFloat(Bundle state, String key, float x) {
    state.putFloat(key + mBaseKey, x);
}
 
Example 19
Project: MRouter   File: MainActivity.java   View Source Code Vote up 4 votes
public Bundle assembleBundle() {
    User user = new User();
    user.setAge(90);
    user.setGender(1);
    user.setName("kitty");

    Address address = new Address();
    address.setCity("HangZhou");
    address.setProvince("ZheJiang");

    Bundle extras = new Bundle();
    extras.putString("extra", "from extras");


    ArrayList<String> stringList = new ArrayList<>();
    stringList.add("Java");
    stringList.add("C#");
    stringList.add("Kotlin");

    ArrayList<String> stringArrayList = new ArrayList<>();
    stringArrayList.add("American");
    stringArrayList.add("China");
    stringArrayList.add("England");

    ArrayList<Integer> intArrayList = new ArrayList<>();
    intArrayList.add(100);
    intArrayList.add(101);
    intArrayList.add(102);

    ArrayList<Integer> intList = new ArrayList<>();
    intList.add(10011);
    intList.add(10111);
    intList.add(10211);

    ArrayList<Address> addressList = new ArrayList<>();
    addressList.add(new Address("JiangXi", "ShangRao", null));
    addressList.add(new Address("ZheJiang", "NingBo", null));

    Address[] addressArray = new Address[]{
            new Address("Beijing", "Beijing", null),
            new Address("Shanghai", "Shanghai", null),
            new Address("Guangzhou", "Guangzhou", null)
    };
    Bundle bundle = new Bundle();
    bundle.putSerializable("user", user);
    bundle.putParcelable("address", address);
    bundle.putParcelableArrayList("addressList", addressList);
    bundle.putParcelableArray("addressArray", addressArray);
    bundle.putString("param", "chiclaim");
    bundle.putStringArray("stringArray", new String[]{"a", "b", "c"});
    bundle.putStringArrayList("stringArrayList", stringList);
    bundle.putStringArrayList("stringList", stringArrayList);
    bundle.putByte("byte", (byte) 2);
    bundle.putByteArray("byteArray", new byte[]{1, 2, 3, 4, 5});
    bundle.putInt("age", 33);
    bundle.putIntArray("intArray", new int[]{10, 11, 12, 13});
    bundle.putIntegerArrayList("intList", intList);
    bundle.putIntegerArrayList("intArrayList", intArrayList);
    bundle.putChar("chara", 'c');
    bundle.putCharArray("charArray", "chiclaim".toCharArray());
    bundle.putShort("short", (short) 1000000);
    bundle.putShortArray("shortArray", new short[]{(short) 10.9, (short) 11.9});
    bundle.putDouble("double", 1200000);
    bundle.putDoubleArray("doubleArray", new double[]{1232, 9999, 8789, 3.1415926});
    bundle.putLong("long", 999999999);
    bundle.putLongArray("longArray", new long[]{1000, 2000, 3000});
    bundle.putFloat("float", 333);
    bundle.putFloatArray("floatArray", new float[]{12.9f, 234.9f});
    bundle.putBoolean("boolean", true);
    bundle.putBooleanArray("booleanArray", new boolean[]{true, false, true});

    return bundle;
}
 
Example 20
Project: ucar-weex-core   File: ArgumentsUtil.java   View Source Code Vote up 4 votes
public static Bundle fromJsonToBundle(JSONObject jsonObject) {
    Bundle budle = new Bundle();
    if (jsonObject == null) {
        return budle;
    } else {
        Iterator iterator = jsonObject.keySet().iterator();

        while (iterator.hasNext()) {
            String key = (String) iterator.next();
            Object value = jsonObject.get(key);
            if (value != null) {
                if (value instanceof String) {
                    budle.putString(key, (String) value);
                } else if (value instanceof Byte) {
                    budle.putByte(key, ((Byte) value).byteValue());
                } else if (value instanceof Short) {
                    budle.putShort(key, ((Short) value).shortValue());
                } else if (value instanceof Integer) {
                    budle.putInt(key, ((Integer) value).intValue());
                } else if (value instanceof Long) {
                    budle.putLong(key, ((Long) value).longValue());
                } else if (value instanceof Float) {
                    budle.putFloat(key, ((Float) value).floatValue());
                } else if (value instanceof Double) {
                    budle.putDouble(key, ((Double) value).doubleValue());
                } else if (value instanceof Boolean) {
                    budle.putBoolean(key, ((Boolean) value).booleanValue());
                } else if (value instanceof Character) {
                    budle.putChar(key, ((Character) value).charValue());
                } else if (value instanceof JSONObject) {
                    budle.putBundle(key, fromJsonToBundle((JSONObject) value));
                } else {
                    if (!value.getClass().isArray()) {
                        throw new IllegalArgumentException("Could not convert " + value.getClass());
                    }

                    fromArrayToBundle(budle, key, value);
                }
            }
        }

        return budle;
    }
}