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 Toolbar mToolbar;
|
||||
|
||||
|
||||
/* Some tracking bits */
|
||||
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 final static long INIT_DELAY = 100;
|
||||
private final static int REQUEST_VPN = 8888;
|
||||
|
||||
/** Called when the activity is first created. */
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -101,9 +101,6 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC
|
|||
|
||||
doLayout();
|
||||
|
||||
// appConflictChecker ();
|
||||
|
||||
|
||||
// Register to receive messages.
|
||||
// We are registering an observer (mMessageReceiver) to receive Intents
|
||||
// with actions named "custom-event-name".
|
||||
|
@ -221,8 +218,6 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC
|
|||
imgStatus.setOnLongClickListener(this);
|
||||
imgStatus.setOnTouchListener(this);
|
||||
|
||||
lblStatus.setText("Initializing the application...");
|
||||
|
||||
downloadText = (TextView)findViewById(R.id.trafficDown);
|
||||
uploadText = (TextView)findViewById(R.id.trafficUp);
|
||||
|
||||
|
@ -247,6 +242,15 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC
|
|||
});
|
||||
|
||||
mBtnVPN = (ToggleButton)findViewById(R.id.btnVPN);
|
||||
|
||||
boolean useVPN = mPrefs.getBoolean("pref_vpn", false);
|
||||
mBtnVPN.setChecked(useVPN);
|
||||
|
||||
if (useVPN)
|
||||
{
|
||||
startVpnService ();
|
||||
}
|
||||
|
||||
mBtnVPN.setOnClickListener(new View.OnClickListener ()
|
||||
{
|
||||
|
||||
|
@ -264,6 +268,7 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC
|
|||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
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)
|
||||
public void startVpnService ()
|
||||
{
|
||||
|
@ -870,10 +873,11 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC
|
|||
if (torServiceMsg.indexOf('%')!=-1)
|
||||
lblStatus.setText(torServiceMsg);
|
||||
|
||||
/**
|
||||
if (torServiceMsg != null && torServiceMsg.length() > 0)
|
||||
{
|
||||
mTxtOrbotLog.append(torServiceMsg + '\n');
|
||||
}
|
||||
}**/
|
||||
|
||||
boolean showFirstTime = mPrefs.getBoolean("connect_first_time",true);
|
||||
|
||||
|
|
Loading…
Reference in New Issue