am c2cef921: Added Clear, View, and Export actions to main list for activity windows without Action Bar feature.
* commit 'c2cef921d33eded570996c5b29818e45bc745be4':
Added Clear, View, and Export actions to main list for activity windows without Action Bar feature.
diff --git a/apps/CtsVerifier/res/layout/test_list_footer.xml b/apps/CtsVerifier/res/layout/test_list_footer.xml
new file mode 100644
index 0000000..fdb8e43
--- /dev/null
+++ b/apps/CtsVerifier/res/layout/test_list_footer.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ ~ Copyright (C) 2014 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
+ -->
+<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <Button
+ android:id="@+id/clear"
+ android:text="@string/clear"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+ <Button
+ android:id="@+id/view"
+ android:text="@string/view"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+ <Button
+ android:id="@+id/export"
+ android:text="@string/export"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+</GridLayout>
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/TestListActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/TestListActivity.java
index 1cc3547..8cfc6df 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/TestListActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/TestListActivity.java
@@ -23,16 +23,23 @@
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
+import android.view.View;
+import android.view.Window;
import android.widget.Toast;
import java.io.IOException;
/** Top-level {@link ListActivity} for launching tests and managing results. */
-public class TestListActivity extends AbstractTestListActivity {
+public class TestListActivity extends AbstractTestListActivity implements View.OnClickListener {
private static final String TAG = TestListActivity.class.getSimpleName();
@Override
+ public void onClick (View v) {
+ handleMenuItemSelected(v.getId());
+ }
+
+ @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -41,6 +48,17 @@
}
setTitle(getString(R.string.title_version, Version.getVersionName(this)));
+
+ if (!getWindow().hasFeature(Window.FEATURE_ACTION_BAR)) {
+ View footer = getLayoutInflater().inflate(R.layout.test_list_footer, null);
+
+ footer.findViewById(R.id.clear).setOnClickListener(this);
+ footer.findViewById(R.id.view).setOnClickListener(this);
+ footer.findViewById(R.id.export).setOnClickListener(this);
+
+ getListView().addFooterView(footer);
+ }
+
setTestListAdapter(new ManifestTestListAdapter(this, null));
}
@@ -53,22 +71,7 @@
@Override
public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case R.id.clear:
- handleClearItemSelected();
- return true;
-
- case R.id.view:
- handleViewItemSelected();
- return true;
-
- case R.id.export:
- handleExportItemSelected();
- return true;
-
- default:
- return super.onOptionsItemSelected(item);
- }
+ return handleMenuItemSelected(item.getItemId()) ? true : super.onOptionsItemSelected(item);
}
private void handleClearItemSelected() {
@@ -91,4 +94,23 @@
private void handleExportItemSelected() {
new ReportExporter(this, mAdapter).execute();
}
+
+ private boolean handleMenuItemSelected(int id) {
+ switch (id) {
+ case R.id.clear:
+ handleClearItemSelected();
+ return true;
+
+ case R.id.view:
+ handleViewItemSelected();
+ return true;
+
+ case R.id.export:
+ handleExportItemSelected();
+ return true;
+
+ default:
+ return false;
+ }
+ }
}