Java Code Examples for android.os.Bundle#putFloatArray()
The following examples show how to use
android.os.Bundle#putFloatArray() .
These examples are extracted from open source projects.
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 Project: PhotoEdit File: SVBar.java License: 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 2
Source Project: memoir File: SVBar.java License: 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]); } state.putBoolean(STATE_ORIENTATION, ORIENTATION_HORIZONTAL); return state; }
Example 3
Source Project: Saiy-PS File: SaiyAccessibilityService.java License: GNU Affero General Public License v3.0 | 6 votes |
/** * 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); } }); }
Example 4
Source Project: TiTouchImageView File: TouchImageView.java License: 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 5
Source Project: android_9.0.0_r45 File: ActivityTransitionCoordinator.java License: Apache License 2.0 | 5 votes |
/** * 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); }
Example 6
Source Project: SwipableLayout File: TouchImageView.java License: Apache License 2.0 | 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 7
Source Project: android-grid-wichterle File: SaturationBar.java License: Apache License 2.0 | 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 8
Source Project: HoloColorPicker File: ValueBar.java License: Apache License 2.0 | 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_VALUE, hsvColor[2]); return state; }
Example 9
Source Project: MoeQuest File: PhotoImageView.java License: Apache License 2.0 | 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 10
Source Project: px-android File: ColorPicker.java License: MIT License | 5 votes |
@Override protected Parcelable onSaveInstanceState() { Bundle state = new Bundle(); state.putFloatArray("color", colorHSV); state.putParcelable("super", super.onSaveInstanceState()); return state; }
Example 11
Source Project: Document-Scanner File: TouchImageView.java License: GNU General Public License v3.0 | 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 12
Source Project: cordova-plugin-video-picture-preview-picker-V2 File: TouchImageView.java License: 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 13
Source Project: MultiView File: TouchImageView.java License: Apache License 2.0 | 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 Project: FacebookImageShareIntent File: SharedPreferencesTokenCacheTests.java License: MIT License | 5 votes |
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); }
Example 15
Source Project: android-grid-wichterle File: ValueBar.java License: Apache License 2.0 | 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_VALUE, hsvColor[2]); return state; }
Example 16
Source Project: ploggy File: TouchImageView.java License: GNU General Public License v3.0 | 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); return bundle; }
Example 17
Source Project: Saiy-PS File: RecognitionNuance.java License: GNU Affero General Public License v3.0 | 5 votes |
@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"); } } }
Example 18
Source Project: PercentageChartView File: PercentageChartView.java License: Apache License 2.0 | 4 votes |
@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; }
Example 19
Source Project: MRouter File: MainActivity.java License: Apache License 2.0 | 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
Source Project: lyra File: FloatArrayCoder.java License: Apache License 2.0 | 2 votes |
/** * 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); }