Replace Copy Function with Report Viewer
It was difficult to check report changes while developing, so
I have replaced the "Copy" button with a "View" button that
displays the report in an EditText to make things easier.
Change-Id: I5bdfe3f951895bf5b1ead925a92728725f97c21d
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index 9bfac6d..2713300 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -47,6 +47,10 @@
<activity android:name=".TestListActivity" android:label="@string/test_list_title" />
+ <activity android:name=".ReportViewerActivity"
+ android:configChanges="keyboardHidden|orientation"
+ android:label="@string/report_viewer" />
+
<provider android:name=".TestResultsProvider"
android:authorities="com.android.cts.verifier.testresultsprovider" />
diff --git a/apps/CtsVerifier/res/layout/report_viewer.xml b/apps/CtsVerifier/res/layout/report_viewer.xml
new file mode 100644
index 0000000..c397582
--- /dev/null
+++ b/apps/CtsVerifier/res/layout/report_viewer.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 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.
+-->
+<EditText xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/report_text"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ />
diff --git a/apps/CtsVerifier/res/menu/test_list_menu.xml b/apps/CtsVerifier/res/menu/test_list_menu.xml
index 16323e9..e777791 100644
--- a/apps/CtsVerifier/res/menu/test_list_menu.xml
+++ b/apps/CtsVerifier/res/menu/test_list_menu.xml
@@ -3,9 +3,9 @@
<item android:id="@+id/clear"
android:icon="@android:drawable/ic_menu_delete"
android:title="@string/clear" />
- <item android:id="@+id/copy"
- android:icon="@android:drawable/ic_menu_upload"
- android:title="@string/copy" />
+ <item android:id="@+id/view"
+ android:icon="@android:drawable/ic_menu_view"
+ android:title="@string/view" />
<item android:id="@+id/export"
android:icon="@android:drawable/ic_menu_save"
android:title="@string/export" />
diff --git a/apps/CtsVerifier/res/values/strings.xml b/apps/CtsVerifier/res/values/strings.xml
index 44278db..4b39842 100644
--- a/apps/CtsVerifier/res/values/strings.xml
+++ b/apps/CtsVerifier/res/values/strings.xml
@@ -23,9 +23,6 @@
<string name="info_button_text">Info</string>
<string name="fail_button_text">Fail</string>
- <!-- Strings for TestResultsReport -->
- <string name="subject_header">CTS Verifier %1$s - %2$s</string>
-
<!-- Strings for TestListActivity -->
<string name="test_list_title">Manual Test List</string>
<string name="test_category_audio">Audio</string>
@@ -38,13 +35,15 @@
<string name="test_category_other">Other</string>
<string name="clear">Clear</string>
<string name="test_results_cleared">Test results cleared.</string>
- <string name="copy">Copy</string>
- <string name="test_results_copied">Test results copied to clipboard.</string>
+ <string name="view">View</string>
<string name="test_results_error">Couldn\'t create test results report.</string>
<string name="export">Export</string>
<string name="no_storage">Cannot save report to external storage, see log for details.</string>
<string name="report_saved">Report saved to: %s</string>
+ <!-- Strings for ReportViewerActivity -->
+ <string name="report_viewer">Report Viewer</string>
+
<!-- Strings for BackupTestActivity -->
<string name="backup_test">Data Backup Test</string>
<string name="backup_info">This test checks that data backup and automatic restore works
@@ -92,7 +91,6 @@
<string name="da_password_quality_alphanumeric">Alphanumeric</string>
<string name="da_password_quality_numeric">Numeric</string>
<string name="da_password_quality_something">Something</string>
- <string name="da_password_quality_unspecified">Unspecified</string>
<string name="da_password_minimum_length">Minimum Password Length</string>
<string name="da_maximum_failed_passwords_for_wipe">Maximum Failed Passwords for Wipe</string>
<string name="da_maximum_time_to_lock">Maximum Time to Lock</string>
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/ReportViewerActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/ReportViewerActivity.java
new file mode 100644
index 0000000..36ec213
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/ReportViewerActivity.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2011 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.cts.verifier;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.widget.TextView;
+
+public class ReportViewerActivity extends Activity {
+
+ public static final String EXTRA_REPORT_CONTENTS = "reportContents";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.report_viewer);
+
+ Intent intent = getIntent();
+ if (intent != null) {
+ String reportContents = intent.getStringExtra(EXTRA_REPORT_CONTENTS);
+ if (reportContents != null) {
+ TextView reportText = (TextView) findViewById(R.id.report_text);
+ reportText.setText(reportContents);
+ }
+ }
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/TestListActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/TestListActivity.java
index f233312..c510653 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/TestListActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/TestListActivity.java
@@ -17,8 +17,8 @@
package com.android.cts.verifier;
import android.app.ListActivity;
+import android.content.Intent;
import android.os.Bundle;
-import android.text.ClipboardManager;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
@@ -52,8 +52,8 @@
handleClearItemSelected();
return true;
- case R.id.copy:
- handleCopyItemSelected();
+ case R.id.view:
+ handleViewItemSelected();
return true;
case R.id.export:
@@ -70,13 +70,12 @@
Toast.makeText(this, R.string.test_results_cleared, Toast.LENGTH_SHORT).show();
}
- private void handleCopyItemSelected() {
+ private void handleViewItemSelected() {
try {
TestResultsReport report = new TestResultsReport(this, mAdapter);
- ClipboardManager clipboardManager = (ClipboardManager)
- getSystemService(CLIPBOARD_SERVICE);
- clipboardManager.setText(report.getContents());
- Toast.makeText(this, R.string.test_results_copied, Toast.LENGTH_SHORT).show();
+ Intent intent = new Intent(this, ReportViewerActivity.class);
+ intent.putExtra(ReportViewerActivity.EXTRA_REPORT_CONTENTS, report.getContents());
+ startActivity(intent);
} catch (IOException e) {
Toast.makeText(this, R.string.test_results_error, Toast.LENGTH_SHORT).show();
Log.e(TAG, "Couldn't copy test results report", e);