improve VPN activation
This commit is contained in:
		
							parent
							
								
									b1294f6d60
								
							
						
					
					
						commit
						a2662c325d
					
				|  | @ -80,7 +80,6 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC | ||||||
| 	private ActionBarDrawerToggle mDrawerToggle; | 	private ActionBarDrawerToggle mDrawerToggle; | ||||||
| 	private Toolbar mToolbar; | 	private Toolbar mToolbar; | ||||||
| 		 | 		 | ||||||
| 	 |  | ||||||
|     /* Some tracking bits */ |     /* Some tracking bits */ | ||||||
|     private int torStatus = TorServiceConstants.STATUS_OFF; //latest status reported from the tor service |     private int torStatus = TorServiceConstants.STATUS_OFF; //latest status reported from the tor service | ||||||
|      |      | ||||||
|  | @ -89,6 +88,7 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC | ||||||
|     private boolean autoStartFromIntent = false; |     private boolean autoStartFromIntent = false; | ||||||
|      |      | ||||||
|     private final static long INIT_DELAY = 100; |     private final static long INIT_DELAY = 100; | ||||||
|  |     private final static int REQUEST_VPN = 8888; | ||||||
|      |      | ||||||
|     /** Called when the activity is first created. */ |     /** Called when the activity is first created. */ | ||||||
|     public void onCreate(Bundle savedInstanceState) { |     public void onCreate(Bundle savedInstanceState) { | ||||||
|  | @ -101,9 +101,6 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC | ||||||
|          |          | ||||||
|     	doLayout(); |     	doLayout(); | ||||||
| 
 | 
 | ||||||
|     //	appConflictChecker (); |  | ||||||
|     	 |  | ||||||
| 
 |  | ||||||
|   	  // Register to receive messages. |   	  // Register to receive messages. | ||||||
|   	  // We are registering an observer (mMessageReceiver) to receive Intents |   	  // We are registering an observer (mMessageReceiver) to receive Intents | ||||||
|   	  // with actions named "custom-event-name". |   	  // with actions named "custom-event-name". | ||||||
|  | @ -221,8 +218,6 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC | ||||||
|         imgStatus.setOnLongClickListener(this); |         imgStatus.setOnLongClickListener(this); | ||||||
|         imgStatus.setOnTouchListener(this); |         imgStatus.setOnTouchListener(this); | ||||||
|          |          | ||||||
|         lblStatus.setText("Initializing the application..."); |  | ||||||
|          |  | ||||||
|         downloadText = (TextView)findViewById(R.id.trafficDown); |         downloadText = (TextView)findViewById(R.id.trafficDown); | ||||||
|         uploadText = (TextView)findViewById(R.id.trafficUp); |         uploadText = (TextView)findViewById(R.id.trafficUp); | ||||||
|          |          | ||||||
|  | @ -247,6 +242,15 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC | ||||||
| 		}); | 		}); | ||||||
| 		 | 		 | ||||||
| 		mBtnVPN = (ToggleButton)findViewById(R.id.btnVPN); | 		mBtnVPN = (ToggleButton)findViewById(R.id.btnVPN); | ||||||
|  | 		 | ||||||
|  | 		boolean useVPN = mPrefs.getBoolean("pref_vpn", false); | ||||||
|  | 		mBtnVPN.setChecked(useVPN); | ||||||
|  | 		 | ||||||
|  | 		if (useVPN) | ||||||
|  | 		{ | ||||||
|  | 			startVpnService (); | ||||||
|  | 		} | ||||||
|  | 		 | ||||||
| 		mBtnVPN.setOnClickListener(new View.OnClickListener () | 		mBtnVPN.setOnClickListener(new View.OnClickListener () | ||||||
| 		{ | 		{ | ||||||
| 
 | 
 | ||||||
|  | @ -264,6 +268,7 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC | ||||||
| 		}); | 		}); | ||||||
| 		 | 		 | ||||||
| 		 | 		 | ||||||
|  | 
 | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     GestureDetector mGestureDetector; |     GestureDetector mGestureDetector; | ||||||
|  | @ -760,8 +765,6 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC | ||||||
|          |          | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     private final static int REQUEST_VPN = 8888; |  | ||||||
|      |  | ||||||
|     @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) |     @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) | ||||||
|     public void startVpnService () |     public void startVpnService () | ||||||
|     { |     { | ||||||
|  | @ -870,10 +873,11 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC | ||||||
|                             	if (torServiceMsg.indexOf('%')!=-1) |                             	if (torServiceMsg.indexOf('%')!=-1) | ||||||
|                             		lblStatus.setText(torServiceMsg); |                             		lblStatus.setText(torServiceMsg); | ||||||
|                          |                          | ||||||
|  |                             /** | ||||||
|                             if (torServiceMsg != null && torServiceMsg.length() > 0) |                             if (torServiceMsg != null && torServiceMsg.length() > 0) | ||||||
|                             { |                             { | ||||||
|                             	mTxtOrbotLog.append(torServiceMsg + '\n'); |                             	mTxtOrbotLog.append(torServiceMsg + '\n'); | ||||||
|                             } |                             }**/ | ||||||
|                              |                              | ||||||
|                             boolean showFirstTime = mPrefs.getBoolean("connect_first_time",true); |                             boolean showFirstTime = mPrefs.getBoolean("connect_first_time",true); | ||||||
|                              |                              | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue