[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [orbot/master] a little bit of code re-org and new package for wizard
commit 6a7c593353f725d6fb3863ad04220061c60d942c
Author: Nathan Freitas <nathan@xxxxxxxxxxx>
Date: Sat Mar 28 00:39:58 2015 -0400
a little bit of code re-org and new package for wizard
---
AndroidManifest.xml | 4 +-
res/menu/orbot_main.xml | 8 +-
res/values/strings.xml | 2 +
src/org/torproject/android/OrbotApp.java | 2 +-
src/org/torproject/android/OrbotConstants.java | 55 +++++
src/org/torproject/android/OrbotMainActivity.java | 35 ++--
src/org/torproject/android/TorConstants.java | 55 -----
.../android/service/TorResourceInstaller.java | 4 +-
src/org/torproject/android/service/TorService.java | 26 +--
.../android/service/TorServiceUtils.java | 6 +-
.../torproject/android/service/TorTransProxy.java | 6 +-
.../torproject/android/settings/AppManager.java | 4 +-
.../android/ui/ChooseLocaleWizardActivity.java | 135 -------------
.../torproject/android/ui/OrbotLogActivity.java | 4 +-
src/org/torproject/android/ui/TipsAndTricks.java | 213 --------------------
.../ui/wizard/ChooseLocaleWizardActivity.java | 135 +++++++++++++
.../android/ui/wizard/TipsAndTricks.java | 213 ++++++++++++++++++++
17 files changed, 459 insertions(+), 448 deletions(-)
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 0dbd192..ee624d8 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -88,8 +88,8 @@
/>
- <activity android:name=".ui.TipsAndTricks" android:exported="false"/>
- <activity android:name=".ui.ChooseLocaleWizardActivity" android:exported="false"/>
+ <activity android:name="org.torproject.android.ui.wizard.TipsAndTricks" android:exported="false"/>
+ org.torproject.android.ui.wizard.ChooseLocaleWizardActivityui.ChooseLocaleWizardActivity" android:exported="false"/>
<activity android:name=".settings.SettingsPreferences" android:label="@string/app_name"/>
<activity android:name=".settings.AppManager" android:label="@string/app_name"/>
diff --git a/res/menu/orbot_main.xml b/res/menu/orbot_main.xml
index 55e5b17..cff67e9 100644
--- a/res/menu/orbot_main.xml
+++ b/res/menu/orbot_main.xml
@@ -26,6 +26,11 @@
yourapp:showAsAction="always"
/>
+ <item
+ android:title="@string/menu_qr"
+ yourapp:showAsAction="never"
+ >
+ <menu>
<item android:id="@+id/menu_scan"
android:title="@string/menu_scan"
yourapp:showAsAction="never"
@@ -35,7 +40,8 @@
android:title="@string/menu_share_bridge"
yourapp:showAsAction="never"
/>
-
+ </menu>
+ </item>
<!--
<item android:id="@+id/menu_verify"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1b7b0cc..f5a1fe7 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -316,4 +316,6 @@
<string name="bridges_updated">Bridges Updated</string>
<string name="restart_orbot_to_use_this_bridge_">"Restart Orbot to use these bridges: "</string>
+
+ <string name="menu_qr">QR Codes</string>
</resources>
diff --git a/src/org/torproject/android/OrbotApp.java b/src/org/torproject/android/OrbotApp.java
index cb1824c..4e6d9ec 100644
--- a/src/org/torproject/android/OrbotApp.java
+++ b/src/org/torproject/android/OrbotApp.java
@@ -9,7 +9,7 @@ import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.preference.PreferenceManager;
-public class OrbotApp extends Application implements TorConstants
+public class OrbotApp extends Application implements OrbotConstants
{
private Locale locale;
diff --git a/src/org/torproject/android/OrbotConstants.java b/src/org/torproject/android/OrbotConstants.java
new file mode 100644
index 0000000..e400851
--- /dev/null
+++ b/src/org/torproject/android/OrbotConstants.java
@@ -0,0 +1,55 @@
+/* Copyright (c) 2009, Nathan Freitas, Orbot/The Guardian Project - http://openideals.com/guardian */
+/* See LICENSE for licensing information */
+
+package org.torproject.android;
+
+public interface OrbotConstants {
+
+ public final static String TAG = "Orbot";
+
+
+ public final static String PREFS_KEY = "OrbotPrefs";
+ public final static String PREFS_KEY_TORIFIED = "PrefTord";
+
+ public final static int FILE_WRITE_BUFFER_SIZE = 2048;
+
+ //path to check Tor against
+ public final static String URL_TOR_CHECK = "https://check.torproject.org";
+
+
+ public final static String NEWLINE = "\n";
+
+ // public final static String INTENT_TOR_SERVICE = "org.torproject.android.service.TOR_SERVICE";
+
+ public final static String HANDLER_TOR_MSG = "torServiceMsg";
+
+ public final static String PREF_BRIDGES_ENABLED = "pref_bridges_enabled";
+ public final static String PREF_BRIDGES_UPDATED = "pref_bridges_enabled";
+ public final static String PREF_BRIDGES_LIST = "pref_bridges_list";
+ //public final static String PREF_BRIDGES_OBFUSCATED = "pref_bridges_obfuscated";
+ public final static String PREF_OR = "pref_or";
+ public final static String PREF_OR_PORT = "pref_or_port";
+ public final static String PREF_OR_NICKNAME = "pref_or_nickname";
+ public final static String PREF_REACHABLE_ADDRESSES = "pref_reachable_addresses";
+ public final static String PREF_REACHABLE_ADDRESSES_PORTS = "pref_reachable_addresses_ports";
+ public final static String PREF_TRANSPARENT = "pref_transparent";
+ public final static String PREF_TRANSPARENT_ALL = "pref_transparent_all";
+
+ public final static String PREF_HAS_ROOT = "has_root";
+ public final static int RESULT_CLOSE_ALL = 0;
+
+ public final static String PREF_USE_SYSTEM_IPTABLES = "pref_use_sys_iptables";
+
+ public final static String PREF_PERSIST_NOTIFICATIONS = "pref_persistent_notifications";
+
+ public final static String PREF_DEFAULT_LOCALE = "pref_default_locale";
+
+ public final static String PREF_DISABLE_NETWORK = "pref_disable_network";
+
+ public final static String PREF_TOR_SHARED_PREFS = "org.torproject.android_preferences";
+
+ public final static int MAX_LOG_LENGTH = 10000;
+
+ public final static String PREF_SOCKS = "pref_socks";
+
+}
diff --git a/src/org/torproject/android/OrbotMainActivity.java b/src/org/torproject/android/OrbotMainActivity.java
index 9f38be4..406f15d 100644
--- a/src/org/torproject/android/OrbotMainActivity.java
+++ b/src/org/torproject/android/OrbotMainActivity.java
@@ -13,10 +13,10 @@ 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.ui.ChooseLocaleWizardActivity;
import org.torproject.android.ui.ImageProgressView;
import org.torproject.android.ui.Rotate3dAnimation;
-import org.torproject.android.ui.TipsAndTricks;
+import org.torproject.android.ui.wizard.ChooseLocaleWizardActivity;
+import org.torproject.android.ui.wizard.TipsAndTricks;
import android.annotation.TargetApi;
import android.app.Activity;
@@ -67,7 +67,7 @@ import com.google.zxing.integration.android.IntentIntegrator;
import com.google.zxing.integration.android.IntentResult;
-public class OrbotMainActivity extends Activity implements TorConstants, OnLongClickListener, OnTouchListener, OnSharedPreferenceChangeListener
+public class OrbotMainActivity extends Activity implements OrbotConstants, OnLongClickListener, OnTouchListener, OnSharedPreferenceChangeListener
{
/* Useful UI bits */
private TextView lblStatus = null; //the main text display widget
@@ -417,18 +417,21 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC
else if (item.getItemId() == R.id.menu_share_bridge)
{
- String bridges = mPrefs.getString(TorConstants.PREF_BRIDGES_LIST, null);
+ String bridges = mPrefs.getString(OrbotConstants.PREF_BRIDGES_LIST, null);
- try {
- bridges = "bridge://" + URLEncoder.encode(bridges,"UTF-8");
-
- IntentIntegrator integrator = new IntentIntegrator(OrbotMainActivity.this);
- integrator.shareText(bridges);
-
- } catch (UnsupportedEncodingException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ if (bridges != null && bridges.length() > 0)
+ {
+ try {
+ bridges = "bridge://" + URLEncoder.encode(bridges,"UTF-8");
+
+ IntentIntegrator integrator = new IntentIntegrator(OrbotMainActivity.this);
+ integrator.shareText(bridges);
+
+ } catch (UnsupportedEncodingException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
}
@@ -652,8 +655,8 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC
Editor pEdit = mPrefs.edit();
- pEdit.putString(TorConstants.PREF_BRIDGES_LIST,newBridgeValue); //set the string to a preference
- pEdit.putBoolean(TorConstants.PREF_BRIDGES_ENABLED,true);
+ pEdit.putString(OrbotConstants.PREF_BRIDGES_LIST,newBridgeValue); //set the string to a preference
+ pEdit.putBoolean(OrbotConstants.PREF_BRIDGES_ENABLED,true);
pEdit.commit();
diff --git a/src/org/torproject/android/TorConstants.java b/src/org/torproject/android/TorConstants.java
deleted file mode 100644
index 9b0966e..0000000
--- a/src/org/torproject/android/TorConstants.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Copyright (c) 2009, Nathan Freitas, Orbot/The Guardian Project - http://openideals.com/guardian */
-/* See LICENSE for licensing information */
-
-package org.torproject.android;
-
-public interface TorConstants {
-
- public final static String TAG = "Orbot";
-
-
- public final static String PREFS_KEY = "OrbotPrefs";
- public final static String PREFS_KEY_TORIFIED = "PrefTord";
-
- public final static int FILE_WRITE_BUFFER_SIZE = 2048;
-
- //path to check Tor against
- public final static String URL_TOR_CHECK = "https://check.torproject.org";
-
-
- public final static String NEWLINE = "\n";
-
- // public final static String INTENT_TOR_SERVICE = "org.torproject.android.service.TOR_SERVICE";
-
- public final static String HANDLER_TOR_MSG = "torServiceMsg";
-
- public final static String PREF_BRIDGES_ENABLED = "pref_bridges_enabled";
- public final static String PREF_BRIDGES_UPDATED = "pref_bridges_enabled";
- public final static String PREF_BRIDGES_LIST = "pref_bridges_list";
- //public final static String PREF_BRIDGES_OBFUSCATED = "pref_bridges_obfuscated";
- public final static String PREF_OR = "pref_or";
- public final static String PREF_OR_PORT = "pref_or_port";
- public final static String PREF_OR_NICKNAME = "pref_or_nickname";
- public final static String PREF_REACHABLE_ADDRESSES = "pref_reachable_addresses";
- public final static String PREF_REACHABLE_ADDRESSES_PORTS = "pref_reachable_addresses_ports";
- public final static String PREF_TRANSPARENT = "pref_transparent";
- public final static String PREF_TRANSPARENT_ALL = "pref_transparent_all";
-
- public final static String PREF_HAS_ROOT = "has_root";
- public final static int RESULT_CLOSE_ALL = 0;
-
- public final static String PREF_USE_SYSTEM_IPTABLES = "pref_use_sys_iptables";
-
- public final static String PREF_PERSIST_NOTIFICATIONS = "pref_persistent_notifications";
-
- public final static String PREF_DEFAULT_LOCALE = "pref_default_locale";
-
- public final static String PREF_DISABLE_NETWORK = "pref_disable_network";
-
- public final static String PREF_TOR_SHARED_PREFS = "org.torproject.android_preferences";
-
- public final static int MAX_LOG_LENGTH = 10000;
-
- public final static String PREF_SOCKS = "pref_socks";
-
-}
diff --git a/src/org/torproject/android/service/TorResourceInstaller.java b/src/org/torproject/android/service/TorResourceInstaller.java
index 6f81f97..a56c618 100644
--- a/src/org/torproject/android/service/TorResourceInstaller.java
+++ b/src/org/torproject/android/service/TorResourceInstaller.java
@@ -20,7 +20,7 @@ import java.util.zip.ZipInputStream;
import org.sufficientlysecure.rootcommands.Shell;
import org.sufficientlysecure.rootcommands.command.SimpleCommand;
import org.torproject.android.R;
-import org.torproject.android.TorConstants;
+import org.torproject.android.OrbotConstants;
import android.content.Context;
import android.util.Log;
@@ -265,7 +265,7 @@ public class TorResourceInstaller implements TorServiceConstants {
} catch (IOException ex) {
- Log.e(TorConstants.TAG, "error copying binary", ex);
+ Log.e(OrbotConstants.TAG, "error copying binary", ex);
}
}
diff --git a/src/org/torproject/android/service/TorService.java b/src/org/torproject/android/service/TorService.java
index 5100368..9529d6d 100644
--- a/src/org/torproject/android/service/TorService.java
+++ b/src/org/torproject/android/service/TorService.java
@@ -51,7 +51,7 @@ import org.sufficientlysecure.rootcommands.Shell;
import org.sufficientlysecure.rootcommands.command.SimpleCommand;
import org.torproject.android.OrbotMainActivity;
import org.torproject.android.R;
-import org.torproject.android.TorConstants;
+import org.torproject.android.OrbotConstants;
import org.torproject.android.settings.AppManager;
import org.torproject.android.settings.TorifiedApp;
import org.torproject.android.vpn.OrbotVpnService;
@@ -79,7 +79,7 @@ import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
import android.widget.RemoteViews;
-public class TorService extends Service implements TorServiceConstants, TorConstants, EventHandler
+public class TorService extends Service implements TorServiceConstants, OrbotConstants, EventHandler
{
public static boolean ENABLE_DEBUG_LOG = true;
@@ -783,7 +783,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
ENABLE_DEBUG_LOG = prefs.getBoolean("pref_enable_logging",false);
Log.i(TAG,"debug logging:" + ENABLE_DEBUG_LOG);
- prefPersistNotifications = prefs.getBoolean(TorConstants.PREF_PERSIST_NOTIFICATIONS, true);
+ prefPersistNotifications = prefs.getBoolean(OrbotConstants.PREF_PERSIST_NOTIFICATIONS, true);
mUseVPN = prefs.getBoolean("pref_vpn", false);
}
@@ -811,7 +811,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
ArrayList<String> customEnv = new ArrayList<String>();
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
- boolean useBridges = prefs.getBoolean(TorConstants.PREF_BRIDGES_ENABLED, false);
+ boolean useBridges = prefs.getBoolean(OrbotConstants.PREF_BRIDGES_ENABLED, false);
if (useBridges)
if (mUseVPN && !mIsLollipop)
@@ -1185,7 +1185,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
- String socksPortPref = prefs.getString(TorConstants.PREF_SOCKS, TorServiceConstants.PORT_SOCKS_DEFAULT);
+ String socksPortPref = prefs.getString(OrbotConstants.PREF_SOCKS, TorServiceConstants.PORT_SOCKS_DEFAULT);
if (socksPortPref.indexOf(':')!=-1)
socksPortPref = socksPortPref.split(":")[1];
@@ -2043,7 +2043,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
- boolean doNetworKSleep = prefs.getBoolean(TorConstants.PREF_DISABLE_NETWORK, true);
+ boolean doNetworKSleep = prefs.getBoolean(OrbotConstants.PREF_DISABLE_NETWORK, true);
final ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
final NetworkInfo netInfo = cm.getActiveNetworkInfo();
@@ -2114,10 +2114,10 @@ public class TorService extends Service implements TorServiceConstants, TorConst
enableTransProxyAndDNSPorts(transPort, dnsPort);
*/
- boolean useBridges = prefs.getBoolean(TorConstants.PREF_BRIDGES_ENABLED, false);
+ boolean useBridges = prefs.getBoolean(OrbotConstants.PREF_BRIDGES_ENABLED, false);
- boolean becomeRelay = prefs.getBoolean(TorConstants.PREF_OR, false);
- boolean ReachableAddresses = prefs.getBoolean(TorConstants.PREF_REACHABLE_ADDRESSES,false);
+ boolean becomeRelay = prefs.getBoolean(OrbotConstants.PREF_OR, false);
+ boolean ReachableAddresses = prefs.getBoolean(OrbotConstants.PREF_REACHABLE_ADDRESSES,false);
boolean enableHiddenServices = prefs.getBoolean("pref_hs_enable", false);
boolean enableStrictNodes = prefs.getBoolean("pref_strict_nodes", false);
@@ -2182,7 +2182,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
updateConfiguration("UseBridges", "1", false);
- String bridgeList = prefs.getString(TorConstants.PREF_BRIDGES_LIST,null);
+ String bridgeList = prefs.getString(OrbotConstants.PREF_BRIDGES_LIST,null);
if (bridgeList != null && bridgeList.length() > 1) //longer then 1 = some real values here
{
@@ -2302,7 +2302,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
if (ReachableAddresses)
{
String ReachableAddressesPorts =
- prefs.getString(TorConstants.PREF_REACHABLE_ADDRESSES_PORTS, "*:80,*:443");
+ prefs.getString(OrbotConstants.PREF_REACHABLE_ADDRESSES_PORTS, "*:80,*:443");
updateConfiguration("ReachableAddresses", ReachableAddressesPorts, false);
@@ -2323,8 +2323,8 @@ public class TorService extends Service implements TorServiceConstants, TorConst
{
if (becomeRelay && (!useBridges) && (!ReachableAddresses))
{
- int ORPort = Integer.parseInt(prefs.getString(TorConstants.PREF_OR_PORT, "9001"));
- String nickname = prefs.getString(TorConstants.PREF_OR_NICKNAME, "Orbot");
+ int ORPort = Integer.parseInt(prefs.getString(OrbotConstants.PREF_OR_PORT, "9001"));
+ String nickname = prefs.getString(OrbotConstants.PREF_OR_NICKNAME, "Orbot");
String dnsFile = writeDNSFile ();
diff --git a/src/org/torproject/android/service/TorServiceUtils.java b/src/org/torproject/android/service/TorServiceUtils.java
index a22b328..609a8e2 100644
--- a/src/org/torproject/android/service/TorServiceUtils.java
+++ b/src/org/torproject/android/service/TorServiceUtils.java
@@ -9,7 +9,7 @@ import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.StringTokenizer;
-import org.torproject.android.TorConstants;
+import org.torproject.android.OrbotConstants;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
@@ -117,9 +117,9 @@ public class TorServiceUtils implements TorServiceConstants {
public static SharedPreferences getSharedPrefs (Context context)
{
if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.HONEYCOMB)
- return context.getSharedPreferences(TorConstants.PREF_TOR_SHARED_PREFS,0 | Context.MODE_MULTI_PROCESS);
+ return context.getSharedPreferences(OrbotConstants.PREF_TOR_SHARED_PREFS,0 | Context.MODE_MULTI_PROCESS);
else
- return context.getSharedPreferences(TorConstants.PREF_TOR_SHARED_PREFS,Context.MODE_PRIVATE);
+ return context.getSharedPreferences(OrbotConstants.PREF_TOR_SHARED_PREFS,Context.MODE_PRIVATE);
}
}
diff --git a/src/org/torproject/android/service/TorTransProxy.java b/src/org/torproject/android/service/TorTransProxy.java
index 78b6ebd..4c32bb5 100644
--- a/src/org/torproject/android/service/TorTransProxy.java
+++ b/src/org/torproject/android/service/TorTransProxy.java
@@ -7,7 +7,7 @@ import java.util.concurrent.TimeoutException;
import org.sufficientlysecure.rootcommands.Shell;
import org.sufficientlysecure.rootcommands.command.SimpleCommand;
-import org.torproject.android.TorConstants;
+import org.torproject.android.OrbotConstants;
import org.torproject.android.settings.TorifiedApp;
import android.content.Context;
@@ -49,7 +49,7 @@ public class TorTransProxy implements TorServiceConstants {
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(context);
- useSystemIpTables = prefs.getBoolean(TorConstants.PREF_USE_SYSTEM_IPTABLES, false);
+ useSystemIpTables = prefs.getBoolean(OrbotConstants.PREF_USE_SYSTEM_IPTABLES, false);
if (useSystemIpTables)
{
@@ -72,7 +72,7 @@ public class TorTransProxy implements TorServiceConstants {
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(context);
- useSystemIpTables = prefs.getBoolean(TorConstants.PREF_USE_SYSTEM_IPTABLES, false);
+ useSystemIpTables = prefs.getBoolean(OrbotConstants.PREF_USE_SYSTEM_IPTABLES, false);
if (useSystemIpTables)
{
diff --git a/src/org/torproject/android/settings/AppManager.java b/src/org/torproject/android/settings/AppManager.java
index 5818519..19dff0a 100644
--- a/src/org/torproject/android/settings/AppManager.java
+++ b/src/org/torproject/android/settings/AppManager.java
@@ -11,7 +11,7 @@ import java.util.List;
import java.util.StringTokenizer;
import org.torproject.android.R;
-import org.torproject.android.TorConstants;
+import org.torproject.android.OrbotConstants;
import org.torproject.android.service.TorServiceUtils;
import android.app.Activity;
@@ -38,7 +38,7 @@ import android.widget.ListView;
import android.widget.TextView;
//import android.R;
-public class AppManager extends Activity implements OnCheckedChangeListener, OnClickListener, TorConstants {
+public class AppManager extends Activity implements OnCheckedChangeListener, OnClickListener, OrbotConstants {
private ListView listApps;
private final static String TAG = "Orbot";
diff --git a/src/org/torproject/android/ui/ChooseLocaleWizardActivity.java b/src/org/torproject/android/ui/ChooseLocaleWizardActivity.java
deleted file mode 100644
index 95f8766..0000000
--- a/src/org/torproject/android/ui/ChooseLocaleWizardActivity.java
+++ /dev/null
@@ -1,135 +0,0 @@
-package org.torproject.android.ui;
-
-import java.util.Locale;
-
-import org.torproject.android.R;
-import org.torproject.android.TorConstants;
-import org.torproject.android.service.TorServiceUtils;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.content.SharedPreferences.Editor;
-import android.content.res.Configuration;
-import android.os.Bundle;
-import android.view.KeyEvent;
-import android.view.View;
-import android.widget.AdapterView;
-import android.widget.AdapterView.OnItemClickListener;
-import android.widget.ArrayAdapter;
-import android.widget.Button;
-import android.widget.ListView;
-import android.widget.Toast;
-
-public class ChooseLocaleWizardActivity extends Activity implements TorConstants {
-
- private int flag = 0;
- private ListView listLocales;
-
- protected void onCreate(Bundle savedInstanceState)
- {
- super.onCreate(savedInstanceState);
-
- }
-
- @Override
- protected void onStart() {
-
- super.onStart();
- setContentView(R.layout.layout_wizard_locale);
-
-
- listLocales = (ListView)findViewById(R.id.wizard_locale_list);
- Button next = ((Button)findViewById(R.id.btnWizard2));
- // next.setEnabled(false);
-
- String[] strLangs = getResources().getStringArray(R.array.languages);
- strLangs[0] = Locale.getDefault().getDisplayName();
- ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, strLangs);
- listLocales.setAdapter(adapter);
-
- listLocales.setSelection(0);
-
-
- listLocales.setOnItemClickListener(new OnItemClickListener() {
-
-
- @Override
- public void onItemClick(AdapterView<?> arg0, View arg1,
- int arg2, long arg3) {
-
- setLocalePref(arg2);
- finish();
- startActivity(new Intent(ChooseLocaleWizardActivity.this, TipsAndTricks.class));
-
- }
- });
-
- next.setOnClickListener(new View.OnClickListener() {
-
- public void onClick(View v) {
- setLocalePref(0);
- finish();
- startActivity(new Intent(ChooseLocaleWizardActivity.this, TipsAndTricks.class));
-
- }
- });
-
-
-
- }
-
- private void setLocalePref(int selId)
- {
-
- SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
-
- Configuration config = getResources().getConfiguration();
-
- String[] localeVals = getResources().getStringArray(R.array.languages_values);
-
- String lang = localeVals[selId];
-
- Editor pEdit = prefs.edit();
- pEdit.putString(PREF_DEFAULT_LOCALE, lang);
- pEdit.commit();
- Locale locale = null;
-
- if (lang.equals("xx"))
- {
- locale = Locale.getDefault();
-
- }
- else
- locale = new Locale(lang);
-
- Locale.setDefault(locale);
- config.locale = locale;
- getResources().updateConfiguration(config, getResources().getDisplayMetrics());
-
-
-
-
- }
-
- @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){
- Toast.makeText(getApplicationContext(), R.string.wizard_exit_at_first_screen_toast, Toast.LENGTH_SHORT).show();
- return true;
- }
- return false;
- }
-}
\ No newline at end of file
diff --git a/src/org/torproject/android/ui/OrbotLogActivity.java b/src/org/torproject/android/ui/OrbotLogActivity.java
index ae83b77..4a24d3f 100644
--- a/src/org/torproject/android/ui/OrbotLogActivity.java
+++ b/src/org/torproject/android/ui/OrbotLogActivity.java
@@ -3,7 +3,7 @@
package org.torproject.android.ui;
-import org.torproject.android.TorConstants;
+import org.torproject.android.OrbotConstants;
import android.app.Activity;
import android.content.BroadcastReceiver;
@@ -14,7 +14,7 @@ import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
-public class OrbotLogActivity extends Activity implements TorConstants
+public class OrbotLogActivity extends Activity implements OrbotConstants
{
/** Called when the activity is first created. */
diff --git a/src/org/torproject/android/ui/TipsAndTricks.java b/src/org/torproject/android/ui/TipsAndTricks.java
deleted file mode 100644
index d0e711b..0000000
--- a/src/org/torproject/android/ui/TipsAndTricks.java
+++ /dev/null
@@ -1,213 +0,0 @@
-package org.torproject.android.ui;
-
-import org.torproject.android.R;
-import org.torproject.android.TorConstants;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.net.Uri;
-import android.os.Bundle;
-import android.view.KeyEvent;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
-import android.widget.TextView;
-
-public class TipsAndTricks extends Activity implements TorConstants {
-
- protected void onCreate(Bundle savedInstanceState)
- {
- super.onCreate(savedInstanceState);
-
- }
-
- @Override
- protected void onStart() {
-
- super.onStart();
- setContentView(R.layout.layout_wizard_tips);
-
- stepFive();
-
- }
-
- @Override
- protected void onResume() {
- super.onResume();
-
-
- }
-
- void stepFive(){
-
-
- String title = getString(R.string.wizard_tips_title);
-
- setTitle(title);
-
- Button btnLink = (Button)findViewById(R.id.WizardRootButtonInstallGibberbot);
-
- btnLink.setOnClickListener(new OnClickListener() {
-
- public void onClick(View view) {
-
- String url = getString(R.string.gibberbot_apk_url);
- finish();
- startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
-
- }
- });
-
- btnLink = (Button)findViewById(R.id.WizardRootButtonInstallOrweb);
-
- btnLink.setOnClickListener(new OnClickListener() {
-
- public void onClick(View view) {
-
- String url = getString(R.string.orweb_apk_url);
- finish();
- startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
-
- }
- });
-
- btnLink = (Button)findViewById(R.id.WizardRootButtonInstallDuckgo);
-
- btnLink.setOnClickListener(new OnClickListener() {
-
- public void onClick(View view) {
-
- String url = getString(R.string.duckgo_apk_url);
- finish();
- startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
-
- }
- });
-
- btnLink = (Button)findViewById(R.id.WizardRootButtonInstallFirefox);
-
- btnLink.setOnClickListener(new OnClickListener() {
-
- public void onClick(View view) {
-
- String url = getString(R.string.proxymob_setup_url);
- finish();
- startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
-
- }
- });
-
- btnLink = (Button)findViewById(R.id.WizardRootButtonInstallTwitter);
-
- btnLink.setOnClickListener(new OnClickListener() {
-
- public void onClick(View view) {
-
- String url = getString(R.string.twitter_setup_url);
- finish();
- startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
-
- }
- });
-
- btnLink = (Button)findViewById(R.id.WizardRootButtonInstallStoryMaker);
-
- btnLink.setOnClickListener(new OnClickListener() {
-
- public void onClick(View view) {
-
- String url = getString(R.string.story_maker_url);
- startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
-
- }
- });
-
- btnLink = (Button)findViewById(R.id.WizardRootButtonInstallMartus);
-
- btnLink.setOnClickListener(new OnClickListener() {
-
- public void onClick(View view) {
-
- String url = getString(R.string.martus_url);
- startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
-
- }
- });
-
-
- btnLink = (Button)findViewById(R.id.WizardRootButtonGooglePlay);
-
- btnLink.setOnClickListener(new OnClickListener() {
-
- public void onClick(View view) {
-
- String url = getString(R.string.wizard_tips_play_url);
- startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
-
- }
- });
-
-
- Button back = ((Button)findViewById(R.id.btnWizard1));
- Button next = ((Button)findViewById(R.id.btnWizard2));
-
- back.setOnClickListener(new View.OnClickListener() {
-
- public void onClick(View v) {
- finish();
- startActivityForResult(new Intent(TipsAndTricks.this, ChooseLocaleWizardActivity.class), 1);
- }
- });
-
- next.setOnClickListener(new View.OnClickListener() {
-
- public void onClick(View v) {
- //showWizardFinal();
-
- finish();
- }
- });
-
- }
-
-
-
- //Code to override the back button!
- @Override
- public boolean onKeyDown(int keyCode, KeyEvent event) {
- if(keyCode == KeyEvent.KEYCODE_BACK){
- finish();
- startActivity(new Intent(getBaseContext(), ChooseLocaleWizardActivity.class));
- return true;
- }
- return false;
- }
-
- /*
- 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() {
-
- @Override
- public void onClick(DialogInterface dialog, int which) {
- context.startActivity(new Intent(context, Orbot.class));
-
- }
- };
-
-
- new AlertDialog.Builder(context)
- .setIcon(R.drawable.icon)
- .setTitle(title)
- .setPositiveButton(R.string.button_close, ocListener)
- .setMessage(msg)
- .show();
- }*/
-}
diff --git a/src/org/torproject/android/ui/wizard/ChooseLocaleWizardActivity.java b/src/org/torproject/android/ui/wizard/ChooseLocaleWizardActivity.java
new file mode 100644
index 0000000..3fdd746
--- /dev/null
+++ b/src/org/torproject/android/ui/wizard/ChooseLocaleWizardActivity.java
@@ -0,0 +1,135 @@
+package org.torproject.android.ui.wizard;
+
+import java.util.Locale;
+
+import org.torproject.android.R;
+import org.torproject.android.OrbotConstants;
+import org.torproject.android.service.TorServiceUtils;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.content.SharedPreferences.Editor;
+import android.content.res.Configuration;
+import android.os.Bundle;
+import android.view.KeyEvent;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.ListView;
+import android.widget.Toast;
+
+public class ChooseLocaleWizardActivity extends Activity implements OrbotConstants {
+
+ private int flag = 0;
+ private ListView listLocales;
+
+ protected void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+
+ }
+
+ @Override
+ protected void onStart() {
+
+ super.onStart();
+ setContentView(R.layout.layout_wizard_locale);
+
+
+ listLocales = (ListView)findViewById(R.id.wizard_locale_list);
+ Button next = ((Button)findViewById(R.id.btnWizard2));
+ // next.setEnabled(false);
+
+ String[] strLangs = getResources().getStringArray(R.array.languages);
+ strLangs[0] = Locale.getDefault().getDisplayName();
+ ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, strLangs);
+ listLocales.setAdapter(adapter);
+
+ listLocales.setSelection(0);
+
+
+ listLocales.setOnItemClickListener(new OnItemClickListener() {
+
+
+ @Override
+ public void onItemClick(AdapterView<?> arg0, View arg1,
+ int arg2, long arg3) {
+
+ setLocalePref(arg2);
+ finish();
+ startActivity(new Intent(ChooseLocaleWizardActivity.this, TipsAndTricks.class));
+
+ }
+ });
+
+ next.setOnClickListener(new View.OnClickListener() {
+
+ public void onClick(View v) {
+ setLocalePref(0);
+ finish();
+ startActivity(new Intent(ChooseLocaleWizardActivity.this, TipsAndTricks.class));
+
+ }
+ });
+
+
+
+ }
+
+ private void setLocalePref(int selId)
+ {
+
+ SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
+
+ Configuration config = getResources().getConfiguration();
+
+ String[] localeVals = getResources().getStringArray(R.array.languages_values);
+
+ String lang = localeVals[selId];
+
+ Editor pEdit = prefs.edit();
+ pEdit.putString(PREF_DEFAULT_LOCALE, lang);
+ pEdit.commit();
+ Locale locale = null;
+
+ if (lang.equals("xx"))
+ {
+ locale = Locale.getDefault();
+
+ }
+ else
+ locale = new Locale(lang);
+
+ Locale.setDefault(locale);
+ config.locale = locale;
+ getResources().updateConfiguration(config, getResources().getDisplayMetrics());
+
+
+
+
+ }
+
+ @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){
+ Toast.makeText(getApplicationContext(), R.string.wizard_exit_at_first_screen_toast, Toast.LENGTH_SHORT).show();
+ return true;
+ }
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/src/org/torproject/android/ui/wizard/TipsAndTricks.java b/src/org/torproject/android/ui/wizard/TipsAndTricks.java
new file mode 100644
index 0000000..d47a4fb
--- /dev/null
+++ b/src/org/torproject/android/ui/wizard/TipsAndTricks.java
@@ -0,0 +1,213 @@
+package org.torproject.android.ui.wizard;
+
+import org.torproject.android.R;
+import org.torproject.android.OrbotConstants;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.view.KeyEvent;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.TextView;
+
+public class TipsAndTricks extends Activity implements OrbotConstants {
+
+ protected void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+
+ }
+
+ @Override
+ protected void onStart() {
+
+ super.onStart();
+ setContentView(R.layout.layout_wizard_tips);
+
+ stepFive();
+
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+
+
+ }
+
+ void stepFive(){
+
+
+ String title = getString(R.string.wizard_tips_title);
+
+ setTitle(title);
+
+ Button btnLink = (Button)findViewById(R.id.WizardRootButtonInstallGibberbot);
+
+ btnLink.setOnClickListener(new OnClickListener() {
+
+ public void onClick(View view) {
+
+ String url = getString(R.string.gibberbot_apk_url);
+ finish();
+ startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
+
+ }
+ });
+
+ btnLink = (Button)findViewById(R.id.WizardRootButtonInstallOrweb);
+
+ btnLink.setOnClickListener(new OnClickListener() {
+
+ public void onClick(View view) {
+
+ String url = getString(R.string.orweb_apk_url);
+ finish();
+ startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
+
+ }
+ });
+
+ btnLink = (Button)findViewById(R.id.WizardRootButtonInstallDuckgo);
+
+ btnLink.setOnClickListener(new OnClickListener() {
+
+ public void onClick(View view) {
+
+ String url = getString(R.string.duckgo_apk_url);
+ finish();
+ startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
+
+ }
+ });
+
+ btnLink = (Button)findViewById(R.id.WizardRootButtonInstallFirefox);
+
+ btnLink.setOnClickListener(new OnClickListener() {
+
+ public void onClick(View view) {
+
+ String url = getString(R.string.proxymob_setup_url);
+ finish();
+ startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
+
+ }
+ });
+
+ btnLink = (Button)findViewById(R.id.WizardRootButtonInstallTwitter);
+
+ btnLink.setOnClickListener(new OnClickListener() {
+
+ public void onClick(View view) {
+
+ String url = getString(R.string.twitter_setup_url);
+ finish();
+ startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
+
+ }
+ });
+
+ btnLink = (Button)findViewById(R.id.WizardRootButtonInstallStoryMaker);
+
+ btnLink.setOnClickListener(new OnClickListener() {
+
+ public void onClick(View view) {
+
+ String url = getString(R.string.story_maker_url);
+ startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
+
+ }
+ });
+
+ btnLink = (Button)findViewById(R.id.WizardRootButtonInstallMartus);
+
+ btnLink.setOnClickListener(new OnClickListener() {
+
+ public void onClick(View view) {
+
+ String url = getString(R.string.martus_url);
+ startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
+
+ }
+ });
+
+
+ btnLink = (Button)findViewById(R.id.WizardRootButtonGooglePlay);
+
+ btnLink.setOnClickListener(new OnClickListener() {
+
+ public void onClick(View view) {
+
+ String url = getString(R.string.wizard_tips_play_url);
+ startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
+
+ }
+ });
+
+
+ Button back = ((Button)findViewById(R.id.btnWizard1));
+ Button next = ((Button)findViewById(R.id.btnWizard2));
+
+ back.setOnClickListener(new View.OnClickListener() {
+
+ public void onClick(View v) {
+ finish();
+ startActivityForResult(new Intent(TipsAndTricks.this, ChooseLocaleWizardActivity.class), 1);
+ }
+ });
+
+ next.setOnClickListener(new View.OnClickListener() {
+
+ public void onClick(View v) {
+ //showWizardFinal();
+
+ finish();
+ }
+ });
+
+ }
+
+
+
+ //Code to override the back button!
+ @Override
+ public boolean onKeyDown(int keyCode, KeyEvent event) {
+ if(keyCode == KeyEvent.KEYCODE_BACK){
+ finish();
+ startActivity(new Intent(getBaseContext(), ChooseLocaleWizardActivity.class));
+ return true;
+ }
+ return false;
+ }
+
+ /*
+ 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() {
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ context.startActivity(new Intent(context, Orbot.class));
+
+ }
+ };
+
+
+ new AlertDialog.Builder(context)
+ .setIcon(R.drawable.icon)
+ .setTitle(title)
+ .setPositiveButton(R.string.button_close, ocListener)
+ .setMessage(msg)
+ .show();
+ }*/
+}
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits