android.os.Bundle#putFloatArray ( )源码实例Demo

下面列出了android.os.Bundle#putFloatArray ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: PhotoEdit   文件: SVBar.java
@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;
}
 
源代码2 项目: memoir   文件: SVBar.java
@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]);
    }
    state.putBoolean(STATE_ORIENTATION, ORIENTATION_HORIZONTAL);

    return state;
}
 
源代码3 项目: Saiy-PS   文件: SaiyAccessibilityService.java
/**
 * Process the extracted text as identified as a command
 *
 * @param text the command to process
 */
private void process(@NonNull final String text) {
    if (DEBUG) {
        MyLog.i(CLS_NAME, "process");
    }

    final Bundle bundle = new Bundle();

    final ArrayList<String> voiceResults = new ArrayList<>(1);
    voiceResults.add(text);

    final float[] confidence = new float[1];
    confidence[0] = 1f;

    bundle.putStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION, voiceResults);
    bundle.putFloatArray(SpeechRecognizer.CONFIDENCE_SCORES, confidence);
    bundle.putInt(LocalRequest.EXTRA_CONDITION, Condition.CONDITION_GOOGLE_NOW);

    AsyncTask.execute(new Runnable() {
        @Override
        public void run() {
            new RecognitionAction(SaiyAccessibilityService.this.getApplicationContext(), SPH.getVRLocale(SaiyAccessibilityService.this.getApplicationContext()),
                    SPH.getTTSLocale(SaiyAccessibilityService.this.getApplicationContext()), sl, bundle);
        }
    });
}
 
源代码4 项目: TiTouchImageView   文件: TouchImageView.java
@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;
}
 
/**
 * Captures placement information for Views with a shared element name for
 * Activity Transitions.
 *
 * @param view           The View to capture the placement information for.
 * @param name           The shared element name in the target Activity to apply the placement
 *                       information for.
 * @param transitionArgs Bundle to store shared element placement information.
 * @param tempBounds     A temporary Rect for capturing the current location of views.
 */
protected void captureSharedElementState(View view, String name, Bundle transitionArgs,
        Matrix tempMatrix, RectF tempBounds) {
    Bundle sharedElementBundle = new Bundle();
    tempMatrix.reset();
    view.transformMatrixToGlobal(tempMatrix);
    tempBounds.set(0, 0, view.getWidth(), view.getHeight());
    tempMatrix.mapRect(tempBounds);

    sharedElementBundle.putFloat(KEY_SCREEN_LEFT, tempBounds.left);
    sharedElementBundle.putFloat(KEY_SCREEN_RIGHT, tempBounds.right);
    sharedElementBundle.putFloat(KEY_SCREEN_TOP, tempBounds.top);
    sharedElementBundle.putFloat(KEY_SCREEN_BOTTOM, tempBounds.bottom);
    sharedElementBundle.putFloat(KEY_TRANSLATION_Z, view.getTranslationZ());
    sharedElementBundle.putFloat(KEY_ELEVATION, view.getElevation());

    Parcelable bitmap = null;
    if (mListener != null) {
        bitmap = mListener.onCaptureSharedElementSnapshot(view, tempMatrix, tempBounds);
    }

    if (bitmap != null) {
        sharedElementBundle.putParcelable(KEY_SNAPSHOT, bitmap);
    }

    if (view instanceof ImageView) {
        ImageView imageView = (ImageView) view;
        int scaleTypeInt = scaleTypeToInt(imageView.getScaleType());
        sharedElementBundle.putInt(KEY_SCALE_TYPE, scaleTypeInt);
        if (imageView.getScaleType() == ImageView.ScaleType.MATRIX) {
            float[] matrix = new float[9];
            imageView.getImageMatrix().getValues(matrix);
            sharedElementBundle.putFloatArray(KEY_IMAGE_MATRIX, matrix);
        }
    }

    transitionArgs.putBundle(name, sharedElementBundle);
}
 
源代码6 项目: SwipableLayout   文件: TouchImageView.java
@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;
}
 
源代码7 项目: android-grid-wichterle   文件: SaturationBar.java
@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;
}
 
源代码8 项目: HoloColorPicker   文件: ValueBar.java
@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_VALUE, hsvColor[2]);

	return state;
}
 
源代码9 项目: MoeQuest   文件: PhotoImageView.java
@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;
}
 
源代码10 项目: px-android   文件: ColorPicker.java
@Override
protected Parcelable onSaveInstanceState() {
    Bundle state = new Bundle();
    state.putFloatArray("color", colorHSV);
    state.putParcelable("super", super.onSaveInstanceState());
    return state;
}
 
源代码11 项目: Document-Scanner   文件: TouchImageView.java
@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;
}
 
@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;
}
 
源代码13 项目: MultiView   文件: TouchImageView.java
@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;
}
 
private static void putFloatArray(String key, Bundle bundle) {
    int length = random.nextInt(50);
    float[] array = new float[length];
    for (int i = 0; i < length; i++) {
        array[i] = random.nextFloat();
    }
    bundle.putFloatArray(key, array);
}
 
源代码15 项目: android-grid-wichterle   文件: ValueBar.java
@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_VALUE, hsvColor[2]);

	return state;
}
 
源代码16 项目: ploggy   文件: TouchImageView.java
@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);
  return bundle;
}
 
源代码17 项目: Saiy-PS   文件: RecognitionNuance.java
@Override
public void onInterpretation(final Transaction transaction, final Interpretation interpretation) {
    if (DEBUG) {
        MyLog.i(CLS_NAME, "onInterpretation");

        try {
            MyLog.d(CLS_NAME, interpretation.getResult().toString(2));
        } catch (final JSONException e) {
            e.printStackTrace();
        }
    }

    Recognition.setState(Recognition.State.IDLE);

    // We would expect the recognition results to be returned first
    // Check if the user has cancelled the request.
    if (!isCancelled) {
        if (servingRemote) {
            final Bundle results = new Bundle();
            results.putStringArrayList(Request.RESULTS_RECOGNITION, resultsArray);
            results.putFloatArray(Request.CONFIDENCE_SCORES, floatsArray);
            results.putString(Request.RESULTS_NLU, interpretation.getResult().toString());
            listener.onResults(results);
        } else {
            new ResolveNuance(mContext, sl, UtilsLocale.stringToLocale(vrLocale.getLocaleString()),
                    ttsLocale, floatsArray, resultsArray).unpack(interpretation.getResult());
        }
    } else {
        if (DEBUG) {
            MyLog.i(CLS_NAME, "onInterpretation: cancelled ignoring");
        }
    }
}
 
源代码18 项目: PercentageChartView   文件: PercentageChartView.java
@Override
protected Parcelable onSaveInstanceState() {
    Bundle bundle = new Bundle();
    bundle.putParcelable(STATE_SUPER_INSTANCE, super.onSaveInstanceState());

    bundle.putInt(STATE_MODE, mode);
    if (renderer instanceof OrientationBasedMode) {
        bundle.putInt(STATE_ORIENTATION, ((OrientationBasedMode) renderer).getOrientation());
    }
    bundle.putFloat(STATE_START_ANGLE, renderer.getStartAngle());
    bundle.putInt(STATE_DURATION, renderer.getAnimationDuration());

    bundle.putFloat(STATE_PROGRESS, renderer.getProgress());
    bundle.putInt(STATE_PG_COLOR, renderer.getProgressColor());

    bundle.putBoolean(STATE_DRAW_BG, renderer.isDrawBackgroundEnabled());
    bundle.putInt(STATE_BG_COLOR, renderer.getBackgroundColor());
    if (renderer instanceof OffsetEnabledMode) {
        bundle.putInt(STATE_BG_OFFSET, ((OffsetEnabledMode) renderer).getBackgroundOffset());
    }

    bundle.putInt(STATE_TXT_COLOR, renderer.getTextColor());
    bundle.putFloat(STATE_TXT_SIZE, renderer.getTextSize());
    bundle.putInt(STATE_TXT_SHA_COLOR, renderer.getTextShadowColor());
    bundle.putFloat(STATE_TXT_SHA_RADIUS, renderer.getTextShadowRadius());
    bundle.putFloat(STATE_TXT_SHA_DIST_X, renderer.getTextShadowDistX());
    bundle.putFloat(STATE_TXT_SHA_DIST_Y, renderer.getTextShadowDistY());

    if (renderer instanceof RingModeRenderer) {
        bundle.putFloat(STATE_PG_BAR_THICKNESS, ((RingModeRenderer) renderer).getProgressBarThickness());
        bundle.putInt(STATE_PG_BAR_STYLE, ((RingModeRenderer) renderer).getProgressBarStyle());
        bundle.putBoolean(STATE_DRAW_BG_BAR, ((RingModeRenderer) renderer).isDrawBackgroundBarEnabled());
        bundle.putInt(STATE_BG_BAR_COLOR, ((RingModeRenderer) renderer).getBackgroundBarColor());
        bundle.putFloat(STATE_BG_BAR_THICKNESS, ((RingModeRenderer) renderer).getBackgroundBarThickness());
    }

    if (renderer.getGradientType() != -1) {
        bundle.putInt(STATE_GRADIENT_TYPE, renderer.getGradientType());
        bundle.putFloat(STATE_GRADIENT_ANGLE, renderer.getGradientAngle());
        bundle.putIntArray(STATE_GRADIENT_COLORS, renderer.getGradientColors());
        bundle.putFloatArray(STATE_GRADIENT_POSITIONS, renderer.getGradientDistributions());
    }

    return bundle;
}
 
源代码19 项目: MRouter   文件: MainActivity.java
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;
}
 
源代码20 项目: lyra   文件: FloatArrayCoder.java
/**
 * Write a field's value into the saved state {@link Bundle}.
 *
 * @param state      {@link Bundle} used to save the state
 * @param key        key retrieved from {@code fieldDeclaringClass#fieldName}
 * @param fieldValue value of field
 */
@Override
public void serialize(@NonNull Bundle state, @NonNull String key, @NonNull float[] fieldValue) {
    state.putFloatArray(key, fieldValue);
}