Loading tests/UiBench/AndroidManifest.xml +9 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,15 @@ <category android:name="com.android.test.uibench.TEST" /> </intent-filter> </activity> <activity android:name=".ClippedListActivity" android:label="General/Clipped ListView" android:theme="@style/NoActionBar"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="com.android.test.uibench.TEST" /> </intent-filter> </activity> <activity android:name=".TrivialRecyclerViewActivity" android:label="General/Trivial RecyclerView" > Loading tests/UiBench/res/layout/app_bar_navigation_drawer.xml +1 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ --> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/app_bar_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true"> Loading tests/UiBench/src/com/android/test/uibench/ClippedListActivity.java 0 → 100644 +66 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 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.design.widget.NavigationView; import android.support.v4.app.FragmentManager; import android.support.v4.app.ListFragment; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.MenuItem; import android.widget.ArrayAdapter; import android.widget.ListAdapter; public class ClippedListActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_navigation_drawer); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); FragmentManager fm = getSupportFragmentManager(); if (fm.findFragmentById(android.R.id.content) == null) { ListFragment listFragment = new ListFragment(); ListAdapter adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, TextUtils.buildSimpleStringList(40)); listFragment.setListAdapter(adapter); fm.beginTransaction().add(R.id.app_bar_layout, listFragment).commit(); } } @Override public boolean onNavigationItemSelected(MenuItem item) { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } } tests/UiBench/src/com/android/test/uibench/TextUtils.java +5 −1 Original line number Diff line number Diff line Loading @@ -35,10 +35,14 @@ public class TextUtils { } public static String[] buildSimpleStringList() { return buildSimpleStringList(SIMPLE_STRING_LENGTH); } public static String[] buildSimpleStringList(int stringLength) { String[] strings = new String[STRING_COUNT]; Random random = new Random(0); for (int i = 0; i < strings.length; i++) { strings[i] = randomWord(random, SIMPLE_STRING_LENGTH); strings[i] = randomWord(random, stringLength); } return strings; } Loading Loading
tests/UiBench/AndroidManifest.xml +9 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,15 @@ <category android:name="com.android.test.uibench.TEST" /> </intent-filter> </activity> <activity android:name=".ClippedListActivity" android:label="General/Clipped ListView" android:theme="@style/NoActionBar"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="com.android.test.uibench.TEST" /> </intent-filter> </activity> <activity android:name=".TrivialRecyclerViewActivity" android:label="General/Trivial RecyclerView" > Loading
tests/UiBench/res/layout/app_bar_navigation_drawer.xml +1 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ --> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/app_bar_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true"> Loading
tests/UiBench/src/com/android/test/uibench/ClippedListActivity.java 0 → 100644 +66 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 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.design.widget.NavigationView; import android.support.v4.app.FragmentManager; import android.support.v4.app.ListFragment; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.MenuItem; import android.widget.ArrayAdapter; import android.widget.ListAdapter; public class ClippedListActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_navigation_drawer); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); FragmentManager fm = getSupportFragmentManager(); if (fm.findFragmentById(android.R.id.content) == null) { ListFragment listFragment = new ListFragment(); ListAdapter adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, TextUtils.buildSimpleStringList(40)); listFragment.setListAdapter(adapter); fm.beginTransaction().add(R.id.app_bar_layout, listFragment).commit(); } } @Override public boolean onNavigationItemSelected(MenuItem item) { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } }
tests/UiBench/src/com/android/test/uibench/TextUtils.java +5 −1 Original line number Diff line number Diff line Loading @@ -35,10 +35,14 @@ public class TextUtils { } public static String[] buildSimpleStringList() { return buildSimpleStringList(SIMPLE_STRING_LENGTH); } public static String[] buildSimpleStringList(int stringLength) { String[] strings = new String[STRING_COUNT]; Random random = new Random(0); for (int i = 0; i < strings.length; i++) { strings[i] = randomWord(random, SIMPLE_STRING_LENGTH); strings[i] = randomWord(random, stringLength); } return strings; } Loading