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,8 +90,10 @@ public class OrbotMainActivity extends AppCompatActivity
private TextView uploadText = null; private TextView uploadText = null;
private TextView mTxtOrbotLog = null; private TextView mTxtOrbotLog = null;
// private Button mBtnBrowser = null; private Button mBtnBrowser = null;
private SwitchCompat mBtnVPN = null; private Button mBtnStart = null;
private SwitchCompat mBtnVPN = null;
private SwitchCompat mBtnBridges = null; private SwitchCompat mBtnBridges = null;
private Spinner spnCountries = null; private Spinner spnCountries = null;
@ -258,7 +260,24 @@ public class OrbotMainActivity extends AppCompatActivity
// Gesture detection // Gesture detection
mGestureDetector = new GestureDetector(this, new MyGestureDetector()); 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 = (Button)findViewById(R.id.btnBrowser);
mBtnBrowser.setOnClickListener(new View.OnClickListener () mBtnBrowser.setOnClickListener(new View.OnClickListener ()
{ {
@ -272,7 +291,6 @@ public class OrbotMainActivity extends AppCompatActivity
}); });
mBtnBrowser.setEnabled(false); mBtnBrowser.setEnabled(false);
*/
mBtnVPN = (SwitchCompat)findViewById(R.id.btnVPN); mBtnVPN = (SwitchCompat)findViewById(R.id.btnVPN);
@ -1125,12 +1143,14 @@ public class OrbotMainActivity extends AppCompatActivity
imgStatus.setImageResource(R.drawable.toron); imgStatus.setImageResource(R.drawable.toron);
//mBtnBrowser.setEnabled(true); mBtnBrowser.setEnabled(true);
mBtnStart.setText(R.string.menu_stop);
if (torServiceMsg != null) if (torServiceMsg != null)
{ {
if (torServiceMsg.contains(TorServiceConstants.LOG_NOTICE_HEADER)) if (torServiceMsg.contains(TorServiceConstants.LOG_NOTICE_HEADER)) {
lblStatus.setText(torServiceMsg); lblStatus.setText(torServiceMsg);
}
} }
else else
lblStatus.setText(getString(R.string.status_activated)); lblStatus.setText(getString(R.string.status_activated));
@ -1171,7 +1191,7 @@ public class OrbotMainActivity extends AppCompatActivity
else else
lblStatus.setText(getString(R.string.status_starting_up)); lblStatus.setText(getString(R.string.status_starting_up));
// mBtnBrowser.setEnabled(false); mBtnBrowser.setEnabled(false);
} else if (torStatus == TorServiceConstants.STATUS_STOPPING) { } else if (torStatus == TorServiceConstants.STATUS_STOPPING) {
@ -1180,13 +1200,16 @@ public class OrbotMainActivity extends AppCompatActivity
imgStatus.setImageResource(R.drawable.torstarting); imgStatus.setImageResource(R.drawable.torstarting);
lblStatus.setText(torServiceMsg); lblStatus.setText(torServiceMsg);
// mBtnBrowser.setEnabled(false); mBtnBrowser.setEnabled(false);
} else if (torStatus == TorServiceConstants.STATUS_OFF) { } else if (torStatus == TorServiceConstants.STATUS_OFF) {
imgStatus.setImageResource(R.drawable.toroff); imgStatus.setImageResource(R.drawable.toroff);
lblStatus.setText(getString(R.string.press_to_start)); 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) if (torServiceMsg != null && torServiceMsg.length() > 0)

View File

@ -18,10 +18,9 @@
android:layout_height="match_parent" android:layout_height="match_parent"
> >
<LinearLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/content_frame" android:id="@+id/content_frame"
> >
@ -59,84 +58,107 @@ android:layout_gravity="center_horizontal|center_vertical"/>
android:layout_margin="0dp" android:layout_margin="0dp"
android:src="@drawable/toroff" /> 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" <LinearLayout android:gravity="center_horizontal"
android:orientation="horizontal" android:layout_width="match_parent" android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="wrap_content" 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 <Button
android:id="@+id/btnBrowser" android:id="@+id/btnBrowser"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/menu_verify_browser" android:text="@string/menu_browse"
android:layout_marginTop="3dp"
android:layout_marginBottom="3dp"
android:ellipsize="end" android:ellipsize="end"
android:singleLine="true" android:singleLine="true"
/>--> />
</LinearLayout>
<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>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:gravity="bottom" 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" <TextView android:id="@+id/lblStatus"
@ -151,6 +173,7 @@ android:layout_gravity="center_horizontal|center_vertical"/>
android:layout_marginRight="40dp" android:layout_marginRight="40dp"
android:textColor="#ffffff" android:textColor="#ffffff"
android:maxLines="1" android:maxLines="1"
android:orientation="vertical"
android:fontFamily="sans-serif-light" android:fontFamily="sans-serif-light"
/> />
--> -->
@ -214,20 +237,34 @@ android:layout_gravity="center_horizontal|center_vertical"/>
/> />
</RelativeLayout> </RelativeLayout>
</LinearLayout> </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 <LinearLayout
android:layout_width="320dp" android:layout_width="320dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
android:id="@+id/left_drawer" android:id="@+id/right_drawer"
android:layout_gravity="start" android:layout_gravity="end"
android:background="#333333" android:background="#333333"
> >
<TextView <TextView
android:id="@+id/orbotLog" android:id="@+id/orbotLog"
android:textSize="12sp" android:textSize="12sp"
android:gravity="left" android:gravity="start"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
@ -238,7 +275,7 @@ android:layout_gravity="center_horizontal|center_vertical"/>
</LinearLayout> </LinearLayout>
</android.support.v4.widget.DrawerLayout> </android.support.v4.widget.DrawerLayout>
</LinearLayout> </LinearLayout>