diff options
Diffstat (limited to 'app/src/main/java/se/leap')
-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); |