Skip to Content.
Sympa Menu

ndt-dev - [ndt-dev] [ndt] r497 committed - Capture stats, use new activity to display.

Subject: NDT-DEV email list created

List archive

[ndt-dev] [ndt] r497 committed - Capture stats, use new activity to display.


Chronological Thread 
  • From:
  • To:
  • Subject: [ndt-dev] [ndt] r497 committed - Capture stats, use new activity to display.
  • Date: Tue, 16 Aug 2011 16:58:34 +0000

Revision: 497
Author:

Date: Tue Aug 16 09:54:15 2011
Log: Capture stats, use new activity to display.
http://code.google.com/p/ndt/source/detail?r=497

Added:
/branches/android/Android/res/layout/results.xml
/branches/android/Android/src/net/measurementlab/ndt/ResultsActivity.java
Modified:
/branches/android/Android/res/layout/initial.xml
/branches/android/Android/src/net/measurementlab/ndt/InitialActivity.java
/branches/android/Android/src/net/measurementlab/ndt/NdtService.java
/branches/android/Android/src/net/measurementlab/ndt/TestsActivity.java

=======================================
--- /dev/null
+++ /branches/android/Android/res/layout/results.xml Tue Aug 16 09:54:15 2011
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android";
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content">
+ <LinearLayout android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent">
+ <TextView android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:id="@+id/Statistics"
+ android:text=""
+ android:scrollbars="vertical"
+ android:gravity="top" />
+ </LinearLayout>
+</ScrollView>
=======================================
--- /dev/null
+++ /branches/android/Android/src/net/measurementlab/ndt/ResultsActivity.java Tue Aug 16 09:54:15 2011
@@ -0,0 +1,22 @@
+package net.measurementlab.ndt;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.widget.TextView;
+
+public class ResultsActivity extends Activity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.results);
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ String statistics = getIntent().getStringExtra("statistics");
+ TextView textView = (TextView) findViewById(R.id.Statistics);
+ textView.setText(statistics);
+ }
+}
=======================================
--- /branches/android/Android/res/layout/initial.xml Mon Aug 15 11:29:46 2011
+++ /branches/android/Android/res/layout/initial.xml Tue Aug 16 09:54:15 2011
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android";
- android:orientation="vertical" android:layout_width="fill_parent"
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout android:id="@+id/UpperFrame"
android:layout_width="fill_parent"
=======================================
--- /branches/android/Android/src/net/measurementlab/ndt/InitialActivity.java Mon Aug 15 11:29:46 2011
+++ /branches/android/Android/src/net/measurementlab/ndt/InitialActivity.java Tue Aug 16 09:54:15 2011
@@ -35,9 +35,7 @@

@Override
public void onClick(View v) {
- Intent intent = null;
-
- intent = new Intent(getApplicationContext(),
+ Intent intent = new
Intent(getApplicationContext(),
TestsActivity.class);
startActivity(intent);
}
=======================================
--- /branches/android/Android/src/net/measurementlab/ndt/NdtService.java Mon Aug 15 12:41:56 2011
+++ /branches/android/Android/src/net/measurementlab/ndt/NdtService.java Tue Aug 16 09:54:15 2011
@@ -9,7 +9,6 @@
import android.util.Log;

public class NdtService extends Service {
- static final String LOG_TAG = "ndt";

public static final int PREPARING = 0;
public static final int UPLOADING = 1;
@@ -92,11 +91,19 @@
private boolean wantToStop = false;

int status = PREPARING;
+
+ StringBuilder statistics = new StringBuilder();

@Override
public void appendString(String str, int viewId) {
Log.d("ndt", String.format("Appended: (%1$d) %2$s.",
viewId, str
.trim()));
+
+ switch(viewId) {
+ case Constants.THREAD_STAT_APPEND:
+ statistics.append(str);
+ break;
+ }

if (str.contains("client-to-server") && 0 == viewId) {
Log.i("ndt", "Starting upload test.");
@@ -135,6 +142,7 @@
public void onEndTest() {
Log.d("ndt", "Test ended.");
intent.putExtra("status", COMPLETE);
+ intent.putExtra("statistics", statistics.toString());
sendBroadcast(intent);
wantToStop = false;
status = COMPLETE;
=======================================
--- /branches/android/Android/src/net/measurementlab/ndt/TestsActivity.java Mon Aug 15 12:55:43 2011
+++ /branches/android/Android/src/net/measurementlab/ndt/TestsActivity.java Tue Aug 16 09:54:15 2011
@@ -21,7 +21,7 @@
import android.widget.ImageView;
import android.widget.TextView;

-import static net.measurementlab.ndt.NdtService.LOG_TAG;
+import static net.measurementlab.ndt.Constants.LOG_TAG;

/**
* Animated progress while selecting server location.
@@ -124,10 +124,12 @@
// TODO show download animation
}

- private void complete() {
+ private void complete(String statistics) {
Log.i(LOG_TAG, "Testing Complete.");
updateHeader(R.string.tests_complete_header);
- // TODO send intent for summary activity
+ Intent intent = new Intent(getApplicationContext(), ResultsActivity.class);
+ intent.putExtra("statistics", statistics);
+ startActivity(intent);
}

private BroadcastReceiver createReceiver() {
@@ -148,7 +150,7 @@
downloading();
break;
case NdtService.COMPLETE:
- complete();
+
complete(intent.getStringExtra("statistics"));
break;
default:
Log.i(LOG_TAG, "Test reporter not
initialized.");


  • [ndt-dev] [ndt] r497 committed - Capture stats, use new activity to display., ndt, 08/16/2011

Archive powered by MHonArc 2.6.16.

Top of Page