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

The following are Jave code examples for showing how to use getFloatArray() 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: yphoto   File: TouchImageView.java   View Source Code Vote up 7 votes
@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");
        super.onRestoreInstanceState(bundle.getParcelable("instanceState"));
        return;
    }

    super.onRestoreInstanceState(state);
}
 
Example 2
Project: AndroidBackendlessChat   File: TouchImageView.java   View Source Code Vote up 7 votes
@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");
     super.onRestoreInstanceState(bundle.getParcelable("instanceState"));
     return;
  	}

  	super.onRestoreInstanceState(state);
}
 
Example 3
Project: ImageMagnifier   File: TouchImageView.java   View Source Code Vote up 7 votes
public void onRestoreInstanceState(Parcelable state) {
    if (state instanceof Bundle) {
        Bundle bundle = (Bundle) state;
        this.normalizedScale = bundle.getFloat("saveScale");
        this.values = bundle.getFloatArray("matrix");
        this.prevMatrix.setValues(this.values);
        this.prevMatchViewHeight = bundle.getFloat("matchViewHeight");
        this.prevMatchViewWidth = bundle.getFloat("matchViewWidth");
        this.prevViewHeight = bundle.getInt("viewHeight");
        this.prevViewWidth = bundle.getInt("viewWidth");
        this.imageRenderedAtLeastOnce = bundle.getBoolean("imageRendered");
        super.onRestoreInstanceState(bundle.getParcelable("instanceState"));
        return;
    }
    super.onRestoreInstanceState(state);
}
 
Example 4
Project: chat-sdk-android-push-firebase   File: TouchImageView.java   View Source Code Vote up 7 votes
@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");
     super.onRestoreInstanceState(bundle.getParcelable("instanceState"));
     return;
  	}

  	super.onRestoreInstanceState(state);
}
 
Example 5
Project: Programmers   File: TouchImageView.java   View Source Code Vote up 7 votes
@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");
        super.onRestoreInstanceState(bundle.getParcelable("instanceState"));
        return;
    }

    super.onRestoreInstanceState(state);
}
 
Example 6
Project: PhotoPicker-master   File: TouchImageView.java   View Source Code Vote up 7 votes
@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");
    super.onRestoreInstanceState(bundle.getParcelable("instanceState"));
    return;
  }

  super.onRestoreInstanceState(state);
}
 
Example 7
Project: Monolith   File: TouchImageView.java   View Source Code Vote up 7 votes
@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");
        super.onRestoreInstanceState(bundle.getParcelable("instanceState"));
        return;
    }

    super.onRestoreInstanceState(state);
}
 
Example 8
Project: social-app-android   File: TouchImageView.java   View Source Code Vote up 7 votes
@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");
        super.onRestoreInstanceState(bundle.getParcelable("instanceState"));
        return;
    }

    super.onRestoreInstanceState(state);
}
 
Example 9
Project: boohee_v5.6   File: TouchImageView.java   View Source Code Vote up 7 votes
public void onRestoreInstanceState(Parcelable state) {
    if (state instanceof Bundle) {
        Bundle bundle = (Bundle) state;
        this.normalizedScale = bundle.getFloat("saveScale");
        this.m = bundle.getFloatArray("matrix");
        this.prevMatrix.setValues(this.m);
        this.prevMatchViewHeight = bundle.getFloat("matchViewHeight");
        this.prevMatchViewWidth = bundle.getFloat("matchViewWidth");
        this.prevViewHeight = bundle.getInt("viewHeight");
        this.prevViewWidth = bundle.getInt("viewWidth");
        this.imageRenderedAtLeastOnce = bundle.getBoolean("imageRendered");
        super.onRestoreInstanceState(bundle.getParcelable("instanceState"));
        return;
    }
    super.onRestoreInstanceState(state);
}
 
Example 10
Project: Sega   File: TouchImageView.java   View Source Code Vote up 7 votes
@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");
        super.onRestoreInstanceState(bundle.getParcelable("instanceState"));
        return;
    }

    super.onRestoreInstanceState(state);
}
 
Example 11
Project: Android_ImagePicker   File: TouchImageView.java   View Source Code Vote up 7 votes
@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");
        super.onRestoreInstanceState(bundle.getParcelable("instanceState"));
        return;
    }

    super.onRestoreInstanceState(state);
}
 
Example 12
Project: ThunderMusic   File: ColorPicker.java   View Source Code Vote up 6 votes
@Override
protected void onRestoreInstanceState(Parcelable state) {
    if (state instanceof Bundle) {
        Bundle bundle = (Bundle) state;
        colorHSV = bundle.getFloatArray("color");
        super.onRestoreInstanceState(bundle.getParcelable("super"));
    } else {
        super.onRestoreInstanceState(state);
    }
}
 
Example 13
Project: airgram   File: ColorPicker.java   View Source Code Vote up 6 votes
@Override
protected void onRestoreInstanceState(Parcelable state) {
    if (state instanceof Bundle) {
        Bundle bundle = (Bundle) state;
        colorHSV = bundle.getFloatArray("color");
        super.onRestoreInstanceState(bundle.getParcelable("super"));
    } else {
        super.onRestoreInstanceState(state);
    }
}
 
Example 14
Project: airgram   File: MultiColorPicker.java   View Source Code Vote up 6 votes
@Override
protected void onRestoreInstanceState(Parcelable state) {
    if (state instanceof Bundle) {
        Bundle bundle = (Bundle) state;
        colorHSV = bundle.getFloatArray("color");
        updateAdjacentHue();
        super.onRestoreInstanceState(bundle.getParcelable("super"));
    } else {
        super.onRestoreInstanceState(state);
    }
}
 
Example 15
Project: auto-value-bundle   File: AutoValue_TestClassBundled.java   View Source Code Vote up 6 votes
public static TestClassBundled unbundle(Bundle bundle, Gson gson) {
    return new AutoValue_TestClassBundled(
            bundle,
            bundle.getByte("some_byte"),
            bundle.getBoolean("some_boolean"),
            bundle.getShort("some_short"),
            bundle.getInt("some_int"),
            bundle.getLong("some_long"),
            bundle.getChar("some_char"),
            bundle.getFloat("some_float"),
            bundle.getDouble("some_double"),
            bundle.getString("some_string"),
            bundle.getCharSequence("some_char_sequence"),
            bundle.getParcelable("some_parcelable"),
            bundle.getParcelableArrayList("some_parcelable_array_list"),
            bundle.getSparseParcelableArray("some_parcelable_sparse_array"),
            bundle.getSerializable("some_serializable"),
            bundle.getIntegerArrayList("some_integer_array_list"),
            bundle.getStringArrayList("some_string_array_list"),
            bundle.getCharSequenceArrayList("some_char_sequence_array_list"),
            bundle.getByteArray("some_byte_array"),
            bundle.getShortArray("some_short_array"),
            bundle.getCharArray("some_char_array"),
            bundle.getFloatArray("some_float_array"),
            gson.fromJson(bundle.getString("some_unknown_object"), new com.google.common.reflect.TypeToken<UnknownObject>(){}.getType()),
            gson.fromJson(bundle.getString("some_unknown_object_list"), new com.google.common.reflect.TypeToken<ArrayList<UnknownObject>>(){}.getType()),
            gson.fromJson(bundle.getString("test_enum"), new com.google.common.reflect.TypeToken<TestEnum>(){}.getType()));
}
 
Example 16
Project: planetcon   File: ColorPicker.java   View Source Code Vote up 6 votes
@Override
protected void onRestoreInstanceState(Parcelable state) {
    if (state instanceof Bundle) {
        Bundle bundle = (Bundle) state;
        mColorHSV = bundle.getFloatArray("color");
        mColorInitial = bundle.getInt("previous");
        super.onRestoreInstanceState(bundle.getParcelable("super"));
    } else {
        super.onRestoreInstanceState(state);
    }
}
 
Example 17
Project: Saiy-PS   File: SelfAwareConditions.java   View Source Code Vote up 6 votes
/**
 * Add the recognition results to the existing {@link Bundle}
 *
 * @param results recognition results {@link Bundle}
 */
public void putResults(@NonNull final Bundle results) {
    if (DEBUG) {
        MyLog.i(CLS_NAME, "putResults");
    }

    final ArrayList<String> heardVoice = results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
    final float[] confidence = results.getFloatArray(SpeechRecognizer.CONFIDENCE_SCORES);

    if (heardVoice != null) {
        getBundle().putStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION, heardVoice);
    } else {
        if (DEBUG) {
            MyLog.i(CLS_NAME, "putResults: speech empty");
        }
        getBundle().putStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION, new ArrayList<String>());
    }

    if (confidence != null) {
        getBundle().putFloatArray(SpeechRecognizer.CONFIDENCE_SCORES, confidence);
    } else {
        if (DEBUG) {
            MyLog.i(CLS_NAME, "putResults: confidence empty");
        }
        getBundle().putFloatArray(SpeechRecognizer.CONFIDENCE_SCORES, new float[0]);
    }
}
 
Example 18
Project: GitHub   File: Injector.java   View Source Code Vote up 5 votes
public float[] getFloatArray(Bundle state, String key) {
    return state.getFloatArray(key + baseKey);
}
 
Example 19
Project: Saiy-PS   File: SelfAwareVerbose.java   View Source Code Vote up 5 votes
/**
 * Iterate through the recognition results and their associated confidence scores.
 *
 * @param bundle of recognition data
 */
public static void logSpeechResults(final Bundle bundle) {
    MyLog.i(CLS_NAME, "logSpeechResults");

    examineBundle(bundle);

    final ArrayList<String> heardVoice = bundle.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
    final ArrayList<String> unstable = bundle.getStringArrayList(RecognitionNative.UNSTABLE_RESULTS);
    final float[] confidence = bundle.getFloatArray(SpeechRecognizer.CONFIDENCE_SCORES);

    if (heardVoice != null) {
        MyLog.d(CLS_NAME, "heardVoice: " + heardVoice.size());
    }
    if (unstable != null) {
        MyLog.d(CLS_NAME, "unstable: " + unstable.size());
    }
    if (confidence != null) {
        MyLog.d(CLS_NAME, "confidence: " + confidence.length);
    }

    /* handles empty string bug */
    if (UtilsList.notNaked(heardVoice)) {
        heardVoice.removeAll(Collections.singleton(""));
    }

    /* handles empty string bug */
    if (UtilsList.notNaked(unstable)) {
        unstable.removeAll(Collections.singleton(""));
    }

    if (UtilsList.notNaked(confidence) && UtilsList.notNaked(heardVoice) && confidence.length == heardVoice.size()) {
        for (int i = 0; i < heardVoice.size(); i++) {
            MyLog.i(CLS_NAME, "Results: " + heardVoice.get(i) + " ~ " + confidence[i]);
        }
    } else if (UtilsList.notNaked(heardVoice)) {
        for (int i = 0; i < heardVoice.size(); i++) {
            MyLog.i(CLS_NAME, "Results: " + heardVoice.get(i));
        }
    } else if (UtilsList.notNaked(unstable)) {
        for (int i = 0; i < unstable.size(); i++) {
            MyLog.i(CLS_NAME, "Unstable: " + unstable.get(i));
        }
    } else {
        MyLog.w(CLS_NAME, "Results: values error");
    }
}
 
Example 20
Project: API-Example-App   File: FragmentDemoCommand.java   View Source Code Vote up 5 votes
/**
 * This example method is exposed to simulate a callback from your Intent Service, once a keyphrase
 * has been detected.
 *
 * @param bundle containing associated keyphrase extras
 */
public void onExampleCallback(final Bundle bundle) {

    if (getActivity() != null && tvResults != null && bundle != null && !bundle.isEmpty()) {

        appendText(null);

        final ArrayList<String> voiceData = bundle.getStringArrayList(Request.RESULTS_RECOGNITION);
        final float[] confidenceScore = bundle.getFloatArray(Request.CONFIDENCE_SCORES);

        if (confidenceScore != null && voiceData != null && confidenceScore.length == voiceData.size()) {
            for (int i = 0; i < voiceData.size(); i++) {
                Log.i(CLS_NAME, "onSpeechResults: " + voiceData.get(i) + " ~ " + confidenceScore[i]);
                appendText(voiceData.get(i) + " ~ " + confidenceScore[i]);
            }
        } else if (voiceData != null) {
            for (int i = 0; i < voiceData.size(); i++) {
                Log.i(CLS_NAME, "onSpeechResults: " + voiceData.get(i));
                appendText(voiceData.get(i));
            }
        } else {
            Log.w(CLS_NAME, "onSpeechResults: values error");
            appendText("onSpeechResults: values error");
        }

        appendText("\n");

        bundle.remove(Request.RESULTS_RECOGNITION);
        bundle.remove(Request.CONFIDENCE_SCORES);

        final Set<String> keys = bundle.keySet();
        for (final String key : keys) {
            appendText(key + ": " + bundle.get(key));
        }

        if (voiceData != null && !voiceData.isEmpty()) {

            switch (bundle.getInt(SaiyKeyphrase.SAIY_ACTION, 0)) {

                case DO_SOMETHING_1:
                    Log.i(CLS_NAME, "onHandleIntent: DO_SOMETHING_1");
                    appendText("Heard: " + SAUSAGES + "!");
                    break;
                case DO_SOMETHING_2:
                    Log.i(CLS_NAME, "onHandleIntent: DO_SOMETHING_2");
                    appendText("\nStart the playlist: " + voiceData.get(0).toLowerCase(Locale.US)
                            .replaceFirst(SPOTIFY_PLAYLIST, "") + "!");
                    break;
                case DO_SOMETHING_3:
                    Log.i(CLS_NAME, "onHandleIntent: DO_SOMETHING_3");
                    appendText("\nStart the album: " + voiceData.get(0).toLowerCase(Locale.US)
                            .replaceFirst(SPOTIFY_ALBUM, "") + "!");
                    break;
                case DO_NOT_USE_ZERO:
                    Log.e(CLS_NAME, "onHandleIntent: DO_NOT_USE_ZERO");
                    break;
            }
        } else {
            Log.e(CLS_NAME, "onHandleIntent: voice data empty - should not happen");
        }
    }
}