summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--res/layout/configuration_wizard_activity.xml11
-rw-r--r--res/layout/provider_list_fragment.xml12
-rwxr-xr-xres/values/strings.xml5
-rw-r--r--src/se/leap/bitmaskclient/ConfigurationWizard.java84
-rw-r--r--src/se/leap/bitmaskclient/ProviderListFragment.java8
5 files changed, 85 insertions, 35 deletions
diff --git a/res/layout/configuration_wizard_activity.xml b/res/layout/configuration_wizard_activity.xml
index 264ccf98..4bc4a8e1 100644
--- a/res/layout/configuration_wizard_activity.xml
+++ b/res/layout/configuration_wizard_activity.xml
@@ -5,4 +5,15 @@
android:layout_height="match_parent"
tools:context=".ConfigurationWizard" >
+ <ProgressBar
+ android:id="@+id/progressbar"
+ style="?android:attr/progressBarStyleHorizontal"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:max="3"
+ android:maxHeight="20dip"
+ android:minHeight="20dip"
+ android:progress="0"
+ android:background="@android:color/transparent"/>
+
</RelativeLayout> \ No newline at end of file
diff --git a/res/layout/provider_list_fragment.xml b/res/layout/provider_list_fragment.xml
index 5a6770c8..70dbae0d 100644
--- a/res/layout/provider_list_fragment.xml
+++ b/res/layout/provider_list_fragment.xml
@@ -1,9 +1,9 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:paddingLeft="8dp"
- android:paddingRight="8dp">
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:paddingLeft="8dp"
+ android:paddingRight="8dp" >
<ListView
android:id="@id/android:list"
@@ -12,4 +12,4 @@
android:layout_weight="1"
android:drawSelectorOnTop="false" />
-</LinearLayout>
+</LinearLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 91e72a60..ba05b19b 100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -222,7 +222,8 @@
<string name="faq_hint">Be sure to also check out the FAQ. There is a quick start guide.</string>
<string name="correcttls">Convert remote-tls format from OpenVPN 2.2 to 2.3 format</string>
<string name="faq_routing_title">Routing/Interface Configuration</string>
- <string name="faq_routing">The Routing and interface configuration is not done via traditionell ifconfig/route command but by using the VPNService API. This results in a different routing configuration than on other OSes. The configuration only consists of the IP of the tunnel interface and the networks that should be routed over this interface. Especially no peer partner address or gateway address is needed. Special routes to reach the VPN Server (for example added when using redirect-gateway) are not needed either. The application will consequently ignore these settings when importing a configuration. The app ensures with the VPNService API that the connection to the server is not routed through the VPN tunnel. Since only specifing networks to be routed via tunnel is supported extra routes not pointing to the tunnel cannot be supported either. (e.g. route x.x.x.x y.y.y.y net_gateway). The show information button in the log windows show the current configuration of the VPNService network configuration.</string>
+ <string name="faq_routing">The Routing and interface configuration is not done via traditionell ifconfig/route command but by using the VPNService API. This results in a different routing configuration than on other OSes. The configuration only consists of the IP of the tunnel interface and the networks that should be routed over this interface. Especially no peer partner address or gateway address is needed. Special routes to reach the VPN Server (for example added when using redirect-gateway) are not needed either. The application will consequently ignore these settings when importing a configuration. The app ensures with the VPNService API that the connection to the server is not routed through the VPN tunnel. Since only specifing networks to be routed via tunnel is supported extra routes not pointing to the tunnel cannot be supported either. (e.g. route x.x.x.x y.y.y.y net_gateway). The show information button in the log windows show the current configuration of the VPNService network configuration.</
+string>
<string name="persisttun_summary">Do not fallback to no VPN connection when OpenVPN is reconnecting.</string>
<string name="persistent_tun_title">Persistent tun</string>
<string name="translation">Translation</string>
@@ -264,6 +265,8 @@
<string name="eip_status">Status unknown</string>
<string name="eip_service_label">Encrypted Internet</string>
<string name="title_activity_configuration_wizard">Configure Bitmask</string>
+ <string name="provider_list_fragment_tag">Provider list fragment</string>
+ <string name="top_padding">Top padding</string>
<string name="new_provider_button">Select new Provider</string>
<string name="introduce_new_provider">Introduce new provider</string>
<string name="save">Save</string>
diff --git a/src/se/leap/bitmaskclient/ConfigurationWizard.java b/src/se/leap/bitmaskclient/ConfigurationWizard.java
index c03d7c9e..ea85361d 100644
--- a/src/se/leap/bitmaskclient/ConfigurationWizard.java
+++ b/src/se/leap/bitmaskclient/ConfigurationWizard.java
@@ -38,6 +38,8 @@ import android.os.Handler;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ProgressBar;
/**
* Activity that builds and shows the list of known available providers.
@@ -51,7 +53,7 @@ public class ConfigurationWizard extends Activity
implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogInterface, ProviderDetailFragment.ProviderDetailFragmentInterface, Receiver {
private ProviderItem mSelectedProvider;
- private ProgressDialog mProgressDialog;
+ private ProgressBar mProgressBar;
private Intent mConfigState = new Intent();
final public static String TYPE_OF_CERTIFICATE = "type_of_certificate";
@@ -68,6 +70,8 @@ implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogIn
super.onCreate(savedInstanceState);
setContentView(R.layout.configuration_wizard_activity);
+ mProgressBar = (ProgressBar) findViewById(R.id.progressbar);
+ mProgressBar.setVisibility(ProgressBar.INVISIBLE);
providerAPI_result_receiver = new ProviderAPIResultReceiver(new Handler());
providerAPI_result_receiver.setReceiver(this);
@@ -80,17 +84,29 @@ implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogIn
if ( savedInstanceState == null ){
// TODO Some welcome screen?
// We will need better flow control when we have more Fragments (e.g. user auth)
- ProviderListFragment providerList = new ProviderListFragment();
+ ProviderListFragment provider_list_fragment = new ProviderListFragment();
FragmentManager fragmentManager = getFragmentManager();
fragmentManager.beginTransaction()
- .add(R.id.configuration_wizard_layout, providerList, "providerlist")
+ .add(R.id.configuration_wizard_layout, provider_list_fragment, getResources().getString(R.string.provider_list_fragment_tag))
.commit();
}
// TODO: If exposing deep links into your app, handle intents here.
}
+ private void refreshProviderList(int top_padding) {
+ ProviderListFragment providerList = new ProviderListFragment();
+ Bundle top_padding_bundle = new Bundle();
+ top_padding_bundle.putInt(getResources().getString(R.string.top_padding), top_padding);
+ providerList.setArguments(top_padding_bundle);
+
+ FragmentManager fragmentManager = getFragmentManager();
+ fragmentManager.beginTransaction()
+ .replace(R.id.configuration_wizard_layout, providerList, getResources().getString(R.string.provider_list_fragment_tag))
+ .commit();
+ }
+
@Override
public void onReceiveResult(int resultCode, Bundle resultData) {
if(resultCode == ProviderAPI.CORRECTLY_UPDATED_PROVIDER_DOT_JSON) {
@@ -103,62 +119,76 @@ implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogIn
ConfigHelper.saveSharedPref(EIP.ALLOWED_ANON, provider_json.getJSONObject(Provider.SERVICE).getBoolean(EIP.ALLOWED_ANON));
mConfigState.setAction(PROVIDER_SET);
- if(mProgressDialog != null) mProgressDialog.dismiss();
- mProgressDialog = ProgressDialog.show(this, getResources().getString(R.string.config_wait_title), getResources().getString(R.string.config_connecting_provider), true);
- mProgressDialog.setMessage(getResources().getString(R.string.config_downloading_services));
+ if(!mProgressBar.isShown())
+ startProgressBar();
+ mProgressBar.incrementProgressBy(1);
if(resultData.containsKey(Provider.NAME))
mSelectedProvider = getProvider(resultData.getString(Provider.NAME));
- ProviderListFragment providerList = new ProviderListFragment();
-
- FragmentManager fragmentManager = getFragmentManager();
- fragmentManager.beginTransaction()
- .replace(R.id.configuration_wizard_layout, providerList, "providerlist")
- .commit();
+ refreshProviderList(30);
downloadJSONFiles(mSelectedProvider);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
-
- mProgressDialog.dismiss();
+ mProgressBar.setVisibility(ProgressBar.GONE);
+ refreshProviderList(0);
//Toast.makeText(this, getResources().getString(R.string.config_error_parsing), Toast.LENGTH_LONG);
setResult(RESULT_CANCELED, mConfigState);
}
- }
+ }
else if(resultCode == ProviderAPI.INCORRECTLY_UPDATED_PROVIDER_DOT_JSON) {
String reason_to_fail = resultData.getString(ProviderAPI.ERRORS);
- showDownloadFailedDialog(getCurrentFocus(), reason_to_fail);
- mProgressDialog.dismiss();
+ showDownloadFailedDialog(getCurrentFocus(), reason_to_fail);
+ refreshProviderList(0);
+ mProgressBar.setVisibility(ProgressBar.GONE);
setResult(RESULT_CANCELED, mConfigState);
}
else if(resultCode == ProviderAPI.CORRECTLY_DOWNLOADED_JSON_FILES) {
+ mProgressBar.incrementProgressBy(1);
if (ConfigHelper.getBoolFromSharedPref(EIP.ALLOWED_ANON)){
- mProgressDialog.setMessage(getResources().getString(R.string.config_downloading_certificates));
mConfigState.putExtra(SERVICES_RETRIEVED, true);
downloadAnonCert();
} else {
- mProgressDialog.dismiss();
+ mProgressBar.incrementProgressBy(1);
+ mProgressBar.setVisibility(ProgressBar.GONE);
+ refreshProviderList(0);
//Toast.makeText(getApplicationContext(), R.string.success, Toast.LENGTH_LONG).show();
setResult(RESULT_OK);
- finish();
+ showProviderDetails(getCurrentFocus());
}
}
else if(resultCode == ProviderAPI.INCORRECTLY_DOWNLOADED_JSON_FILES) {
- //Toast.makeText(getApplicationContext(), R.string.incorrectly_downloaded_json_files_message, Toast.LENGTH_LONG).show();
+ //Toast.makeText(getApplicationContext(), R.string.incorrectly_downloaded_json_files_message, Toast.LENGTH_LONG).show();
+<<<<<<< HEAD:src/se/leap/bitmaskclient/ConfigurationWizard.java
String reason_to_fail = resultData.getString(ProviderAPI.ERRORS);
- showDownloadFailedDialog(getCurrentFocus(), reason_to_fail);
+ showDownloadFailedDialog(getCurrentFocus(), reason_to_fail);
+=======
+ refreshProviderList(0);
+ mProgressBar.setVisibility(ProgressBar.GONE);
+>>>>>>> ed8ca1d... Added a progressbar to ConfigurationWizard.:src/se/leap/leapclient/ConfigurationWizard.java
setResult(RESULT_CANCELED, mConfigState);
}
else if(resultCode == ProviderAPI.CORRECTLY_DOWNLOADED_CERTIFICATE) {
- mProgressDialog.dismiss();
+ mProgressBar.incrementProgressBy(1);
+ mProgressBar.setVisibility(ProgressBar.GONE);
+ refreshProviderList(0);
setResult(RESULT_OK);
showProviderDetails(getCurrentFocus());
} else if(resultCode == ProviderAPI.INCORRECTLY_DOWNLOADED_CERTIFICATE) {
- mProgressDialog.dismiss();
+ refreshProviderList(0);
+ mProgressBar.setVisibility(ProgressBar.GONE);
//Toast.makeText(getApplicationContext(), R.string.incorrectly_downloaded_certificate_message, Toast.LENGTH_LONG).show();
setResult(RESULT_CANCELED, mConfigState);
}
}
+
+ private void startProgressBar() {
+ FragmentManager fragmentManager = getFragmentManager();
+ fragmentManager.findFragmentByTag(getResources().getString(R.string.provider_list_fragment_tag)).getView().setPadding(8, 30, 8, 0);
+ mProgressBar.setVisibility(ProgressBar.VISIBLE);
+ mProgressBar.setProgress(0);
+ mProgressBar.setMax(3);
+ }
/**
* Callback method from {@link ProviderListFragment.Callbacks}
@@ -168,7 +198,7 @@ implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogIn
public void onItemSelected(String id) {
//TODO Code 2 pane view
ProviderItem selected_provider = getProvider(id);
- mProgressDialog = ProgressDialog.show(this, getResources().getString(R.string.config_wait_title), getResources().getString(R.string.config_connecting_provider), true);
+ startProgressBar();
mSelectedProvider = selected_provider;
saveProviderJson(mSelectedProvider);
}
@@ -252,8 +282,8 @@ implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogIn
ConfigHelper.saveSharedPref(Provider.KEY, provider_json);
ConfigHelper.saveSharedPref(EIP.ALLOWED_ANON, provider_json.getJSONObject(Provider.SERVICE).getBoolean(EIP.ALLOWED_ANON));
ConfigHelper.saveSharedPref(ProviderItem.DANGER_ON, provider.danger_on);
-
- mProgressDialog.setMessage(getResources().getString(R.string.config_downloading_services));
+
+ mProgressBar.incrementProgressBy(1);
downloadJSONFiles(mSelectedProvider);
}
} catch (JSONException e) {
diff --git a/src/se/leap/bitmaskclient/ProviderListFragment.java b/src/se/leap/bitmaskclient/ProviderListFragment.java
index 82c4bdc8..05cd4b78 100644
--- a/src/se/leap/bitmaskclient/ProviderListFragment.java
+++ b/src/se/leap/bitmaskclient/ProviderListFragment.java
@@ -90,7 +90,7 @@ public class ProviderListFragment extends ListFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
+ super.onCreate(savedInstanceState);
content_adapter = new ArrayAdapter<ProviderListContent.ProviderItem>(
getActivity(),
android.R.layout.simple_list_item_activated_2,
@@ -128,6 +128,12 @@ public class ProviderListFragment extends ListFragment {
&& savedInstanceState.containsKey(STATE_ACTIVATED_POSITION)) {
setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION));
}
+ String top_padding_key = getResources().getString(R.string.top_padding);
+ if(getArguments() != null && getArguments().containsKey(top_padding_key)) {
+ int topPadding = getArguments().getInt(top_padding_key);
+ View current_view = getView();
+ getView().setPadding(current_view.getPaddingLeft(), topPadding, current_view.getPaddingRight(), current_view.getPaddingBottom());
+ }
}
@Override