move the controls to the left sidebar; improve VPN mode more
This commit is contained in:
parent
c76d935cc3
commit
345aea9ad2
|
@ -322,17 +322,9 @@ public class OrbotMainActivity extends AppCompatActivity
|
|||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
|
||||
{
|
||||
enableVPN(isChecked);
|
||||
|
||||
Prefs.putUseVpn(isChecked);
|
||||
|
||||
if (isChecked) {
|
||||
if (mIsLollipop) //let the user choose the apps
|
||||
startActivityForResult(new Intent(OrbotMainActivity.this, AppManager.class),REQUEST_VPN_APPS_SELECT);
|
||||
else
|
||||
startActivity(new Intent(OrbotMainActivity.this, VPNEnableActivity.class));
|
||||
}
|
||||
else
|
||||
stopVpnService();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -551,6 +543,19 @@ public class OrbotMainActivity extends AppCompatActivity
|
|||
|
||||
}
|
||||
|
||||
private void enableVPN (boolean enable)
|
||||
{
|
||||
Prefs.putUseVpn(enable);
|
||||
|
||||
if (enable) {
|
||||
if (mIsLollipop) //let the user choose the apps
|
||||
startActivityForResult(new Intent(OrbotMainActivity.this, AppManager.class), REQUEST_VPN_APPS_SELECT);
|
||||
else
|
||||
startActivity(new Intent(OrbotMainActivity.this, VPNEnableActivity.class));
|
||||
} else
|
||||
stopVpnService();
|
||||
}
|
||||
|
||||
private void enableHiddenServicePort (int hsPort) throws RemoteException, InterruptedException
|
||||
{
|
||||
|
||||
|
@ -758,7 +763,6 @@ public class OrbotMainActivity extends AppCompatActivity
|
|||
else
|
||||
{
|
||||
AlertDialog aDialog = new AlertDialog.Builder(OrbotMainActivity.this)
|
||||
.setIcon(R.drawable.onion32)
|
||||
.setTitle(R.string.install_apps_)
|
||||
.setMessage(R.string.it_doesn_t_seem_like_you_have_orweb_installed_want_help_with_that_or_should_we_just_open_the_browser_)
|
||||
.setPositiveButton(R.string.install_orweb, new Dialog.OnClickListener ()
|
||||
|
@ -777,6 +781,13 @@ public class OrbotMainActivity extends AppCompatActivity
|
|||
}
|
||||
|
||||
})
|
||||
.setNeutralButton(R.string.apps_mode, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// enableVPN(true);
|
||||
mBtnVPN.setChecked(true);
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.standard_browser, new Dialog.OnClickListener ()
|
||||
{
|
||||
|
||||
|
@ -864,8 +875,9 @@ public class OrbotMainActivity extends AppCompatActivity
|
|||
}
|
||||
else if (request == REQUEST_VPN)
|
||||
{
|
||||
if (response == RESULT_OK)
|
||||
sendIntentToService(TorServiceConstants.CMD_VPN);
|
||||
if (response == RESULT_OK) {
|
||||
sendIntentToService(TorServiceConstants.CMD_VPN);
|
||||
}
|
||||
else
|
||||
{
|
||||
Prefs.putUseVpn(false);
|
||||
|
@ -949,27 +961,17 @@ public class OrbotMainActivity extends AppCompatActivity
|
|||
enableBridges(true);
|
||||
|
||||
break;
|
||||
case 1: //obfs3
|
||||
setupBridgeType("obfs3");
|
||||
enableBridges(true);
|
||||
|
||||
break;
|
||||
case 2: //scramblesuit
|
||||
setupBridgeType("scramblesuit");
|
||||
enableBridges(true);
|
||||
|
||||
break;
|
||||
case 3: //azure
|
||||
case 1: //azure
|
||||
Prefs.setBridgesList("2");
|
||||
enableBridges(true);
|
||||
|
||||
break;
|
||||
case 4: //amazon
|
||||
case 2: //amazon
|
||||
Prefs.setBridgesList("1");
|
||||
enableBridges(true);
|
||||
|
||||
break;
|
||||
case 5:
|
||||
case 3:
|
||||
showGetBridgePrompt("obfs4");
|
||||
|
||||
break;
|
||||
|
@ -1224,7 +1226,7 @@ public class OrbotMainActivity extends AppCompatActivity
|
|||
} else if (torStatus == TorServiceConstants.STATUS_OFF) {
|
||||
|
||||
imgStatus.setImageResource(R.drawable.toroff);
|
||||
lblStatus.setText(getString(R.string.press_to_start));
|
||||
// lblStatus.setText(getString(R.string.press_to_start));
|
||||
mBtnBrowser.setEnabled(false);
|
||||
|
||||
mBtnStart.setText(R.string.menu_start);
|
||||
|
|
|
@ -27,6 +27,7 @@ import android.support.v7.app.ActionBarActivity;
|
|||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -128,6 +129,20 @@ public class AppManager extends AppCompatActivity implements OnCheckedChangeList
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
setResult(RESULT_OK);
|
||||
finish();
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
|
|
@ -9,6 +9,6 @@
|
|||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_margin="3dp"
|
||||
android:layout_margin="6dp"
|
||||
/>
|
||||
</ScrollView>
|
|
@ -34,8 +34,9 @@
|
|||
android:id="@+id/frameMain"
|
||||
android:visibility="visible"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_horizontal|center_vertical"
|
||||
>
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true">
|
||||
<org.torproject.android.ui.ImageProgressView
|
||||
android:id="@+id/imgStatus"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -76,166 +77,14 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="bottom"
|
||||
android:layout_gravity="bottom"
|
||||
android:padding="3dp"
|
||||
android:background="#454545"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true">
|
||||
|
||||
<LinearLayout android:gravity="center_horizontal"
|
||||
android:orientation="horizontal" android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
>
|
||||
|
||||
|
||||
|
||||
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/btnVPN"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/menu_vpn"
|
||||
android:layout_margin="3dp"
|
||||
android:singleLine="true"
|
||||
app:switchPadding="9dp"
|
||||
|
||||
/>
|
||||
|
||||
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/btnBridges"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/bridges"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:singleLine="true"
|
||||
app:switchPadding="9dp"
|
||||
/>
|
||||
<Spinner
|
||||
android:id="@+id/spinnerCountry"
|
||||
android:layout_width="140dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginBottom="3dp"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lblStatus"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:gravity="center_horizontal"
|
||||
android:fontFamily="sans-serif-light"
|
||||
android:text=""
|
||||
android:lines="2"
|
||||
android:maxLines="2"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_margin="0dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<!--
|
||||
<TextView android:id="@+id/lblStatus"
|
||||
android:text="status status status"
|
||||
android:gravity="center_horizontal"
|
||||
android:textSize="20sp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_marginRight="40dp"
|
||||
android:textColor="#ffffff"
|
||||
android:maxLines="1"
|
||||
android:orientation="vertical"
|
||||
android:fontFamily="sans-serif-light"
|
||||
/>
|
||||
-->
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rowTrafficDown"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="3sp"
|
||||
android:paddingRight="3sp"
|
||||
|
||||
>
|
||||
<TextView
|
||||
android:id="@+id/trafficLabelDown"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:textSize="15sp"
|
||||
android:text="@string/main_layout_download"
|
||||
android:gravity="center_vertical"
|
||||
android:fontFamily="sans-serif-light" />
|
||||
<TextView
|
||||
android:id="@+id/trafficLabelUp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:text="@string/main_layout_upload"
|
||||
android:textSize="15sp"
|
||||
android:gravity="center_vertical"
|
||||
android:fontFamily="sans-serif-light" />
|
||||
|
||||
</RelativeLayout>
|
||||
<RelativeLayout
|
||||
android:id="@+id/rowTrafficUp"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="3sp"
|
||||
android:paddingRight="3sp"
|
||||
android:paddingBottom="3sp"
|
||||
|
||||
>
|
||||
<TextView
|
||||
android:id="@+id/trafficDown"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:textSize="15sp"
|
||||
android:gravity="center_vertical"
|
||||
android:fontFamily="sans-serif-light"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/trafficUp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:textSize="15sp"
|
||||
android:gravity="center_vertical"
|
||||
android:fontFamily="sans-serif-light"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="320dp"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:id="@+id/left_drawer"
|
||||
|
@ -243,6 +92,9 @@
|
|||
android:background="#333333"
|
||||
>
|
||||
|
||||
<include layout="@layout/layout_orbot_control"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -252,7 +104,14 @@
|
|||
android:id="@+id/right_drawer"
|
||||
android:layout_gravity="end"
|
||||
android:background="#333333"
|
||||
android:padding="6dp"
|
||||
>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/menu_log"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/orbotLog"
|
||||
android:textSize="12sp"
|
||||
|
|
|
@ -0,0 +1,124 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="3dp">
|
||||
|
||||
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/btnVPN"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/apps_mode"
|
||||
android:layout_margin="12dp"
|
||||
android:singleLine="true"
|
||||
app:switchPadding="9dp"
|
||||
/>
|
||||
|
||||
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/btnBridges"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/bridges"
|
||||
android:layout_margin="12dp"
|
||||
android:singleLine="true"
|
||||
app:switchPadding="9dp"
|
||||
/>
|
||||
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinnerCountry"
|
||||
android:layout_width="220dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="12dp"
|
||||
android:layout_marginLeft="9dp"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rowTrafficDown"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="3sp"
|
||||
android:paddingRight="3sp"
|
||||
android:layout_margin="12dp"
|
||||
>
|
||||
<TextView
|
||||
android:id="@+id/trafficLabelDown"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:textSize="15sp"
|
||||
android:text="@string/main_layout_download"
|
||||
android:gravity="center_vertical"
|
||||
android:fontFamily="sans-serif-light" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/trafficDown"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:textSize="15sp"
|
||||
android:gravity="center_vertical"
|
||||
android:fontFamily="sans-serif-light"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
<RelativeLayout
|
||||
android:id="@+id/rowTrafficUp"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="3sp"
|
||||
android:paddingRight="3sp"
|
||||
android:paddingBottom="3sp"
|
||||
android:layout_margin="12dp"
|
||||
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/trafficLabelUp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:text="@string/main_layout_upload"
|
||||
android:textSize="15sp"
|
||||
android:gravity="center_vertical"
|
||||
android:fontFamily="sans-serif-light" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/trafficUp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:textSize="15sp"
|
||||
android:gravity="center_vertical"
|
||||
android:fontFamily="sans-serif-light"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lblStatus"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="sans-serif-light"
|
||||
android:text=""
|
||||
android:lines="2"
|
||||
android:maxLines="2"
|
||||
android:layout_margin="12dp"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
<string-array name="bridge_options">
|
||||
<item>Obfs4 (Best)</item>
|
||||
<item>Obfs3</item>
|
||||
<item>ScrambleSuit</item>
|
||||
<item>Tunnel through Azure</item>
|
||||
<item>Tunnel through Amazon</item>
|
||||
<item>Get New Bridges</item>
|
||||
|
|
Loading…
Reference in New Issue