[tor-commits] r24718: {projects} small fixes to fix progress dialog and alert box glitches (projects/android/trunk/Orbot/src/org/torproject/android)

Nathan Freitas nathan at freitas.net
Tue May 3 06:49:25 UTC 2011


Author: n8fr8
Date: 2011-05-03 06:49:25 +0000 (Tue, 03 May 2011)
New Revision: 24718

Modified:
   projects/android/trunk/Orbot/src/org/torproject/android/Orbot.java
Log:
small fixes to fix progress dialog and alert box glitches


Modified: projects/android/trunk/Orbot/src/org/torproject/android/Orbot.java
===================================================================
--- projects/android/trunk/Orbot/src/org/torproject/android/Orbot.java	2011-05-03 06:41:34 UTC (rev 24717)
+++ projects/android/trunk/Orbot/src/org/torproject/android/Orbot.java	2011-05-03 06:49:25 UTC (rev 24718)
@@ -500,6 +500,7 @@
 	         .show();
 		 }
 	
+		 aDialog.setCanceledOnTouchOutside(true);
 	}
     /*
      * Set the state of the running/not running graphic and label
@@ -518,7 +519,6 @@
 		    	if (torStatus == STATUS_ON)
 		    	{
 		    		imgStatus.setImageResource(R.drawable.toron);
-		    	
 
 		    		if (progressDialog != null)
 		    		{
@@ -559,11 +559,8 @@
 		    	{
 		    		
 		    		imgStatus.setImageResource(R.drawable.torstarting);
-		    		if (progressDialog == null)
-		    		{
-		    			progressDialog =ProgressDialog.show(this, "", getString(R.string.status_starting_up));
-		    		}
-		    		else
+		    		
+		    		if (progressDialog != null)
 		    			progressDialog.setMessage(torServiceMsg);
 		    		
 		    		if (mItemOnOff != null)
@@ -594,7 +591,6 @@
 		    			progressDialog = null;
 		    		}
 		    		
-		    		
 		    		imgStatus.setImageResource(R.drawable.toroff);
 		    		lblStatus.setText(getString(R.string.status_disabled) + "\n" + getString(R.string.press_to_start));
 		    		
@@ -725,11 +721,7 @@
                     break;
                 case TorServiceConstants.ENABLE_TOR_MSG:
                 	
-                	if (progressDialog == null)
-					{
-						progressDialog = ProgressDialog.show(Orbot.this, "", getString(R.string.status_starting_up));
-					}
-    	
+                	createProgressDialog(getString(R.string.status_starting_up));
                 	
                 	updateStatus((String)msg.getData().getString(HANDLER_TOR_MSG));
                 	
@@ -745,6 +737,17 @@
             }
         }
         
+        private synchronized void createProgressDialog (String msg)
+        {
+        	if (progressDialog == null)
+			{
+				progressDialog = ProgressDialog.show(Orbot.this, "", msg);
+				
+				progressDialog.setCancelable(true);
+			}
+	
+        }
+        
     };
 
     



More information about the tor-commits mailing list