盛康基办.apk(点击下载) / URLSpanNoUnderline.java


package im.guobwnxjuc.ui.components;

import android.net.Uri;
import android.text.TextPaint;
import android.text.style.URLSpan;
import android.view.View;
import im.guobwnxjuc.messenger.browser.Browser;
import im.guobwnxjuc.ui.components.TextStyleSpan;

public class URLSpanNoUnderline extends URLSpan {
    private TextStyleSpan.TextStyleRun style;

    public URLSpanNoUnderline(String str) {
        this(str, null);
    }

    /* JADX INFO: super call moved to the top of the method (can break code semantics) */
    public URLSpanNoUnderline(String str, TextStyleSpan.TextStyleRun textStyleRun) {
        super(str != null ? str.replace((char) 8238, ' ') : str);
        this.style = textStyleRun;
    }

    public void onClick(View view) {
        String url = getURL();
        if (url.startsWith("@")) {
            Browser.openUrl(view.getContext(), Uri.parse("https://m12345.cc/" + url.substring(1)));
            return;
        }
        Browser.openUrl(view.getContext(), url);
    }

    public void updateDrawState(TextPaint textPaint) {
        super.updateDrawState(textPaint);
        TextStyleSpan.TextStyleRun textStyleRun = this.style;
        if (textStyleRun != null) {
            textStyleRun.applyStyle(textPaint);
        } else {
            textPaint.setUnderlineText(false);
        }
    }
}