update VPN to toggle button
This commit is contained in:
parent
17f2a0bdac
commit
ec4350ee40
|
@ -170,12 +170,12 @@
|
||||||
android:text="Open Browser"
|
android:text="Open Browser"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Button
|
<ToggleButton
|
||||||
android:id="@+id/btnVPN"
|
android:id="@+id/btnVPN"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Start VPN"
|
android:textOff="VPN Off"
|
||||||
|
android:textOn="VPN On"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -58,6 +58,7 @@ import android.view.animation.AccelerateInterpolator;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
import android.widget.ToggleButton;
|
||||||
|
|
||||||
|
|
||||||
public class OrbotMainActivity extends Activity implements TorConstants, OnLongClickListener, OnTouchListener, OnSharedPreferenceChangeListener
|
public class OrbotMainActivity extends Activity implements TorConstants, OnLongClickListener, OnTouchListener, OnSharedPreferenceChangeListener
|
||||||
|
@ -73,8 +74,8 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC
|
||||||
private TextView mTxtOrbotLog = null;
|
private TextView mTxtOrbotLog = null;
|
||||||
|
|
||||||
private Button mBtnBrowser = null;
|
private Button mBtnBrowser = null;
|
||||||
private Button mBtnVPN = null;
|
private ToggleButton mBtnVPN = null;
|
||||||
|
|
||||||
private DrawerLayout mDrawer;
|
private DrawerLayout mDrawer;
|
||||||
private ActionBarDrawerToggle mDrawerToggle;
|
private ActionBarDrawerToggle mDrawerToggle;
|
||||||
private Toolbar mToolbar;
|
private Toolbar mToolbar;
|
||||||
|
@ -246,14 +247,17 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
mBtnVPN = (Button)findViewById(R.id.btnVPN);
|
mBtnVPN = (ToggleButton)findViewById(R.id.btnVPN);
|
||||||
mBtnVPN.setOnClickListener(new View.OnClickListener ()
|
mBtnVPN.setOnClickListener(new View.OnClickListener ()
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
|
||||||
startVpnService();
|
if (mBtnVPN.isChecked())
|
||||||
|
startVpnService();
|
||||||
|
else
|
||||||
|
stopVpnService();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -807,6 +811,11 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void stopVpnService ()
|
||||||
|
{
|
||||||
|
startService(TorServiceConstants.CMD_VPN_CLEAR);
|
||||||
|
}
|
||||||
|
|
||||||
private boolean flushTransProxy ()
|
private boolean flushTransProxy ()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue