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

The following examples show how to use android.os.Bundle#getFloatArray() . 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: styT   File: TouchImageView.java    License: Apache License 2.0 6 votes vote down vote up
@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
@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
Source Project: MoeQuest   File: PhotoImageView.java    License: Apache License 2.0 6 votes vote down vote up
@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 4
Source Project: SwipableLayout   File: TouchImageView.java    License: Apache License 2.0 6 votes vote down vote up
@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
@Override
    public void onResults(Bundle results) {
        if ((results != null)
                && results.containsKey(SpeechRecognizer.RESULTS_RECOGNITION)) {
            List<String> heard =
                    results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
            float[] scores =
                    results.getFloatArray(SpeechRecognizer.CONFIDENCE_SCORES);
            String msg = "";
            for (String s : heard) {
                Toast.makeText(_hgcontext.getApplicationContext(), "Executing: " + s, Toast.LENGTH_LONG).show();
                interpretInput(s);
//                msg += s;
                break;
            }
        }
    }
 
Example 6
Source Project: CodePolitan   File: TouchImageView.java    License: Apache License 2.0 6 votes vote down vote up
@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
Source Project: MultiView   File: TouchImageView.java    License: Apache License 2.0 6 votes vote down vote up
@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
Source Project: TiTouchImageView   File: TouchImageView.java    License: MIT License 6 votes vote down vote up
@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
Source Project: Chimee   File: TouchImageView.java    License: MIT License 6 votes vote down vote up
@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 10
Source Project: PhotoPicker   File: TouchImageView.java    License: Apache License 2.0 6 votes vote down vote up
@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
Source Project: meizhi   File: TouchImageView.java    License: Apache License 2.0 6 votes vote down vote up
@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
@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 13
@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 14
@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 15
@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 16
Source Project: GankMeizhi   File: TouchImageView.java    License: Apache License 2.0 6 votes vote down vote up
@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 17
/**
 * Takes and processes the results from a recognition action. It parses the confidence and
 * string values and stores the processed results here so they are made available to the
 * {@link AutocompleteController} and show up in the omnibox results. This method does not
 * reorder the voice results that come back from the recognizer.
 * @param extras The {@link Bundle} that contains the recognition results from a
 *               {@link RecognizerIntent#ACTION_RECOGNIZE_SPEECH} action.
 */
public void setVoiceResultsFromIntentBundle(Bundle extras) {
    clearVoiceSearchResults();

    if (extras == null) return;

    ArrayList<String> strings = extras.getStringArrayList(
            RecognizerIntent.EXTRA_RESULTS);
    float[] confidences = extras.getFloatArray(
            RecognizerIntent.EXTRA_CONFIDENCE_SCORES);

    if (strings == null || confidences == null) return;

    assert (strings.size() == confidences.length);
    if (strings.size() != confidences.length) return;

    for (int i = 0; i < strings.size(); ++i) {
        // Remove any spaces in the voice search match when determining whether it
        // appears to be a URL. This is to prevent cases like (
        // "tech crunch.com" and "www. engadget .com" from not appearing like URLs)
        // from not navigating to the URL.
        // If the string appears to be a URL, then use it instead of the string returned from
        // the voice engine.
        String culledString = strings.get(i).replaceAll(" ", "");
        String url = AutocompleteController.nativeQualifyPartialURLQuery(culledString);
        mResults.add(new VoiceResult(
                url == null ? strings.get(i) : culledString, confidences[i]));
    }
}
 
Example 18
@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 19
Source Project: px-android   File: ColorPicker.java    License: MIT License 5 votes vote down vote up
@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 20
/**
 * OpenAPIParser#parse(String) に testEnum.json を渡して解析を行う。
 * 
 * parameter の type と異なる enum の宣言が存在する testEnum.json をよみこむ。
 * <pre>
 * 【期待する動作】
 * ・Swagger オブジェクトが取得できること。
 * ・parameter の enum が取得できること。
 * </pre>
 */
@Test
public void testEnum() throws JSONException {
    DevicePluginContext pluginContext = Mockito.mock(DevicePluginContext.class);

    String jsonString = FileLoader.readString("parser/testEnum.json");

    DConnectServiceSpec spec = new DConnectServiceSpec(pluginContext);
    spec.addProfileSpec("testEnum", jsonString);

    Bundle swagger = spec.findProfileSpec("testEnum").toBundle();
    assertThat(swagger, is(notNullValue()));

    Bundle paths = swagger.getBundle("paths");
    assertThat(paths, is(notNullValue()));
    assertThat(paths.size(), is(1));

    Bundle a0 = paths.getBundle("/a0");
    assertThat(a0, is(notNullValue()));

    Bundle a0Get = a0.getBundle("get");
    assertThat(a0Get, is(notNullValue()));

    Parcelable[] parameters = a0Get.getParcelableArray("parameters");
    assertThat(parameters, is(notNullValue()));
    assertThat(parameters.length, is(7));

    Bundle stringInt = (Bundle) parameters[1];
    assertThat(stringInt.getString("type"), is("string"));
    String[] stringIntEnum = stringInt.getStringArray("enum");
    assertThat(stringIntEnum, is(notNullValue()));
    assertThat(stringIntEnum[0], is("1"));
    assertThat(stringIntEnum[1], is("2"));
    assertThat(stringIntEnum[2], is("3"));
    assertThat(stringIntEnum[3], is("4"));

    Bundle stringNumber = (Bundle) parameters[2];
    assertThat(stringNumber.getString("type"), is("string"));
    String[] stringNumberEnum = stringNumber.getStringArray("enum");
    assertThat(stringNumberEnum, is(notNullValue()));
    assertThat(stringNumberEnum[0], is("1.1"));
    assertThat(stringNumberEnum[1], is("2.2"));
    assertThat(stringNumberEnum[2], is("3.3"));
    assertThat(stringNumberEnum[3], is("4.4"));

    Bundle intString = (Bundle) parameters[3];
    assertThat(intString.getString("type"), is("integer"));
    assertThat(intString.getString("format"), is("int32"));
    int[] intStringEnum = intString.getIntArray("enum");
    assertThat(intStringEnum, is(notNullValue()));
    assertThat(intStringEnum[0], is(1));
    assertThat(intStringEnum[1], is(2));
    assertThat(intStringEnum[2], is(3));
    assertThat(intStringEnum[3], is(4));

    Bundle longString = (Bundle) parameters[4];
    assertThat(longString.getString("type"), is("integer"));
    assertThat(longString.getString("format"), is("int64"));
    long[] longStringEnum = longString.getLongArray("enum");
    assertThat(longStringEnum, is(notNullValue()));
    assertThat(longStringEnum[0], is(1L));
    assertThat(longStringEnum[1], is(2L));
    assertThat(longStringEnum[2], is(3L));
    assertThat(longStringEnum[3], is(4L));

    Bundle floatString = (Bundle) parameters[5];
    assertThat(floatString.getString("type"), is("number"));
    assertThat(floatString.getString("format"), is("float"));
    float[] floatStringEnum = floatString.getFloatArray("enum");
    assertThat(floatStringEnum, is(notNullValue()));
    assertThat(floatStringEnum[0], is(1.1F));
    assertThat(floatStringEnum[1], is(2.2F));
    assertThat(floatStringEnum[2], is(3.3F));
    assertThat(floatStringEnum[3], is(4.4F));

    Bundle doubleString = (Bundle) parameters[6];
    assertThat(doubleString.getString("type"), is("number"));
    assertThat(doubleString.getString("format"), is("double"));
    double[] doubleStringEnum = doubleString.getDoubleArray("enum");
    assertThat(doubleStringEnum, is(notNullValue()));
    assertThat(doubleStringEnum[0], is(1.1D));
    assertThat(doubleStringEnum[1], is(2.2D));
    assertThat(doubleStringEnum[2], is(3.3D));
    assertThat(doubleStringEnum[3], is(4.4D));
}