summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/ProviderSelectionFragment.java2
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/viewmodel/ProviderSelectionViewModel.java9
-rw-r--r--app/src/main/res/layout/f_provider_selection.xml3
3 files changed, 12 insertions, 2 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/ProviderSelectionFragment.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/ProviderSelectionFragment.java
index 0b0c5034..f15aaa43 100644
--- a/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/ProviderSelectionFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/ProviderSelectionFragment.java
@@ -107,7 +107,7 @@ public class ProviderSelectionFragment extends BaseSetupFragment implements Canc
if (viewModel.isCustomProviderSelected()) {
setupActivityCallback.onSetupStepValidationChanged(viewModel.isValidConfig());
if (viewModel.isValidConfig()) {
- setupActivityCallback.onProviderSelected(new Provider(s.toString()));
+ setupActivityCallback.onProviderSelected(new Provider(viewModel.getCustomUrl()));
}
}
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/viewmodel/ProviderSelectionViewModel.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/viewmodel/ProviderSelectionViewModel.java
index 53d02b46..29dab98a 100644
--- a/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/viewmodel/ProviderSelectionViewModel.java
+++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/viewmodel/ProviderSelectionViewModel.java
@@ -48,7 +48,7 @@ public class ProviderSelectionViewModel extends ViewModel {
public boolean isValidConfig() {
if (selected == ADD_PROVIDER) {
- return URLUtil.isValidUrl(customUrl) && Patterns.WEB_URL.matcher(customUrl).matches();
+ return customUrl != null && (Patterns.DOMAIN_NAME.matcher(customUrl).matches() || (URLUtil.isNetworkUrl(customUrl) && Patterns.WEB_URL.matcher(customUrl).matches()));
}
return true;
}
@@ -82,6 +82,13 @@ public class ProviderSelectionViewModel extends ViewModel {
customUrl = url;
}
+ public String getCustomUrl() {
+ if (customUrl != null && Patterns.DOMAIN_NAME.matcher(customUrl).matches()) {
+ return "https://" + customUrl;
+ }
+ return customUrl;
+ }
+
public String getProviderName(int pos) {
String domain = getProvider(pos).getDomain();
diff --git a/app/src/main/res/layout/f_provider_selection.xml b/app/src/main/res/layout/f_provider_selection.xml
index 7c861a14..48d5bdd3 100644
--- a/app/src/main/res/layout/f_provider_selection.xml
+++ b/app/src/main/res/layout/f_provider_selection.xml
@@ -81,6 +81,9 @@
android:layout_height="wrap_content"
android:background="@color/white"
android:hint="https://example.org"
+ android:inputType="textWebEditText"
+ android:imeOptions="actionDone"
+ android:maxLines="1"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textColorHint="@color/black800_transparent"
/>