commit 6a83a0d2f62fbb303e0646520296f1134e80407a Author: Nathan Freitas nathan@freitas.net Date: Sun Feb 1 12:49:10 2015 -0500
update project and layout for v15 merged browser + VPN --- AndroidManifest.xml | 44 ++++ project.properties | 1 + res/layout-land/layout_main.xml | 169 -------------- res/layout/layout_main.xml | 121 +++++----- res/layout/layout_wizard_permissions.xml | 37 --- res/layout/layout_wizard_root.xml | 51 ----- res/menu/main.xml | 81 ------- src/org/torproject/android/Orbot.java | 133 ++++++----- .../android/wizard/ConfigureTransProxy.java | 241 -------------------- src/org/torproject/android/wizard/LotsaText.java | 2 +- src/org/torproject/android/wizard/Permissions.java | 206 ----------------- .../torproject/android/wizard/TipsAndTricks.java | 7 +- 12 files changed, 179 insertions(+), 914 deletions(-)
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 2e9aa21..192acaf 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -99,6 +99,50 @@ <activity android:name=".settings.SettingsPreferences" android:label="@string/app_name"/> <activity android:name=".settings.AppManager" android:label="@string/app_name"/>
+ <activity android:name="info.guardianproject.browser.Browser" + android:label="@string/app_name_orweb" + android:icon="@drawable/icon_orweb" + android:configChanges="locale|orientation|screenSize" + android:launchMode="singleTop" + > + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + <intent-filter> + <action android:name="android.intent.action.SEARCH" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + <intent-filter> + <action android:name="android.intent.action.VIEW" /> + + <category android:name="android.intent.category.DEFAULT" /> + <category android:name="android.intent.category.BROWSABLE" /> + <data android:scheme="http" /> + <data android:scheme="https" /> + <data android:scheme="about" /> + </intent-filter> + <!-- For these schemes where any of these particular MIME types + have been supplied, we are a good candidate. --> + <intent-filter> + <action android:name="android.intent.action.VIEW" /> + + <category android:name="android.intent.category.BROWSABLE" /> + <category android:name="android.intent.category.DEFAULT" /> + <data android:scheme="http" /> --> + <data android:scheme="https" /> + <data android:mimeType="text/html"/> + <data android:mimeType="text/plain"/> + <data android:mimeType="application/xhtml+xml"/> + <data android:mimeType="application/vnd.wap.xhtml+xml"/> + </intent-filter> + + <meta-data android:name="android.app.searchable" + android:resource="@xml/searchable"/> + </activity> + <activity android:label="@string/app_name" android:name="info.guardianproject.browser.EditPreferences"></activity> + + <service android:enabled="true" android:name=".service.TorService" android:permission="org.torproject.android.MANAGE_TOR" diff --git a/project.properties b/project.properties index 2abb592..e87ce9f 100644 --- a/project.properties +++ b/project.properties @@ -12,3 +12,4 @@ proguard.config=${sdk.dir}/tools/proguard/proguard-android-optimize.txt:proguard target=android-21 android.library.reference.1=external/appcompat android.library.reference.2=external/superuser-commands/RootCommands-Library +android.library.reference.3=../Orweb diff --git a/res/layout-land/layout_main.xml b/res/layout-land/layout_main.xml deleted file mode 100644 index b90faf1..0000000 --- a/res/layout-land/layout_main.xml +++ /dev/null @@ -1,169 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:id="@+id/viewMain" - android:paddingTop="0sp" - android:background="@drawable/tilebg" - > - - <!-- - <org.torproject.android.RandomColorCircleView android:layout_width="fill_parent" - android:layout_height="fill_parent"></org.torproject.android.RandomColorCircleView> - --> - - - <!-- - <RelativeLayout android:id="@+id/layoutHeaderMain" - android:layout_width="fill_parent" - android:layout_height="30dp"> - - <ImageView android:id="@+id/radioModeImage" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginTop="3dp" - android:layout_marginRight="3dp" - android:gravity="right" - android:layout_alignParentRight="true" - android:layout_alignParentTop="true" - android:src="@drawable/tor25" - /> - <TextView android:id="@+id/radioModeText" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/powered_by" - android:layout_marginTop="8dp" - android:layout_marginRight="0px" - android:gravity="right" - android:layout_toLeftOf="@+id/radioModeImage" - android:textColor="#cccccc" - android:fontFamily="sans-serif-light" - - /> - </RelativeLayout> --> - - <LinearLayout android:gravity="center_vertical" - android:layout_gravity="center_vertical|left" - android:orientation="vertical" android:layout_width="240dip" - android:layout_height="match_parent" - android:id="@+id/boxStatus" - > - - <org.torproject.android.ImageProgressView - android:id="@+id/imgStatus" - android:layout_width="fill_parent" - android:layout_height="0dp" - android:layout_marginTop="40dp" - android:layout_weight="1" - android:src="@drawable/toroff" - android:layout_gravity="center_horizontal" /> - - <TextView android:id="@+id/lblStatus" - android:text="@string/press_to_start" - android:gravity="center_horizontal" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:layout_marginBottom="20dp" - android:textColor="#ffffff" - android:maxLines="1" - android:fontFamily="sans-serif-light" - - /> - -</LinearLayout> - - <RelativeLayout - android:id="@+id/log" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:layout_margin="6dp" - android:layout_gravity="center_vertical|right" - android:layout_toRightOf="@+id/boxStatus" - - > - - <RelativeLayout - android:id="@+id/rowTrafficLabels" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:paddingLeft="3sp" - android:paddingRight="3sp" - - > - <TextView - android:id="@+id/trafficLabelDown" - android:textColor="#FFFFFFFF" - 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:textColor="#FFFFFFFF" - 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/rowTrafficData" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:paddingLeft="3sp" - android:paddingRight="3sp" - android:paddingBottom="3sp" - android:layout_below="@+id/rowTrafficLabels" - > - <TextView - android:id="@+id/trafficDown" - android:textColor="#ccff2a" - 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:textColor="#ccff2a" - 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/orbotLog" - android:textColor="#FFFFFF" - android:textSize="12sp" - android:gravity="left" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:layout_alignParentLeft="true" - android:textIsSelectable="true" - android:layout_below="@+id/rowTrafficData" - android:fontFamily="sans-serif-light" - android:background="#aa333333" - android:padding="3sp" - - /> - </RelativeLayout> - -</RelativeLayout> diff --git a/res/layout/layout_main.xml b/res/layout/layout_main.xml index c1a50c7..965e599 100644 --- a/res/layout/layout_main.xml +++ b/res/layout/layout_main.xml @@ -1,77 +1,36 @@ <?xml version="1.0" encoding="utf-8"?> -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:id="@+id/viewMain" - android:paddingTop="0sp" - android:background="@drawable/tilebg" - > + +<LinearLayout android:gravity="center_vertical|center_horizontal" + xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" android:layout_width="match_parent" + android:layout_height="match_parent"> + + <LinearLayout android:gravity="center_vertical|center_horizontal" + android:orientation="vertical" android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="#686868" + > + <!-- - <org.torproject.android.RandomColorCircleView android:layout_width="fill_parent" - android:layout_height="fill_parent"></org.torproject.android.RandomColorCircleView> - --> - <!-- - <RelativeLayout android:id="@+id/layoutHeaderMain" - android:layout_width="fill_parent" - android:layout_height="30dp" - android:background="#A0343434"> - <ImageView android:id="@+id/radioModeImage" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginTop="3dp" - android:layout_marginRight="3dp" - android:gravity="right" - android:layout_toRightOf="@+id/radioModeLabel" - android:layout_alignParentRight="true" - android:layout_alignParentTop="true" - android:src="@drawable/ic_stat_tor" - /> - <TextView android:id="@+id/radioModeText" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/powered_by" - android:layout_marginTop="8dp" - android:layout_marginRight="0px" - android:gravity="right" - android:layout_toLeftOf="@+id/radioModeImage" - android:textColor="#cccccc" - android:fontFamily="sans-serif-light" - - /> - </RelativeLayout> --> - <LinearLayout android:gravity="center_vertical|center_horizontal" - android:orientation="vertical" android:layout_width="fill_parent" - android:layout_height="fill_parent" - - > - - <org.torproject.android.ImageProgressView - android:id="@+id/imgStatus" - android:layout_width="fill_parent" - android:layout_height="0dp" - android:layout_marginTop="40dp" - android:layout_weight="1" - android:src="@drawable/toroff" - android:layout_gravity="center_horizontal" /> - <TextView android:id="@+id/lblStatus" - android:text="@string/press_to_start" + 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="40dp" - android:layout_marginLeft="60dp" - android:layout_marginRight="60dp" + android:layout_marginBottom="10dp" + android:layout_marginTop="10dp" + android:layout_marginLeft="40dp" + android:layout_marginRight="40dp" android:textColor="#ffffff" - android:maxLines="2" + android:maxLines="1" android:fontFamily="sans-serif-light" /> - - + --> + <RelativeLayout android:id="@+id/rowTrafficDown" - android:layout_width="fill_parent" + android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:paddingLeft="3sp" @@ -130,8 +89,44 @@ android:fontFamily="sans-serif-light" /> </RelativeLayout> + </LinearLayout> + + + <org.torproject.android.ImageProgressView + android:id="@+id/imgStatus" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_marginTop="5dp" + android:padding="0dp" + android:layout_weight="1" + android:src="@drawable/toroff" + android:layout_gravity="center_horizontal" /> + + + <LinearLayout android:gravity="center_horizontal" + android:orientation="horizontal" android:layout_width="match_parent" + android:layout_height="wrap_content" + android:padding="5dp" + android:background="#686868" + > + + <Button + android:id="@+id/btnBrowser" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Open Browser" /> + + <Button + android:id="@+id/btnVPN" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Start VPN" /> + + </LinearLayout> + </LinearLayout>
+ <!-- <SlidingDrawer android:layout_width="fill_parent" android:id="@+id/SlidingDrawer" @@ -173,4 +168,6 @@ </SlidingDrawer>
</FrameLayout> + --> +
diff --git a/res/layout/layout_wizard_permissions.xml b/res/layout/layout_wizard_permissions.xml deleted file mode 100644 index 5e3b1ed..0000000 --- a/res/layout/layout_wizard_permissions.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" - android:layout_width="fill_parent" - android:layout_height="fill_parent"> - - -<TableLayout android:id="@+id/TableLayout01" android:stretchColumns="*" android:layout_height="fill_parent" android:layout_width="wrap_content"> - -<TableRow android:layout_margin="10dip" android:id="@+id/TableRow01" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="fill_parent"> - - - <ScrollView android:id="@+id/helpscrollview" - android:orientation="vertical" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:layout_span="3" - > - <LinearLayout android:background="#575757" android:layout_width="wrap_content" android:id="@+id/linearLayout1" android:layout_height="wrap_content" android:orientation="vertical"> - <TextView android:layout_width="wrap_content" android:textColor="#ffffff" android:layout_height="wrap_content" android:textSize="8pt" android:id="@+id/WizardTextBody1" android:text="this is sample text this is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample text" android:padding="20dip"></TextView> - <Button android:layout_width="wrap_content" android:visibility="gone" android:layout_height="wrap_content" android:gravity="center" android:text="@string/button_grant_superuser" android:id="@+id/grantPermissions" android:layout_gravity="center"></Button> - <TextView android:layout_width="wrap_content" android:layout_gravity="left" android:visibility="gone" android:textColor="#ffffff" android:layout_height="wrap_content" android:textSize="8pt" android:id="@+id/WizardTextBody2" android:text="this is sample text this is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample textthis is sample text" android:padding="20dip"></TextView> - <CheckBox android:id="@+id/checkBox" android:layout_gravity="left" android:text="@string/wizard_permissions_consent" android:layout_height="wrap_content" android:layout_width="wrap_content" android:gravity="center" android:visibility="visible"></CheckBox> - </LinearLayout> - - </ScrollView> - -</TableRow> -<TableRow android:background="#000000" android:layout_marginTop="10dip" android:paddingTop="10dip" android:id="@+id/TableRow01" android:textColor="#00ff00" android:layout_width="fill_parent" android:layout_height="30px"> - <Button android:text="@string/btn_back" android:id="@+id/btnWizard1" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button> - <Button android:text="@string/btn_next" android:id="@+id/btnWizard2" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button> -</TableRow> -</TableLayout> -</LinearLayout> - - diff --git a/res/layout/layout_wizard_root.xml b/res/layout/layout_wizard_root.xml deleted file mode 100644 index cdda4f4..0000000 --- a/res/layout/layout_wizard_root.xml +++ /dev/null @@ -1,51 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" - android:layout_width="fill_parent" - android:layout_height="fill_parent"> - -<TableLayout android:id="@+id/TableLayout01" android:stretchColumns="*" android:layout_height="fill_parent" android:layout_width="wrap_content"> - -<TableRow android:layout_margin="10dip" android:id="@+id/TableRow01" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="fill_parent"> - - - <ScrollView android:id="@+id/helpscrollview" - android:orientation="vertical" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:layout_span="3"> - -<LinearLayout - android:background="#575757" - android:orientation="vertical" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:padding="3px"> -<TextView android:text="@string/wizard_transproxy_msg" android:layout_width="wrap_content" android:textColor="#ffffff" android:layout_height="wrap_content" android:textSize="8pt" android:id="@+id/WizardTextBody1" android:padding="20dip"></TextView> -<RadioGroup android:id="@+id/radioGroup" android:layout_height="wrap_content" android:layout_width="wrap_content" android:paddingLeft="15dip"> - <RadioButton android:text="@string/wizard_configure_all" android:id="@+id/radio0" android:layout_height="wrap_content" android:layout_width="wrap_content"></RadioButton> - <TextView android:layout_height="wrap_content" - android:text="@string/wizard_transproxy_hint" - android:layout_width="wrap_content" - android:textSize="15sp" - android:paddingBottom="10dip" android:paddingRight="20dip"> - </TextView> - <RadioButton android:text="@string/wizard_configure_select_apps" android:id="@+id/radio1" android:layout_height="wrap_content" android:layout_width="wrap_content"></RadioButton> - <RadioButton android:text="@string/wizard_transproxy_none" android:id="@+id/radio2" android:layout_height="wrap_content" android:layout_width="wrap_content"></RadioButton> -</RadioGroup> - - - </LinearLayout> - </ScrollView> - -</TableRow> -<TableRow android:background="#000000" android:layout_marginTop="10dip" android:paddingTop="10dip" android:id="@+id/TableRow01" android:textColor="#00ff00" android:layout_width="fill_parent" android:layout_height="30px"> - <Button android:text="@string/btn_back" android:id="@+id/btnWizard1" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button> - <Button android:text="@string/btn_next" android:id="@+id/btnWizard2" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button> -</TableRow> -</TableLayout> -</LinearLayout> - - - diff --git a/res/menu/main.xml b/res/menu/main.xml deleted file mode 100644 index 3c592b2..0000000 --- a/res/menu/main.xml +++ /dev/null @@ -1,81 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* - * Copyright (C) 2008 Esmertec AG. - * Copyright (C) 2008 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ ---> -<menu xmlns:yourapp="http://schemas.android.com/apk/res-auto" - xmlns:android="http://schemas.android.com/apk/res/android%22%3E - - <item android:id="@+id/menu_start" - android:title="@string/menu_start" - android:icon="@drawable/ic_action_start" - yourapp:showAsAction="never" - /> - - <item android:id="@+id/menu_settings" - android:title="@string/menu_settings" - android:icon="@drawable/ic_action_settings" - yourapp:showAsAction="always" - /> - - <item - android:id="@+id/menu_verify_list" - android:title="@string/menu_verify" - android:icon="@drawable/ic_action_browse" - yourapp:showAsAction="always" - > - <menu> - <item android:id="@+id/menu_verify" - android:title="@string/menu_verify_browser" - android:icon="@drawable/ic_action_browse" - /> - - <!-- - <item android:id="@+id/menu_use_chatsecure" - android:title="@string/menu_use_chatsecure" - android:icon="@drawable/ic_chatsecure" - /> --> - - </menu> - </item> - <item android:id="@+id/menu_about" - android:title="@string/menu_about" - android:icon="@drawable/ic_menu_about" - yourapp:showAsAction="never" - - /> - - <item android:id="@+id/menu_wizard" - android:title="@string/menu_wizard" - android:icon="@drawable/ic_menu_goto" - yourapp:showAsAction="never" - - /> - <!-- - <item android:id="@+id/menu_vpn" - android:title="@string/menu_vpn" - yourapp:showAsAction="never"/> - --> - - <item android:id="@+id/menu_exit" - android:title="@string/menu_exit" - android:icon="@drawable/ic_menu_exit" - yourapp:showAsAction="never" - - /> - -</menu> diff --git a/src/org/torproject/android/Orbot.java b/src/org/torproject/android/Orbot.java index d57eacf..a55f53e 100644 --- a/src/org/torproject/android/Orbot.java +++ b/src/org/torproject/android/Orbot.java @@ -4,6 +4,7 @@ package org.torproject.android;
import static org.torproject.android.TorConstants.TAG; +import info.guardianproject.browser.Browser;
import java.net.URLDecoder; import java.util.Locale; @@ -12,9 +13,7 @@ import org.torproject.android.service.TorService; import org.torproject.android.service.TorServiceConstants; import org.torproject.android.service.TorServiceUtils; import org.torproject.android.settings.SettingsPreferences; -import org.torproject.android.vpn.OrbotVpnService; import org.torproject.android.wizard.ChooseLocaleWizardActivity; -import org.torproject.android.wizard.TipsAndTricks;
import android.annotation.TargetApi; import android.app.AlertDialog; @@ -22,7 +21,6 @@ import android.app.ProgressDialog; import android.content.BroadcastReceiver; import android.content.Context; import android.content.DialogInterface; -import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; @@ -41,9 +39,6 @@ import android.os.Message; import android.os.RemoteException; import android.support.v4.content.LocalBroadcastManager; import android.support.v7.app.ActionBarActivity; -import android.text.ClipboardManager; -import android.text.Layout; -import android.text.method.ScrollingMovementMethod; import android.util.Log; import android.view.GestureDetector; import android.view.GestureDetector.SimpleOnGestureListener; @@ -57,7 +52,6 @@ import android.view.View.OnLongClickListener; import android.view.View.OnTouchListener; import android.view.animation.AccelerateInterpolator; import android.widget.Button; -import android.widget.SlidingDrawer; import android.widget.TextView; import android.widget.Toast;
@@ -65,16 +59,16 @@ import android.widget.Toast; public class Orbot extends ActionBarActivity implements TorConstants, OnLongClickListener, OnTouchListener, OnSharedPreferenceChangeListener { /* Useful UI bits */ - private TextView lblStatus = null; //the main text display widget + //private TextView lblStatus = null; //the main text display widget private ImageProgressView imgStatus = null; //the main touchable image for activating Orbot
private MenuItem mItemOnOff = null; private TextView downloadText = null; private TextView uploadText = null; - private TextView mTxtOrbotLog = null; - private SlidingDrawer mDrawer = null; + // private TextView mTxtOrbotLog = null; + // private SlidingDrawer mDrawer = null; private boolean mDrawerOpen = false; - private View mViewMain = null; + // private View mViewMain = null;
/* Some tracking bits */ private int torStatus = TorServiceConstants.STATUS_OFF; //latest status reported from the tor service @@ -96,7 +90,7 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
doLayout();
- appConflictChecker (); + // appConflictChecker ();
// Register to receive messages. @@ -181,19 +175,19 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic { setContentView(R.layout.layout_main); - mViewMain = findViewById(R.id.viewMain); - lblStatus = (TextView)findViewById(R.id.lblStatus); - lblStatus.setOnLongClickListener(this); + // lblStatus = (TextView)findViewById(R.id.lblStatus); +// lblStatus.setOnLongClickListener(this); imgStatus = (ImageProgressView)findViewById(R.id.imgStatus); imgStatus.setOnLongClickListener(this); imgStatus.setOnTouchListener(this); - lblStatus.setText("Initializing the application..."); + // lblStatus.setText("Initializing the application..."); downloadText = (TextView)findViewById(R.id.trafficDown); uploadText = (TextView)findViewById(R.id.trafficUp); - mTxtOrbotLog = (TextView)findViewById(R.id.orbotLog); + // mTxtOrbotLog = (TextView)findViewById(R.id.orbotLog);
+ /* mDrawer = ((SlidingDrawer)findViewById(R.id.SlidingDrawer)); Button slideButton = (Button)findViewById(R.id.slideButton); if (slideButton != null) @@ -212,8 +206,9 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic } }); - } + }*/ + /* ScrollingMovementMethod smm = new ScrollingMovementMethod(); mTxtOrbotLog.setMovementMethod(smm); @@ -227,7 +222,7 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic Toast.makeText(Orbot.this, "LOG COPIED TO CLIPBOARD", Toast.LENGTH_SHORT).show(); return true; } - }); + });*/
downloadText.setText(formatCount(0) + " / " + formatTotal(0)); uploadText.setText(formatCount(0) + " / " + formatTotal(0)); @@ -235,6 +230,33 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic // Gesture detection mGestureDetector = new GestureDetector(this, new MyGestureDetector()); + Button btnBrowser = (Button)findViewById(R.id.btnBrowser); + btnBrowser.setOnClickListener(new View.OnClickListener () + { + + @Override + public void onClick(View v) { + doTorCheck(); + + } + + + }); + + Button btnVPN = (Button)findViewById(R.id.btnVPN); + btnVPN.setOnClickListener(new View.OnClickListener () + { + + @Override + public void onClick(View v) { + + startVpnService(); + + } + + + }); +
} @@ -247,8 +269,10 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
} + /* private void appendLogTextAndScroll(String text) { + if(mTxtOrbotLog != null && text != null && text.length() > 0){ if (mTxtOrbotLog.getText().length() > MAX_LOG_LENGTH) @@ -263,7 +287,7 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic mTxtOrbotLog.scrollBy(0, scrollDelta); } } - } + }*/
/* * Create the UI Options Menu (non-Javadoc) @@ -273,14 +297,14 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuInflater inflater = getMenuInflater(); - inflater.inflate(R.menu.main, menu); + inflater.inflate(R.menu.orbot_main, menu);
mItemOnOff = menu.getItem(0);
return true; }
- + /** private void appConflictChecker () { SharedPreferences sprefs = TorServiceUtils.getSharedPrefs(getApplicationContext()); @@ -300,13 +324,13 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic if (showAppConflict) showAlert(getString(R.string.app_conflict),msg,true); - appendLogTextAndScroll(msg); + // appendLogTextAndScroll(msg); } } sprefs.edit().putBoolean("pref_show_conflict", false).commit(); - } + }*/
@@ -394,12 +418,10 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
} - /** - * remove for now... VPN is not ready yet else if (item.getItemId() == R.id.menu_vpn) { - this.startVpnService(); - }*/ + startVpnService(); + }
return true; } @@ -451,29 +473,8 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic private void doTorCheck () { - DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() { - - public void onClick(DialogInterface dialog, int which) { - switch (which){ - case DialogInterface.BUTTON_POSITIVE: - - openBrowser(URL_TOR_CHECK); - - - - break; - - case DialogInterface.BUTTON_NEGATIVE: - - //do nothing - break; - } - } - }; - - AlertDialog.Builder builder = new AlertDialog.Builder(this); - builder.setMessage(R.string.tor_check).setPositiveButton(R.string.btn_okay, dialogClickListener) - .setNegativeButton(R.string.btn_cancel, dialogClickListener).show(); + openBrowser(URL_TOR_CHECK); +
} @@ -666,12 +667,19 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic */ private void openBrowser(final String browserLaunchUrl) { + //startIntent("info.guardianproject.browser.Browser",Intent.ACTION_VIEW,Uri.parse(browserLaunchUrl)); + + Intent intentBrowser = new Intent(this, Browser.class); + intentBrowser.setAction(Intent.ACTION_VIEW); + intentBrowser.setData(Uri.parse(browserLaunchUrl)); + startActivity(intentBrowser); + + /** boolean isOrwebInstalled = appInstalledOrNot("info.guardianproject.browser"); boolean isTransProxy = mPrefs.getBoolean("pref_transparent", false); if (isOrwebInstalled) { - startIntent("info.guardianproject.browser",Intent.ACTION_VIEW,Uri.parse(browserLaunchUrl)); } else if (isTransProxy) { @@ -685,7 +693,7 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic .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(android.R.string.ok, new OnClickListener () + .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener () {
@Override @@ -698,7 +706,7 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic } }) - .setNegativeButton(android.R.string.no, new OnClickListener () + .setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener () {
@Override @@ -712,7 +720,7 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic }) .show(); - } + }*/ } @@ -894,7 +902,7 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic imgStatus.setImageResource(R.drawable.toron); String lblMsg = getString(R.string.status_activated); - lblStatus.setText(lblMsg); + //lblStatus.setText(lblMsg);
if (mItemOnOff != null) mItemOnOff.setTitle(R.string.menu_stop); @@ -902,7 +910,7 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
if (torServiceMsg != null && torServiceMsg.length() > 0) { - appendLogTextAndScroll(torServiceMsg); + // appendLogTextAndScroll(torServiceMsg); }
boolean showFirstTime = mPrefs.getBoolean("connect_first_time",true); @@ -936,19 +944,20 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic if (mItemOnOff != null) mItemOnOff.setTitle(R.string.menu_stop); - + /** if (lblStatus != null && torServiceMsg != null) if (torServiceMsg.indexOf('%')!=-1) lblStatus.setText(torServiceMsg); + **/
- appendLogTextAndScroll(torServiceMsg); + //appendLogTextAndScroll(torServiceMsg);
} else if (torStatus == TorServiceConstants.STATUS_OFF) { imgStatus.setImageResource(R.drawable.toroff); - lblStatus.setText(getString(R.string.status_disabled) + "\n" + getString(R.string.press_to_start)); + //lblStatus.setText(getString(R.string.status_disabled) + "\n" + getString(R.string.press_to_start));
if (mItemOnOff != null) mItemOnOff.setTitle(R.string.menu_start); @@ -970,12 +979,12 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic startService (TorServiceConstants.CMD_START); torStatus = TorServiceConstants.STATUS_CONNECTING; - mTxtOrbotLog.setText(""); +// mTxtOrbotLog.setText("");
//here we update the UI which is a bit sloppy and mixed up code wise //might be best to just call updateStatus() instead of directly manipulating UI in this method - yep makes sense imgStatus.setImageResource(R.drawable.torstarting); - lblStatus.setText(getString(R.string.status_starting_up)); + // lblStatus.setText(getString(R.string.status_starting_up));
//we send a message here to the progressDialog i believe, but we can clarify that shortly Message msg = mHandler.obtainMessage(TorServiceConstants.ENABLE_TOR_MSG); diff --git a/src/org/torproject/android/wizard/ConfigureTransProxy.java b/src/org/torproject/android/wizard/ConfigureTransProxy.java deleted file mode 100644 index ca7f3ac..0000000 --- a/src/org/torproject/android/wizard/ConfigureTransProxy.java +++ /dev/null @@ -1,241 +0,0 @@ -package org.torproject.android.wizard; - -import org.torproject.android.Orbot; -import org.torproject.android.R; -import org.torproject.android.TorConstants; -import org.torproject.android.R.drawable; -import org.torproject.android.R.id; -import org.torproject.android.R.layout; -import org.torproject.android.R.string; -import org.torproject.android.service.TorServiceUtils; -import org.torproject.android.settings.AppManager; - -import android.app.Activity; -import android.app.AlertDialog; -import android.content.Context; -import android.content.DialogInterface; -import android.content.Intent; -import android.content.SharedPreferences; -import android.content.SharedPreferences.Editor; -import android.net.Uri; -import android.os.Bundle; -import android.preference.PreferenceManager; -import android.util.Log; -import android.view.KeyEvent; -import android.view.View; -import android.view.View.OnClickListener; -import android.widget.Button; -import android.widget.CheckBox; -import android.widget.CompoundButton; -import android.widget.RadioButton; -import android.widget.RadioGroup; -import android.widget.TextView; -import android.widget.CompoundButton.OnCheckedChangeListener; -import android.widget.Toast; - -public class ConfigureTransProxy extends Activity implements TorConstants { - - private Context context; - private int flag = 0; - - protected void onCreate(Bundle savedInstanceState) - { - super.onCreate(savedInstanceState); - context = this; - - } - - @Override - protected void onStart() { - - super.onStart(); - setContentView(R.layout.layout_wizard_root); - - stepSix(); - - } - - @Override - protected void onResume() { - super.onResume(); - - setupUI(); - - - - } - - private void setupUI () - { - SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext()); - - boolean transEnabled = prefs.getBoolean(PREF_TRANSPARENT, false); - - if (transEnabled) - { - boolean transAllEnabled = prefs.getBoolean(PREF_TRANSPARENT_ALL, false); - - if (transAllEnabled) - { - RadioButton rb0 = (RadioButton)findViewById(R.id.radio0); - rb0.setChecked(true); - - - } - else - { - RadioButton rb1 = (RadioButton)findViewById(R.id.radio1); - rb1.setChecked(true); - - } - - Button next = ((Button)findViewById(R.id.btnWizard2)); - next.setEnabled(true); - } - - } - - - private void stepSix(){ - - String title = context.getString(R.string.wizard_transproxy_title); - - setTitle(title); - - Button back = ((Button)findViewById(R.id.btnWizard1)); - Button next = ((Button)findViewById(R.id.btnWizard2)); - next.setEnabled(false); - - back.setOnClickListener(new View.OnClickListener() { - - public void onClick(View v) { - finish(); - startActivity(new Intent(ConfigureTransProxy.this, Permissions.class)); - } - }); - - next.setOnClickListener(new View.OnClickListener() { - - public void onClick(View v) { - finish(); - startActivity(new Intent(ConfigureTransProxy.this, TipsAndTricks.class)); - - } - }); - - - RadioButton rb0 = (RadioButton)findViewById(R.id.radio0); - RadioButton rb1 = (RadioButton)findViewById(R.id.radio1); - RadioButton rb2 = (RadioButton)findViewById(R.id.radio2); - - rb1.setOnClickListener(new OnClickListener() - { - - public void onClick(View v) { - - startActivity(new Intent(ConfigureTransProxy.this, AppManager.class)); - } - - }); - - RadioGroup mRadioGroup = (RadioGroup)findViewById(R.id.radioGroup); - mRadioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener (){ - - - public void onCheckedChanged(RadioGroup group, int checkedId){ - Button next = ((Button)findViewById(R.id.btnWizard2)); - next.setEnabled(true); - - RadioButton rb0 = (RadioButton)findViewById(R.id.radio0); - RadioButton rb1 = (RadioButton)findViewById(R.id.radio1); - RadioButton rb2 = (RadioButton)findViewById(R.id.radio2); - - SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext()); - - Editor pEdit = prefs.edit(); - pEdit.putBoolean(PREF_TRANSPARENT, rb0.isChecked()); - pEdit.putBoolean(PREF_TRANSPARENT_ALL, rb0.isChecked()); - pEdit.commit(); - - if(rb0.isChecked()) - { - pEdit.putString("radiobutton","rb0"); - pEdit.commit(); - } - - else if(rb1.isChecked()) - { - flag++; - - pEdit.putBoolean(PREF_TRANSPARENT, true); - pEdit.putBoolean(PREF_TRANSPARENT_ALL, false); - pEdit.putString("radiobutton","rb1"); - pEdit.commit(); - - } - else if(rb2.isChecked()) - { - pEdit.putString("radiobutton", "rb2"); - pEdit.commit(); - } - - } - }); - - - } - - /* - private void showWizardFinal () - { - String title = null; - String msg = null; - - - title = context.getString(R.string.wizard_final); - msg = context.getString(R.string.wizard_final_msg); - - DialogInterface.OnClickListener ocListener = new DialogInterface.OnClickListener() { - - public void onClick(DialogInterface dialog, int which) { - startActivityForResult(new Intent(getBaseContext(), Orbot.class), 1); - - } - }; - - - new AlertDialog.Builder(context) - .setIcon(R.drawable.icon) - .setTitle(title) - .setPositiveButton(R.string.button_close, ocListener) - .setMessage(msg) - .show(); - - - - - }*/ - - @Override - protected void onRestoreInstanceState(Bundle savedInstanceState) { - super.onRestoreInstanceState(savedInstanceState); - } - - @Override - protected void onSaveInstanceState(Bundle outState) { - super.onSaveInstanceState(outState); - - } - - //Code to override the back button! - @Override - public boolean onKeyDown(int keyCode, KeyEvent event) { - if(keyCode == KeyEvent.KEYCODE_BACK){ - finish(); - startActivityForResult(new Intent(getBaseContext(), Permissions.class), 1); - return true; - } - return false; - } - -} \ No newline at end of file diff --git a/src/org/torproject/android/wizard/LotsaText.java b/src/org/torproject/android/wizard/LotsaText.java index 536edab..137282f 100644 --- a/src/org/torproject/android/wizard/LotsaText.java +++ b/src/org/torproject/android/wizard/LotsaText.java @@ -117,7 +117,7 @@ public class LotsaText extends Activity implements TorConstants{ public void onClick(View v) { finish(); - startActivity(new Intent(LotsaText.this, Permissions.class)); + startActivity(new Intent(LotsaText.this, TipsAndTricks.class)); } }); diff --git a/src/org/torproject/android/wizard/Permissions.java b/src/org/torproject/android/wizard/Permissions.java deleted file mode 100644 index 229f5bd..0000000 --- a/src/org/torproject/android/wizard/Permissions.java +++ /dev/null @@ -1,206 +0,0 @@ -package org.torproject.android.wizard; - -import org.sufficientlysecure.rootcommands.RootCommands; -import org.torproject.android.R; -import org.torproject.android.TorConstants; -import org.torproject.android.service.TorServiceUtils; - -import android.app.Activity; -import android.content.Context; -import android.content.Intent; -import android.content.SharedPreferences; -import android.content.SharedPreferences.Editor; -import android.os.Bundle; -import android.util.Log; -import android.view.KeyEvent; -import android.view.View; -import android.widget.Button; -import android.widget.CheckBox; -import android.widget.CompoundButton; -import android.widget.CompoundButton.OnCheckedChangeListener; -import android.widget.TextView; - -public class Permissions extends Activity implements TorConstants { - - private Context context; - - protected void onCreate(Bundle savedInstanceState) - { - super.onCreate(savedInstanceState); - context = this; - - } - - @Override - protected void onStart() { - - super.onStart(); - setContentView(R.layout.layout_wizard_permissions); - - stepFourRoot(); - - } - - @Override - protected void onResume() { - super.onResume(); - - - } - - - private void stepFourRoot(){ - - String msg1 = context.getString(R.string.wizard_permissions_root_msg1); - String msg2 = context.getString(R.string.wizard_permissions_root_msg2); - - TextView txtBody1 = ((TextView)findViewById(R.id.WizardTextBody1)); - txtBody1.setText(msg1); - - - TextView txtBody2 = ((TextView)findViewById(R.id.WizardTextBody2)); - txtBody2.setText(msg2); - txtBody2.setVisibility(TextView.VISIBLE); - - Button grantPermissions = ((Button)findViewById(R.id.grantPermissions)); - grantPermissions.setVisibility(Button.VISIBLE); - - Button back = ((Button)findViewById(R.id.btnWizard1)); - Button next = ((Button)findViewById(R.id.btnWizard2)); - next.setEnabled(false); - - CheckBox consent = (CheckBox)findViewById(R.id.checkBox); - consent.setVisibility(CheckBox.VISIBLE); - - consent.setOnCheckedChangeListener(new OnCheckedChangeListener (){ - - public void onCheckedChanged(CompoundButton buttonView, - boolean isChecked) { - - - //this is saying do not use root - - SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext()); - - Editor pEdit = prefs.edit(); - - pEdit.putBoolean(PREF_TRANSPARENT, false); - pEdit.putBoolean(PREF_TRANSPARENT_ALL, false); - pEdit.putBoolean(PREF_HAS_ROOT, false); - - pEdit.commit(); - - /* - Button next = ((Button)findViewById(R.id.btnWizard2)); - if(isChecked) - next.setEnabled(true); - else - next.setEnabled(false); - */ - - stepFour(); - - } - - }); - - - grantPermissions.setOnClickListener(new View.OnClickListener() { - - public void onClick(View v) { - //Check and Install iptables - TorTransProxy.testOwnerModule(this) - - SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext()); - - boolean hasRoot = RootCommands.rootAccessGiven(); - Editor pEdit = prefs.edit(); - pEdit.putBoolean(PREF_HAS_ROOT,hasRoot); - pEdit.commit(); - - if (!hasRoot) - { - - stepFour(); - - } - else - { - finish(); - startActivity(new Intent(Permissions.this, ConfigureTransProxy.class)); - } - - - } - }); - - back.setOnClickListener(new View.OnClickListener() { - - public void onClick(View v) { - finish(); - startActivity(new Intent(Permissions.this, LotsaText.class)); - } - }); - - - next.setOnClickListener(new View.OnClickListener() { - - - public void onClick(View v) { - finish(); - startActivity(new Intent(Permissions.this, TipsAndTricks.class)); - } - }); - - } - - private void stepFour(){ - - String title = context.getString(R.string.wizard_permissions_title); - String msg = context.getString(R.string.wizard_permissions_no_root_msg); - - setTitle(title); - - TextView txtBody = ((TextView)findViewById(R.id.WizardTextBody1)); - txtBody.setText(msg); - - Button btn1 = ((Button)findViewById(R.id.btnWizard1)); - Button btn2 = ((Button)findViewById(R.id.btnWizard2)); - btn2.setEnabled(true); - - TextView txtBody2 = ((TextView)findViewById(R.id.WizardTextBody2)); - txtBody2.setVisibility(TextView.GONE); - - Button grantPermissions = ((Button)findViewById(R.id.grantPermissions)); - grantPermissions.setVisibility(Button.GONE); - - CheckBox consent = (CheckBox)findViewById(R.id.checkBox); - consent.setVisibility(CheckBox.GONE); - - btn1.setOnClickListener(new View.OnClickListener() { - - public void onClick(View v) { - finish(); - startActivity(new Intent(Permissions.this, LotsaText.class)); - } - }); - - btn2.setOnClickListener(new View.OnClickListener() { - - public void onClick(View v) { - finish(); - startActivity(new Intent(Permissions.this, TipsAndTricks.class)); - } - }); - } - - //Code to override the back button! - public boolean onKeyDown(int keyCode, KeyEvent event) { - if(keyCode == KeyEvent.KEYCODE_BACK){ - finish(); - startActivity(new Intent(getBaseContext(), LotsaText.class)); - return true; - } - return false; - } - -} \ No newline at end of file diff --git a/src/org/torproject/android/wizard/TipsAndTricks.java b/src/org/torproject/android/wizard/TipsAndTricks.java index d10278b..3eea373 100644 --- a/src/org/torproject/android/wizard/TipsAndTricks.java +++ b/src/org/torproject/android/wizard/TipsAndTricks.java @@ -157,7 +157,7 @@ public class TipsAndTricks extends Activity implements TorConstants { public void onClick(View v) { finish(); - startActivityForResult(new Intent(TipsAndTricks.this, Permissions.class), 1); + startActivityForResult(new Intent(TipsAndTricks.this, LotsaText.class), 1); } }); @@ -184,7 +184,6 @@ public class TipsAndTricks extends Activity implements TorConstants { Button btn1 = ((Button)findViewById(R.id.btnWizard1)); Button btn2 = ((Button)findViewById(R.id.btnWizard2));
- btn2.setText(getString(R.string.btn_finish)); btn1.setVisibility(Button.VISIBLE); @@ -192,7 +191,7 @@ public class TipsAndTricks extends Activity implements TorConstants { public void onClick(View v) { finish(); - startActivity(new Intent(TipsAndTricks.this, Permissions.class)); + startActivity(new Intent(TipsAndTricks.this, LotsaText.class)); } }); @@ -209,7 +208,7 @@ public class TipsAndTricks extends Activity implements TorConstants { public boolean onKeyDown(int keyCode, KeyEvent event) { if(keyCode == KeyEvent.KEYCODE_BACK){ finish(); - startActivity(new Intent(getBaseContext(), Permissions.class)); + startActivity(new Intent(getBaseContext(), LotsaText.class)); return true; } return false;