new helper activities for Apps and Bridge setup
This commit is contained in:
parent
150488dd9c
commit
84932594ce
|
@ -4,12 +4,11 @@
|
|||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<TextView
|
||||
android:id="@+id/diaglog"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="15px"
|
||||
android:paddingLeft="15px"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#00ff00" />
|
||||
</ScrollView>
|
||||
<TextView
|
||||
android:id="@+id/diaglog"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_margin="9dp"
|
||||
/>
|
||||
</ScrollView>
|
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<ScrollView android:id="@+id/aboutscrollview"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<TextView android:text="Apps Mode"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="15px"
|
||||
android:paddingLeft="15px"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#00ff00" />
|
||||
<TextView android:text=""
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:autoLink="web"
|
||||
android:textColorLink="#ffffff"
|
||||
android:paddingLeft="15px"
|
||||
android:textColor="#ffffff" />
|
||||
|
||||
<Button android:id="@+id/btnActivateVPN"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Activate"
|
||||
android:layout_margin="0sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
|
@ -318,4 +318,16 @@
|
|||
<string name="restart_orbot_to_use_this_bridge_">"Restart Orbot to use these bridges: "</string>
|
||||
|
||||
<string name="menu_qr">QR Codes</string>
|
||||
|
||||
<string name="if_your_mobile_network_actively_blocks_tor_you_can_use_a_tor_bridge_to_access_the_network_another_way_to_get_bridges_is_to_send_an_email_to_bridges_torproject_org_please_note_that_you_must_send_the_email_using_an_address_from_one_of_the_following_email_providers_riseup_gmail_or_yahoo_">If your mobile network actively blocks Tor, you can use a Tor Bridge to access the network.\n\nYou can get a bridge address from https://bridges.torproject.org or scan a bridge QR code from a friend.\n\nAnother way to get bridges is to send an email to bridges@torproject.org. Please note that you must send the email using an address from one of the following email providers: Riseup, Gmail or Yahoo.</string>
|
||||
|
||||
<string name="bridge_mode">Bridge Mode</string>
|
||||
|
||||
<string name="get_bridges">Get Bridges</string>
|
||||
|
||||
<string name="activate">Activate</string>
|
||||
|
||||
<string name="apps_mode">Apps Mode</string>
|
||||
|
||||
<string name="you_can_enable_all_apps_on_your_device_to_run_through_the_tor_network_using_the_vpn_feature_of_android_">You can enable all apps on your device to run through the Tor network using the VPN feature of Android.</string>
|
||||
</resources>
|
||||
|
|
|
@ -16,6 +16,7 @@ public interface OrbotConstants {
|
|||
//path to check Tor against
|
||||
public final static String URL_TOR_CHECK = "https://check.torproject.org";
|
||||
|
||||
public final static String URL_TOR_BRIDGES = "https://bridges.torproject.org";
|
||||
|
||||
public final static String NEWLINE = "\n";
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ import org.torproject.android.service.TorServiceUtils;
|
|||
import org.torproject.android.settings.SettingsPreferences;
|
||||
import org.torproject.android.ui.ImageProgressView;
|
||||
import org.torproject.android.ui.Rotate3dAnimation;
|
||||
import org.torproject.android.ui.wizard.ChooseLocaleWizardActivity;
|
||||
import org.torproject.android.ui.wizard.PromoAppsActivity;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
|
@ -267,7 +266,7 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
|
|||
public void onClick(View v) {
|
||||
|
||||
if (mBtnVPN.isChecked())
|
||||
startVpnService();
|
||||
promptStartVpnService();
|
||||
else
|
||||
stopVpnService();
|
||||
|
||||
|
@ -286,11 +285,8 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
Editor edit = mPrefs.edit();
|
||||
edit.putBoolean("pref_bridges_enabled", mBtnBridges.isChecked());
|
||||
edit.commit();
|
||||
promptSetupBridges ();
|
||||
|
||||
updateSettings();
|
||||
|
||||
}
|
||||
|
||||
|
@ -842,10 +838,8 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
|
|||
|
||||
setNewBridges(results);
|
||||
|
||||
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
Log.e(TAG,"unsupported",e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -853,6 +847,109 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
|
|||
|
||||
}
|
||||
|
||||
public void promptSetupBridges ()
|
||||
{
|
||||
LayoutInflater li = LayoutInflater.from(this);
|
||||
View view = li.inflate(R.layout.layout_diag, null);
|
||||
|
||||
TextView versionName = (TextView)view.findViewById(R.id.diaglog);
|
||||
versionName.setText(R.string.if_your_mobile_network_actively_blocks_tor_you_can_use_a_tor_bridge_to_access_the_network_another_way_to_get_bridges_is_to_send_an_email_to_bridges_torproject_org_please_note_that_you_must_send_the_email_using_an_address_from_one_of_the_following_email_providers_riseup_gmail_or_yahoo_);
|
||||
|
||||
if (mBtnBridges.isChecked())
|
||||
{
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.bridge_mode)
|
||||
.setView(view)
|
||||
.setNeutralButton(R.string.get_bridges, new Dialog.OnClickListener ()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
openBrowser(URL_TOR_BRIDGES);
|
||||
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
.setPositiveButton(R.string.activate, new Dialog.OnClickListener ()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
enableBridges (true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
.setNegativeButton(android.R.string.cancel, new Dialog.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
mBtnBridges.setChecked(false);
|
||||
|
||||
}
|
||||
})
|
||||
.show();
|
||||
}
|
||||
else
|
||||
{
|
||||
enableBridges(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void enableBridges (boolean enable)
|
||||
{
|
||||
|
||||
Editor edit = mPrefs.edit();
|
||||
edit.putBoolean("pref_bridges_enabled", enable);
|
||||
edit.commit();
|
||||
|
||||
updateSettings();
|
||||
}
|
||||
|
||||
public void promptStartVpnService ()
|
||||
{
|
||||
LayoutInflater li = LayoutInflater.from(this);
|
||||
View view = li.inflate(R.layout.layout_diag, null);
|
||||
|
||||
TextView versionName = (TextView)view.findViewById(R.id.diaglog);
|
||||
versionName.setText(R.string.you_can_enable_all_apps_on_your_device_to_run_through_the_tor_network_using_the_vpn_feature_of_android_);
|
||||
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.apps_mode)
|
||||
.setView(view)
|
||||
.setPositiveButton(R.string.activate, new Dialog.OnClickListener ()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
startVpnService();
|
||||
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
.setNegativeButton(android.R.string.cancel, new Dialog.OnClickListener ()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
mBtnVPN.setChecked(false);
|
||||
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
.show();
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||
public void startVpnService ()
|
||||
{
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
package org.torproject.android.ui;
|
||||
|
||||
public class BridgeSetupActivity {
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package org.torproject.android.ui;
|
||||
|
||||
public class VPNSetupActivity {
|
||||
|
||||
}
|
Loading…
Reference in New Issue