diff options
Diffstat (limited to 'tests')
26 files changed, 495 insertions, 64 deletions
diff --git a/tests/BiDiTests/res/layout/textview_drawables_ltr.xml b/tests/BiDiTests/res/layout/textview_drawables_ltr.xml new file mode 100644 index 0000000..88b13b7 --- /dev/null +++ b/tests/BiDiTests/res/layout/textview_drawables_ltr.xml @@ -0,0 +1,104 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2011 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/textview_drawables_ltr" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:layoutDirection="ltr"> + + <LinearLayout android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <TextView android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:textSize="24dip" + android:text="@string/textview_text" + android:drawableLeft="@drawable/start" + android:drawableRight="@drawable/end" + android:drawablePadding="3dip" + /> + + <TextView android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:textSize="24dip" + android:text="@string/textview_text" + android:drawableStart="@drawable/start" + android:drawableEnd="@drawable/end" + android:drawablePadding="3dip" + /> + + <TextView android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:textSize="24dip" + android:text="@string/textview_text" + android:drawableLeft="@drawable/end" + android:drawableStart="@drawable/start" + android:drawableEnd="@drawable/end" + android:drawablePadding="3dip" + /> + + <TextView android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:textSize="24dip" + android:text="@string/textview_text" + android:drawableRight="@drawable/start" + android:drawableStart="@drawable/start" + android:drawableEnd="@drawable/end" + android:drawablePadding="3dip" + /> + + <TextView android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:textSize="24dip" + android:text="@string/textview_text" + android:drawableLeft="@drawable/end" + android:drawableRight="@drawable/start" + android:drawableStart="@drawable/start" + android:drawableEnd="@drawable/end" + android:drawablePadding="3dip" + /> + + <TextView android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:textSize="24dip" + android:text="@string/textview_text" + android:drawableRight="@drawable/end" + android:drawableStart="@drawable/start" + android:drawablePadding="3dip" + /> + + <TextView android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:textSize="24dip" + android:text="@string/textview_text" + android:drawableLeft="@drawable/start" + android:drawableEnd="@drawable/end" + android:drawablePadding="3dip" + /> + + <TextView android:id="@+id/textview_error" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:textSize="24dip" + android:text="@string/textview_text" + android:drawablePadding="3dip" + /> + + </LinearLayout> + +</FrameLayout> diff --git a/tests/BiDiTests/res/layout/textview_drawables_rtl.xml b/tests/BiDiTests/res/layout/textview_drawables_rtl.xml new file mode 100644 index 0000000..7f47d5d --- /dev/null +++ b/tests/BiDiTests/res/layout/textview_drawables_rtl.xml @@ -0,0 +1,104 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2011 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/textview_drawables_rtl" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:layoutDirection="rtl"> + + <LinearLayout android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <TextView android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:textSize="24dip" + android:text="@string/textview_text" + android:drawableLeft="@drawable/end" + android:drawableRight="@drawable/start" + android:drawablePadding="3dip" + /> + + <TextView android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:textSize="24dip" + android:text="@string/textview_text" + android:drawableStart="@drawable/start" + android:drawableEnd="@drawable/end" + android:drawablePadding="3dip" + /> + + <TextView android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:textSize="24dip" + android:text="@string/textview_text" + android:drawableLeft="@drawable/start" + android:drawableStart="@drawable/start" + android:drawableEnd="@drawable/end" + android:drawablePadding="3dip" + /> + + <TextView android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:textSize="24dip" + android:text="@string/textview_text" + android:drawableRight="@drawable/end" + android:drawableStart="@drawable/start" + android:drawableEnd="@drawable/end" + android:drawablePadding="3dip" + /> + + <TextView android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:textSize="24dip" + android:text="@string/textview_text" + android:drawableLeft="@drawable/start" + android:drawableRight="@drawable/end" + android:drawableStart="@drawable/start" + android:drawableEnd="@drawable/end" + android:drawablePadding="3dip" + /> + + <TextView android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:textSize="24dip" + android:text="@string/textview_text" + android:drawableLeft="@drawable/end" + android:drawableStart="@drawable/start" + android:drawablePadding="3dip" + /> + + <TextView android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:textSize="24dip" + android:text="@string/textview_text" + android:drawableRight="@drawable/start" + android:drawableEnd="@drawable/end" + android:drawablePadding="3dip" + /> + + <TextView android:id="@+id/textview_error" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:textSize="24dip" + android:text="@string/textview_text" + android:drawablePadding="3dip" + /> + + </LinearLayout> + +</FrameLayout> diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java index c033879..7002c41 100644 --- a/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java +++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java @@ -134,6 +134,9 @@ public class BiDiTestActivity extends Activity { addItem(result, "TextDirection LTR", BiDiTestTextViewDirectionLtr.class, R.id.textview_direction_ltr); addItem(result, "TextDirection RTL", BiDiTestTextViewDirectionRtl.class, R.id.textview_direction_rtl); + addItem(result, "TextView Drawables LTR", BiDiTestTextViewDrawablesLtr.class, R.id.textview_drawables_ltr); + addItem(result, "TextView Drawables RTL", BiDiTestTextViewDrawablesRtl.class, R.id.textview_drawables_rtl); + return result; } diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestTextViewDrawablesLtr.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestTextViewDrawablesLtr.java new file mode 100644 index 0000000..a65d92d --- /dev/null +++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestTextViewDrawablesLtr.java @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.bidi; + +import android.app.Fragment; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +public class BiDiTestTextViewDrawablesLtr extends Fragment { + + private View currentView; + private TextView textViewError; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + currentView = inflater.inflate(R.layout.textview_drawables_ltr, container, false); + return currentView; + } + + @Override + public void onViewCreated(View view, Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + + textViewError = (TextView) currentView.findViewById(R.id.textview_error); + textViewError.setError("Error!!"); + } +} diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestTextViewDrawablesRtl.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestTextViewDrawablesRtl.java new file mode 100644 index 0000000..7b7e812 --- /dev/null +++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestTextViewDrawablesRtl.java @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.bidi; + +import android.app.Fragment; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +public class BiDiTestTextViewDrawablesRtl extends Fragment { + + private View currentView; + private TextView textViewError; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + currentView = inflater.inflate(R.layout.textview_drawables_rtl, container, false); + return currentView; + } + + @Override + public void onViewCreated(View view, Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + + textViewError = (TextView) currentView.findViewById(R.id.textview_error); + textViewError.setError("Error!!"); + } +} diff --git a/tests/GridLayoutTest/src/com/android/test/layout/Activity2.java b/tests/GridLayoutTest/src/com/android/test/layout/Activity2.java index b9bf526..af5006f 100644 --- a/tests/GridLayoutTest/src/com/android/test/layout/Activity2.java +++ b/tests/GridLayoutTest/src/com/android/test/layout/Activity2.java @@ -38,20 +38,20 @@ public class Activity2 extends Activity { vg.setUseDefaultMargins(true); vg.setAlignmentMode(ALIGN_BOUNDS); - Group row1 = new Group(1, CENTER); - Group row2 = new Group(2, CENTER); - Group row3 = new Group(3, BASELINE); - Group row4 = new Group(4, BASELINE); - Group row5 = new Group(5, FILL); - Group row6 = new Group(6, CENTER); - Group row7 = new Group(7, CENTER); + Spec row1 = spec(0, CENTER); + Spec row2 = spec(1, CENTER); + Spec row3 = spec(2, BASELINE); + Spec row4 = spec(3, BASELINE); + Spec row5 = spec(4, FILL, CAN_STRETCH); + Spec row6 = spec(5, CENTER); + Spec row7 = spec(6, CENTER); - Group col1a = new Group(1, 4, CENTER); - Group col1b = new Group(1, 4, LEFT); - Group col1c = new Group(1, RIGHT); - Group col2 = new Group(2, LEFT); - Group col3 = new Group(3, FILL); - Group col4 = new Group(4, FILL); + Spec col1a = spec(0, 4, CENTER); + Spec col1b = spec(0, 4, LEFT); + Spec col1c = spec(0, RIGHT); + Spec col2 = spec(1, LEFT); + Spec col3 = spec(2, FILL, CAN_STRETCH); + Spec col4 = spec(3, FILL); { TextView v = new TextView(context); @@ -96,10 +96,7 @@ public class Activity2 extends Activity { { Space v = new Space(context); { - LayoutParams lp = new LayoutParams(row5, col3); - lp.columnGroup.flexibility = CAN_STRETCH; - lp.rowGroup.flexibility = CAN_STRETCH; - vg.addView(v, lp); + vg.addView(v, new LayoutParams(row5, col3)); } } { diff --git a/tests/GridLayoutTest/src/com/android/test/layout/AlignmentTest.java b/tests/GridLayoutTest/src/com/android/test/layout/AlignmentTest.java index 505c83d..b1c4486 100755 --- a/tests/GridLayoutTest/src/com/android/test/layout/AlignmentTest.java +++ b/tests/GridLayoutTest/src/com/android/test/layout/AlignmentTest.java @@ -21,7 +21,6 @@ import android.content.Context; import android.os.Bundle; import android.view.View; import android.view.ViewGroup; -import android.view.ViewParent; import android.widget.Button; import android.widget.EditText; import android.widget.GridLayout; @@ -84,9 +83,7 @@ public class AlignmentTest extends Activity { Alignment va = VERTICAL_ALIGNMENTS[i]; for (int j = 0; j < HORIZONTAL_ALIGNMENTS.length; j++) { Alignment ha = HORIZONTAL_ALIGNMENTS[j]; - Group rowGroup = new Group(i, va); - Group colGroup = new Group(j, ha); - LayoutParams layoutParams = new LayoutParams(rowGroup, colGroup); + LayoutParams layoutParams = new LayoutParams(spec(i, va), spec(j, ha)); String name = VERTICAL_NAMES[i] + "-" + HORIZONTAL_NAMES[j]; ViewFactory factory = FACTORIES[(i + j) % FACTORIES.length]; container.addView(factory.create(name, 20), layoutParams); diff --git a/tests/GridLayoutTest/src/com/android/test/layout/GridLayoutTest.java b/tests/GridLayoutTest/src/com/android/test/layout/GridLayoutTest.java index c5681e2..4ce449a 100644 --- a/tests/GridLayoutTest/src/com/android/test/layout/GridLayoutTest.java +++ b/tests/GridLayoutTest/src/com/android/test/layout/GridLayoutTest.java @@ -33,9 +33,9 @@ public class GridLayoutTest extends AbstractLayoutTest { int va = VERTICAL_ALIGNMENTS[i]; for (int j = 0; j < HORIZONTAL_ALIGNMENTS.length; j++) { int ha = HORIZONTAL_ALIGNMENTS[j]; - GridLayout.Group rowGroup = new GridLayout.Group(UNDEFINED, null); - GridLayout.Group colGroup = new GridLayout.Group(UNDEFINED, null); - GridLayout.LayoutParams lp = new GridLayout.LayoutParams(rowGroup, colGroup); + Spec rowSpec = spec(UNDEFINED, null); + Spec colSpec = spec(UNDEFINED, null); + GridLayout.LayoutParams lp = new GridLayout.LayoutParams(rowSpec, colSpec); //GridLayout.LayoutParams lp = new GridLayout.LayoutParams(); lp.setGravity(va | ha); View v = create(context, VERTICAL_NAMES[i] + "-" + HORIZONTAL_NAMES[j], 20); diff --git a/tests/HwAccelerationTest/AndroidManifest.xml b/tests/HwAccelerationTest/AndroidManifest.xml index cb8084d..32a6a65 100644 --- a/tests/HwAccelerationTest/AndroidManifest.xml +++ b/tests/HwAccelerationTest/AndroidManifest.xml @@ -382,6 +382,15 @@ <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> + + <activity + android:name="MoreNinePatchesActivity" + android:label="_9patch2"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> <activity android:name="QuickRejectActivity" diff --git a/tests/HwAccelerationTest/res/drawable-nodpi/progress_vertical_bg_holo_dark.9.png b/tests/HwAccelerationTest/res/drawable-nodpi/progress_vertical_bg_holo_dark.9.png Binary files differnew file mode 100644 index 0000000..089704e --- /dev/null +++ b/tests/HwAccelerationTest/res/drawable-nodpi/progress_vertical_bg_holo_dark.9.png diff --git a/tests/HwAccelerationTest/res/drawable-nodpi/progress_vertical_primary_holo_dark.9.png b/tests/HwAccelerationTest/res/drawable-nodpi/progress_vertical_primary_holo_dark.9.png Binary files differnew file mode 100644 index 0000000..385dbc4 --- /dev/null +++ b/tests/HwAccelerationTest/res/drawable-nodpi/progress_vertical_primary_holo_dark.9.png diff --git a/tests/HwAccelerationTest/res/drawable-nodpi/progress_vertical_secondary_holo_dark.9.png b/tests/HwAccelerationTest/res/drawable-nodpi/progress_vertical_secondary_holo_dark.9.png Binary files differnew file mode 100644 index 0000000..f1510b2 --- /dev/null +++ b/tests/HwAccelerationTest/res/drawable-nodpi/progress_vertical_secondary_holo_dark.9.png diff --git a/tests/HwAccelerationTest/res/drawable-nodpi/scrubber_vertical_primary_holo.9.png b/tests/HwAccelerationTest/res/drawable-nodpi/scrubber_vertical_primary_holo.9.png Binary files differnew file mode 100644 index 0000000..4208c6f --- /dev/null +++ b/tests/HwAccelerationTest/res/drawable-nodpi/scrubber_vertical_primary_holo.9.png diff --git a/tests/HwAccelerationTest/res/drawable-nodpi/scrubber_vertical_secondary_holo.9.png b/tests/HwAccelerationTest/res/drawable-nodpi/scrubber_vertical_secondary_holo.9.png Binary files differnew file mode 100644 index 0000000..b25fb2f --- /dev/null +++ b/tests/HwAccelerationTest/res/drawable-nodpi/scrubber_vertical_secondary_holo.9.png diff --git a/tests/HwAccelerationTest/res/drawable-nodpi/scrubber_vertical_track_holo_dark.9.png b/tests/HwAccelerationTest/res/drawable-nodpi/scrubber_vertical_track_holo_dark.9.png Binary files differnew file mode 100644 index 0000000..25129c6 --- /dev/null +++ b/tests/HwAccelerationTest/res/drawable-nodpi/scrubber_vertical_track_holo_dark.9.png diff --git a/tests/HwAccelerationTest/res/drawable-nodpi/scrubber_vertical_track_holo_light.9.png b/tests/HwAccelerationTest/res/drawable-nodpi/scrubber_vertical_track_holo_light.9.png Binary files differnew file mode 100644 index 0000000..1505e0e --- /dev/null +++ b/tests/HwAccelerationTest/res/drawable-nodpi/scrubber_vertical_track_holo_light.9.png diff --git a/tests/HwAccelerationTest/res/drawable/progress_vertical_holo_dark.xml b/tests/HwAccelerationTest/res/drawable/progress_vertical_holo_dark.xml new file mode 100644 index 0000000..9eb54b7 --- /dev/null +++ b/tests/HwAccelerationTest/res/drawable/progress_vertical_holo_dark.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2010 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + + <item android:id="@android:id/background" + android:drawable="@drawable/progress_vertical_bg_holo_dark" /> + + <item android:id="@android:id/secondaryProgress"> + <scale android:scaleHeight="100%" android:scaleGravity="bottom" + android:drawable="@drawable/progress_vertical_secondary_holo_dark" /> + </item> + + <item android:id="@android:id/progress"> + <scale android:scaleHeight="100%" android:scaleGravity="bottom" + android:drawable="@drawable/progress_vertical_primary_holo_dark" /> + </item> + +</layer-list> diff --git a/tests/HwAccelerationTest/res/drawable/scrubber_progress_vertical_holo_dark.xml b/tests/HwAccelerationTest/res/drawable/scrubber_progress_vertical_holo_dark.xml new file mode 100644 index 0000000..0cc56bf --- /dev/null +++ b/tests/HwAccelerationTest/res/drawable/scrubber_progress_vertical_holo_dark.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2010 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:id="@android:id/background" + android:drawable="@drawable/scrubber_vertical_track_holo_dark" /> + <item android:id="@android:id/secondaryProgress"> + <scale android:scaleHeight="100%" android:scaleGravity="bottom" + android:drawable="@drawable/scrubber_vertical_secondary_holo" /> + </item> + <item android:id="@android:id/progress"> + <scale android:scaleHeight="100%" android:scaleGravity="bottom" + android:drawable="@drawable/scrubber_vertical_primary_holo" /> + </item> +</layer-list> diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/GLTextureViewActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/GLTextureViewActivity.java index e1ca756..949589f 100644 --- a/tests/HwAccelerationTest/src/com/android/test/hwui/GLTextureViewActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/GLTextureViewActivity.java @@ -39,7 +39,10 @@ import javax.microedition.khronos.egl.EGLContext; import javax.microedition.khronos.egl.EGLDisplay; import javax.microedition.khronos.egl.EGLSurface; import javax.microedition.khronos.opengles.GL; - +import java.io.BufferedOutputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; @@ -57,6 +60,25 @@ public class GLTextureViewActivity extends Activity implements TextureView.Surfa mTextureView = new TextureView(this); mTextureView.setSurfaceTextureListener(this); + mTextureView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Bitmap b = mTextureView.getBitmap(800, 800); + BufferedOutputStream out = null; + try { + out = new BufferedOutputStream(new FileOutputStream("/sdcard/out.png")); + b.compress(Bitmap.CompressFormat.PNG, 100, out); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } finally { + if (out != null) try { + out.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + }); setContentView(mTextureView, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, @@ -77,7 +99,7 @@ public class GLTextureViewActivity extends Activity implements TextureView.Surfa animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { - ((View) mTextureView.getParent()).invalidate(); + mTextureView.invalidate(); } }); animator.start(); diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/MoreNinePatchesActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/MoreNinePatchesActivity.java new file mode 100644 index 0000000..0c42387 --- /dev/null +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/MoreNinePatchesActivity.java @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.test.hwui; + +import android.app.Activity; +import android.content.Context; +import android.content.res.Resources; +import android.graphics.Canvas; +import android.graphics.drawable.Drawable; +import android.os.Bundle; +import android.view.Gravity; +import android.view.View; +import android.widget.FrameLayout; + +@SuppressWarnings({"UnusedDeclaration"}) +public class MoreNinePatchesActivity extends Activity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + FrameLayout layout = new FrameLayout(this); + PatchView b = new PatchView (this); + b.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, + FrameLayout.LayoutParams.MATCH_PARENT, Gravity.CENTER)); + layout.addView(b); + layout.setBackgroundColor(0xffffffff); + + setContentView(layout); + } + + private class PatchView extends View { + private final Drawable mDrawable1; + private final Drawable mDrawable2; + private final Drawable mDrawable3; + + private PatchView(Context context) { + super(context); + Resources res = context.getResources(); + mDrawable1 = res.getDrawable(R.drawable.progress_vertical_holo_dark); + mDrawable2 = res.getDrawable(R.drawable.scrubber_progress_vertical_holo_dark); + mDrawable3 = res.getDrawable(R.drawable.scrubber_vertical_primary_holo); + } + + @Override + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); + + canvas.translate(100, 100); + mDrawable1.setBounds(0, 0, 33, 120); + mDrawable1.setLevel(5000); + mDrawable1.draw(canvas); + + canvas.translate(20, 0); + mDrawable2.setBounds(0, 0, 33, 120); + mDrawable2.setLevel(5000); + mDrawable2.draw(canvas); + + canvas.translate(20, 0); + mDrawable3.setBounds(0, 0, 33, 120); + mDrawable3.draw(canvas); + } + } +} diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/TextureViewActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/TextureViewActivity.java index c857ded..634e7e3 100644 --- a/tests/HwAccelerationTest/src/com/android/test/hwui/TextureViewActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/TextureViewActivity.java @@ -16,7 +16,6 @@ package com.android.test.hwui; -import android.animation.AnimatorSet; import android.app.Activity; import android.graphics.SurfaceTexture; import android.hardware.Camera; @@ -34,7 +33,6 @@ public class TextureViewActivity extends Activity implements TextureView.Surface private Camera mCamera; private TextureView mTextureView; private FrameLayout mContent; - private AnimatorSet mAnimatorSet; @Override protected void onCreate(Bundle savedInstanceState) { @@ -53,7 +51,6 @@ public class TextureViewActivity extends Activity implements TextureView.Surface @Override public void onClick(View v) { if (mAdded) { - if (mAnimatorSet != null) mAnimatorSet.cancel(); mContent.removeView(mTextureView); } else { mContent.addView(mTextureView); @@ -62,7 +59,9 @@ public class TextureViewActivity extends Activity implements TextureView.Surface } }); - mContent.addView(mTextureView, new FrameLayout.LayoutParams(500, 400, Gravity.CENTER)); + mContent.addView(mTextureView, new FrameLayout.LayoutParams( + FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT, + Gravity.CENTER)); mContent.addView(button, new FrameLayout.LayoutParams( FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM)); @@ -72,6 +71,9 @@ public class TextureViewActivity extends Activity implements TextureView.Surface @Override public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) { mCamera = Camera.open(); + Camera.Size previewSize = mCamera.getParameters().getPreviewSize(); + mTextureView.setLayoutParams(new FrameLayout.LayoutParams( + previewSize.width, previewSize.height, Gravity.CENTER)); try { mCamera.setPreviewTexture(surface); @@ -82,20 +84,6 @@ public class TextureViewActivity extends Activity implements TextureView.Surface mCamera.startPreview(); mTextureView.setCameraDistance(5000); - -// ObjectAnimator rotationY = ObjectAnimator.ofFloat(mTextureView, "rotationY", 0.0f, 360.0f); -// rotationY.setRepeatMode(ObjectAnimator.REVERSE); -// rotationY.setRepeatCount(ObjectAnimator.INFINITE); -// rotationY.setDuration(4000); - -// ObjectAnimator alpha = ObjectAnimator.ofFloat(mTextureView, "alpha", 1.0f, 0.0f); -// alpha.setRepeatMode(ObjectAnimator.REVERSE); -// alpha.setRepeatCount(ObjectAnimator.INFINITE); -// alpha.setDuration(4000); - -// mAnimatorSet = new AnimatorSet(); -// mAnimatorSet.play(alpha).with(rotationY); -// mAnimatorSet.start(); } @Override diff --git a/tests/RenderScriptTests/FBOTest/Android.mk b/tests/RenderScriptTests/FBOTest/Android.mk index 55525c4..1df7b26 100644 --- a/tests/RenderScriptTests/FBOTest/Android.mk +++ b/tests/RenderScriptTests/FBOTest/Android.mk @@ -14,8 +14,6 @@ # limitations under the License. # -ifneq ($(TARGET_SIMULATOR),true) - LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) @@ -26,5 +24,3 @@ LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-fil LOCAL_PACKAGE_NAME := FBOTest include $(BUILD_PACKAGE) - -endif diff --git a/tests/RenderScriptTests/ImageProcessing/Android.mk b/tests/RenderScriptTests/ImageProcessing/Android.mk index 7fa30d0..507cc92 100644 --- a/tests/RenderScriptTests/ImageProcessing/Android.mk +++ b/tests/RenderScriptTests/ImageProcessing/Android.mk @@ -14,8 +14,6 @@ # limitations under the License. # -ifneq ($(TARGET_SIMULATOR),true) - LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) @@ -28,5 +26,3 @@ LOCAL_SRC_FILES := $(call all-java-files-under, src) \ LOCAL_PACKAGE_NAME := ImageProcessing include $(BUILD_PACKAGE) - -endif diff --git a/tests/RenderScriptTests/ModelViewer/Android.mk b/tests/RenderScriptTests/ModelViewer/Android.mk index efe77d7..1d9bacf 100644 --- a/tests/RenderScriptTests/ModelViewer/Android.mk +++ b/tests/RenderScriptTests/ModelViewer/Android.mk @@ -14,8 +14,6 @@ # limitations under the License. # -ifneq ($(TARGET_SIMULATOR),true) - LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) @@ -27,5 +25,3 @@ LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-fil LOCAL_PACKAGE_NAME := ModelViewer include $(BUILD_PACKAGE) - -endif diff --git a/tests/RenderScriptTests/PerfTest/Android.mk b/tests/RenderScriptTests/PerfTest/Android.mk index 757b3b1..0d1e7d2 100644 --- a/tests/RenderScriptTests/PerfTest/Android.mk +++ b/tests/RenderScriptTests/PerfTest/Android.mk @@ -14,8 +14,6 @@ # limitations under the License. # -ifneq ($(TARGET_SIMULATOR),true) - LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) @@ -29,5 +27,3 @@ LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-fil LOCAL_PACKAGE_NAME := PerfTest include $(BUILD_PACKAGE) - -endif diff --git a/tests/RenderScriptTests/tests/Android.mk b/tests/RenderScriptTests/tests/Android.mk index 6c992d5..880b80f 100644 --- a/tests/RenderScriptTests/tests/Android.mk +++ b/tests/RenderScriptTests/tests/Android.mk @@ -14,8 +14,6 @@ # limitations under the License. # -ifneq ($(TARGET_SIMULATOR),true) - LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) @@ -26,5 +24,3 @@ LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-fil LOCAL_PACKAGE_NAME := RSTest include $(BUILD_PACKAGE) - -endif |
