[tor-commits] [orbot/master] a bit more cleanup on strings for about and hidden service requests

n8fr8 at torproject.org n8fr8 at torproject.org
Mon Nov 14 09:18:53 UTC 2011


commit 2b8eef305cfe5dc33c3f1d4b59252688c481fab4
Author: Nathan Freitas <nathan at freitas.net>
Date:   Mon Nov 14 04:03:41 2011 -0500

    a bit more cleanup on strings for about and hidden service requests
---
 res/layout/layout_about.xml           |   18 ++--
 res/values/strings.xml                |   11 +++-
 src/org/torproject/android/Orbot.java |  143 ++++++++++++++-------------------
 3 files changed, 78 insertions(+), 94 deletions(-)

diff --git a/res/layout/layout_about.xml b/res/layout/layout_about.xml
index 0e0be56..fbc8cae 100644
--- a/res/layout/layout_about.xml
+++ b/res/layout/layout_about.xml
@@ -40,14 +40,14 @@
 				android:paddingLeft="15px"		
 				android:layout_gravity="center_vertical"
 				android:textColor="#ffffff" />	
-			<TextView android:text="Project Home(s): "
+			<TextView android:text="@string/project_home"
 				android:layout_width="fill_parent" 
 				android:layout_height="wrap_content"		
 				android:paddingTop="15px"
 				android:paddingLeft="15px"
 				android:textStyle="bold"
 				android:textColor="#00ff00" />
-			<TextView android:text="https://www.torproject.org/docs/android\nhttps://guardianproject.info/apps/orbot/"
+			<TextView android:text="@string/project_urls"
 				android:layout_width="fill_parent" 
 				android:layout_height="wrap_content"
 				android:autoLink="web"
@@ -61,47 +61,47 @@
 				android:paddingLeft="15px"
 				android:textStyle="bold"
 				android:textColor="#00ff00" />	
-			<TextView android:text="The Tor License"
+			<TextView android:text="@string/the_tor_license"
 				android:layout_width="fill_parent" 
 				android:layout_height="wrap_content"
 				android:paddingLeft="15px"								
 				android:textColor="#ffffff" />	
-			<TextView android:text="https://torproject.org"
+			<TextView android:text="@string/https_torproject_org"
 				android:layout_width="fill_parent" 
 				android:layout_height="wrap_content"
 				android:autoLink="web"
 				android:textColorLink="#ffffff"
 				android:paddingLeft="15px"		
 				android:textColor="#ffffff" />				
-			<TextView android:text="3rd-Party-Software: "
+			<TextView android:text="@string/third_party_software"
 				android:layout_width="fill_parent" 
 				android:layout_height="wrap_content"		
 				android:paddingTop="15px"
 				android:paddingLeft="15px"
 				android:textStyle="bold"
 				android:textColor="#00ff00" />	
-			<TextView android:text="Tor v0.2.3.6-alpha: https://www.torproject.org"
+			<TextView android:text="@string/tor_version"
 				android:layout_width="fill_parent" 
 				android:layout_height="wrap_content"
 				android:autoLink="web"
 				android:textColorLink="#ffffff"
 				android:paddingLeft="15px"
 				android:textColor="#ffffff" />				
-			<TextView android:text="LibEvent v1.4.13: http://www.monkey.org/~provos/libevent/"
+			<TextView android:text="@string/libevent_version"
 				android:layout_width="fill_parent" 
 				android:layout_height="wrap_content"
 				android:autoLink="web"
 				android:textColorLink="#ffffff"
 				android:paddingLeft="15px"	
 				android:textColor="#ffffff" />	
-			<TextView android:text="Privoxy v3.0.12: http://www.privoxy.org"
+			<TextView android:text="@string/privoxy_version"
 				android:layout_width="fill_parent" 
 				android:layout_height="wrap_content"
 				android:autoLink="web"
 				android:textColorLink="#ffffff"
 				android:paddingLeft="15px"	
 				android:textColor="#ffffff" />	
-			<TextView android:text="Iptables v1.4.7: http://www.netfilter.org"
+			<TextView android:text="@string/iptables_version"
 				android:layout_width="fill_parent" 
 				android:layout_height="wrap_content"
 				android:autoLink="web"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 546be68..0cbd848 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -232,5 +232,14 @@
 <string name="hidden_service_ports">Hidden Service Ports</string>
 <string name="the_addressable_name_for_your_hidden_service_generated_automatically_">the addressable name for your hidden service (generated automatically)</string>
 <string name="enable_debug_log_to_output_must_use_adb_or_alogcat_to_view_">enable debug log to output (must use adb or aLogCat to view)</string>
-
+<string name="project_home">Project Home(s): </string>
+<string name="project_urls">https://www.torproject.org/docs/android\nhttps://guardianproject.info/apps/orbot/</string>
+<string name="the_tor_license">The Tor License</string>
+<string name="https_torproject_org">https://torproject.org</string>
+<string name="third_party_software">3rd-Party-Software: </string>
+<string name="tor_version">Tor v0.2.3.7-alpha: https://www.torproject.org</string>
+<string name="libevent_version">LibEvent v1.4.13: http://www.monkey.org/~provos/libevent/</string>
+<string name="privoxy_version">Privoxy v3.0.12: http://www.privoxy.org</string>
+<string name="iptables_version">Iptables v1.4.7: http://www.netfilter.org</string>
+<string name="hidden_service_request">An app wants to open hidden server port %S to the Tor network. This is safe if you trust the app.</string>
 </resources>
diff --git a/src/org/torproject/android/Orbot.java b/src/org/torproject/android/Orbot.java
index 8493f00..b7bb62f 100644
--- a/src/org/torproject/android/Orbot.java
+++ b/src/org/torproject/android/Orbot.java
@@ -3,9 +3,6 @@
 
 package org.torproject.android;
 
-
-
-
 import org.torproject.android.service.ITorService;
 import org.torproject.android.service.ITorServiceCallback;
 import org.torproject.android.service.TorServiceConstants;
@@ -253,30 +250,6 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
                 
         }
         
-        /* Return to the main view when the back key is pressed
-         * (non-Javadoc)
-         * @see android.app.Activity#onKeyDown(int, android.view.KeyEvent)
-         */
-        /*
-        public boolean onKeyDown(int keyCode, KeyEvent event){
-                
-                //yeah this should probably go away now :) - or not
-                if(keyCode==KeyEvent.KEYCODE_BACK){
-
-                        if(currentView != R.layout.layout_main){
-                                        
-                                        showMain ();
-                                        return true;
-                        }
-                        else{
-                                return super.onKeyDown(keyCode, event);
-                        }
-                }
-        
-                return super.onKeyDown(keyCode, event);
-                
-        }*/
- 
     /* (non-Javadoc)
 	 * @see android.app.Activity#onPause()
 	 */
@@ -405,7 +378,7 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
 
         	int hsPort = getIntent().getIntExtra("hs_port", -1);
 
-			String requestMsg = "An app wants to open a server port (" + hsPort + ") to the Tor network. This is safe if you trust the app.";
+			String requestMsg = getString(R.string.hidden_service_request, hsPort);
 			AlertDialog.Builder builder = new AlertDialog.Builder(this);
 			builder.setMessage(requestMsg).setPositiveButton("Allow", dialogClickListener)
 			    .setNegativeButton("Deny", dialogClickListener).show();
@@ -499,61 +472,62 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
     /*
      * Load the basic settings application to display torrc
      */
-        private void showSettings ()
-        {
-                
-                startActivityForResult(new Intent(this, SettingsPreferences.class), 1);
-        }
-        
-        
-        @Override
-        protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-                super.onActivityResult(requestCode, resultCode, data);
-                
-                //if we get a response from an activity we launched (like from line 527 where we launch the Settings/Prefs screen)
-                //and the resultCode matches our arbitrary 1010 value, AND Tor is running
-                //then update the preferences in an async background task
-                if (requestCode == 1 && resultCode == 1010 && mService != null)
-                {
-                        new ProcessSettingsAsyncTask().execute(mService);        
-                }
-        }
-        
-        AlertDialog aDialog = null;
-        
-        //general alert dialog for mostly Tor warning messages
-        //sometimes this can go haywire or crazy with too many error
-        //messages from Tor, and the user cannot stop or exit Orbot
-        //so need to ensure repeated error messages are not spamming this method
-        private void showAlert(String title, String msg, boolean button)
-        {
-                try
-                {
-                        if (aDialog != null && aDialog.isShowing())
-                                aDialog.dismiss();
-                }
-                catch (Exception e){} //swallow any errors
-                
-                 if (button)
-                 {
-                                aDialog = new AlertDialog.Builder(this)
-                         .setIcon(R.drawable.icon)
-                 .setTitle(title)
-                 .setMessage(msg)
-                 .setPositiveButton(android.R.string.ok, null)
-                 .show();
-                 }
-                 else
-                 {
-                         aDialog = new AlertDialog.Builder(this)
-                         .setIcon(R.drawable.icon)
-                 .setTitle(title)
-                 .setMessage(msg)
-                 .show();
-                 }
-        
-                 aDialog.setCanceledOnTouchOutside(true);
-        }
+    private void showSettings ()
+    {
+            
+            startActivityForResult(new Intent(this, SettingsPreferences.class), 1);
+    }
+    
+    
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+            super.onActivityResult(requestCode, resultCode, data);
+            
+            //if we get a response from an activity we launched (like from line 527 where we launch the Settings/Prefs screen)
+            //and the resultCode matches our arbitrary 1010 value, AND Tor is running
+            //then update the preferences in an async background task
+            if (requestCode == 1 && resultCode == 1010 && mService != null)
+            {
+                    new ProcessSettingsAsyncTask().execute(mService);        
+            }
+    }
+    
+    AlertDialog aDialog = null;
+    
+    //general alert dialog for mostly Tor warning messages
+    //sometimes this can go haywire or crazy with too many error
+    //messages from Tor, and the user cannot stop or exit Orbot
+    //so need to ensure repeated error messages are not spamming this method
+    private void showAlert(String title, String msg, boolean button)
+    {
+            try
+            {
+                    if (aDialog != null && aDialog.isShowing())
+                            aDialog.dismiss();
+            }
+            catch (Exception e){} //swallow any errors
+            
+             if (button)
+             {
+                            aDialog = new AlertDialog.Builder(this)
+                     .setIcon(R.drawable.icon)
+             .setTitle(title)
+             .setMessage(msg)
+             .setPositiveButton(android.R.string.ok, null)
+             .show();
+             }
+             else
+             {
+                     aDialog = new AlertDialog.Builder(this)
+                     .setIcon(R.drawable.icon)
+             .setTitle(title)
+             .setMessage(msg)
+             .show();
+             }
+    
+             aDialog.setCanceledOnTouchOutside(true);
+    }
+    
     /*
      * Set the state of the running/not running graphic and label
      * this all needs to be looked at w/ the shift to progressDialog
@@ -875,6 +849,7 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
     }
     
     //unbind removes the callback, and unbinds the service
+    /*
     private void unbindService ()
     {
             if (mIsBound) {
@@ -898,7 +873,7 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
             mIsBound = false;
             
         }
-    }
+    }*/
         
     private void createProgressDialog (String msg)
     {





More information about the tor-commits mailing list