Merge branch 'eighthave-the-big-start-stop-makeover'

This commit is contained in:
Nathan Freitas 2015-06-22 12:39:17 -04:00
commit a8384bde74
26 changed files with 1034 additions and 1526 deletions

View File

@ -7,4 +7,17 @@ file_filter = res/values-<lang>/strings.xml
host = https://www.transifex.com
source_file = res/values/strings.xml
source_lang = en
type = ANDROID
[orbot.description]
file_filter = description/<lang>.xlf
host = https://www.transifex.com
source_file = description/source.xlf
source_lang = en
type = XLIFF
[orbot.olddescription]
file_filter = releases/assets/<lang>-description.txt
host = https://www.transifex.com
source_file = releases/assets/description.txt
source_lang = en

View File

@ -56,13 +56,7 @@
</intent-filter>
</activity>
<activity android:name=".ui.OrbotLogActivity"
android:configChanges="orientation|screenSize"
android:exported="false"
/>
<!--
This is for ensuring the background service still runs when/if the app is swiped away
-->
@ -81,24 +75,27 @@
/>
<activity android:name="org.torproject.android.ui.wizard.PromoAppsActivity" android:exported="false"/>
<activity android:name="org.torproject.android.ui.wizard.ChooseLocaleWizardActivity" android:exported="false"/>
<activity android:name="org.torproject.android.ui.PromoAppsActivity" android:exported="false"/>
<activity android:name=".settings.SettingsPreferences" android:label="@string/app_name"/>
<activity android:name=".settings.AppManager" android:label="@string/app_name"/>
<service android:enabled="true"
android:name=".service.TorService"
android:permission="org.torproject.android.MANAGE_TOR"
android:stopWithTask="false"
>
<intent-filter>
<action android:name="org.torproject.android.service.ITorService" />
<action android:name="org.torproject.android.service.TOR_SERVICE" />
</intent-filter>
</service>
<service
android:name=".service.TorService"
android:enabled="true"
android:permission="org.torproject.android.MANAGE_TOR"
android:stopWithTask="false" >
</service>
<receiver
android:name=".service.StartTorReceiver"
android:exported="true">
<intent-filter>
<action android:name="org.torproject.android.intent.action.START" />
</intent-filter>
</receiver>
<receiver android:name="org.torproject.android.service.OnBootReceiver"
android:enabled="true" android:exported="true"

86
description/source.xlf Normal file
View File

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.2">
<file datatype="plaintext" original="source.xlf" source-language="en">
<header>
<note from="developer">Google places strick character limits on the various text fields in Google Play. The title is 30 characters, the short description is 80 characters, and the rest of the strings, which all go together in the description, are limited to 4000 characters.</note>
</header>
<body>
<trans-unit id="title" size-unit="char" maxwidth="30">
<source>Orbot</source>
<note from="developer">This is limited by Google to 30 characters</note>
</trans-unit>
<trans-unit id="shortdescription" size-unit="char" maxwidth="80">
<source>Protect your privacy with this proxy with Tor</source>
<note from="developer">This is limited by Google to 80 characters</note>
</trans-unit>
<trans-unit id="intro">
<source>Orbot is a free proxy app that empowers other apps to use the internet more securely. Orbot uses Tor to encrypt your Internet traffic and then hides it by bouncing through a series of computers around the world. Tor is free software and an open network that helps you defend against a form of network surveillance that threatens personal freedom and privacy, confidential business activities and relationships, and state security known as traffic analysis.</source>
</trans-unit>
<trans-unit id="intro2">
<source>Orbot is the only app that creates a truly private internet connection. As the New York Times writes, “when a communication arrives from Tor, you can never know where or whom its from.” Tor won the 2012 Electronic Frontier Foundation (EFF) Pioneer Award.</source>
</trans-unit>
<trans-unit id="intro2">
<source>ACCEPT NO SUBSTITUTES: Orbot is the safest way to use the Internet on Android. Period. Orbot bounces your encrypted traffic several times through computers around the world, instead of connecting you directly like VPNs and proxies. This process takes a little longer, but the strongest privacy and identity protection available is worth the wait.</source>
</trans-unit>
<trans-unit id="intro2">
<source>PRIVATE WEB SURFING: Use with Orweb, the most anonymous way to access any website, even if its normally blocked, monitored, or on the hidden web. Get Orweb: https://goo.gl/s3mLa</source>
</trans-unit>
<trans-unit id="intro2">
<source>PRIVATE CHAT MESSAGING: Use Gibberbot with Orbot to chat confidentially with anyone, anywhere for free. Get Gibberbot: https://goo.gl/O3FfS</source>
</trans-unit>
<trans-unit id="intro2">
<source>PRIVACY FOR APPS: Any installed app can use Tor if it has a proxy feature, using the settings found here: https://goo.gl/2OA1y Use Orbot with Twitter, or try private web searching with DuckDuckGo: https://goo.gl/lgh1p</source>
</trans-unit>
<trans-unit id="intro2">
<source>PRIVACY FOR EVERYONE: Tor can help you confidentially research a competitor, get around the Facebook block at school, or circumvent a firewall to watch sports at work.
PRIVACY MADE EASY: Check out our fun, interactive walkthrough: https://guardianproject.info/howto/browsefreely
ITS OFFICIAL: This is the official version of the Tor onion routing service for Android.</source>
</trans-unit>
<trans-unit id="expertrootmode">
<source>***Expert Root Mode***</source>
</trans-unit>
<trans-unit id="universalmode">
<source>UNIVERSAL MODE: Orbot can be configured to transparently proxy all of your Internet traffic through Tor. You can also choose which specific apps you want to use through Tor.</source>
</trans-unit>
<trans-unit id="wespeakyourlanguage">
<source>★ WE SPEAK YOUR LANGUAGE: Orbot is available for friends who speak:</source>
</trans-unit>
<trans-unit id="languagelist" translate="no">
<source>العربية, azərbaycanca, български, català, Čeština, dansk, Deutsch, Ελληνικά, English, español, eesti, euskara, فارسی, suomi, français, galego, hrvatski, magyar, עברית, íslenska, italiano, 日本語, 한국어, lietuvių, latviešu, Македонци, Bahasa Melayu, Nederlands, norsk, polski, português, Русский, slovenčina, slovenščina, српски, svenska, Türkçe, українська, Tagalog, Tiếng Việt, 中文(简体), 中文(台灣)</source>
<note from="developer">Do not translate the names of the languages, leave them just like this.</note>
</trans-unit>
<trans-unit id="helptranslate">
<source>Dont see your language? Join us and help translate the app:</source>
</trans-unit>
<trans-unit id="helptranslateurl" translate="no">
<source>https://www.transifex.com/projects/p/orbot</source>
<note from="developer">Do not translate this.</note>
</trans-unit>
<trans-unit id="learnmore">
<source>***Learn More***</source>
</trans-unit>
<trans-unit id="aboutus">
<source>★ ABOUT US: Guardian Project is a group of developers that make secure mobile apps and open-source code for a better tomorrow</source>
</trans-unit>
<trans-unit id="ourwebsite">
<source>★ OUR WEBSITE: https://GuardianProject.info</source>
</trans-unit>
<trans-unit id="abouttor">
<source>★ ABOUT TOR: https://TorProject.org</source>
</trans-unit>
<trans-unit id="ontwitter">
<source>★ ON TWITTER: https://twitter.com/guardianproject</source>
</trans-unit>
<trans-unit id="freesoftware">
<source>★ FREE SOFTWARE: Orbot is free software. Take a look at our source code, or join the community to make it better:</source>
</trans-unit>
<trans-unit id="gitrepo" translate="no">
<source>https://gitweb.torproject.org/orbot.git</source>
<note from="developer">Do not translate this.</note>
</trans-unit>
<trans-unit id="messageus">
<source>★ MESSAGE US: Are we missing your favorite feature? Found an annoying bug? Please tell us! Wed love to hear from you. Send us an email: support@guardianproject.info or find us in our chat room https://guardianproject.info/contact</source>
</trans-unit>
</body>
</file>
</xliff>

15
external/.tx/config vendored
View File

@ -1,15 +0,0 @@
[main]
host = https://www.transifex.com
lang_map = af_ZA: af-rZA, am_ET: am-rET, ar_AE: ar-rAE, ar_BH: ar-rBH, ar_DZ: ar-rDZ, ar_EG: ar-rEG, ar_IQ: ar-rIQ, ar_JO: ar-rJO, ar_KW: ar-rKW, ar_LB: ar-rLB, ar_LY: ar-rLY, ar_MA: ar-rMA, ar_OM: ar-rOM, ar_QA: ar-rQA, ar_SA: ar-rSA, ar_SY: ar-rSY, ar_TN: ar-rTN, ar_YE: ar-rYE, arn_CL: arn-rCL, as_IN: as-rIN, az_AZ: az-rAZ, ba_RU: ba-rRU, be_BY: be-rBY, bg_BG: bg-rBG, bn_BD: bn-rBD, bn_IN: bn-rIN, bo_CN: bo-rCN, br_FR: br-rFR, bs_BA: bs-rBA, ca_ES: ca-rES, co_FR: co-rFR, cs_CZ: cs-rCZ, cy_GB: cy-rGB, da_DK: da-rDK, de_AT: de-rAT, de_CH: de-rCH, de_DE: de-rDE, de_LI: de-rLI, de_LU: de-rLU, dsb_DE: dsb-rDE, dv_MV: dv-rMV, el_GR: el-rGR, en_AU: en-rAU, en_BZ: en-rBZ, en_CA: en-rCA, en_GB: en-rGB, en_IE: en-rIE, en_IN: en-rIN, en_JM: en-rJM, en_MY: en-rMY, en_NZ: en-rNZ, en_PH: en-rPH, en_SG: en-rSG, en_TT: en-rTT, en_US: en-rUS, en_ZA: en-rZA, en_ZW: en-rZW, es_AR: es-rAR, es_BO: es-rBO, es_CL: es-rCL, es_CO: es-rCO, es_CR: es-rCR, es_DO: es-rDO, es_EC: es-rEC, es_ES: es-rES, es_GT: es-rGT, es_HN: es-rHN, es_MX: es-rMX, es_NI: es-rNI, es_PA: es-rPA, es_PE: es-rPE, es_PR: es-rPR, es_PY: es-rPY, es_SV: es-rSV, es_US: es-rUS, es_UY: es-rUY, es_VE: es-rVE, et_EE: et-rEE, eu_ES: eu-rES, fa_IR: fa-rIR, fi_FI: fi-rFI, fil_PH: tl-rPH, fil: tl, fo_FO: fo-rFO, fr_BE: fr-rBE, fr_CA: fr-rCA, fr_CH: fr-rCH, fr_FR: fr-rFR, fr_LU: fr-rLU, fr_MC: fr-rMC, fy_NL: fy-rNL, ga_IE: ga-rIE, gd_GB: gd-rGB, gl_ES: gl-rES, gsw_FR: gsw-rFR, gu_IN: gu-rIN, ha_NG: ha-rNG, he_IL: he-rIL, hi_IN: hi-rIN, hr_BA: hr-rBA, hr_HR: hr-rHR, hsb_DE: hsb-rDE, hu_HU: hu-rHU, hy_AM: hy-rAM, id_ID: id-rID, ig_NG: ig-rNG, ii_CN: ii-rCN, is_IS: is-rIS, it_CH: it-rCH, it_IT: it-rIT, iu_CA: iu-rCA, ja_JP: ja-rJP, ka_GE: ka-rGE, kk_KZ: kk-rKZ, kl_GL: kl-rGL, km_KH: km-rKH, kn_IN: kn-rIN, ko_KR: ko-rKR, kok_IN: kok-rIN, ky_KG: ky-rKG, lb_LU: lb-rLU, lo_LA: lo-rLA, lt_LT: lt-rLT, lv_LV: lv-rLV, mi_NZ: mi-rNZ, mk_MK: mk-rMK, ml_IN: ml-rIN, mn_CN: mn-rCN, mn_MN: mn-rMN, moh_CA: moh-rCA, mr_IN: mr-rIN, ms_BN: ms-rBN, ms_MY: ms-rMY, mt_MT: mt-rMT, nb_NO: nb-rNO, ne_NP: ne-rNP, nl_BE: nl-rBE, nl_NL: nl-rNL, nn_NO: nn-rNO, nso_ZA: nso-rZA, oc_FR: oc-rFR, or_IN: or-rIN, pa_IN: pa-rIN, pl_PL: pl-rPL, prs_AF: prs-rAF, ps_AF: ps-rAF, pt_BR: pt-rBR, pt_PT: pt-rPT, qut_GT: qut-rGT, quz_BO: quz-rBO, quz_EC: quz-rEC, quz_PE: quz-rPE, rm_CH: rm-rCH, ro_RO: ro-rRO, ru_RU: ru-rRU, rw_RW: rw-rRW, sa_IN: sa-rIN, sah_RU: sah-rRU, se_FI: se-rFI, se_NO: se-rNO, se_SE: se-rSE, si_LK: si-rLK, sk_SK: sk-rSK, sl_SI: sl-rSI, sma_NO: sma-rNO, sma_SE: sma-rSE, smj_NO: smj-rNO, smj_SE: smj-rSE, smn_FI: smn-rFI, sms_FI: sms-rFI, sq_AL: sq-rAL, sr_BA: sr-rBA, sr_CS: sr-rCS, sr_ME: sr-rME, sr_RS: sr-rRS, sv_FI: sv-rFI, sv_SE: sv-rSE, sw_KE: sw-rKE, syr_SY: syr-rSY, ta_IN: ta-rIN, te_IN: te-rIN, tg_TJ: tg-rTJ, th_TH: th-rTH, tk_TM: tk-rTM, tn_ZA: tn-rZA, tr_TR: tr-rTR, tt_RU: tt-rRU, tzm_DZ: tzm-rDZ, ug_CN: ug-rCN, uk_UA: uk-rUA, ur_PK: ur-rPK, uz_UZ: uz-rUZ, vi_VN: vi-rVN, wo_SN: wo-rSN, xh_ZA: xh-rZA, yo_NG: yo-rNG, zh_CN: zh-rCN, zh_HK: zh-rHK, zh_MO: zh-rMO, zh_SG: zh-rSG, zh_TW: zh-rTW, zu_ZA: zu-rZA
[orbot.stringsxml]
file_filter = ../res/values-<lang>/strings.xml
host = https://www.transifex.com
source_file = ../res/values/strings.xml
source_lang = en
[orbot.description]
file_filter = ../releases/assets/<lang>-description.txt
host = https://www.transifex.com
source_file = ../releases/assets/description.txt
source_lang = en

2
external/tor vendored

@ -1 +1 @@
Subproject commit 9ccf019b168909ef6674c71aebda9f90516bb6a1
Subproject commit d41ab97294ec69c748566f4cb610f899d9976572

View File

@ -4,6 +4,8 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/panel_background_main"
>
<android.support.v7.widget.Toolbar
@ -123,45 +125,58 @@
</RelativeLayout>
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@color/panel_background_main"
>
<org.torproject.android.ui.ImageProgressView
android:id="@+id/imgStatus"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:padding="0dp"
android:src="@drawable/toroff"
android:layout_gravity="center_horizontal|center_vertical" />
<ProgressBar
android:id="@+id/pbConnecting"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="60dp"
android:visibility="gone"
android:layout_gravity="center_horizontal|center_vertical"/>
<TextView
android:id="@+id/lblStatus"
android:textColor="@android:color/white"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:gravity="center_vertical"
android:fontFamily="sans-serif-light"
android:text=""
android:layout_gravity="center_horizontal|bottom"
android:layout_margin="10dp"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/frameMain"
android:visibility="visible"
android:orientation="vertical"
android:layout_gravity="center_horizontal|center_vertical"
>
<org.torproject.android.ui.ImageProgressView
android:id="@+id/imgStatus"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".8"
android:padding="0dp"
android:layout_margin="0dp"
android:src="@drawable/toroff" />
<TextView
android:id="@+id/lblStatus"
android:textColor="@android:color/white"
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"
/>
</FrameLayout>
<LinearLayout android:gravity="center_horizontal"
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:background="@color/panel_background_dark"
android:layout_gravity="bottom"
>
<Button
@ -203,8 +218,11 @@
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="320dp"
android:layout_height="match_parent"

View File

@ -1,22 +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="wrap_content">
<ScrollView android:id="@+id/helpscrollview"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView android:text=""
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#ffffff" />
</LinearLayout>
</ScrollView>
</LinearLayout>

View File

@ -1,57 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/relativeLayout1"
android:layout_gravity="center_horizontal"
android:background="#000000">
<TextView android:textSize="10pt"
android:textColor="#FFFFFF"
android:layout_alignParentTop="true"
android:layout_height="wrap_content"
android:id="@+id/WizardLocaleTitle"
android:layout_width="wrap_content"
android:fadingEdge="vertical"
android:text="@string/wizard_locale_title"
android:singleLine="true"
android:padding="20px" android:layout_centerInParent="true">
</TextView>
</RelativeLayout>
<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">
<LinearLayout
android:background="#575757"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:padding="3px">
<TextView android:text="@string/wizard_locale_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>
<ListView
android:id="@+id/wizard_locale_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
>
</ListView>
</LinearLayout>
</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_next" android:id="@+id/btnWizard2" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button>
</TableRow>
</TableLayout>
</LinearLayout>

View File

@ -57,8 +57,8 @@
-->
<item android:id="@+id/menu_wizard"
android:title="@string/menu_wizard"
<item android:id="@+id/menu_promo_apps"
android:title="@string/menu_promo_apps"
android:icon="@drawable/ic_menu_goto"
yourapp:showAsAction="never"

View File

@ -11,7 +11,7 @@
<string name="status_starting_up">Orbot is starting&#8230;</string>
<string name="status_activated">Connected to the Tor network</string>
<string name="status_disabled">Orbot is deactivated</string>
<string name="status_shutting_down">Orbot is shutting down</string>
<string name="status_shutting_down">TorService is shutting down</string>
<string name="tor_process_starting">Starting Tor client&#8230;</string>
<string name="tor_process_complete">complete.</string>
<string name="tor_process_waiting">waiting.</string>
@ -25,7 +25,7 @@
<string name="menu_start">Start</string>
<string name="menu_stop">Stop</string>
<string name="menu_about">About</string>
<string name="menu_wizard">Wizard</string>
<string name="menu_promo_apps">Get apps…</string>
<string name="main_layout_download">Download</string>
<string name="main_layout_upload">Upload</string>
<string name="button_help">Help</string>
@ -126,6 +126,8 @@
<string name="pref_entrance_node">Entrance Nodes</string>
<string name="pref_entrance_node_summary">Fingerprints, nicks, countries and addresses for the first hop</string>
<string name="pref_entrance_node_dialog">Enter Entrance Nodes</string>
<string name="pref_allow_background_starts_title">Allow Background Starts</string>
<string name="pref_allow_background_starts_summary">Let any app tell Orbot to start Tor and related services</string>
<string name="button_proxy_all">Proxy All</string>
<string name="button_proxy_none">Proxy None</string>

View File

@ -22,6 +22,11 @@ android:summary="@string/pref_use_expanded_notifications"
android:enabled="true"
android:title="@string/pref_use_expanded_notifications_title"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="pref_allow_background_starts"
android:summary="@string/pref_allow_background_starts_summary"
android:title="@string/pref_allow_background_starts_title"/>
<ListPreference android:title="@string/set_locale_title"
android:key="pref_default_locale"

View File

@ -5,8 +5,6 @@ import android.annotation.TargetApi;
import android.app.Activity;
import android.app.Application;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.res.Configuration;
import android.os.Build;
import android.text.TextUtils;
@ -14,29 +12,26 @@ import android.util.Log;
import info.guardianproject.util.Languages;
import org.torproject.android.service.TorServiceUtils;
import java.util.Locale;
public class OrbotApp extends Application implements OrbotConstants
{
private Locale locale;
private SharedPreferences prefs;
@Override
public void onCreate() {
super.onCreate();
Prefs.setContext(this);
prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
setNewLocale(prefs.getString(PREF_DEFAULT_LOCALE, Locale.getDefault().getLanguage()));
setNewLocale(Prefs.getDefaultLocale());
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
Log.i(TAG, "onConfigurationChanged " + newConfig.locale.getLanguage());
setNewLocale(prefs.getString(PREF_DEFAULT_LOCALE, Locale.getDefault().getLanguage()));
setNewLocale(Prefs.getDefaultLocale());
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
@ -65,10 +60,7 @@ public class OrbotApp extends Application implements OrbotConstants
* wrong. If setting the locale causes an Exception, it should be set in
* the preferences, otherwise ChatSecure will be stuck in a crash loop.
*/
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(this);
Editor prefEdit = prefs.edit();
prefEdit.putString(PREF_DEFAULT_LOCALE, language);
prefEdit.apply();
Prefs.setDefaultLocale(language);
Log.i(TAG, "setNewLocale complete: locale: " + locale.getLanguage()
+ " Locale.getDefault: " + Locale.getDefault().getLanguage());
}

View File

@ -6,7 +6,6 @@ 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";
@ -17,34 +16,16 @@ public interface OrbotConstants {
public final static String URL_TOR_CHECK = "https://check.torproject.org";
public final static String URL_TOR_BRIDGES = "https://bridges.torproject.org/bridges?transport=";
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";

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,121 @@
package org.torproject.android;
import android.content.Context;
import android.content.SharedPreferences;
import org.torproject.android.service.TorServiceUtils;
import java.util.Locale;
public class Prefs {
private final static String PREF_BRIDGES_ENABLED = "pref_bridges_enabled";
private final static String PREF_BRIDGES_LIST = "pref_bridges_list";
private final static String PREF_DEFAULT_LOCALE = "pref_default_locale";
private final static String PREF_ENABLE_LOGGING = "pref_enable_logging";
private final static String PREF_EXPANDED_NOTIFICATIONS = "pref_expanded_notifications";
private final static String PREF_HAS_ROOT = "has_root";
private final static String PREF_PERSIST_NOTIFICATIONS = "pref_persistent_notifications";
private final static String PREF_START_ON_BOOT = "pref_start_boot";
private final static String PREF_ALLOW_BACKGROUND_STARTS = "pref_allow_background_starts";
private final static String PREF_TRANSPARENT = "pref_transparent";
private final static String PREF_TRANSPARENT_ALL = "pref_transparent_all";
private final static String PREF_TRANSPARENT_TETHERING = "pref_transparent_tethering";
private final static String PREF_TRANSPROXY_REFRESH = "pref_transproxy_refresh";
private final static String PREF_USE_SYSTEM_IPTABLES = "pref_use_sys_iptables";
private final static String PREF_USE_VPN = "pref_vpn";
private static SharedPreferences prefs;
public static void setContext(Context context) {
if (prefs == null)
prefs = TorServiceUtils.getSharedPrefs(context);
}
private static void putBoolean(String key, boolean value) {
prefs.edit().putBoolean(key, value).apply();
}
private static void putString(String key, String value) {
prefs.edit().putString(key, value).apply();
}
public static boolean bridgesEnabled() {
return prefs.getBoolean(PREF_BRIDGES_ENABLED, false);
}
public static void putBridgesEnabled(boolean value) {
putBoolean(PREF_BRIDGES_ENABLED, value);
}
public static String getBridgesList() {
return prefs.getString(PREF_BRIDGES_LIST, "");
}
public static void setBridgesList(String value) {
putString(PREF_BRIDGES_LIST, value);
}
public static String getDefaultLocale() {
return prefs.getString(PREF_DEFAULT_LOCALE, Locale.getDefault().getLanguage());
}
public static void setDefaultLocale(String value) {
putString(PREF_DEFAULT_LOCALE, value);
}
public static boolean useSystemIpTables() {
return prefs.getBoolean(PREF_USE_SYSTEM_IPTABLES, false);
}
public static boolean useRoot() {
return prefs.getBoolean(PREF_HAS_ROOT, false);
}
public static boolean useTransparentProxying() {
return prefs.getBoolean(PREF_TRANSPARENT, false);
}
public static boolean transparentProxyAll() {
return prefs.getBoolean(PREF_TRANSPARENT_ALL, false);
}
public static boolean transparentTethering() {
return prefs.getBoolean(PREF_TRANSPARENT_TETHERING, false);
}
public static boolean transProxyNetworkRefresh() {
return prefs.getBoolean(PREF_TRANSPROXY_REFRESH, false);
}
public static boolean expandedNotifications() {
return prefs.getBoolean(PREF_EXPANDED_NOTIFICATIONS, false);
}
public static boolean useDebugLogging() {
return prefs.getBoolean(PREF_ENABLE_LOGGING, false);
}
public static boolean persistNotifications() {
return prefs.getBoolean(PREF_PERSIST_NOTIFICATIONS, true);
}
public static boolean allowBackgroundStarts() {
return prefs.getBoolean(PREF_ALLOW_BACKGROUND_STARTS, true);
}
public static boolean useVpn() {
return prefs.getBoolean(PREF_USE_VPN, false);
}
public static void putUseVpn(boolean value) {
putBoolean(PREF_USE_VPN, value);
}
public static boolean startOnBoot() {
return prefs.getBoolean(PREF_START_ON_BOOT, true);
}
public static void putStartOnBoot(boolean value) {
putBoolean(PREF_START_ON_BOOT, value);
}
}

View File

@ -5,30 +5,22 @@ import android.annotation.SuppressLint;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.VpnService;
import org.torproject.android.Prefs;
public class OnBootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(context.getApplicationContext());
boolean startOnBoot = prefs.getBoolean("pref_start_boot",true);
boolean useVPN = prefs.getBoolean("pref_vpn",true);
if (startOnBoot)
Prefs.setContext(context);
if (Prefs.startOnBoot())
{
startService(TorServiceConstants.CMD_INIT,context);
startService(TorServiceConstants.CMD_START,context);
if (useVPN)
startVpnService(context);
}
startService(TorServiceConstants.ACTION_START, context);
if (Prefs.useVpn())
startVpnService(context);
}
}
@SuppressLint("NewApi")

View File

@ -0,0 +1,36 @@
package org.torproject.android.service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import org.torproject.android.Prefs;
public class StartTorReceiver extends BroadcastReceiver implements TorServiceConstants {
@Override
public void onReceive(Context context, Intent intent) {
/* sanitize the Intent before forwarding it to TorService */
Prefs.setContext(context);
String action = intent.getAction();
if (TextUtils.equals(action, ACTION_START)) {
String packageName = intent.getStringExtra(EXTRA_PACKAGE_NAME);
if (Prefs.allowBackgroundStarts()) {
Intent startTorIntent = new Intent(context, TorService.class);
startTorIntent.setAction(action);
if (packageName != null)
startTorIntent.putExtra(EXTRA_PACKAGE_NAME, packageName);
context.startService(startTorIntent);
} else if (!TextUtils.isEmpty(packageName)) {
// let the requesting app know that the user has disabled
// starting via Intent
Intent startsDisabledIntent = new Intent(ACTION_STATUS);
startsDisabledIntent.putExtra(EXTRA_STATUS, STATUS_STARTS_DISABLED);
startsDisabledIntent.setPackage(packageName);
context.sendBroadcast(startsDisabledIntent);
}
}
}
}

View File

@ -8,12 +8,10 @@ import java.io.DataOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.StringBufferInputStream;
import java.util.ArrayList;
import java.util.concurrent.TimeoutException;
@ -96,11 +94,13 @@ public class TorResourceInstaller implements TorServiceConstants {
outFile = new File(installFolder, OBFSCLIENT_ASSET_KEY);
shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish();
streamToFile(is,outFile, false, true);
setExecutable(outFile);
is = context.getResources().openRawResource(R.raw.meek);
outFile = new File(installFolder, MEEK_ASSET_KEY);
shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish();
streamToFile(is,outFile, false, true);
setExecutable(outFile);
cpuPath = "armeabi";
}
@ -111,17 +111,19 @@ public class TorResourceInstaller implements TorServiceConstants {
outFile = new File(installFolder, TOR_ASSET_KEY);
shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish();
streamToFile(is,outFile, false, true);
setExecutable(outFile);
is = context.getAssets().open(cpuPath + "/polipo.mp3");
outFile = new File(installFolder, POLIPO_ASSET_KEY);
shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish();
streamToFile(is,outFile, false, true);
setExecutable(outFile);
is = context.getAssets().open(cpuPath + "/xtables.mp3");
outFile = new File(installFolder, IPTABLES_ASSET_KEY);
shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish();
streamToFile(is,outFile, false, true);
setExecutable(outFile);
return true;
}
@ -359,4 +361,11 @@ public class TorResourceInstaller implements TorServiceConstants {
}*/
private void setExecutable(File fileBin) {
fileBin.setReadable(true);
fileBin.setExecutable(true);
fileBin.setWritable(false);
fileBin.setWritable(true, true);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,10 @@
/* Copyright (c) 2009, Nathan Freitas, Orbot / The Guardian Project - http://openideals.com/guardian */
/* See LICENSE for licensing information */
package org.torproject.android.service;
import android.content.Intent;
public interface TorServiceConstants {
public final static String TOR_APP_USERNAME = "org.torproject.android";
@ -46,46 +49,84 @@ public interface TorServiceConstants {
public final static String CHMOD_EXE_VALUE = "770";
public final static int FILE_WRITE_BUFFER_SIZE = 1024;
//HTTP Proxy server port
public static int PORT_HTTP = 8118; //just like Privoxy!
//Socks port client connects to, server is the Tor binary
public static String PORT_SOCKS_DEFAULT = "9050";
//what is says!
public final static String IP_LOCALHOST = "127.0.0.1";
public final static int UPDATE_TIMEOUT = 1000;
public final static int TOR_TRANSPROXY_PORT_DEFAULT = 9040;
public final static int STANDARD_DNS_PORT = 53;
public final static int TOR_DNS_PORT_DEFAULT = 5400;
public final static int CONTROL_PORT_DEFAULT = 9051;
public final static int HTTP_PROXY_PORT_DEFAULT = 8118; // like Privoxy!
public final static int SOCKS_PROXY_PORT_DEFAULT = 9050;
//path to check Tor against
public final static String URL_TOR_CHECK = "https://check.torproject.org";
//control port
public final static String TOR_CONTROL_PORT_MSG_BOOTSTRAP_DONE = "Bootstrapped 100%";
public final static String LOG_NOTICE_HEADER = "NOTICE";
public final static String LOG_NOTICE_BOOTSTRAPPED = "Bootstrapped";
public final static int STATUS_OFF = 0;
public final static int STATUS_ON = 1;
public final static int STATUS_CONNECTING = 2;
public static final int STATUS_MSG = 1;
public static final int ENABLE_TOR_MSG = 2;
public static final int DISABLE_TOR_MSG = 3;
public static final int LOG_MSG = 4;
public static final String CMD_START = "start";
public static final String CMD_STOP = "stop";
/**
* A request to Orbot to transparently start Tor services
*/
public final static String ACTION_START = "org.torproject.android.intent.action.START";
/**
* {@link Intent} send by Orbot with {@code ON/OFF/STARTING/STOPPING} status
*/
public final static String ACTION_STATUS = "org.torproject.android.intent.action.STATUS";
/**
* {@code String} that contains a status constant: {@link #STATUS_ON},
* {@link #STATUS_OFF}, {@link #STATUS_STARTING}, or
* {@link #STATUS_STOPPING}
*/
public final static String EXTRA_STATUS = "org.torproject.android.intent.extra.STATUS";
/**
* A {@link String} {@code packageName} for Orbot to direct its status reply
* to, used in {@link #ACTION_START} {@link Intent}s sent to Orbot
*/
public final static String EXTRA_PACKAGE_NAME = "org.torproject.android.intent.extra.PACKAGE_NAME";
/**
* The SOCKS proxy settings in URL form.
*/
public final static String EXTRA_SOCKS_PROXY = "org.torproject.android.intent.extra.SOCKS_PROXY";
public final static String EXTRA_SOCKS_PROXY_HOST = "org.torproject.android.intent.extra.SOCKS_PROXY_HOST";
public final static String EXTRA_SOCKS_PROXY_PORT = "org.torproject.android.intent.extra.SOCKS_PROXY_PORT";
/**
* The HTTP proxy settings in URL form.
*/
public final static String EXTRA_HTTP_PROXY = "org.torproject.android.intent.extra.HTTP_PROXY";
public final static String EXTRA_HTTP_PROXY_HOST = "org.torproject.android.intent.extra.HTTP_PROXY_HOST";
public final static String EXTRA_HTTP_PROXY_PORT = "org.torproject.android.intent.extra.HTTP_PROXY_PORT";
public final static String LOCAL_ACTION_LOG = "log";
public final static String LOCAL_ACTION_BANDWIDTH = "bandwidth";
public final static String LOCAL_EXTRA_LOG = "log";
/**
* All tor-related services and daemons are stopped
*/
public final static String STATUS_OFF = "OFF";
/**
* All tor-related services and daemons have completed starting
*/
public final static String STATUS_ON = "ON";
public final static String STATUS_STARTING = "STARTING";
public final static String STATUS_STOPPING = "STOPPING";
/**
* The user has disabled the ability for background starts triggered by
* apps. Fallback to the old Intent that brings up Orbot.
*/
public final static String STATUS_STARTS_DISABLED = "STARTS_DISABLED";
// actions for internal command Intents
public static final String CMD_SIGNAL_HUP = "signal_hup";
public static final String CMD_FLUSH = "flush";
public static final String CMD_NEWNYM = "newnym";
public static final String CMD_INIT = "init";
public static final String CMD_VPN = "vpn";
public static final String CMD_VPN_CLEAR = "vpnclear";
public static final String CMD_UPDATE = "update";
public static final String CMD_UPDATE_TRANS_PROXY = "update";
public static final String BINARY_TOR_VERSION = "0.2.6.7";
public static final String PREF_BINARY_TOR_VERSION_INSTALLED = "BINARY_TOR_VERSION_INSTALLED";
@ -93,15 +134,7 @@ public interface TorServiceConstants {
public static final String OBFSCLIENT_ASSET_KEY = "obfs4proxy";
public static final String MEEK_ASSET_KEY = "meek-client";
public static final int MESSAGE_TRAFFIC_COUNT = 5;
//name of the iptables binary
public final static String IPTABLES_ASSET_KEY = "xtables";
public final static int DEFAULT_CONTROL_PORT = 9051;
}

View File

@ -3,20 +3,17 @@ package org.torproject.android.service;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.concurrent.TimeoutException;
import org.sufficientlysecure.rootcommands.Shell;
import org.sufficientlysecure.rootcommands.command.SimpleCommand;
import org.torproject.android.OrbotConstants;
import org.torproject.android.Prefs;
import org.torproject.android.settings.TorifiedApp;
import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;
public class TorTransProxy implements TorServiceConstants {
private boolean useSystemIpTables = false;
private String mSysIptables = null;
private TorService mTorService = null;
private File mFileXtables = null;
@ -46,12 +43,8 @@ public class TorTransProxy implements TorServiceConstants {
{
String ipTablesPath = null;
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(context);
useSystemIpTables = prefs.getBoolean(OrbotConstants.PREF_USE_SYSTEM_IPTABLES, false);
if (useSystemIpTables)
if (Prefs.useSystemIpTables())
{
ipTablesPath = findSystemIPTables();
}
@ -70,11 +63,7 @@ public class TorTransProxy implements TorServiceConstants {
String ipTablesPath = null;
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(context);
useSystemIpTables = prefs.getBoolean(OrbotConstants.PREF_USE_SYSTEM_IPTABLES, false);
if (useSystemIpTables)
if (Prefs.useSystemIpTables())
{
ipTablesPath = findSystemIP6Tables();
}
@ -335,7 +324,7 @@ public class TorTransProxy implements TorServiceConstants {
return code;
}*/
public int setTransparentProxyingByApp(Context context, ArrayList<TorifiedApp> apps, boolean enableRule, Shell shell) throws Exception
public int setTransparentProxyingByApp(Context context, ArrayList<TorifiedApp> apps, boolean enableRule, Shell shell)
{
String ipTablesPath = getIpTablesPath(context);
@ -439,10 +428,13 @@ public class TorTransProxy implements TorServiceConstants {
return lastExit;
}
private int executeCommand (Shell shell, String cmdString) throws IOException, TimeoutException
{
private int executeCommand (Shell shell, String cmdString) {
SimpleCommand cmd = new SimpleCommand(cmdString);
shell.add(cmd);
try {
shell.add(cmd);
} catch (IOException e) {
e.printStackTrace();
}
int exitCode = cmd.getExitCode();
String output = cmd.getOutput();
@ -524,8 +516,7 @@ public class TorTransProxy implements TorServiceConstants {
}
public int dropAllIPv6Traffic (Context context, int appUid, boolean enableDrop, Shell shell) throws Exception
{
public int dropAllIPv6Traffic (Context context, int appUid, boolean enableDrop, Shell shell) {
String action = " -A ";
String chain = "OUTPUT";
@ -575,8 +566,7 @@ public class TorTransProxy implements TorServiceConstants {
return lastExit;
}*/
public int flushTransproxyRules (Context context) throws Exception
{
public int flushTransproxyRules (Context context) throws IOException {
int exit = -1;
String ipTablesPath = getIpTablesPath(context);
@ -676,7 +666,7 @@ public class TorTransProxy implements TorServiceConstants {
script = new StringBuilder();
if (TorService.ENABLE_DEBUG_LOG)
if (Prefs.useDebugLogging())
{
//XXX: Comment the following rules for non-debug builds
script.append(ipTablesPath);

View File

@ -1,75 +0,0 @@
/* Copyright (c) 2009, Nathan Freitas, Orbot / The Guardian Project - https://guardianproject.info */
/* See LICENSE for licensing information */
package org.torproject.android.ui;
import org.torproject.android.OrbotConstants;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
public class OrbotLogActivity extends Activity implements OrbotConstants
{
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
doLayout();
LocalBroadcastManager.getInstance(this).registerReceiver(mMessageReceiver,
new IntentFilter("log"));
}
// Our handler for received Intents. This will be called whenever an Intent
// with an action named "custom-event-name" is broadcasted.
private BroadcastReceiver mMessageReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
// Get extra data included in the Intent
if (intent.hasExtra("log"))
{
String log = intent.getStringExtra("log");
updateStatus(log);
}
}
};
private void doLayout ()
{
}
private void updateStatus(String log)
{
}
@Override
protected void onDestroy() {
super.onDestroy();
LocalBroadcastManager.getInstance(this).unregisterReceiver(mMessageReceiver);
}
}

View File

@ -1,4 +1,4 @@
package org.torproject.android.ui.wizard;
package org.torproject.android.ui;
import android.app.Activity;
import android.content.Intent;
@ -10,14 +10,12 @@ import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import org.torproject.android.OrbotConstants;
import org.torproject.android.R;
import java.util.List;
public class PromoAppsActivity extends Activity implements OrbotConstants {
@ -42,7 +40,7 @@ public class PromoAppsActivity extends Activity implements OrbotConstants {
protected void onStart() {
super.onStart();
setContentView(R.layout.layout_wizard_tips);
setContentView(R.layout.layout_promo_apps);
stepFive();
@ -169,43 +167,16 @@ public class PromoAppsActivity extends Activity implements OrbotConstants {
}
});
// 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(PromoAppsActivity.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;
}
boolean isAppInstalled(PackageManager pm, String packageName) {
try {
pm.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES);
@ -239,32 +210,4 @@ public class PromoAppsActivity extends Activity implements OrbotConstants {
}
return intent;
}
/*
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();
}*/
}

View File

@ -1,108 +0,0 @@
package org.torproject.android.ui.wizard;
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;
import info.guardianproject.util.Languages;
import org.torproject.android.OrbotApp;
import org.torproject.android.OrbotConstants;
import org.torproject.android.R;
import org.torproject.android.service.TorServiceUtils;
import java.util.Locale;
public class ChooseLocaleWizardActivity extends Activity implements OrbotConstants {
private ListView listLocales;
private String[] localeValues;
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_wizard_locale);
listLocales = (ListView)findViewById(R.id.wizard_locale_list);
Button next = ((Button)findViewById(R.id.btnWizard2));
// next.setEnabled(false);
Languages languages = OrbotApp.getLanguages(this);
localeValues = languages.getSupportedLocales();
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, android.R.id.text1,
languages.getAllNames());
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, PromoAppsActivity.class));
}
});
next.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
setLocalePref(0);
finish();
startActivity(new Intent(ChooseLocaleWizardActivity.this, PromoAppsActivity.class));
}
});
}
private void setLocalePref(int selId)
{
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
Configuration config = getResources().getConfiguration();
String lang = localeValues[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());
}
//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;
}
}

View File

@ -241,7 +241,8 @@ public class OrbotVpnService extends VpnService implements Handler.Callback {
final String virtualGateway = "10.0.0.1";
final String virtualIP = "10.0.0.2";
final String virtualNetMask = "255.255.255.0";
final String localSocks = "127.0.0.1:" + TorServiceConstants.PORT_SOCKS_DEFAULT;
final String localSocks = "127.0.0.1:"
+ String.valueOf(TorServiceConstants.SOCKS_PROXY_PORT_DEFAULT);
final String localDNS = "10.0.0.1:" + TorServiceConstants.TOR_DNS_PORT_DEFAULT;
Builder builder = new Builder();