commit f8532715c0388f0c17558939140299524dc49076
Author: Nathan Freitas <[email protected]>
Date:   Wed Apr 9 09:11:38 2014 -0400

    fix Service init/bind logic
    also remove updates for background drawing to save memory
---
 src/org/torproject/android/Orbot.java |   26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/src/org/torproject/android/Orbot.java 
b/src/org/torproject/android/Orbot.java
index f28328d..9bd504b 100644
--- a/src/org/torproject/android/Orbot.java
+++ b/src/org/torproject/android/Orbot.java
@@ -75,6 +75,12 @@ public class Orbot extends ActionBarActivity implements 
TorConstants, OnLongClic
        /* Tor Service interaction */
                /* The primary interface we will be calling on the service. */
     ITorService mService = null;
+
+    //should move this up with all the other class variables
+    private boolean mIsBound = false;
+    private Intent mTorService = null;
+    
+    
        private boolean autoStartFromIntent = false;
 
        SharedPreferences mPrefs;
@@ -89,6 +95,10 @@ public class Orbot extends ActionBarActivity implements 
TorConstants, OnLongClic
         setLocale();
         
        doLayout();
+
+       mTorService = new Intent(this, TorService.class);
+       getApplication().getApplicationContext().startService(mTorService);
+        
        }
        
        private void doLayout ()
@@ -800,7 +810,8 @@ public class Orbot extends ActionBarActivity implements 
TorConstants, OnLongClic
                                        if (torStatus != newTorStatus)
                                        {
                                            
imgStatus.setImageResource(R.drawable.toron);
-                                               
mViewMain.setBackgroundResource(R.drawable.onionrootonly);                      
                                            
+                                       //      
mViewMain.setBackgroundResource(R.drawable.onionrootonly);    
+                                               
                                            String lblMsg = 
getString(R.string.status_activated);                                     
                                            lblStatus.setText(lblMsg);
 
@@ -842,7 +853,7 @@ public class Orbot extends ActionBarActivity implements 
TorConstants, OnLongClic
                                if (torStatus != newTorStatus)
                                {
                                     
imgStatus.setImageResource(R.drawable.torstarting);
-                                       
mViewMain.setBackgroundResource(R.drawable.onionrootonlygold);
+                            //         
mViewMain.setBackgroundResource(R.drawable.onionrootonlygold);
 
                                     if (mItemOnOff != null)
                                             
mItemOnOff.setTitle(R.string.menu_stop);
@@ -858,7 +869,7 @@ public class Orbot extends ActionBarActivity implements 
TorConstants, OnLongClic
                             }
                             else if (torStatus != newTorStatus)
                             {
-                                       
mViewMain.setBackgroundResource(R.drawable.onionrootonlygrey);                  
                
+                               //      
mViewMain.setBackgroundResource(R.drawable.onionrootonlygrey);                  
                
                                 imgStatus.setImageResource(R.drawable.toroff);
                                 
lblStatus.setText(getString(R.string.status_disabled) + "\n" + 
getString(R.string.press_to_start));
                                 
@@ -1130,21 +1141,14 @@ public class Orbot extends ActionBarActivity implements 
TorConstants, OnLongClic
         }
     };
     
-    //should move this up with all the other class variables
-    boolean mIsBound = false;
-    
     //this is where we bind! 
     private void bindService ()
     {
         
-       Intent iTorService = new Intent(this, TorService.class);
-
-       getApplication().getApplicationContext().startService(iTorService);
-        
          //since its auto create, we prob don't ever need to call startService
          //also we should again be consistent with using either 
iTorService.class.getName()
          //or the variable constant       
-         bindService(iTorService,
+         bindService(mTorService,
              mConnection, Context.BIND_AUTO_CREATE);
          
          mIsBound = true;



_______________________________________________
tor-commits mailing list
[email protected]
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits

Reply via email to