ndt-dev - [ndt-dev] [ndt] r757 committed - Restore email results feature, layout needs work.
Subject: NDT-DEV email list created
List archive
[ndt-dev] [ndt] r757 committed - Restore email results feature, layout needs work.
Chronological Thread
- From:
- To:
- Subject: [ndt-dev] [ndt] r757 committed - Restore email results feature, layout needs work.
- Date: Thu, 15 Dec 2011 14:34:28 +0000
Revision: 757
Author:
Date: Thu Dec 15 06:33:50 2011
Log: Restore email results feature, layout needs work.
http://code.google.com/p/ndt/source/detail?r=757
Deleted:
/branches/android/Android/src/net/measurementlab/ndt/Statistics.java
Modified:
/branches/android/Android/res/layout/results.xml
/branches/android/Android/res/values/strings.xml
/branches/android/Android/src/net/measurementlab/ndt/ResultsActivity.java
=======================================
--- /branches/android/Android/src/net/measurementlab/ndt/Statistics.java Tue Aug 23 13:36:59 2011
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2009 Google Inc. All Rights Reserved.
-
-package net.measurementlab.ndt;
-
-import java.util.Date;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
-import android.widget.TextView;
-
-/**
- * Shows the testing report to the user, email application also could be called here.
- */
-public class Statistics extends Activity implements OnClickListener {
- private Button buttonEmail;
- private String statistics;
- private String location;
- private String network;
- private Date date;
- private TextView textViewStatistics;
-
- /**
- * Gets results from the main activity and shows them to the user.
- */
- @Override
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- date = new Date();
- buttonEmail = null;
- buttonEmail.setOnClickListener(this);
- textViewStatistics = null;
- textViewStatistics.setText(statistics);
- }
-
- /**
- * Invokes the email application. Does not work on the emulator.
- */
- @Override
- public void onClick(View view) {
- Intent intentMail = new Intent(Intent.ACTION_SEND);
- String networkTypeResult = getString(R.string.network_type_indicator, network);
- StringBuilder mail = new StringBuilder()
- .append(statistics)
- .append("\n")
- .append(location)
- .append("\n")
- .append(networkTypeResult);
- intentMail.putExtra(Intent.EXTRA_TEXT, mail.toString());
- String emailTitle = getString(R.string.email_title, date.toString());
- intentMail.putExtra(Intent.EXTRA_SUBJECT, emailTitle);
- intentMail.setType("plain/text");
- startActivity(Intent.createChooser(intentMail, "Choose Email Client"));
- }
-}
=======================================
--- /branches/android/Android/res/layout/results.xml Tue Oct 11 14:24:22 2011
+++ /branches/android/Android/res/layout/results.xml Thu Dec 15 06:33:50 2011
@@ -126,9 +126,11 @@
android:text="@string/results_more_about" style="@style/NdtResultsMoreInfo"
android:paddingTop="5sp"
android:padding="0sp" />
</LinearLayout>
- <LinearLayout android:orientation="vertical"
+ <LinearLayout android:orientation="horizontal"
android:layout_alignParentRight="true" android:layout_width="wrap_content"
android:layout_height="wrap_content">
+ <Button android:text="@string/results_email" android:id="@+id/ButtonEmail"
+ style="@style/NdtButton" />
<Button android:text="@string/results_test_again" android:id="@+id/ButtonStart"
style="@style/NdtButton" />
</LinearLayout>
=======================================
--- /branches/android/Android/res/values/strings.xml Thu Dec 15 06:19:29 2011
+++ /branches/android/Android/res/values/strings.xml Thu Dec 15 06:33:50 2011
@@ -61,5 +61,6 @@
<string name="results_advanced">Advanced Results</string>
<string name="results_advanced_web100">WEB100 Kernel Variables:\n%s</string>
<string name="results_more_about">More information about M-Lab</string>
+ <string name="results_email">Email Results</string>
<string name="results_test_again">Test Again</string>
</resources>
=======================================
--- /branches/android/Android/src/net/measurementlab/ndt/ResultsActivity.java Tue Nov 1 12:29:52 2011
+++ /branches/android/Android/src/net/measurementlab/ndt/ResultsActivity.java Thu Dec 15 06:33:50 2011
@@ -1,6 +1,7 @@
package net.measurementlab.ndt;
import java.text.DecimalFormat;
+import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -59,6 +60,16 @@
aboutView.setOnClickListener(aboutListener);
aboutView = findViewById(R.id.MLabLogo);
aboutView.setOnClickListener(aboutListener);
+
+
+ Button emailButton = (Button) findViewById(R.id.ButtonEmail);
+ emailButton.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ emailResults();
+ }
+ });
Button startButton = (Button) findViewById(R.id.ButtonStart);
startButton.setOnClickListener(new OnClickListener() {
@@ -212,6 +223,16 @@
.size()]));
return message.concat("\n");
}
+
+ private void emailResults() {
+ Intent intentMail = new Intent(Intent.ACTION_SEND);
+ TextView textView = (TextView)
findViewById(R.id.AdvancedResultsInfo);
+ intentMail.putExtra(Intent.EXTRA_TEXT, textView.getText());
+ String emailTitle = getString(R.string.email_title, new Date().toString());
+ intentMail.putExtra(Intent.EXTRA_SUBJECT, emailTitle);
+ intentMail.setType("plain/text");
+ startActivity(Intent.createChooser(intentMail, "Choose Email Client"));
+ }
private boolean isVarSet(Map<String,Object> variables, String key) {
Object value = variables.get(key);
- [ndt-dev] [ndt] r757 committed - Restore email results feature, layout needs work., ndt, 12/15/2011
Archive powered by MHonArc 2.6.16.