<commit_before>package ru.touchin.roboswag.components.utils.spans;

import android.content.Intent;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.text.TextPaint;
import android.text.style.URLSpan;
import android.view.View;

import ru.touchin.roboswag.core.log.Lc;

/**
 * Created by <NAME> on 14/11/2015.
 * Span that is opening phone call intent.
 */
public class PhoneSpan extends URLSpan {

    public PhoneSpan(@NonNull final String phoneNumber) {
        super(phoneNumber);
    }

    @SuppressWarnings("PMD.AvoidCatchingThrowable")
    @Override
    public void onClick(@NonNull final View widget) {
        super.onClick(widget);
        try {
            final Intent intent = new Intent(Intent.ACTION_DIAL);
            intent.setData(Uri.parse(getURL()));
            widget.getContext().startActivity(intent);
            // it should catch throwable to not crash in production if there are problems with startActivity()
        } catch (final Throwable throwable) {
            Lc.assertion(throwable);
        }
    }

    @Override
    public void updateDrawState(@NonNull final TextPaint ds) {
        super.updateDrawState(ds);
        ds.setUnderlineText(false);
    }

}<commit_msg>warning of PhoneSpan fixed<commit_after>package ru.touchin.roboswag.components.utils.spans;

import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.text.TextPaint;
import android.text.style.URLSpan;
import android.view.View;

import ru.touchin.roboswag.core.log.Lc;

/**
 * Created by <NAME> on 14/11/2015.
 * Span that is opening phone call intent.
 */
public class PhoneSpan extends URLSpan {

    public PhoneSpan(@NonNull final String phoneNumber) {
        super(phoneNumber);
    }

    @Override
    public void onClick(@NonNull final View widget) {
        super.onClick(widget);
        try {
            final Intent intent = new Intent(Intent.ACTION_DIAL);
            intent.setData(Uri.parse(getURL()));
            widget.getContext().startActivity(intent);
        } catch (final ActivityNotFoundException exception) {
            Lc.assertion(exception);
        }
    }

    @Override
    public void updateDrawState(@NonNull final TextPaint ds) {
        super.updateDrawState(ds);
        ds.setUnderlineText(false);
    }

}
{'fraction_non_alphanumeric': 0.10008375209380234, 'fraction_numerical': 0.006700167504187605, 'mean_word_length': 3.0907534246575343, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2562908', 'n_tokens_mistral': 684, 'n_tokens_neox': 679, 'n_words': 159}