ndt-dev - [ndt-dev] [ndt] r495 committed - Fill in test server address, complete test screens.
Subject: NDT-DEV email list created
List archive
[ndt-dev] [ndt] r495 committed - Fill in test server address, complete test screens.
Chronological Thread
- From:
- To:
- Subject: [ndt-dev] [ndt] r495 committed - Fill in test server address, complete test screens.
- Date: Mon, 15 Aug 2011 19:56:23 +0000
Revision: 495
Author:
Date: Mon Aug 15 12:55:43 2011
Log: Fill in test server address, complete test screens.
http://code.google.com/p/ndt/source/detail?r=495
Modified:
/branches/android/Android/res/layout/tests.xml
/branches/android/Android/src/net/measurementlab/ndt/TestsActivity.java
=======================================
--- /branches/android/Android/res/layout/tests.xml Mon Aug 15 12:24:06
2011
+++ /branches/android/Android/res/layout/tests.xml Mon Aug 15 12:55:43
2011
@@ -16,7 +16,7 @@
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/progress_bar"
- android:id="@+id/NdtServerLocationProgress"></ImageView>
+ android:id="@+id/NdtTestsProgress"></ImageView>
<TextView android:text="@string/tests_test_server"
android:id="@+id/TestServerLabel"
style="@style/NdtTestsDetail" />
=======================================
--- /branches/android/Android/src/net/measurementlab/ndt/TestsActivity.java Mon Aug 15 12:41:56 2011
+++ /branches/android/Android/src/net/measurementlab/ndt/TestsActivity.java Mon Aug 15 12:55:43 2011
@@ -5,6 +5,7 @@
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
+import java.net.UnknownHostException;
import java.util.Enumeration;
import android.app.Activity;
@@ -17,6 +18,7 @@
import android.net.NetworkInfo;
import android.os.Bundle;
import android.util.Log;
+import android.widget.ImageView;
import android.widget.TextView;
import static net.measurementlab.ndt.NdtService.LOG_TAG;
@@ -93,23 +95,32 @@
Log.i(LOG_TAG, "Preparing Your Tests...");
updateHeader(R.string.tests_preparing_header);
- String localAddress = getLocalIpAddress();
+ String localAddress = getLocalAddress();
if (null != localAddress) {
TextView textView = (TextView)
findViewById(R.id.TestClientValue);
textView.setText(localAddress);
}
+ String serverAddress = getServerAddress();
+ if (null != serverAddress) {
+ TextView textView = (TextView)
findViewById(R.id.TestServerValue);
+ textView.setText(serverAddress);
+ }
// TODO show preparation animation
}
private void uploading() {
Log.i(LOG_TAG, "Testing Upload...");
updateHeader(R.string.tests_both_header,
R.string.tests_upload_info);
+ ImageView imageView = (ImageView)
findViewById(R.id.NdtTestsProgress);
+ imageView.setImageDrawable(getResources().getDrawable(R.drawable.progress_bar_left));
// TODO show upload animation
}
private void downloading() {
Log.i(LOG_TAG, "Testing Download...");
updateHeader(R.string.tests_both_header,
R.string.tests_download_info);
+ ImageView imageView = (ImageView)
findViewById(R.id.NdtTestsProgress);
+ imageView.setImageDrawable(getResources().getDrawable(R.drawable.progress_bar_right));
// TODO show download animation
}
@@ -179,7 +190,7 @@
}
}
- public String getLocalIpAddress() {
+ private String getLocalAddress() {
try {
for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {
NetworkInterface intf = en.nextElement();
@@ -195,4 +206,15 @@
}
return null;
}
-}
+
+ private String getServerAddress() {
+ try {
+ InetAddress server = InetAddress.getByName(Constants.SERVER_HOST[Constants.DEFAULT_SERVER]);
+ return server.getHostAddress();
+ } catch (UnknownHostException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return null;
+ }
+}
- [ndt-dev] [ndt] r495 committed - Fill in test server address, complete test screens., ndt, 08/15/2011
Archive powered by MHonArc 2.6.16.