ndt-dev - [ndt-dev] [ndt] r492 committed - Rename activities, layouts.
Subject: NDT-DEV email list created
List archive
- From:
- To:
- Subject: [ndt-dev] [ndt] r492 committed - Rename activities, layouts.
- Date: Mon, 15 Aug 2011 18:30:15 +0000
Revision: 492
Author:
Date: Mon Aug 15 11:29:46 2011
Log: Rename activities, layouts.
http://code.google.com/p/ndt/source/detail?r=492
Added:
/branches/android/Android/res/layout/initial.xml
/branches/android/Android/res/layout/tests.xml
/branches/android/Android/src/net/measurementlab/ndt/InitialActivity.java
/branches/android/Android/src/net/measurementlab/ndt/TestsActivity.java
Deleted:
/branches/android/Android/res/layout/server_location.xml
/branches/android/Android/res/layout/start.xml
/branches/android/Android/src/net/measurementlab/ndt/AndroidNdt2.java
/branches/android/Android/src/net/measurementlab/ndt/ServerLocation.java
=======================================
--- /dev/null
+++ /branches/android/Android/res/layout/initial.xml Mon Aug 15 11:29:46 2011
@@ -0,0 +1,35 @@
+<?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:layout_height="wrap_content">
+ <LinearLayout android:id="@+id/UpperFrame"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:layout_above="@+id/LowerFrame"
+ android:layout_alignParentTop="true"
+ android:orientation="vertical">
+ <ImageView android:id="@+id/MLabLogo"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:src="@drawable/mlab_logo_small"
+ android:gravity="center"
+ android:padding="25sp" />
+ <TextView android:id="@+id/MLabDesc"
+ android:text="@string/mlabdesc"
+ style="@style/NdtDesc"
+ android:scrollbars="vertical" />
+ </LinearLayout>
+ <LinearLayout android:id="@+id/LowerFrame"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
+ android:orientation="horizontal">
+ <Button android:text="@string/start"
+ android:id="@+id/ButtonStart"
+ style="@style/NdtButton" />
+ <Button android:text="@string/about"
+ android:id="@+id/ButtonAbout"
+ style="@style/NdtButton" />
+ </LinearLayout>
+</RelativeLayout>
=======================================
--- /dev/null
+++ /branches/android/Android/res/layout/tests.xml Mon Aug 15 11:29:46
2011
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" android:orientation="vertical">
+ <LinearLayout android:id="@+id/linearLayout1"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <TextView android:layout_width="match_parent"
+ android:text="@string/tests_preparing_header"
+ android:layout_height="wrap_content"
+ android:id="@+id/NdtServerLocationLabel"
+ android:layout_gravity="top"
+ style="@style/NdtHeader" />
+ <ImageView android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/progress_bar"
+ android:id="@+id/NdtServerLocationProgress"></ImageView>
+ </LinearLayout>
+</LinearLayout>
=======================================
--- /dev/null
+++ /branches/android/Android/src/net/measurementlab/ndt/InitialActivity.java Mon Aug 15 11:29:46 2011
@@ -0,0 +1,46 @@
+// Copyright 2009 Google Inc. All Rights Reserved.
+
+package net.measurementlab.ndt;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.graphics.Typeface;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.TextView;
+
+/**
+ * UI Thread and Entry Point of NDT mobile client.
+ */
+public class InitialActivity extends Activity {
+
+ /**
+ * Initializes the activity.
+ */
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.initial);
+ Log.i("ndt", "Loaded!");
+ Typeface typeFace = Typeface.createFromAsset(getAssets(),
+ "fonts/League_Gothic.otf");
+ TextView textView = (TextView) findViewById(R.id.MLabDesc);
+ textView.setTypeface(typeFace);
+
+ Button startButton = (Button) findViewById(R.id.ButtonStart);
+ startButton.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ Intent intent = null;
+
+ intent = new Intent(getApplicationContext(),
+ TestsActivity.class);
+ startActivity(intent);
+ }
+ });
+ }
+}
=======================================
--- /dev/null
+++ /branches/android/Android/src/net/measurementlab/ndt/TestsActivity.java Mon Aug 15 11:29:46 2011
@@ -0,0 +1,134 @@
+// Copyright 2009 Google Inc. All Rights Reserved.
+
+package net.measurementlab.ndt;
+
+import android.app.Activity;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.graphics.Typeface;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
+import android.os.Bundle;
+import android.util.Log;
+import android.widget.TextView;
+
+/**
+ * Animated progress while selecting server location.
+ */
+public class TestsActivity extends Activity {
+ private BroadcastReceiver statusReceiver;
+
+ /**
+ * Initializes the activity.
+ */
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.tests);
+ Log.i("ndt", "Loaded!");
+ Typeface typeFace = Typeface.createFromAsset(getAssets(),
+ "fonts/League_Gothic.otf");
+ TextView textView = (TextView)
findViewById(R.id.NdtServerLocationLabel);
+ textView.setTypeface(typeFace);
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+ Log.i("ndt", "Tests activity started.");
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+
+ preparing();
+
+ statusReceiver = createReceiver();
+ registerReceiver(statusReceiver, new IntentFilter(
+ NdtService.INTENT_UPDATE_STATUS));
+
+ Intent intent = new Intent(getApplicationContext(),
NdtService.class);
+ intent.putExtra("networkType", getNetworkType());
+ startService(intent);
+
+ Log.i("ndt", "Tests activity resumed.");
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ Intent intent = new Intent(NdtService.INTENT_STOP_TESTS);
+ sendBroadcast(intent);
+
+ intent = new Intent(getApplicationContext(),
NdtService.class);
+ stopService(intent);
+
+ unregisterReceiver(statusReceiver);
+ statusReceiver = null;
+
+ Log.i("ndt", "Tests activity paused.");
+ }
+
+ private void preparing() {
+ Log.i("ndt", "Preparing Your Tests...");
+
updateHeader(getResources().getText(R.string.tests_preparing_header));
+ }
+
+ private BroadcastReceiver createReceiver() {
+ BroadcastReceiver receiver = new BroadcastReceiver() {
+
+ @Override
+ public void onReceive(Context context, Intent intent)
{
+ Log.i("ndt", "Status change received.");
+ int status = intent.getIntExtra("status",
NdtService.PREPARING);
+ switch (status) {
+ case NdtService.PREPARING:
+ preparing();
+ break;
+ case NdtService.UPLOADING:
+ Log.i("ndt", "Testing Upload...");
+ updateHeader("Testing upload...");
+ break;
+ case NdtService.DOWNLOADING:
+ Log.i("ndt", "Testing Download...");
+ updateHeader("Testing download...");
+ break;
+ case NdtService.COMPLETE:
+ Log.i("ndt", "Testing Complete.");
+ updateHeader("Test complete.");
+ break;
+ default:
+ Log.i("ndt", "Test reporter not
initialized.");
+ break;
+ }
+ }
+ };
+ Log.i("ndt", "Status receiver created.");
+ return receiver;
+
+ }
+
+ private void updateHeader(CharSequence labelText) {
+ TextView textView = (TextView)
findViewById(R.id.NdtServerLocationLabel);
+ textView.setText(labelText);
+ }
+
+ private String getNetworkType() {
+ ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
+ NetworkInfo networkInfo =
connectivityManager.getActiveNetworkInfo();
+ if (null == networkInfo) {
+ return NdtTests.NETWORK_UNKNOWN;
+ }
+ switch (networkInfo.getType()) {
+ case ConnectivityManager.TYPE_MOBILE:
+ return NdtTests.NETWORK_MOBILE;
+ case ConnectivityManager.TYPE_WIFI:
+ return NdtTests.NETWORK_WIFI;
+ default:
+ return NdtTests.NETWORK_UNKNOWN;
+ }
+ }
+}
=======================================
--- /branches/android/Android/res/layout/server_location.xml Mon Jun 20 09:23:24 2011
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent" android:orientation="vertical">
- <LinearLayout android:id="@+id/linearLayout1"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <TextView android:layout_width="match_parent"
- android:text="@string/server_location_header"
- android:layout_height="wrap_content"
- android:id="@+id/NdtServerLocationLabel"
- android:layout_gravity="top"
- style="@style/NdtHeader" />
- <ImageView android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:src="@drawable/progress_bar"
- android:id="@+id/NdtServerLocationProgress"></ImageView>
- </LinearLayout>
-</LinearLayout>
=======================================
--- /branches/android/Android/res/layout/start.xml Fri Jun 17 11:09:30
2011
+++ /dev/null
@@ -1,35 +0,0 @@
-<?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:layout_height="wrap_content">
- <LinearLayout android:id="@+id/UpperFrame"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:layout_above="@+id/LowerFrame"
- android:layout_alignParentTop="true"
- android:orientation="vertical">
- <ImageView android:id="@+id/MLabLogo"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:src="@drawable/mlab_logo_small"
- android:gravity="center"
- android:padding="25sp" />
- <TextView android:id="@+id/MLabDesc"
- android:text="@string/mlabdesc"
- style="@style/NdtDesc"
- android:scrollbars="vertical" />
- </LinearLayout>
- <LinearLayout android:id="@+id/LowerFrame"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_alignParentBottom="true"
- android:orientation="horizontal">
- <Button android:text="@string/start"
- android:id="@+id/ButtonStart"
- style="@style/NdtButton" />
- <Button android:text="@string/about"
- android:id="@+id/ButtonAbout"
- style="@style/NdtButton" />
- </LinearLayout>
-</RelativeLayout>
=======================================
--- /branches/android/Android/src/net/measurementlab/ndt/AndroidNdt2.java Tue Jun 21 13:11:16 2011
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2009 Google Inc. All Rights Reserved.
-
-package net.measurementlab.ndt;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.graphics.Typeface;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
-import android.widget.TextView;
-
-/**
- * UI Thread and Entry Point of NDT mobile client.
- */
-public class AndroidNdt2 extends Activity {
-
- /**
- * Initializes the activity.
- */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.start);
- Log.i("ndt", "Loaded!");
- Typeface typeFace = Typeface.createFromAsset(getAssets(),
- "fonts/League_Gothic.otf");
- TextView textView = (TextView) findViewById(R.id.MLabDesc);
- textView.setTypeface(typeFace);
-
- Button startButton = (Button) findViewById(R.id.ButtonStart);
- startButton.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- Intent intent = null;
-
- intent = new Intent(getApplicationContext(),
- ServerLocation.class);
- startActivity(intent);
- }
- });
- }
-}
=======================================
--- /branches/android/Android/src/net/measurementlab/ndt/ServerLocation.java Thu Jul 7 11:15:40 2011
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright 2009 Google Inc. All Rights Reserved.
-
-package net.measurementlab.ndt;
-
-import android.app.Activity;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.graphics.Typeface;
-import android.net.ConnectivityManager;
-import android.net.NetworkInfo;
-import android.os.Bundle;
-import android.util.Log;
-import android.widget.TextView;
-
-/**
- * Animated progress while selecting server location.
- */
-public class ServerLocation extends Activity {
- private BroadcastReceiver statusReceiver;
-
- /**
- * Initializes the activity.
- */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.server_location);
- Log.i("ndt", "Loaded!");
- Typeface typeFace = Typeface.createFromAsset(getAssets(),
- "fonts/League_Gothic.otf");
- TextView textView = (TextView)
findViewById(R.id.NdtServerLocationLabel);
- textView.setTypeface(typeFace);
-
- Intent intent = new Intent(getApplicationContext(),
NdtService.class);
- intent.putExtra("networkType", getNetworkType());
- startService(intent);
-
- bindAndRegister();
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- Log.i("ndt", "Server location started.");
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- Log.i("ndt", "Server location resumed.");
- }
-
- @Override
- protected void onPause() {
- super.onPause();
- Log.i("ndt", "Server location paused.");
- unregisterReceiver(statusReceiver);
- // TODO tell NdtService to stop test
- // TODO reset activity state to preparing
- }
-
- private void bindAndRegister() {
- statusReceiver = createReceiver();
- registerReceiver(statusReceiver, new IntentFilter(
- NdtService.INTENT_UPDATE_STATUS));
- Log.i("ndt", "Status receiver registered.");
- }
-
- private BroadcastReceiver createReceiver() {
- BroadcastReceiver receiver = new BroadcastReceiver() {
-
- @Override
- public void onReceive(Context context, Intent intent)
{
- Log.i("ndt", "Status change received.");
- int status = intent.getIntExtra("status",
NdtService.PREPARING);
- switch (status) {
- case NdtService.PREPARING:
- Log.i("ndt", "Preparing Your
Tests...");
- updateHeader("Preparing...");
- break;
- case NdtService.UPLOADING:
- Log.i("ndt", "Testing Upload...");
- updateHeader("Testing upload...");
- break;
- case NdtService.DOWNLOADING:
- Log.i("ndt", "Testing Download...");
- updateHeader("Testing download...");
- break;
- case NdtService.COMPLETE:
- Log.i("ndt", "Testing Complete.");
- updateHeader("Test complete.");
- break;
- default:
- Log.i("ndt", "Test reporter not
initialized.");
- break;
- }
- }
- };
- Log.i("ndt", "Status receiver created.");
- return receiver;
-
- }
-
- private void updateHeader(String labelText) {
- TextView textView = (TextView)
findViewById(R.id.NdtServerLocationLabel);
- textView.setText(labelText);
- }
-
- private String getNetworkType() {
- ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
- NetworkInfo networkInfo =
connectivityManager.getActiveNetworkInfo();
- if (null == networkInfo) {
- return NdtTests.NETWORK_UNKNOWN;
- }
- switch (networkInfo.getType()) {
- case ConnectivityManager.TYPE_MOBILE:
- return NdtTests.NETWORK_MOBILE;
- case ConnectivityManager.TYPE_WIFI:
- return NdtTests.NETWORK_WIFI;
- default:
- return NdtTests.NETWORK_UNKNOWN;
- }
- }
-}
- [ndt-dev] [ndt] r492 committed - Rename activities, layouts., ndt, 08/15/2011
Archive powered by MHonArc 2.6.16.