Search in sources :

Example 11 with URLSpanNoUnderline

use of org.telegram.ui.Components.URLSpanNoUnderline in project Telegram-FOSS by Telegram-FOSS-Team.

the class SettingsSuggestionCell method setType.

public void setType(int type) {
    currentType = type;
    if (type == TYPE_PHONE) {
        final TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(UserConfig.getInstance(currentAccount).clientUserId);
        textView.setText(LocaleController.formatString("CheckPhoneNumber", R.string.CheckPhoneNumber, PhoneFormat.getInstance().format("+" + user.phone)));
        String text = LocaleController.getString("CheckPhoneNumberInfo", R.string.CheckPhoneNumberInfo);
        SpannableStringBuilder builder = new SpannableStringBuilder(text);
        int index1 = text.indexOf("**");
        int index2 = text.lastIndexOf("**");
        if (index1 >= 0 && index2 >= 0 && index1 != index2) {
            builder.replace(index2, index2 + 2, "");
            builder.replace(index1, index1 + 2, "");
            try {
                builder.setSpan(new URLSpanNoUnderline(LocaleController.getString("CheckPhoneNumberLearnMoreUrl", R.string.CheckPhoneNumberLearnMoreUrl)), index1, index2 - 2, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            } catch (Exception e) {
                FileLog.e(e);
            }
        }
        detailTextView.setText(builder);
        yesButton.setText(LocaleController.getString("CheckPhoneNumberYes", R.string.CheckPhoneNumberYes));
        noButton.setText(LocaleController.getString("CheckPhoneNumberNo", R.string.CheckPhoneNumberNo));
    } else if (type == TYPE_PASSWORD) {
        textView.setText(LocaleController.getString("YourPasswordHeader", R.string.YourPasswordHeader));
        detailTextView.setText(LocaleController.getString("YourPasswordRemember", R.string.YourPasswordRemember));
        yesButton.setText(LocaleController.getString("YourPasswordRememberYes", R.string.YourPasswordRememberYes));
        noButton.setText(LocaleController.getString("YourPasswordRememberNo", R.string.YourPasswordRememberNo));
    }
}
Also used : URLSpanNoUnderline(org.telegram.ui.Components.URLSpanNoUnderline) TLRPC(org.telegram.tgnet.TLRPC) SpannableStringBuilder(android.text.SpannableStringBuilder)

Aggregations

URLSpanNoUnderline (org.telegram.ui.Components.URLSpanNoUnderline)11 Spannable (android.text.Spannable)6 SpannableStringBuilder (android.text.SpannableStringBuilder)6 TextPaint (android.text.TextPaint)6 URLSpan (android.text.style.URLSpan)6 TLRPC (org.telegram.tgnet.TLRPC)6 Paint (android.graphics.Paint)5 Intent (android.content.Intent)4 Canvas (android.graphics.Canvas)4 Spanned (android.text.Spanned)4 View (android.view.View)4 ViewGroup (android.view.ViewGroup)4 ImageView (android.widget.ImageView)4 TextView (android.widget.TextView)4 ArrayList (java.util.ArrayList)4 AndroidUtilities (org.telegram.messenger.AndroidUtilities)4 ActionBar (org.telegram.ui.ActionBar.ActionBar)4 Manifest (android.Manifest)3 Animator (android.animation.Animator)3 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)3