commit d9bd32a646c7ad9c698dfd898589dacaac3694b5 Author: n8fr8 nathan@freitas.net Date: Fri Dec 8 16:11:34 2017 -0500
more UI updates --- .../org/torproject/android/OrbotMainActivity.java | 52 ++++--- app/src/main/res/layout/layout_main.xml | 160 +++++++++++++++++---- app/src/main/res/layout/layout_orbot_control.xml | 99 ------------- app/src/main/res/values/strings.xml | 4 +- 4 files changed, 166 insertions(+), 149 deletions(-)
diff --git a/app/src/main/java/org/torproject/android/OrbotMainActivity.java b/app/src/main/java/org/torproject/android/OrbotMainActivity.java index 88637331..1b006ae6 100644 --- a/app/src/main/java/org/torproject/android/OrbotMainActivity.java +++ b/app/src/main/java/org/torproject/android/OrbotMainActivity.java @@ -70,6 +70,7 @@ import android.util.AttributeSet; import android.util.Log; import android.view.GestureDetector; import android.view.GestureDetector.SimpleOnGestureListener; +import android.view.Gravity; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; @@ -264,23 +265,30 @@ public class OrbotMainActivity extends AppCompatActivity setSupportActionBar(toolbar);
mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout); + /** mDrawerToggle = new ActionBarDrawerToggle( this, mDrawer, toolbar, R.string.btn_okay, R.string.btn_cancel - ); + );**/
- getSupportActionBar().setDisplayHomeAsUpEnabled(true); - getSupportActionBar().setHomeButtonEnabled(true); + //getSupportActionBar().setDisplayHomeAsUpEnabled(true); + //getSupportActionBar().setHomeButtonEnabled(true);
- mDrawer.setDrawerListener(mDrawerToggle); - mDrawerToggle.syncState(); + //mDrawer.setDrawerListener(mDrawerToggle); + //mDrawerToggle.syncState();
mTxtOrbotLog = (TextView)findViewById(R.id.orbotLog);
lblStatus = (TextView)findViewById(R.id.lblStatus); - lblStatus.setOnLongClickListener(this); + lblStatus.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + mDrawer.openDrawer(Gravity.RIGHT); + } + }); + imgStatus = (ImageProgressView)findViewById(R.id.imgStatus); imgStatus.setOnLongClickListener(this); imgStatus.setOnTouchListener(this); @@ -432,7 +440,6 @@ public class OrbotMainActivity extends AppCompatActivity
});
- ((TextView)findViewById(R.id.torInfo)).setText("Tor v" + BINARY_TOR_VERSION);
mPulsator = (PulsatorLayout) findViewById(R.id.pulsator);
@@ -1327,9 +1334,8 @@ public class OrbotMainActivity extends AppCompatActivity } else if (torStatus == TorServiceConstants.STATUS_OFF) {
imgStatus.setImageResource(R.drawable.toroff); - + lblStatus.setText("Tor v" + BINARY_TOR_VERSION); mBtnStart.setText(R.string.menu_start); - mPulsator.start();
} @@ -1388,20 +1394,7 @@ public class OrbotMainActivity extends AppCompatActivity @Override public void handleMessage(final Message msg) { - String newTorStatus = msg.getData().getString("status"); - String log = (String)msg.obj;
- if (torStatus == null && newTorStatus != null) //first time status - { - findViewById(R.id.frameMain).setVisibility(View.VISIBLE); - updateStatus(log, newTorStatus); - - //now you can handle the intents properly - handleIntents(); - - } - else - updateStatus(log, newTorStatus);
switch (msg.what) { case MESSAGE_TRAFFIC_COUNT: @@ -1417,7 +1410,22 @@ public class OrbotMainActivity extends AppCompatActivity
break; default: + String newTorStatus = msg.getData().getString("status"); + String log = (String)msg.obj; + + if (torStatus == null && newTorStatus != null) //first time status + { + findViewById(R.id.frameMain).setVisibility(View.VISIBLE); + updateStatus(log, newTorStatus); + + //now you can handle the intents properly + handleIntents(); + + } + else + updateStatus(log, newTorStatus); super.handleMessage(msg); + break; } } }; diff --git a/app/src/main/res/layout/layout_main.xml b/app/src/main/res/layout/layout_main.xml index a955fd0a..535efa7a 100644 --- a/app/src/main/res/layout/layout_main.xml +++ b/app/src/main/res/layout/layout_main.xml @@ -68,30 +68,54 @@ /> </FrameLayout>
+ <TextView + android:id="@+id/lblStatus" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:textSize="14sp" + android:fontFamily="sans-serif-light" + android:lines="1" + android:text="[ ]" + android:maxLines="1" + android:layout_margin="12dp" + android:ellipsize="end" + android:layout_gravity="top|center" + android:gravity="center" + android:layout_below="@+id/frameMain" + /> + <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" - android:layout_below="@+id/frameMain" + android:layout_below="@+id/lblStatus" android:id="@+id/controls"
>
<LinearLayout android:id="@+id/spinnerBox" - android:layout_gravity="left" + android:layout_gravity="center" android:orientation="vertical" - android:layout_width="170sp" + android:layout_width="170dp" android:layout_height="100dp" android:background="#11CCCCCC" android:layout_margin="3dp" android:layout_weight="1" > +<TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Select Region" + android:layout_margin="12dp" + + /> <Spinner android:id="@+id/spinnerCountry" - android:layout_width="140dp" + android:layout_width="165dp" android:layout_height="wrap_content" android:layout_margin="12dp" + />
</LinearLayout> @@ -99,9 +123,9 @@
<LinearLayout android:id="@+id/row_vpn" - android:layout_gravity="right" + android:layout_gravity="center" android:orientation="vertical" - android:layout_width="170sp" + android:layout_width="170dp" android:layout_height="100dp" android:background="#11CCCCCC" android:layout_margin="3dp" @@ -131,42 +155,126 @@ </LinearLayout>
</LinearLayout> - <TextView - android:id="@+id/lblStatus" + + + + <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:textSize="14sp" - android:fontFamily="sans-serif-light" - android:lines="1" - android:text="[ ]" - android:maxLines="1" - android:layout_margin="12dp" - android:ellipsize="end" - android:layout_gravity="top|center" - android:gravity="center" + android:orientation="horizontal" android:layout_below="@+id/controls" - /> + android:id="@+id/traffic"
+ >
+ <LinearLayout + android:layout_gravity="center" + android:orientation="horizontal" + android:layout_width="170dp" + android:layout_height="wrap_content" + android:layout_margin="3dp" + android:layout_weight="1" + > + <TextView + android:id="@+id/trafficLabelDown" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/main_layout_download" + android:gravity="center" + android:fontFamily="sans-serif-light" + android:layout_margin="3dp" + android:lines="1"
+ />
-</RelativeLayout> + <TextView + android:id="@+id/trafficDown" + android:layout_width="100dp" + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:fontFamily="sans-serif-light" + android:text="0kbps" + android:layout_margin="3dp" + android:lines="1" + + /> + </LinearLayout>
<LinearLayout - android:layout_width="250dp" - android:layout_height="match_parent" - android:orientation="vertical" - android:id="@+id/left_drawer" - android:layout_gravity="start" - android:background="#333333" + android:layout_gravity="center" + android:orientation="horizontal" + android:layout_width="170dp" + android:layout_height="wrap_content" + android:layout_margin="3dp" + android:layout_weight="1" + > + <TextView + android:id="@+id/trafficLabelUp" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/main_layout_upload" + android:gravity="center_vertical" + android:fontFamily="sans-serif-light" + android:layout_margin="3dp" + />
- <include layout="@layout/layout_orbot_control"/> + <TextView + android:id="@+id/trafficUp" + android:layout_width="100dp" + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:fontFamily="sans-serif-light" + android:text="0kbps" + android:layout_margin="3dp" + android:lines="1"
+ />
</LinearLayout> + + </LinearLayout> + + <LinearLayout + android:id="@+id/row_bridges" + android:gravity="center_horizontal" + android:orientation="horizontal" + android:layout_width="match_parent" + android:layout_height="40dp" + android:background="#11CCCCCC" + android:layout_margin="3dp" + android:layout_weight="1" + android:layout_below="@+id/traffic" + > + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:fontFamily="sans-serif-light" + android:text="Having trouble connecting?" + android:layout_margin="3dp" + android:lines="1" + + /> + <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_margin="3dp" + android:singleLine="true" + app:switchPadding="9dp" + android:gravity="center_vertical" + /> + </LinearLayout> + + + +</RelativeLayout> + + <LinearLayout android:layout_width="320dp" diff --git a/app/src/main/res/layout/layout_orbot_control.xml b/app/src/main/res/layout/layout_orbot_control.xml index 0e40e49c..6e434590 100644 --- a/app/src/main/res/layout/layout_orbot_control.xml +++ b/app/src/main/res/layout/layout_orbot_control.xml @@ -5,105 +5,6 @@ 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/btnBridges" - android:layout_width="200dp" - android:layout_height="wrap_content" - android:text="@string/bridges" - android:layout_margin="12dp" - android:singleLine="true" - app:switchPadding="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> - - <RelativeLayout - 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/torInfo" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentLeft="true" - android:text="" - android:textSize="15sp" - android:gravity="center_vertical" - android:fontFamily="sans-serif-light" /> - </RelativeLayout> - - </LinearLayout> - </LinearLayout> \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0a6c8db1..94b9a303 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -320,7 +320,7 @@
<string name="activate">Activate</string>
- <string name="apps_mode">Apps VPN Mode</string> + <string name="apps_mode">VPN Mode</string>
<string name="you_can_enable_all_apps_on_your_device_to_run_through_the_tor_network_using_the_vpn_feature_of_android_">You can enable all apps on your device to run through the Tor network using the VPN feature of Android.\n\n*WARNING* This is a new, experimental feature and in some cases may not start automatically, or may stop. It should NOT be used for anonymity, and ONLY used for getting through firewalls and filters.</string>
@@ -334,7 +334,7 @@
<string name="note_only_standard_tor_bridges_work_on_intel_x86_atom_devices">NOTE: Only standard Tor bridges work on Intel X86/ATOM devices</string>
- <string name="vpn_default_world">World (Location)</string> + <string name="vpn_default_world">Global (Auto)</string> <string name="hidden_services">Hidden Services</string> <string name="title_activity_hidden_services">Hidden Services</string> <string name="menu_hidden_services">Hidden Services</string>
tor-commits@lists.torproject.org