// Path: app/src/main/java/com/joanzapata/iconify/Icon.java
// public interface Icon {
// 
//     /** The key of icon, for example 'fa-ok' */
//     String key();
// 
//     /** The character matching the key in the font, for example '\u4354' */
//     char character();
// 
// }
// 
// Path: app/src/main/java/com/joanzapata/iconify/internal/HasOnViewAttachListener.java
// interface OnViewAttachListener {
//     void onAttach();
// 
//     void onDetach();
// }


import java.util.List;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Color;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.util.TypedValue;
import android.widget.TextView;
import androidx.core.view.ViewCompat;
import com.joanzapata.iconify.Icon;
import com.joanzapata.iconify.internal.HasOnViewAttachListener.OnViewAttachListener;
package com.joanzapata.iconify.internal;





public final class ParsingUtil {

    private static final String ANDROID_PACKAGE_NAME = "android";

    // Prevents instantiation
    private ParsingUtil() {}

    public static CharSequence parse(
            Context context,
            List<IconFontDescriptorWrapper> iconFontDescriptors,
            CharSequence text,
            final TextView target) {
        context = context.getApplicationContext();

        // Don't do anything related to iconify if text is null
        if (text == null) return text;

        // Analyse the text and replace {} blocks with the appropriate character
        // Retain all transformations in the accumulator
        final SpannableStringBuilder spannableBuilder = new SpannableStringBuilder(text);
        recursivePrepareSpannableIndexes(context,
                text.toString(), spannableBuilder,
                iconFontDescriptors, 0);
        boolean isAnimated = hasAnimatedSpans(spannableBuilder);

        // If animated, periodically invalidate the TextView so that the
        // CustomTypefaceSpan can redraw itself
        if (isAnimated) {
            if (target == null)
                throw new IllegalArgumentException("You can't use \"spin\" without providing the target TextView.");
            if (!(target instanceof HasOnViewAttachListener))
                throw new IllegalArgumentException(target.getClass().getSimpleName() + " does not implement " +
                        "HasOnViewAttachListener. Please use IconTextView, IconButton or IconToggleButton.");

// Path: app/src/main/java/com/joanzapata/iconify/Icon.java
// public interface Icon {
// 
//     /** The key of icon, for example 'fa-ok' */
//     String key();
// 
//     /** The character matching the key in the font, for example '\u4354' */
//     char character();
// 
// }
// 
// Path: app/src/main/java/com/joanzapata/iconify/internal/HasOnViewAttachListener.java
// interface OnViewAttachListener {
//     void onAttach();
// 
//     void onDetach();
// }


// Path: app/src/main/java/com/joanzapata/iconify/internal/ParsingUtil.java
import java.util.List;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Color;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.util.TypedValue;
import android.widget.TextView;
import androidx.core.view.ViewCompat;
import com.joanzapata.iconify.Icon;
import com.joanzapata.iconify.internal.HasOnViewAttachListener.OnViewAttachListener;

package com.joanzapata.iconify.internal;





public final class ParsingUtil {

    private static final String ANDROID_PACKAGE_NAME = "android";

    // Prevents instantiation
    private ParsingUtil() {}

    public static CharSequence parse(
            Context context,
            List<IconFontDescriptorWrapper> iconFontDescriptors,
            CharSequence text,
            final TextView target) {
        context = context.getApplicationContext();

        // Don't do anything related to iconify if text is null
        if (text == null) return text;

        // Analyse the text and replace {} blocks with the appropriate character
        // Retain all transformations in the accumulator
        final SpannableStringBuilder spannableBuilder = new SpannableStringBuilder(text);
        recursivePrepareSpannableIndexes(context,
                text.toString(), spannableBuilder,
                iconFontDescriptors, 0);
        boolean isAnimated = hasAnimatedSpans(spannableBuilder);

        // If animated, periodically invalidate the TextView so that the
        // CustomTypefaceSpan can redraw itself
        if (isAnimated) {
            if (target == null)
                throw new IllegalArgumentException("You can't use \"spin\" without providing the target TextView.");
            if (!(target instanceof HasOnViewAttachListener))
                throw new IllegalArgumentException(target.getClass().getSimpleName() + " does not implement " +
                        "HasOnViewAttachListener. Please use IconTextView, IconButton or IconToggleButton.");

            ((HasOnViewAttachListener) target).setOnViewAttachListener(new OnViewAttachListener() {