summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jni/Application.mk4
-rw-r--r--res/layout-xlarge/about.xml134
-rw-r--r--res/layout-xlarge/client_dashboard.xml69
-rw-r--r--res/layout-xlarge/configuration_wizard_activity.xml27
-rw-r--r--res/layout-xlarge/eip_service_fragment.xml75
-rw-r--r--res/layout-xlarge/log_in_dialog.xml39
-rw-r--r--res/layout-xlarge/logwindow.xml17
-rw-r--r--res/layout-xlarge/new_provider_dialog.xml26
-rw-r--r--res/layout-xlarge/provider_detail_fragment.xml43
-rw-r--r--res/layout-xlarge/provider_list_fragment.xml16
-rw-r--r--res/layout-xlarge/provider_list_item.xml44
-rw-r--r--res/layout/about.xml1
-rw-r--r--res/layout/log_in_dialog.xml2
-rw-r--r--res/layout/provider_list_item.xml43
-rw-r--r--src/se/leap/bitmaskclient/ConfigurationWizard.java67
-rw-r--r--src/se/leap/bitmaskclient/Dashboard.java2
-rw-r--r--src/se/leap/bitmaskclient/EipServiceFragment.java2
-rw-r--r--src/se/leap/bitmaskclient/ProviderAPI.java109
-rw-r--r--src/se/leap/bitmaskclient/ProviderDetailFragment.java2
-rw-r--r--src/se/leap/bitmaskclient/ProviderListAdapter.java2
-rw-r--r--src/se/leap/bitmaskclient/ProviderListFragment.java4
21 files changed, 650 insertions, 78 deletions
diff --git a/jni/Application.mk b/jni/Application.mk
index 5670b6e3..0795b5b8 100644
--- a/jni/Application.mk
+++ b/jni/Application.mk
@@ -1,6 +1,6 @@
APP_ABI := all
-NDK_TOOLCHAIN_VERSION=4.4.3
-#APP_PLATFORM := android-14
+NDK_TOOLCHAIN_VERSION=4.8
+APP_PLATFORM := android-14
APP_STL:=stlport_static
#APP_OPTIM := release
diff --git a/res/layout-xlarge/about.xml b/res/layout-xlarge/about.xml
new file mode 100644
index 00000000..6ab88737
--- /dev/null
+++ b/res/layout-xlarge/about.xml
@@ -0,0 +1,134 @@
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/dashboardLayout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:layout_marginLeft="12sp"
+ tools:context=".Dashboard" >
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical" >
+
+ <TextView
+ android:id="@+id/version"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textSize="18sp" />
+
+ <Space
+ android:layout_width="match_parent"
+ android:layout_height="12sp" />
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textSize="18sp"
+ android:autoLink="all"
+ android:text="@string/copyright_leapgui" />
+
+ <Space
+ android:layout_width="match_parent"
+ android:layout_height="12sp" />
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textSize="18sp"
+ android:autoLink="all"
+ android:text="@string/repository_url_text" />
+
+ <Space
+ android:layout_width="match_parent"
+ android:layout_height="12sp" />
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textSize="18sp"
+ android:autoLink="all"
+ android:text="@string/translation_project_text" />
+
+ <Space
+ android:layout_width="match_parent"
+ android:layout_height="12sp" />
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textSize="18sp"
+ android:autoLink="all"
+ android:text="@string/translationby" />
+
+ <Space
+ android:layout_width="match_parent"
+ android:layout_height="18sp" />
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textSize="18sp"
+ android:text="@string/copyright_others" />
+
+ <Space
+ android:layout_width="match_parent"
+ android:layout_height="12sp" />
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textSize="18sp"
+ android:text="@string/openvpn"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+ <!--
+ ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:contentDescription="@string/openvpn_logo_descr"
+ android:src="@drawable/openvpnLogo" />
+ -->
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textSize="18sp"
+ android:text="@string/opevpn_copyright" />
+
+ <Space
+ android:layout_width="match_parent"
+ android:layout_height="20sp" />
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textSize="18sp"
+ android:text="@string/lzo"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textSize="18sp"
+ android:text="@string/lzo_copyright" />
+
+ <Space
+ android:layout_width="match_parent"
+ android:layout_height="20sp" />
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textSize="18sp"
+ android:text="@string/openssl"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textSize="18sp"
+ android:text="@string/copyright_openssl" />
+ </LinearLayout>
+
+</ScrollView>
diff --git a/res/layout-xlarge/client_dashboard.xml b/res/layout-xlarge/client_dashboard.xml
new file mode 100644
index 00000000..bd644e1e
--- /dev/null
+++ b/res/layout-xlarge/client_dashboard.xml
@@ -0,0 +1,69 @@
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/dashboardLayout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:layout_marginLeft="10sp"
+ android:layout_marginTop="10sp"
+ tools:context=".Dashboard" >
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="42dp"
+ android:background="?android:attr/selectableItemBackground" >
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:gravity="center_vertical"
+ android:orientation="vertical"
+ android:paddingLeft="10dp" >
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:ellipsize="marquee"
+ android:fadingEdge="horizontal"
+ android:singleLine="true"
+ android:text="@string/provider_label"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textSize="32sp" />
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="center_vertical"
+ android:orientation="vertical"
+ android:paddingLeft="32dp" >
+
+ <TextView
+ android:id="@+id/providerName"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:ellipsize="marquee"
+ android:fadingEdge="horizontal"
+ android:singleLine="true"
+ android:text="@string/provider_label_none"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ </LinearLayout>
+ </LinearLayout>
+
+ <View
+ android:layout_width="wrap_content"
+ android:layout_height="1dp"
+ android:layout_marginBottom="7dp"
+ android:background="@android:drawable/divider_horizontal_bright" />
+
+ <LinearLayout
+ android:id="@+id/servicesCollection"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="0.11"
+ android:orientation="vertical" >
+ </LinearLayout>
+
+</LinearLayout>
diff --git a/res/layout-xlarge/configuration_wizard_activity.xml b/res/layout-xlarge/configuration_wizard_activity.xml
new file mode 100644
index 00000000..bb169e00
--- /dev/null
+++ b/res/layout-xlarge/configuration_wizard_activity.xml
@@ -0,0 +1,27 @@
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/configuration_wizard_layout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context=".ConfigurationWizard" >
+
+ <ProgressBar
+ android:id="@+id/progressbar_configuration_wizard"
+ style="?android:attr/progressBarStyleHorizontal"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:max="3" />
+
+ <TextView
+ android:id="@+id/progressbar_description"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:fadingEdge="horizontal"
+ android:singleLine="true"
+ android:text="@string/configuring_provider"
+ android:textSize="24sp"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:layout_centerHorizontal="true"
+ android:textColor="@android:color/holo_blue_bright" />
+
+</RelativeLayout> \ No newline at end of file
diff --git a/res/layout-xlarge/eip_service_fragment.xml b/res/layout-xlarge/eip_service_fragment.xml
new file mode 100644
index 00000000..e5c7f23d
--- /dev/null
+++ b/res/layout-xlarge/eip_service_fragment.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="10dp"
+ android:layout_marginLeft="20dp" >
+
+ <TextView
+ android:id="@+id/eipLabel"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentTop="true"
+ android:layout_marginLeft="10dp"
+ android:clickable="true"
+ android:text="@string/eip_service_label"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textSize="26sp" />
+
+ <Switch
+ android:id="@+id/eipSwitch"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentRight="true"
+ android:layout_alignParentTop="true"
+ android:layout_marginRight="10dp"
+ android:height="26dp"/>
+
+ <ProgressBar
+ android:id="@+id/eipProgress"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ style="@android:style/Widget.Holo.ProgressBar.Horizontal"
+ android:indeterminate="true"
+ android:visibility="gone"
+ android:layout_below="@id/eipLabel"
+ android:layout_marginLeft="15dp"
+ android:layout_marginRight="15dp" />
+
+ <RelativeLayout
+ android:id="@+id/eipDetail"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentRight="true"
+ android:layout_below="@+id/eipLabel"
+ android:paddingBottom="10dp"
+ android:paddingLeft="10dp"
+ android:paddingRight="10dp"
+ android:paddingTop="10dp"
+ android:visibility="gone" >
+
+ <ImageView
+ android:id="@+id/eipSettings"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentRight="true"
+ android:layout_alignParentTop="true"
+ android:layout_margin="10dp"
+ android:contentDescription="@string/eip_settings_button_description"
+ android:src="@drawable/ic_sysbar_quicksettings" />
+
+ <TextView
+ android:id="@+id/eipStatus"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentLeft="true"
+ android:layout_centerVertical="true"
+ android:clickable="true"
+ android:text="@string/status_unknown"
+ android:textSize="16sp" />
+
+ </RelativeLayout>
+
+</RelativeLayout>
diff --git a/res/layout-xlarge/log_in_dialog.xml b/res/layout-xlarge/log_in_dialog.xml
new file mode 100644
index 00000000..3a9eebb8
--- /dev/null
+++ b/res/layout-xlarge/log_in_dialog.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ tools:context=".LogInDialog" >
+
+ <TextView
+ android:id="@+id/user_message"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ <EditText
+ android:id="@+id/username_entered"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="4dp"
+ android:layout_marginLeft="4dp"
+ android:layout_marginRight="4dp"
+ android:layout_marginTop="16dp"
+ android:ems="10"
+ android:hint="@string/username_hint"
+ android:inputType="textUri" >
+
+ <requestFocus />
+ </EditText>
+
+ <EditText
+ android:id="@+id/password_entered"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:ems="10"
+ android:hint="@string/password_hint"
+ android:inputType="textPassword" />
+
+</LinearLayout> \ No newline at end of file
diff --git a/res/layout-xlarge/logwindow.xml b/res/layout-xlarge/logwindow.xml
new file mode 100644
index 00000000..4051c92c
--- /dev/null
+++ b/res/layout-xlarge/logwindow.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical" >
+
+ <TextView android:text="@string/speed_waiting"
+ android:singleLine="true"
+ android:id="@+id/speed"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"/>
+ <ListView
+ android:id="@android:id/list"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent" />
+
+</LinearLayout> \ No newline at end of file
diff --git a/res/layout-xlarge/new_provider_dialog.xml b/res/layout-xlarge/new_provider_dialog.xml
new file mode 100644
index 00000000..fc7d84ab
--- /dev/null
+++ b/res/layout-xlarge/new_provider_dialog.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:textSize="24sp" >
+
+ <EditText
+ android:id="@+id/new_provider_url"
+ android:inputType="textUri"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="16dp"
+ android:layout_marginLeft="4dp"
+ android:layout_marginRight="4dp"
+ android:textSize="24sp"
+ android:hint="@string/new_provider_uri" />
+
+ <CheckBox
+ android:id="@+id/danger_checkbox"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textSize="24sp"
+ android:text="@string/danger_checkbox" />
+
+</LinearLayout> \ No newline at end of file
diff --git a/res/layout-xlarge/provider_detail_fragment.xml b/res/layout-xlarge/provider_detail_fragment.xml
new file mode 100644
index 00000000..4abbaa17
--- /dev/null
+++ b/res/layout-xlarge/provider_detail_fragment.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical" >
+
+ <TextView
+ android:id="@+id/provider_detail_domain"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="4dp"
+ android:layout_marginLeft="4dp"
+ android:layout_marginRight="4dp"
+ android:layout_marginTop="16dp"
+ android:textSize="32sp"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textStyle="bold" />
+
+ <TextView
+ android:id="@+id/provider_detail_name"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="16dp"
+ android:layout_marginLeft="4dp"
+ android:layout_marginRight="4dp"
+ android:layout_marginBottom="4dp"
+ android:textSize="24sp"
+ android:textStyle="italic"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ <TextView
+ android:id="@+id/provider_detail_description"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="16dp"
+ android:layout_marginLeft="4dp"
+ android:layout_marginRight="4dp"
+ android:layout_marginBottom="4dp"
+ android:textSize="18sp"
+ android:textStyle="normal"
+ android:textAppearance="?android:attr/textAppearanceSmall" />
+
+</LinearLayout> \ No newline at end of file
diff --git a/res/layout-xlarge/provider_list_fragment.xml b/res/layout-xlarge/provider_list_fragment.xml
new file mode 100644
index 00000000..59dd37d1
--- /dev/null
+++ b/res/layout-xlarge/provider_list_fragment.xml
@@ -0,0 +1,16 @@
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:paddingLeft="12dp"
+ android:paddingRight="12dp"
+ android:paddingTop="12dp" >
+
+ <ListView
+ android:id="@id/android:list"
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1"
+ android:drawSelectorOnTop="false" />
+
+</LinearLayout>
diff --git a/res/layout-xlarge/provider_list_item.xml b/res/layout-xlarge/provider_list_item.xml
new file mode 100644
index 00000000..ec5db117
--- /dev/null
+++ b/res/layout-xlarge/provider_list_item.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<TwoLineListItem xmlns:android="http://schemas.android.com/apk/res/android"
+ android:paddingTop="2dip"
+ android:paddingBottom="2dip"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="?android:attr/activatedBackgroundIndicator"
+ android:minHeight="?android:attr/listPreferredItemHeight"
+ android:mode="twoLine"
+>
+
+ <TextView android:id="@android:id/text1"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="?android:attr/listPreferredItemPaddingLeft"
+ android:layout_marginTop="6dip"
+ android:textSize = "32sp"
+ android:textAppearance="?android:attr/textAppearanceListItem"
+ />
+
+ <TextView android:id="@android:id/text2"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_below="@android:id/text1"
+ android:layout_alignLeft="@android:id/text1"
+ android:textSize = "24sp"
+ />
+
+</TwoLineListItem>
diff --git a/res/layout/about.xml b/res/layout/about.xml
index ce57564d..4b3f16e0 100644
--- a/res/layout/about.xml
+++ b/res/layout/about.xml
@@ -4,6 +4,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
+ android:layout_marginLeft="8sp"
tools:context=".Dashboard" >
<LinearLayout
diff --git a/res/layout/log_in_dialog.xml b/res/layout/log_in_dialog.xml
index 3a9eebb8..c8a2f0a8 100644
--- a/res/layout/log_in_dialog.xml
+++ b/res/layout/log_in_dialog.xml
@@ -21,6 +21,7 @@
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginTop="16dp"
+ android:textSize="24sp"
android:ems="10"
android:hint="@string/username_hint"
android:inputType="textUri" >
@@ -32,6 +33,7 @@
android:id="@+id/password_entered"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:textSize="24sp"
android:ems="10"
android:hint="@string/password_hint"
android:inputType="textPassword" />
diff --git a/res/layout/provider_list_item.xml b/res/layout/provider_list_item.xml
new file mode 100644
index 00000000..8746f6f8
--- /dev/null
+++ b/res/layout/provider_list_item.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<TwoLineListItem xmlns:android="http://schemas.android.com/apk/res/android"
+ android:paddingTop="2dip"
+ android:paddingBottom="2dip"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="?android:attr/activatedBackgroundIndicator"
+ android:minHeight="?android:attr/listPreferredItemHeight"
+ android:mode="twoLine"
+>
+
+ <TextView android:id="@android:id/text1"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="?android:attr/listPreferredItemPaddingLeft"
+ android:layout_marginTop="6dip"
+ android:textAppearance="?android:attr/textAppearanceListItem"
+ />
+
+ <TextView android:id="@android:id/text2"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_below="@android:id/text1"
+ android:layout_alignLeft="@android:id/text1"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ />
+
+</TwoLineListItem>
diff --git a/src/se/leap/bitmaskclient/ConfigurationWizard.java b/src/se/leap/bitmaskclient/ConfigurationWizard.java
index 1c5f6048..1c839389 100644
--- a/src/se/leap/bitmaskclient/ConfigurationWizard.java
+++ b/src/se/leap/bitmaskclient/ConfigurationWizard.java
@@ -84,9 +84,10 @@ implements ProviderListFragment.Callbacks, NewProviderDialogInterface, ProviderD
final protected static String SERVICES_RETRIEVED = "SERVICES RETRIEVED";
public ProviderAPIResultReceiver providerAPI_result_receiver;
- private ProviderAPIBroadcastReceiver_Update providerAPI_broadcast_receiver_update;
+ private ProviderAPIBroadcastReceiver_Update providerAPI_broadcast_receiver_update;
- private static SharedPreferences preferences;
+ private static SharedPreferences preferences;
+ private static boolean setting_up_provider = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -159,6 +160,7 @@ implements ProviderListFragment.Callbacks, NewProviderDialogInterface, ProviderD
mProgressBar.setVisibility(ProgressBar.GONE);
progressbar_description.setVisibility(TextView.GONE);
setResult(RESULT_OK);
+ setting_up_provider = false;
showProviderDetails(getCurrentFocus());
}
} else if(resultCode == ProviderAPI.PROVIDER_NOK) {
@@ -166,8 +168,9 @@ implements ProviderListFragment.Callbacks, NewProviderDialogInterface, ProviderD
String reason_to_fail = resultData.getString(ProviderAPI.ERRORS);
showDownloadFailedDialog(getCurrentFocus(), reason_to_fail);
mProgressBar.setVisibility(ProgressBar.GONE);
- progressbar_description.setVisibility(TextView.GONE);
- preferences.edit().remove(Provider.KEY).commit();
+ progressbar_description.setVisibility(TextView.GONE);
+ preferences.edit().remove(Provider.KEY).commit();
+ setting_up_provider = false;
setResult(RESULT_CANCELED, mConfigState);
}
else if(resultCode == ProviderAPI.CORRECTLY_DOWNLOADED_CERTIFICATE) {
@@ -175,8 +178,8 @@ implements ProviderListFragment.Callbacks, NewProviderDialogInterface, ProviderD
mProgressBar.setVisibility(ProgressBar.GONE);
progressbar_description.setVisibility(TextView.GONE);
//refreshProviderList(0);
- setResult(RESULT_OK);
- showProviderDetails(getCurrentFocus());
+ setResult(RESULT_OK);
+ showProviderDetails(getCurrentFocus());
} else if(resultCode == ProviderAPI.INCORRECTLY_DOWNLOADED_CERTIFICATE) {
//refreshProviderList(0);
mProgressBar.setVisibility(ProgressBar.GONE);
@@ -212,9 +215,26 @@ implements ProviderListFragment.Callbacks, NewProviderDialogInterface, ProviderD
@Override
public void onBackPressed() {
- try {
- boolean is_provider_set_up = new JSONObject(preferences.getString(Provider.KEY, "no provider")) != null ? true : false;
- boolean is_provider_set_up_truly = new JSONObject(preferences.getString(Provider.KEY, "no provider")).length() != 0 ? true : false;
+ if(setting_up_provider) {
+ stopSettingUpProvider();
+ } else {
+ usualBackButton();
+ }
+ }
+
+ private void stopSettingUpProvider() {
+ ProviderAPI.stop();
+ mProgressBar.setVisibility(ProgressBar.GONE);
+ mProgressBar.setProgress(0);
+ progressbar_description.setVisibility(TextView.GONE);
+ getSharedPreferences(Dashboard.SHARED_PREFERENCES, Activity.MODE_PRIVATE).edit().remove(Provider.KEY).commit();
+ setting_up_provider = false;
+ }
+
+ private void usualBackButton() {
+ try {
+ boolean is_provider_set_up = new JSONObject(preferences.getString(Provider.KEY, "no provider")) != null ? true : false;
+ boolean is_provider_set_up_truly = new JSONObject(preferences.getString(Provider.KEY, "no provider")).length() != 0 ? true : false;
if(!is_provider_set_up || !is_provider_set_up_truly) {
askDashboardToQuitApp();
} else {
@@ -222,10 +242,11 @@ implements ProviderListFragment.Callbacks, NewProviderDialogInterface, ProviderD
}
} catch (JSONException e) {
askDashboardToQuitApp();
+ super.onBackPressed();
+ e.printStackTrace();
}
- super.onBackPressed();
+ super.onBackPressed();
}
-
private void askDashboardToQuitApp() {
Intent ask_quit = new Intent();
ask_quit.putExtra(Dashboard.ACTION_QUIT, Dashboard.ACTION_QUIT);
@@ -407,15 +428,17 @@ implements ProviderListFragment.Callbacks, NewProviderDialogInterface, ProviderD
* @param view
*/
public void showProviderDetails(View view) {
- FragmentTransaction fragment_transaction = getFragmentManager().beginTransaction();
- Fragment previous_provider_details_dialog = getFragmentManager().findFragmentByTag(ProviderDetailFragment.TAG);
- if (previous_provider_details_dialog != null) {
- fragment_transaction.remove(previous_provider_details_dialog);
+ if(setting_up_provider) {
+ FragmentTransaction fragment_transaction = getFragmentManager().beginTransaction();
+ Fragment previous_provider_details_dialog = getFragmentManager().findFragmentByTag(ProviderDetailFragment.TAG);
+ if (previous_provider_details_dialog != null) {
+ fragment_transaction.remove(previous_provider_details_dialog);
+ }
+ fragment_transaction.addToBackStack(null);
+
+ DialogFragment newFragment = ProviderDetailFragment.newInstance();
+ newFragment.show(fragment_transaction, ProviderDetailFragment.TAG);
}
- fragment_transaction.addToBackStack(null);
-
- DialogFragment newFragment = ProviderDetailFragment.newInstance();
- newFragment.show(fragment_transaction, ProviderDetailFragment.TAG);
}
public void showAndSelectProvider(String provider_main_url, boolean danger_on) {
@@ -448,9 +471,10 @@ implements ProviderListFragment.Callbacks, NewProviderDialogInterface, ProviderD
provider_API_command.setAction(ProviderAPI.SET_UP_PROVIDER);
provider_API_command.putExtra(ProviderAPI.PARAMETERS, parameters);
- provider_API_command.putExtra(ProviderAPI.RECEIVER_KEY, providerAPI_result_receiver);
+ provider_API_command.putExtra(ProviderAPI.RECEIVER_KEY, providerAPI_result_receiver);
- startService(provider_API_command);
+ startService(provider_API_command);
+ setting_up_provider = true;
}
public void retrySetUpProvider() {
@@ -466,7 +490,6 @@ implements ProviderListFragment.Callbacks, NewProviderDialogInterface, ProviderD
startService(provider_API_command);
}
}
-
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.configuration_wizard_activity, menu);
diff --git a/src/se/leap/bitmaskclient/Dashboard.java b/src/se/leap/bitmaskclient/Dashboard.java
index 65fd2d5b..aa3cd4d9 100644
--- a/src/se/leap/bitmaskclient/Dashboard.java
+++ b/src/se/leap/bitmaskclient/Dashboard.java
@@ -103,7 +103,7 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
protected void onActivityResult(int requestCode, int resultCode, Intent data){
if ( requestCode == CONFIGURE_LEAP || requestCode == SWITCH_PROVIDER) {
// It should be equivalent: if ( (requestCode == CONFIGURE_LEAP) || (data!= null && data.hasExtra(STOP_FIRST))) {
- if ( resultCode == RESULT_OK ){
+ if ( resultCode == RESULT_OK ){
getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE).edit().putInt(EIP.PARSED_SERIAL, 0).commit();
getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE).edit().putBoolean(EIP.AUTHED_EIP, authed_eip).commit();
Intent updateEIP = new Intent(getApplicationContext(), EIP.class);
diff --git a/src/se/leap/bitmaskclient/EipServiceFragment.java b/src/se/leap/bitmaskclient/EipServiceFragment.java
index 74755a5c..0534838d 100644
--- a/src/se/leap/bitmaskclient/EipServiceFragment.java
+++ b/src/se/leap/bitmaskclient/EipServiceFragment.java
@@ -179,7 +179,7 @@ public class EipServiceFragment extends Fragment implements StateListener, OnChe
statusMessage = getString(R.string.eip_state_connected); getActivity().findViewById(R.id.eipProgress).setVisibility(View.GONE);
mEipStartPending = false;
- } else if ( (state.equals("NOPROCESS") && !mEipStartPending ) || state.equals("EXITING") || state.equals("FATAL")) {
+ } else if ( (state.equals("NOPROCESS") && !mEipStartPending ) || state.equals("EXITING") && !mEipStartPending || state.equals("FATAL")) {
statusMessage = getString(R.string.eip_state_not_connected);
getActivity().findViewById(R.id.eipProgress).setVisibility(View.GONE);
mEipStartPending = false;
diff --git a/src/se/leap/bitmaskclient/ProviderAPI.java b/src/se/leap/bitmaskclient/ProviderAPI.java
index 7aafa2e3..75ef511d 100644
--- a/src/se/leap/bitmaskclient/ProviderAPI.java
+++ b/src/se/leap/bitmaskclient/ProviderAPI.java
@@ -126,7 +126,12 @@ public class ProviderAPI extends IntentService {
private static String last_provider_main_url;
private static boolean last_danger_on = false;
+ private static boolean setting_up_provider = true;
+ public static void stop() {
+ setting_up_provider = false;
+ }
+
public ProviderAPI() {
super("ProviderAPI");
Log.v("ClassName", "Provider API");
@@ -156,33 +161,36 @@ public class ProviderAPI extends IntentService {
final ResultReceiver receiver = command.getParcelableExtra(RECEIVER_KEY);
String action = command.getAction();
Bundle parameters = command.getBundleExtra(PARAMETERS);
+ setting_up_provider = true;
if(action.equalsIgnoreCase(SET_UP_PROVIDER)) {
Bundle result = setUpProvider(parameters);
- if(result.getBoolean(RESULT_KEY)) {
- receiver.send(PROVIDER_OK, Bundle.EMPTY);
- } else {
- receiver.send(PROVIDER_NOK, result);
+ if(setting_up_provider) {
+ if(result.getBoolean(RESULT_KEY)) {
+ receiver.send(PROVIDER_OK, result);
+ } else {
+ receiver.send(PROVIDER_NOK, result);
+ }
}
} else if (action.equalsIgnoreCase(SRP_AUTH)) {
Bundle session_id_bundle = authenticateBySRP(parameters);
- if(session_id_bundle.getBoolean(RESULT_KEY)) {
- receiver.send(SRP_AUTHENTICATION_SUCCESSFUL, session_id_bundle);
- } else {
- receiver.send(SRP_AUTHENTICATION_FAILED, session_id_bundle);
- }
+ if(session_id_bundle.getBoolean(RESULT_KEY)) {
+ receiver.send(SRP_AUTHENTICATION_SUCCESSFUL, session_id_bundle);
+ } else {
+ receiver.send(SRP_AUTHENTICATION_FAILED, session_id_bundle);
+ }
} else if (action.equalsIgnoreCase(LOG_OUT)) {
- if(logOut(parameters)) {
- receiver.send(LOGOUT_SUCCESSFUL, Bundle.EMPTY);
- } else {
- receiver.send(LOGOUT_FAILED, Bundle.EMPTY);
- }
+ if(logOut(parameters)) {
+ receiver.send(LOGOUT_SUCCESSFUL, Bundle.EMPTY);
+ } else {
+ receiver.send(LOGOUT_FAILED, Bundle.EMPTY);
+ }
} else if (action.equalsIgnoreCase(DOWNLOAD_CERTIFICATE)) {
- if(getNewCert(parameters)) {
- receiver.send(CORRECTLY_DOWNLOADED_CERTIFICATE, Bundle.EMPTY);
- } else {
- receiver.send(INCORRECTLY_DOWNLOADED_CERTIFICATE, Bundle.EMPTY);
- }
+ if(getNewCert(parameters)) {
+ receiver.send(CORRECTLY_DOWNLOADED_CERTIFICATE, Bundle.EMPTY);
+ } else {
+ receiver.send(INCORRECTLY_DOWNLOADED_CERTIFICATE, Bundle.EMPTY);
+ }
}
}
@@ -477,8 +485,9 @@ public class ProviderAPI extends IntentService {
private Bundle downloadCACert(String provider_main_url, boolean danger_on) {
Bundle result = new Bundle();
String cert_string = downloadWithCommercialCA(provider_main_url + "/ca.crt", danger_on);
- if(validCertificate(cert_string)) {
- getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE).edit().putString(Provider.CA_CERT, cert_string).commit();
+
+ if(validCertificate(cert_string) && setting_up_provider) {
+ getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE).edit().putString(Provider.CA_CERT, cert_string).commit();
result.putBoolean(RESULT_KEY, true);
} else {
String reason_to_fail = pickErrorMessage(cert_string);
@@ -512,22 +521,24 @@ public class ProviderAPI extends IntentService {
private Bundle getAndSetProviderJson(String provider_main_url) {
Bundle result = new Bundle();
- String provider_dot_json_string = downloadWithProviderCA(provider_main_url + "/provider.json", true);
+ if(setting_up_provider) {
+ String provider_dot_json_string = downloadWithProviderCA(provider_main_url + "/provider.json", true);
- try {
- JSONObject provider_json = new JSONObject(provider_dot_json_string);
- String name = provider_json.getString(Provider.NAME);
- //TODO setProviderName(name);
-
- getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE).edit().putString(Provider.KEY, provider_json.toString()).commit();
- getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE).edit().putBoolean(EIP.ALLOWED_ANON, provider_json.getJSONObject(Provider.SERVICE).getBoolean(EIP.ALLOWED_ANON)).commit();
+ try {
+ JSONObject provider_json = new JSONObject(provider_dot_json_string);
+ String name = provider_json.getString(Provider.NAME);
+ //TODO setProviderName(name);
- result.putBoolean(RESULT_KEY, true);
- } catch (JSONException e) {
- //TODO Error message should be contained in that provider_dot_json_string
- String reason_to_fail = pickErrorMessage(provider_dot_json_string);
- result.putString(ERRORS, reason_to_fail);
- result.putBoolean(RESULT_KEY, false);
+ getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE).edit().putString(Provider.KEY, provider_json.toString()).commit();
+ getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE).edit().putBoolean(EIP.ALLOWED_ANON, provider_json.getJSONObject(Provider.SERVICE).getBoolean(EIP.ALLOWED_ANON)).commit();
+
+ result.putBoolean(RESULT_KEY, true);
+ } catch (JSONException e) {
+ //TODO Error message should be contained in that provider_dot_json_string
+ String reason_to_fail = pickErrorMessage(provider_dot_json_string);
+ result.putString(ERRORS, reason_to_fail);
+ result.putBoolean(RESULT_KEY, false);
+ }
}
return result;
}
@@ -541,20 +552,22 @@ public class ProviderAPI extends IntentService {
private Bundle getAndSetEipServiceJson() {
Bundle result = new Bundle();
String eip_service_json_string = "";
- try {
- JSONObject provider_json = new JSONObject(getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE).getString(Provider.KEY, ""));
- String eip_service_url = provider_json.getString(Provider.API_URL) + "/" + provider_json.getString(Provider.API_VERSION) + "/" + EIP.SERVICE_API_PATH;
- eip_service_json_string = downloadWithProviderCA(eip_service_url, true);
- JSONObject eip_service_json = new JSONObject(eip_service_json_string);
- eip_service_json.getInt(Provider.API_RETURN_SERIAL);
-
- getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE).edit().putString(EIP.KEY, eip_service_json.toString()).commit();
+ if(setting_up_provider) {
+ try {
+ JSONObject provider_json = new JSONObject(getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE).getString(Provider.KEY, ""));
+ String eip_service_url = provider_json.getString(Provider.API_URL) + "/" + provider_json.getString(Provider.API_VERSION) + "/" + EIP.SERVICE_API_PATH;
+ eip_service_json_string = downloadWithProviderCA(eip_service_url, true);
+ JSONObject eip_service_json = new JSONObject(eip_service_json_string);
+ eip_service_json.getInt(Provider.API_RETURN_SERIAL);
- result.putBoolean(RESULT_KEY, true);
- } catch (JSONException e) {
- String reason_to_fail = pickErrorMessage(eip_service_json_string);
- result.putString(ERRORS, reason_to_fail);
- result.putBoolean(RESULT_KEY, false);
+ getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE).edit().putString(EIP.KEY, eip_service_json.toString()).commit();
+
+ result.putBoolean(RESULT_KEY, true);
+ } catch (JSONException e) {
+ String reason_to_fail = pickErrorMessage(eip_service_json_string);
+ result.putString(ERRORS, reason_to_fail);
+ result.putBoolean(RESULT_KEY, false);
+ }
}
return result;
}
diff --git a/src/se/leap/bitmaskclient/ProviderDetailFragment.java b/src/se/leap/bitmaskclient/ProviderDetailFragment.java
index 3ed04184..c067ce2b 100644
--- a/src/se/leap/bitmaskclient/ProviderDetailFragment.java
+++ b/src/se/leap/bitmaskclient/ProviderDetailFragment.java
@@ -56,7 +56,7 @@ public class ProviderDetailFragment extends DialogFragment {
}
});
}
-
+
return builder.create();
} catch (JSONException e) {
return null;
diff --git a/src/se/leap/bitmaskclient/ProviderListAdapter.java b/src/se/leap/bitmaskclient/ProviderListAdapter.java
index c5e8b64d..43bba085 100644
--- a/src/se/leap/bitmaskclient/ProviderListAdapter.java
+++ b/src/se/leap/bitmaskclient/ProviderListAdapter.java
@@ -101,7 +101,7 @@ public class ProviderListAdapter<T> extends ArrayAdapter<T> {
int position = getRealPosition(index);
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- row = (TwoLineListItem)inflater.inflate(android.R.layout.simple_list_item_2, null);
+ row = (TwoLineListItem)inflater.inflate(R.layout.provider_list_item, null);
} else {
row = (TwoLineListItem)convertView;
}
diff --git a/src/se/leap/bitmaskclient/ProviderListFragment.java b/src/se/leap/bitmaskclient/ProviderListFragment.java
index f35cf739..db414d87 100644
--- a/src/se/leap/bitmaskclient/ProviderListFragment.java
+++ b/src/se/leap/bitmaskclient/ProviderListFragment.java
@@ -94,12 +94,12 @@ public class ProviderListFragment extends ListFragment {
if(getArguments().containsKey(SHOW_ALL_PROVIDERS))
content_adapter = new ProviderListAdapter<ProviderListContent.ProviderItem>(
getActivity(),
- android.R.layout.simple_list_item_activated_2,
+ R.layout.provider_list_item,
ProviderListContent.ITEMS, getArguments().getBoolean(SHOW_ALL_PROVIDERS));
else
content_adapter = new ProviderListAdapter<ProviderListContent.ProviderItem>(
getActivity(),
- android.R.layout.simple_list_item_activated_2,
+ R.layout.provider_list_item,
ProviderListContent.ITEMS);