diff options
Diffstat (limited to 'samples/ApiDemos/src')
5 files changed, 14 insertions, 26 deletions
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/VoiceRecognition.java b/samples/ApiDemos/src/com/example/android/apis/app/VoiceRecognition.java index a784e1587..1a4b5e4a0 100644 --- a/samples/ApiDemos/src/com/example/android/apis/app/VoiceRecognition.java +++ b/samples/ApiDemos/src/com/example/android/apis/app/VoiceRecognition.java @@ -16,17 +16,18 @@ package com.example.android.apis.app; +import com.example.android.apis.R; + import android.app.Activity; import android.content.Intent; import android.os.Bundle; +import android.speech.RecognizerIntent; import android.view.View; import android.view.View.OnClickListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListView; -import com.example.android.apis.R; - import java.util.ArrayList; /** @@ -71,9 +72,10 @@ public class VoiceRecognition extends Activity implements OnClickListener { */ private void startVoiceRecognitionActivity() { //TODO Get these values from constants - Intent intent = new Intent("android.speech.action.RECOGNIZE_SPEECH"); - intent.putExtra("language_model", "free_form"); - intent.putExtra("prompt", "Speech recognition demo"); + Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); + intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, + RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); + intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Speech recognition demo"); startActivityForResult(intent, VOICE_RECOGNITION_REQUEST_CODE); } @@ -83,8 +85,8 @@ public class VoiceRecognition extends Activity implements OnClickListener { @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == VOICE_RECOGNITION_REQUEST_CODE && resultCode == RESULT_OK) { - //TODO get the value from a constant - ArrayList<String>matches = data.getStringArrayListExtra("results"); + ArrayList<String> matches = data.getStringArrayListExtra( + RecognizerIntent.EXTRA_RESULTS); mList.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, matches)); } diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/TranslucentGLSurfaceViewActivity.java b/samples/ApiDemos/src/com/example/android/apis/graphics/TranslucentGLSurfaceViewActivity.java index 750a47ba7..a0bad4bc9 100644 --- a/samples/ApiDemos/src/com/example/android/apis/graphics/TranslucentGLSurfaceViewActivity.java +++ b/samples/ApiDemos/src/com/example/android/apis/graphics/TranslucentGLSurfaceViewActivity.java @@ -34,6 +34,10 @@ public class TranslucentGLSurfaceViewActivity extends Activity { // Create our Preview view and set it as the content of our // Activity mGLSurfaceView = new GLSurfaceView(this); + // We want an 8888 pixel format because that's required for + // a translucent window. + // And we want a depth buffer. + mGLSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 0); // Tell the cube renderer that we want to render a translucent version // of the cube: mGLSurfaceView.setRenderer(new CubeRenderer(true)); diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/TriangleActivity.java b/samples/ApiDemos/src/com/example/android/apis/graphics/TriangleActivity.java index 59f3c6cf8..e5b06f426 100644 --- a/samples/ApiDemos/src/com/example/android/apis/graphics/TriangleActivity.java +++ b/samples/ApiDemos/src/com/example/android/apis/graphics/TriangleActivity.java @@ -26,6 +26,7 @@ public class TriangleActivity extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mGLView = new GLSurfaceView(this); + mGLView.setEGLConfigChooser(false); mGLView.setRenderer(new TriangleRenderer(this)); setContentView(mGLView); } diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/TriangleRenderer.java b/samples/ApiDemos/src/com/example/android/apis/graphics/TriangleRenderer.java index 451b927a9..e5299b332 100644 --- a/samples/ApiDemos/src/com/example/android/apis/graphics/TriangleRenderer.java +++ b/samples/ApiDemos/src/com/example/android/apis/graphics/TriangleRenderer.java @@ -44,16 +44,6 @@ public class TriangleRenderer implements GLSurfaceView.Renderer{ mTriangle = new Triangle(); } - public int[] getConfigSpec() { - // We don't need a depth buffer, and don't care about our - // color depth. - int[] configSpec = { - EGL10.EGL_DEPTH_SIZE, 0, - EGL10.EGL_NONE - }; - return configSpec; - } - public void onSurfaceCreated(GL10 gl, EGLConfig config) { /* * By default, OpenGL enables features that improve quality diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/kube/KubeRenderer.java b/samples/ApiDemos/src/com/example/android/apis/graphics/kube/KubeRenderer.java index 252f566f9..9977041a2 100644 --- a/samples/ApiDemos/src/com/example/android/apis/graphics/kube/KubeRenderer.java +++ b/samples/ApiDemos/src/com/example/android/apis/graphics/kube/KubeRenderer.java @@ -74,15 +74,6 @@ class KubeRenderer implements GLSurfaceView.Renderer { mWorld.draw(gl); } - public int[] getConfigSpec() { - // Need a depth buffer, don't care about color depth. - int[] configSpec = { - EGL10.EGL_DEPTH_SIZE, 16, - EGL10.EGL_NONE - }; - return configSpec; - } - public void onSurfaceChanged(GL10 gl, int width, int height) { gl.glViewport(0, 0, width, height); |
