package android.support.v4.widget;

import android.graphics.drawable.Drawable;
import android.widget.TextView;
import java.lang.reflect.Field;

class q$g {
    private static Field SC;
    private static boolean SD;
    private static Field SE;
    private static boolean SF;

    q$g() {
    }

    public void a(TextView textView, Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
        textView.setCompoundDrawables(drawable, drawable2, drawable3, drawable4);
    }

    private static Field O(String str) {
        Field field = null;
        try {
            field = TextView.class.getDeclaredField(str);
            field.setAccessible(true);
            return field;
        } catch (NoSuchFieldException e) {
            new StringBuilder("Could not retrieve ").append(str).append(" field.");
            return field;
        }
    }

    private static int a(Field field, TextView textView) {
        try {
            return field.getInt(textView);
        } catch (IllegalAccessException e) {
            new StringBuilder("Could not retrieve value of ").append(field.getName()).append(" field.");
            return -1;
        }
    }

    public int b(TextView textView) {
        if (!SF) {
            SE = O("mMaxMode");
            SF = true;
        }
        if (SE != null && a(SE, textView) == 1) {
            if (!SD) {
                SC = O("mMaximum");
                SD = true;
            }
            if (SC != null) {
                return a(SC, textView);
            }
        }
        return -1;
    }

    public void b(TextView textView, int i) {
        textView.setTextAppearance(textView.getContext(), i);
    }

    public Drawable[] c(TextView textView) {
        return textView.getCompoundDrawables();
    }

    public void d(TextView textView) {
        if (textView instanceof b) {
            ((b) textView).setAutoSizeTextTypeWithDefaults(1);
        }
    }
}
