diff options
6 files changed, 211 insertions, 5 deletions
diff --git a/tests/UiBench/AndroidManifest.xml b/tests/UiBench/AndroidManifest.xml index d9df9f88b50c..f892a68eea39 100644 --- a/tests/UiBench/AndroidManifest.xml +++ b/tests/UiBench/AndroidManifest.xml @@ -14,11 +14,13 @@ ~ limitations under the License --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.test.uibench"> + xmlns:tools="http://schemas.android.com/tools" + package="com.android.test.uibench"> <application android:allowBackup="false" - android:theme="@style/Theme.AppCompat.Light.DarkActionBar"> + android:theme="@style/Theme.AppCompat.Light.DarkActionBar" + tools:ignore="MissingApplicationIcon"> <uses-library android:name="android.test.runner" /> <!-- Root navigation activity --> @@ -34,6 +36,14 @@ <!-- General --> <activity + android:name=".DialogListActivity" + android:label="General/Dialog List" > + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="com.android.test.uibench.TEST" /> + </intent-filter> + </activity> + <activity android:name=".GlTextureViewActivity" android:label="General/GL TextureView" > <intent-filter> @@ -74,10 +84,28 @@ </intent-filter> </activity> - <!-- GPU --> + <!-- Rendering --> <activity android:name=".BitmapUploadActivity" - android:label="GPU/Bitmap Upload" > + android:label="Rendering/Bitmap Upload" > + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="com.android.test.uibench.TEST" /> + </intent-filter> + </activity> + <activity + android:name=".ShadowGridActivity" + android:label="Rendering/Shadow Grid" > + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="com.android.test.uibench.TEST" /> + </intent-filter> + </activity> + + <!-- Inflation --> + <activity + android:name=".InflatingListActivity" + android:label="Inflation/Inflating ListView" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="com.android.test.uibench.TEST" /> diff --git a/tests/UiBench/res/layout/card_row.xml b/tests/UiBench/res/layout/card_row.xml new file mode 100644 index 000000000000..215f9df9b7fd --- /dev/null +++ b/tests/UiBench/res/layout/card_row.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2015 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 + --> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="horizontal" + android:layout_width="match_parent" + android:layout_height="100dp" + android:paddingStart="10dp" + android:paddingEnd="10dp" + android:paddingTop="5dp" + android:paddingBottom="5dp" + android:clipToPadding="false" + android:background="@null"> + <android.support.v7.widget.CardView + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="1"> + <TextView + android:id="@+id/card_text" + android:layout_width="match_parent" + android:layout_height="match_parent"/> + </android.support.v7.widget.CardView> + + <android.support.v4.widget.Space + android:layout_height="match_parent" + android:layout_width="10dp" /> + + <android.support.v7.widget.CardView + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="1" /> +</LinearLayout>
\ No newline at end of file diff --git a/tests/UiBench/src/com/android/test/uibench/DialogListActivity.java b/tests/UiBench/src/com/android/test/uibench/DialogListActivity.java new file mode 100644 index 000000000000..7b579a1e3554 --- /dev/null +++ b/tests/UiBench/src/com/android/test/uibench/DialogListActivity.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2015 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.uibench; + +import android.os.Bundle; +import android.support.v7.app.AlertDialog; +import android.support.v7.app.AppCompatActivity; +import android.widget.ArrayAdapter; +import android.widget.ListView; + +public class DialogListActivity extends AppCompatActivity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + ListView listView = new ListView(this); + listView.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, + TrivialListActivity.buildStringList())); + + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle("Dialog"); + builder.setView(listView); + builder.create().show(); + } +} diff --git a/tests/UiBench/src/com/android/test/uibench/InflatingListActivity.java b/tests/UiBench/src/com/android/test/uibench/InflatingListActivity.java new file mode 100644 index 000000000000..798c226bd235 --- /dev/null +++ b/tests/UiBench/src/com/android/test/uibench/InflatingListActivity.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2015 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.uibench; + +import android.os.Bundle; +import android.support.v4.app.FragmentManager; +import android.support.v4.app.ListFragment; +import android.support.v7.app.AppCompatActivity; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.ListAdapter; + +public class InflatingListActivity extends AppCompatActivity { + private ListAdapter createListAdapter() { + return new ArrayAdapter<String>(this, + android.R.layout.simple_list_item_1, TrivialListActivity.buildStringList()) { + @Override + public View getView(int position, View convertView, ViewGroup parent) { + // pathological getView behavior: drop convertView on the floor to force inflation + return super.getView(position, null, parent); + } + }; + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + FragmentManager fm = getSupportFragmentManager(); + if (fm.findFragmentById(android.R.id.content) == null) { + ListFragment listFragment = new ListFragment(); + listFragment.setListAdapter(createListAdapter()); + fm.beginTransaction().add(android.R.id.content, listFragment).commit(); + } + } +} diff --git a/tests/UiBench/src/com/android/test/uibench/ShadowGridActivity.java b/tests/UiBench/src/com/android/test/uibench/ShadowGridActivity.java new file mode 100644 index 000000000000..e39ec03d750f --- /dev/null +++ b/tests/UiBench/src/com/android/test/uibench/ShadowGridActivity.java @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2015 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.uibench; + +import android.os.Bundle; +import android.support.v4.app.FragmentManager; +import android.support.v4.app.ListFragment; +import android.support.v7.app.AppCompatActivity; +import android.view.View; +import android.widget.ArrayAdapter; + +public class ShadowGridActivity extends AppCompatActivity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + FragmentManager fm = getSupportFragmentManager(); + if (fm.findFragmentById(android.R.id.content) == null) { + ListFragment listFragment = new ListFragment() { + @Override + public void onViewCreated(View view, Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + getListView().setDivider(null); + } + }; + + listFragment.setListAdapter(new ArrayAdapter<>(this, + R.layout.card_row, R.id.card_text, TrivialListActivity.buildStringList())); + fm.beginTransaction().add(android.R.id.content, listFragment).commit(); + } + } +} diff --git a/tests/UiBench/src/com/android/test/uibench/TrivialListActivity.java b/tests/UiBench/src/com/android/test/uibench/TrivialListActivity.java index 0af34717f82d..9c8ae9bcceea 100644 --- a/tests/UiBench/src/com/android/test/uibench/TrivialListActivity.java +++ b/tests/UiBench/src/com/android/test/uibench/TrivialListActivity.java @@ -47,7 +47,7 @@ public class TrivialListActivity extends AppCompatActivity { FragmentManager fm = getSupportFragmentManager(); if (fm.findFragmentById(android.R.id.content) == null) { ListFragment listFragment = new ListFragment(); - listFragment.setListAdapter(new ArrayAdapter<>(TrivialListActivity.this, + listFragment.setListAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, buildStringList())); fm.beginTransaction().add(android.R.id.content, listFragment).commit(); } |