summaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorFup Duck <fupduck@sacknagel.com>2018-02-08 19:39:37 +0100
committerFup Duck <fupduck@sacknagel.com>2018-02-08 19:39:37 +0100
commitdbcac111161ee1e26f8f81397e8643d081b116ef (patch)
tree959959870271190480091a81a0a77f36ed2e3e00 /app/src
parentae938c20a11b6195936f97eebd32abd35335bceb (diff)
\#8554
* show only first error of error array * show loading screenin credentials activities * render link in error message correctly
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/AndroidManifest.xml6
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/ProviderCredentialsBaseActivity.java27
-rw-r--r--app/src/main/res/layout/a_provider_credentials.xml53
-rw-r--r--app/src/main/res/layout/provider_credentials.xml1
4 files changed, 57 insertions, 30 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 6a1d40aa..029e9fdb 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -102,10 +102,8 @@
android:label="@string/provider_details_title"
android:launchMode="singleTop" />
- <activity android:name=".LoginActivity"
- android:noHistory="true" />
- <activity android:name=".SignupActivity"
- android:noHistory="true" />
+ <activity android:name=".LoginActivity" />
+ <activity android:name=".SignupActivity" />
<service
android:name=".eip.EIP"
diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderCredentialsBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/ProviderCredentialsBaseActivity.java
index 25dca4e0..172c52d3 100644
--- a/app/src/main/java/se/leap/bitmaskclient/ProviderCredentialsBaseActivity.java
+++ b/app/src/main/java/se/leap/bitmaskclient/ProviderCredentialsBaseActivity.java
@@ -4,6 +4,8 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.os.Build;
+import android.os.Build.VERSION_CODES;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
@@ -12,12 +14,18 @@ import android.support.design.widget.TextInputLayout;
import android.support.v7.widget.AppCompatButton;
import android.support.v7.widget.AppCompatTextView;
import android.text.Editable;
+import android.text.Html;
import android.text.TextWatcher;
+import android.text.method.LinkMovementMethod;
+import android.text.util.Linkify;
import android.util.Log;
import android.view.KeyEvent;
import android.view.inputmethod.InputMethodManager;
import android.widget.TextView;
+import org.json.JSONArray;
+import org.json.JSONException;
+
import butterknife.InjectView;
import butterknife.OnClick;
import se.leap.bitmaskclient.userstatus.SessionDialog;
@@ -316,9 +324,9 @@ public abstract class ProviderCredentialsBaseActivity extends ConfigWizardBaseAc
}
private void handleReceivedErrors(Bundle arguments) {
- if (arguments.containsKey(ERRORS.PASSWORD_INVALID_LENGTH.toString()))
+ if (arguments.containsKey(ERRORS.PASSWORD_INVALID_LENGTH.toString())) {
passwordError.setError(getString(R.string.error_not_valid_password_user_message));
- else if (arguments.containsKey(ERRORS.RISEUP_WARNING.toString())) {
+ } else if (arguments.containsKey(ERRORS.RISEUP_WARNING.toString())) {
userMessage.setVisibility(VISIBLE);
userMessage.setText(R.string.login_riseup_warning);
}
@@ -330,7 +338,20 @@ public abstract class ProviderCredentialsBaseActivity extends ConfigWizardBaseAc
usernameError.setError(getString(R.string.username_ask));
}
if (arguments.containsKey(getString(R.string.user_message))) {
- userMessage.setText(arguments.getString(getString(R.string.user_message)));
+ String userMessageString = arguments.getString(getString(R.string.user_message));
+ try {
+ userMessageString = new JSONArray(userMessageString).getString(0);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+ if (Build.VERSION.SDK_INT >= VERSION_CODES.N) {
+ userMessage.setText(Html.fromHtml(userMessageString, Html.FROM_HTML_MODE_LEGACY));
+ } else {
+ userMessage.setText(Html.fromHtml(userMessageString));
+ }
+ Linkify.addLinks(userMessage, Linkify.ALL);
+ userMessage.setMovementMethod(LinkMovementMethod.getInstance());
userMessage.setVisibility(VISIBLE);
} else if (userMessage.getVisibility() != VISIBLE) {
userMessage.setVisibility(GONE);
diff --git a/app/src/main/res/layout/a_provider_credentials.xml b/app/src/main/res/layout/a_provider_credentials.xml
index 4998effa..6667d905 100644
--- a/app/src/main/res/layout/a_provider_credentials.xml
+++ b/app/src/main/res/layout/a_provider_credentials.xml
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/content"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -10,34 +9,42 @@
<include layout="@layout/loading_screen" />
- <include
- layout="@layout/provider_header"
+ <LinearLayout
+ android:id="@+id/content"
+ android:orientation="vertical"
android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-
-
- <ScrollView
android:layout_height="match_parent"
- android:layout_width="match_parent"
- android:isScrollContainer="true"
>
- <LinearLayout
+ <include
+ layout="@layout/provider_header"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical">
- <include
- layout="@layout/provider_credentials"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
+ android:layout_height="wrap_content" />
+
- <android.support.v7.widget.AppCompatButton
- android:id="@+id/button"
- android:layout_width="wrap_content"
+ <ScrollView
+ android:layout_height="match_parent"
+ android:layout_width="match_parent"
+ android:isScrollContainer="true"
+ >
+
+ <LinearLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_gravity="end"
- android:text="@string/login_button" />
+ android:orientation="vertical">
+ <include
+ layout="@layout/provider_credentials"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ <android.support.v7.widget.AppCompatButton
+ android:id="@+id/button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="end"
+ android:text="@string/login_button" />
- </LinearLayout>
- </ScrollView>
+ </LinearLayout>
+ </ScrollView>
+ </LinearLayout>
</LinearLayout>
diff --git a/app/src/main/res/layout/provider_credentials.xml b/app/src/main/res/layout/provider_credentials.xml
index 6e4dff95..0bfdcc47 100644
--- a/app/src/main/res/layout/provider_credentials.xml
+++ b/app/src/main/res/layout/provider_credentials.xml
@@ -8,6 +8,7 @@
android:layout_height="wrap_content"
style="@style/TextAppearance.Design.Error"
android:visibility="gone"
+ android:linksClickable="true"
/>
<android.support.design.widget.TextInputLayout