[tor-commits] [orbot/master] updated display for setting data transfer UI

n8fr8 at torproject.org n8fr8 at torproject.org
Thu Oct 4 06:19:03 UTC 2012


commit db128fbc2a708a491c98b0f62f08e1d8be783e0a
Author: n8fr8 <nathan at freitas.net>
Date:   Thu Oct 4 11:27:09 2012 +0530

    updated display for setting data transfer UI
---
 src/org/torproject/android/Orbot.java |   38 +++++++++++++++++---------------
 1 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/src/org/torproject/android/Orbot.java b/src/org/torproject/android/Orbot.java
index b4040fd..bdad7ae 100644
--- a/src/org/torproject/android/Orbot.java
+++ b/src/org/torproject/android/Orbot.java
@@ -824,27 +824,29 @@ public class Orbot extends Activity implements TorConstants, OnLongClickListener
             		String TotalUpload = "";
             		String TotalDownload = "";
             		
-            		try {
-            			TotalUpload = mService.getInfo("traffic/written");
-            			TotalDownload = mService.getInfo("traffic/read");
-            			
-            		} catch (RemoteException e) {
-            			Log.d(TAG,"Total bandwidth error"+e.getMessage());
-            		}
-            		
-            		try
+            		if (mService != null)
             		{
-	            		downloadText.setText(formatCount(datacount.Download) + " / " + formatTotal(Long.parseLong(TotalDownload)));
-	            		uploadText.setText(formatCount(datacount.Upload) + " / " + formatTotal(Long.parseLong(TotalUpload)));
+	            		try {
+	            			TotalUpload = mService.getInfo("traffic/written");
+	            			TotalDownload = mService.getInfo("traffic/read");
+	            			
+	            		} catch (RemoteException e) {
+	            			Log.d(TAG,"Total bandwidth error"+e.getMessage());
+	            		}
 	            		
-	            		downloadText.invalidate();
-	            		uploadText.invalidate();
+	            		try
+	            		{
+		            		downloadText.setText(formatCount(datacount.Download) + " / " + formatTotal(Long.parseLong(TotalDownload)));
+		            		uploadText.setText(formatCount(datacount.Upload) + " / " + formatTotal(Long.parseLong(TotalUpload)));
+		            		
+		            		downloadText.invalidate();
+		            		uploadText.invalidate();
+	            		}
+	            		catch (NumberFormatException nfe)
+	            		{
+	            			//just ignore/swallow
+	            		}
             		}
-            		catch (NumberFormatException nfe)
-            		{
-            			//just ignore/swallow
-            		}
-            		
             		break;
                 		
                 default:





More information about the tor-commits mailing list