[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [orbot/master] put browser button back in
commit c1ffdbb4e79320891b28810498207b7faa39e8c0
Author: Nathan Freitas <nathan@xxxxxxxxxxx>
Date: Mon Oct 24 10:50:14 2016 -0400
put browser button back in
---
.../org/torproject/android/OrbotMainActivity.java | 43 ++++--
app/src/main/res/layout/layout_main.xml | 169 +++++++++++++--------
2 files changed, 136 insertions(+), 76 deletions(-)
diff --git a/app/src/main/java/org/torproject/android/OrbotMainActivity.java b/app/src/main/java/org/torproject/android/OrbotMainActivity.java
index 556179a..5aa4cec 100644
--- a/app/src/main/java/org/torproject/android/OrbotMainActivity.java
+++ b/app/src/main/java/org/torproject/android/OrbotMainActivity.java
@@ -90,8 +90,10 @@ public class OrbotMainActivity extends AppCompatActivity
private TextView uploadText = null;
private TextView mTxtOrbotLog = null;
- // private Button mBtnBrowser = null;
- private SwitchCompat mBtnVPN = null;
+ private Button mBtnBrowser = null;
+ private Button mBtnStart = null;
+
+ private SwitchCompat mBtnVPN = null;
private SwitchCompat mBtnBridges = null;
private Spinner spnCountries = null;
@@ -258,7 +260,24 @@ public class OrbotMainActivity extends AppCompatActivity
// Gesture detection
mGestureDetector = new GestureDetector(this, new MyGestureDetector());
- /**
+
+ mBtnStart =(Button)findViewById(R.id.btnStart);
+ mBtnStart.setOnClickListener(new View.OnClickListener()
+ {
+ @Override
+ public void onClick(View v) {
+
+ if (torStatus == TorServiceConstants.STATUS_OFF) {
+ lblStatus.setText(getString(R.string.status_starting_up));
+ startTor();
+ } else {
+ lblStatus.setText(getString(R.string.status_shutting_down));
+ stopTor();
+ }
+
+ }
+ });
+
mBtnBrowser = (Button)findViewById(R.id.btnBrowser);
mBtnBrowser.setOnClickListener(new View.OnClickListener ()
{
@@ -272,7 +291,6 @@ public class OrbotMainActivity extends AppCompatActivity
});
mBtnBrowser.setEnabled(false);
- */
mBtnVPN = (SwitchCompat)findViewById(R.id.btnVPN);
@@ -1125,12 +1143,14 @@ public class OrbotMainActivity extends AppCompatActivity
imgStatus.setImageResource(R.drawable.toron);
- //mBtnBrowser.setEnabled(true);
+ mBtnBrowser.setEnabled(true);
+ mBtnStart.setText(R.string.menu_stop);
if (torServiceMsg != null)
{
- if (torServiceMsg.contains(TorServiceConstants.LOG_NOTICE_HEADER))
- lblStatus.setText(torServiceMsg);
+ if (torServiceMsg.contains(TorServiceConstants.LOG_NOTICE_HEADER)) {
+ lblStatus.setText(torServiceMsg);
+ }
}
else
lblStatus.setText(getString(R.string.status_activated));
@@ -1171,7 +1191,7 @@ public class OrbotMainActivity extends AppCompatActivity
else
lblStatus.setText(getString(R.string.status_starting_up));
- // mBtnBrowser.setEnabled(false);
+ mBtnBrowser.setEnabled(false);
} else if (torStatus == TorServiceConstants.STATUS_STOPPING) {
@@ -1180,13 +1200,16 @@ public class OrbotMainActivity extends AppCompatActivity
imgStatus.setImageResource(R.drawable.torstarting);
lblStatus.setText(torServiceMsg);
- // mBtnBrowser.setEnabled(false);
+ mBtnBrowser.setEnabled(false);
} else if (torStatus == TorServiceConstants.STATUS_OFF) {
imgStatus.setImageResource(R.drawable.toroff);
lblStatus.setText(getString(R.string.press_to_start));
-// mBtnBrowser.setEnabled(false);
+ mBtnBrowser.setEnabled(false);
+
+ mBtnStart.setText(R.string.menu_start);
+
}
if (torServiceMsg != null && torServiceMsg.length() > 0)
diff --git a/app/src/main/res/layout/layout_main.xml b/app/src/main/res/layout/layout_main.xml
index b834135..8692bc1 100644
--- a/app/src/main/res/layout/layout_main.xml
+++ b/app/src/main/res/layout/layout_main.xml
@@ -18,10 +18,9 @@
android:layout_height="match_parent"
>
-<LinearLayout
+<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:orientation="vertical"
android:id="@+id/content_frame"
>
@@ -59,84 +58,107 @@ android:layout_gravity="center_horizontal|center_vertical"/>
android:layout_margin="0dp"
android:src="@drawable/toroff" />
- <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"
- />
-
+
+
<LinearLayout android:gravity="center_horizontal"
- android:orientation="horizontal" android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:orientation="horizontal" android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+
+ >
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/menu_start"
+ android:id="@+id/btnStart"
+
+ />
- >
- <!--
<Button
android:id="@+id/btnBrowser"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="@string/menu_verify_browser"
- android:layout_marginTop="3dp"
- android:layout_marginBottom="3dp"
+ android:text="@string/menu_browse"
android:ellipsize="end"
android:singleLine="true"
- />-->
-
-
- <android.support.v7.widget.SwitchCompat
- android:id="@+id/btnVPN"
- android:layout_width="100dp"
- android:layout_height="wrap_content"
- android:text="@string/menu_vpn"
- android:layout_margin="3dp"
- android:ellipsize="end"
- android:singleLine="true"
- />
-
-
- <android.support.v7.widget.SwitchCompat
- android:id="@+id/btnBridges"
- android:layout_width="100dp"
- android:layout_height="wrap_content"
- android:text="@string/bridges"
- android:layout_marginTop="3dp"
- android:layout_marginLeft="25dp"
- android:layout_marginBottom="3dp"
- android:ellipsize="end"
- android:singleLine="true"
- />
-
+ />
+ </LinearLayout>
- </LinearLayout>
</LinearLayout>
- <Spinner
- android:id="@+id/spinnerCountry"
- android:layout_width="200dp"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- />
+
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="bottom"
- android:padding="6dp"
- >
+ 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="80dp"
+ android:layout_height="wrap_content"
+ android:text="@string/menu_vpn"
+ android:layout_margin="3dp"
+ android:ellipsize="end"
+ android:singleLine="true"
+ />
+
+
+ <android.support.v7.widget.SwitchCompat
+ android:id="@+id/btnBridges"
+ android:layout_width="100dp"
+ android:layout_height="wrap_content"
+ android:text="@string/bridges"
+ android:layout_marginTop="3dp"
+ android:layout_marginLeft="5dp"
+ android:layout_marginBottom="3dp"
+ android:ellipsize="end"
+ android:singleLine="true"
+ />
+ <Spinner
+ android:id="@+id/spinnerCountry"
+ android:layout_width="140dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ />
+
+ </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"
@@ -151,6 +173,7 @@ android:layout_gravity="center_horizontal|center_vertical"/>
android:layout_marginRight="40dp"
android:textColor="#ffffff"
android:maxLines="1"
+ android:orientation="vertical"
android:fontFamily="sans-serif-light"
/>
-->
@@ -214,20 +237,34 @@ android:layout_gravity="center_horizontal|center_vertical"/>
/>
</RelativeLayout>
</LinearLayout>
- </LinearLayout>
+
+
+ </RelativeLayout>
+
+
+ <LinearLayout
+ android:layout_width="320dp"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:id="@+id/left_drawer"
+ android:layout_gravity="start"
+ android:background="#333333"
+ >
+
+ </LinearLayout>
<LinearLayout
android:layout_width="320dp"
android:layout_height="match_parent"
android:orientation="vertical"
- android:id="@+id/left_drawer"
- android:layout_gravity="start"
+ android:id="@+id/right_drawer"
+ android:layout_gravity="end"
android:background="#333333"
>
<TextView
android:id="@+id/orbotLog"
android:textSize="12sp"
- android:gravity="left"
+ android:gravity="start"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
@@ -238,7 +275,7 @@ android:layout_gravity="center_horizontal|center_vertical"/>
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
-
+
</LinearLayout>
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits