put browser button back in

This commit is contained in:
Nathan Freitas 2016-10-24 10:50:14 -04:00
parent 518f70d872
commit c1ffdbb4e7
2 changed files with 136 additions and 76 deletions

View File

@ -90,7 +90,9 @@ public class OrbotMainActivity extends AppCompatActivity
private TextView uploadText = null;
private TextView mTxtOrbotLog = null;
// private Button mBtnBrowser = null;
private Button mBtnBrowser = null;
private Button mBtnStart = null;
private SwitchCompat mBtnVPN = null;
private SwitchCompat mBtnBridges = 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,13 +1143,15 @@ 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))
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)

View File

@ -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,21 +58,48 @@ android:layout_gravity="center_horizontal|center_vertical"/>
android:layout_margin="0dp"
android:src="@drawable/toroff" />
<TextView
android:id="@+id/lblStatus"
<LinearLayout android:gravity="center_horizontal"
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_browse"
android:ellipsize="end"
android:singleLine="true"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
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: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"
@ -81,22 +107,12 @@ android:layout_gravity="center_horizontal|center_vertical"/>
>
<!--
<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:ellipsize="end"
android:singleLine="true"
/>-->
<android.support.v7.widget.SwitchCompat
android:id="@+id/btnVPN"
android:layout_width="100dp"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:text="@string/menu_vpn"
android:layout_margin="3dp"
@ -111,33 +127,39 @@ android:layout_gravity="center_horizontal|center_vertical"/>
android:layout_height="wrap_content"
android:text="@string/bridges"
android:layout_marginTop="3dp"
android:layout_marginLeft="25dp"
android:layout_marginLeft="5dp"
android:layout_marginBottom="3dp"
android:ellipsize="end"
android:singleLine="true"
/>
</LinearLayout>
</LinearLayout>
<Spinner
android:id="@+id/spinnerCountry"
android:layout_width="200dp"
android:layout_width="140dp"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="bottom"
android:padding="6dp"
>
<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"
@ -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,7 +237,10 @@ android:layout_gravity="center_horizontal|center_vertical"/>
/>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="320dp"
@ -224,10 +250,21 @@ android:layout_gravity="center_horizontal|center_vertical"/>
android:layout_gravity="start"
android:background="#333333"
>
</LinearLayout>
<LinearLayout
android:layout_width="320dp"
android:layout_height="match_parent"
android:orientation="vertical"
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"