diff options
| author | Romain Guy <romainguy@google.com> | 2010-08-17 12:36:03 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-08-17 12:36:03 -0700 |
| commit | 89c7ec3453ab72c3e00e9f3890a3415ba212204a (patch) | |
| tree | 4193f1216caeb157004b5c251c2272145778d291 /tests | |
| parent | de8db545b46375eca4f567520cb19f3db3a11f5e (diff) | |
| parent | 1d83e1981c8b89da93dff37a4f8b2b1ad8480b44 (diff) | |
| download | frameworks_base-89c7ec3453ab72c3e00e9f3890a3415ba212204a.zip frameworks_base-89c7ec3453ab72c3e00e9f3890a3415ba212204a.tar.gz frameworks_base-89c7ec3453ab72c3e00e9f3890a3415ba212204a.tar.bz2 | |
Merge changes I16ce79ab,Ib86a7309
* changes:
Correctly set the viewport in layers.
Cleanup, better code reuse.
Diffstat (limited to 'tests')
4 files changed, 139 insertions, 0 deletions
diff --git a/tests/HwAccelerationTest/AndroidManifest.xml b/tests/HwAccelerationTest/AndroidManifest.xml index 181b4c8..775dc24 100644 --- a/tests/HwAccelerationTest/AndroidManifest.xml +++ b/tests/HwAccelerationTest/AndroidManifest.xml @@ -189,5 +189,14 @@ </intent-filter> </activity> + <activity + android:name="StackActivity" + android:label="_Stacks"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + </application> </manifest> diff --git a/tests/HwAccelerationTest/res/layout/stack.xml b/tests/HwAccelerationTest/res/layout/stack.xml new file mode 100644 index 0000000..b4d2d73a --- /dev/null +++ b/tests/HwAccelerationTest/res/layout/stack.xml @@ -0,0 +1,33 @@ +<?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. +--> + +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:paddingTop="0dp" + android:paddingBottom="0dp" + android:paddingLeft="12dp" + android:paddingRight="12dp" + android:focusable="true"> + <StackView + android:id="@+id/stack_view" + android:layout_width="348px" + android:layout_height="374px" + android:layout_gravity="center" + android:background="#00000000" + android:cacheColorHint="#00000000" + android:autoStart="true" /> +</FrameLayout> diff --git a/tests/HwAccelerationTest/res/layout/stack_item.xml b/tests/HwAccelerationTest/res/layout/stack_item.xml new file mode 100644 index 0000000..3504018 --- /dev/null +++ b/tests/HwAccelerationTest/res/layout/stack_item.xml @@ -0,0 +1,38 @@ +<?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. +--> + +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/stack_item" + android:layout_width="fill_parent" + android:layout_height="fill_parent"> + <FrameLayout + android:layout_width="fill_parent" + android:layout_height="fill_parent"> + <ImageView android:id="@+id/textview_icon" + android:layout_height="250dip" + android:layout_width="250dip" + android:layout_gravity="center" /> + <TextView android:id="@+id/mini_text" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" /> + </FrameLayout> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:visibility="gone" + android:layout_gravity="center" /> +</FrameLayout>
\ No newline at end of file diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/StackActivity.java b/tests/HwAccelerationTest/src/com/google/android/test/hwui/StackActivity.java new file mode 100644 index 0000000..5c8db6e --- /dev/null +++ b/tests/HwAccelerationTest/src/com/google/android/test/hwui/StackActivity.java @@ -0,0 +1,59 @@ +/* + * 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.google.android.test.hwui; + +import android.app.Activity; +import android.graphics.drawable.Drawable; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.ImageView; +import android.widget.StackView; +import android.widget.TextView; + +@SuppressWarnings({"UnusedDeclaration"}) +public class StackActivity extends Activity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setContentView(R.layout.stack); + + StackView stack = (StackView) findViewById(R.id.stack_view); + stack.setAdapter(new ArrayAdapter<Drawable>(this, android.R.layout.simple_list_item_1, + android.R.id.text1, new Drawable[] { + getResources().getDrawable(R.drawable.sunset1), + getResources().getDrawable(R.drawable.sunset2), + }) { + @Override + public View getView(int position, View convertView, ViewGroup parent) { + View item = convertView; + if (item == null) { + item = LayoutInflater.from(getContext()).inflate( + R.layout.stack_item, null, false); + } + ((ImageView) item.findViewById(R.id.textview_icon)).setImageDrawable( + getItem(position % getCount())); + ((TextView) item.findViewById(R.id.mini_text)).setText("" + position); + return item; + } + }); + stack.setDisplayedChild(0); + } +} |
