diff options
author | Fup Duck <fupduck@sacknagel.com> | 2018-02-11 12:54:29 +0100 |
---|---|---|
committer | Fup Duck <fupduck@sacknagel.com> | 2018-02-11 12:54:29 +0100 |
commit | df4bf064a8c9310ed887d80bf6cd6328d1363f49 (patch) | |
tree | c739a9ab1ec88641d8d643667f695a266994a5a1 /app/src/main/java/se | |
parent | 02738271daa9457e5f4e97508301bb11a612fb24 (diff) | |
parent | b37575a680cd1e345339bdc5c4c4bc1137b2e4f1 (diff) |
Merge branch 'leap_0.9.8' into 8827_handle_switch_provider
Diffstat (limited to 'app/src/main/java/se')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/ProviderCredentialsBaseActivity.java | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderCredentialsBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/ProviderCredentialsBaseActivity.java index 88221007..47a45a74 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; @@ -13,12 +15,18 @@ import android.support.v4.content.LocalBroadcastManager; 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.Constants.CREDENTIAL_ERRORS; @@ -327,7 +335,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); |