summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorcyberta <cyberta@riseup.net>2018-02-10 12:11:25 -0800
committercyberta <cyberta@riseup.net>2018-02-10 12:11:25 -0800
commitb37575a680cd1e345339bdc5c4c4bc1137b2e4f1 (patch)
treec6708bbcf23c1930d045beee6c46d7c74752e9a6 /app
parenta75de0157b7f80de4526d9ac57a96ecb6e8fa45e (diff)
parent69cd8480df05055e8b068bbff563c17d6feb86dd (diff)
Merge branch '8554_error_array' into '0.9.8'
#8554 See merge request leap/bitmask_android!41
Diffstat (limited to 'app')
-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-sw600dp-port/a_provider_credentials.xml52
-rw-r--r--app/src/main/res/layout-xlarge/a_provider_credentials.xml52
-rw-r--r--app/src/main/res/layout/a_provider_credentials.xml53
-rw-r--r--app/src/main/res/layout/provider_credentials.xml1
6 files changed, 115 insertions, 76 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-sw600dp-port/a_provider_credentials.xml b/app/src/main/res/layout-sw600dp-port/a_provider_credentials.xml
index 4555343c..0cbb08f6 100644
--- a/app/src/main/res/layout-sw600dp-port/a_provider_credentials.xml
+++ b/app/src/main/res/layout-sw600dp-port/a_provider_credentials.xml
@@ -43,7 +43,6 @@
app:layout_constraintGuide_percent="0.725" />
<LinearLayout
- android:id="@+id/content"
android:orientation="vertical"
style="@style/BitmaskActivity"
android:layout_width="0dp"
@@ -61,35 +60,42 @@
<include layout="@layout/loading_screen" />
- <include
- layout="@layout/provider_header"
+ <LinearLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content" />
+ android:layout_height="match_parent"
+ android:id="@+id/content"
+ android:orientation="vertical">
+ <include
+ layout="@layout/provider_header"
+ 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
+ <ScrollView
+ android:layout_height="match_parent"
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:isScrollContainer="true"
+ >
- <android.support.v7.widget.AppCompatButton
- android:id="@+id/button"
- android:layout_width="wrap_content"
+ <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>
</android.support.constraint.ConstraintLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout-xlarge/a_provider_credentials.xml b/app/src/main/res/layout-xlarge/a_provider_credentials.xml
index 82abb5cb..2184aeb8 100644
--- a/app/src/main/res/layout-xlarge/a_provider_credentials.xml
+++ b/app/src/main/res/layout-xlarge/a_provider_credentials.xml
@@ -43,7 +43,6 @@
app:layout_constraintGuide_percent="0.85" />
<LinearLayout
- android:id="@+id/content"
android:orientation="vertical"
style="@style/BitmaskActivity"
android:layout_width="0dp"
@@ -60,35 +59,42 @@
<include layout="@layout/loading_screen" />
- <include
- layout="@layout/provider_header"
+ <LinearLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content" />
+ android:layout_height="match_parent"
+ android:id="@+id/content"
+ android:orientation="vertical">
+ <include
+ layout="@layout/provider_header"
+ 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
+ <ScrollView
+ android:layout_height="match_parent"
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:isScrollContainer="true"
+ >
- <android.support.v7.widget.AppCompatButton
- android:id="@+id/button"
- android:layout_width="wrap_content"
+ <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>
</android.support.constraint.ConstraintLayout> \ No newline at end of file
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