Add Dialog list, shadow, inflation tests
Change-Id: I39a18854248e7b4783fb7475c7aa9cc258a3c394
This commit is contained in:
@@ -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 -->
|
||||
@@ -33,6 +35,14 @@
|
||||
</activity>
|
||||
|
||||
<!-- 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" >
|
||||
@@ -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" />
|
||||
|
||||
45
tests/UiBench/res/layout/card_row.xml
Normal file
45
tests/UiBench/res/layout/card_row.xml
Normal file
@@ -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>
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user