// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package uk.co.chrisjenx.calligraphy; import android.content.Context; import android.content.res.Resources; import android.support.v7.widget.Toolbar; import android.text.TextUtils; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.widget.TextView; import java.util.Map; // Referenced classes of package uk.co.chrisjenx.calligraphy: // CalligraphyConfig, CalligraphyUtils, TypefaceUtils class CalligraphyFactory { private static final String ACTION_BAR_SUBTITLE = "action_bar_subtitle"; private static final String ACTION_BAR_TITLE = "action_bar_title"; private final int mAttributeId; public CalligraphyFactory(int i) { mAttributeId = i; } protected static int[] getStyleForTextView(TextView textview) { int ai[] = new int[2]; int[] _tmp = ai; ai[0] = -1; ai[1] = -1; if (isActionBarTitle(textview)) { ai[0] = 0x10102ce; ai[1] = 0x10102f8; } else if (isActionBarSubTitle(textview)) { ai[0] = 0x10102ce; ai[1] = 0x10102f9; } if (ai[0] == -1) { int i; if (CalligraphyConfig.get().getClassStyles().containsKey(textview.getClass())) { i = ((Integer)CalligraphyConfig.get().getClassStyles().get(textview.getClass())).intValue(); } else { i = 0x1010034; } ai[0] = i; } return ai; } protected static boolean isActionBarSubTitle(TextView textview) { if (matchesResourceIdName(textview, "action_bar_subtitle")) { return true; } if (parentIsToolbarV7(textview)) { return TextUtils.equals(((Toolbar)textview.getParent()).getSubtitle(), textview.getText()); } else { return false; } } protected static boolean isActionBarTitle(TextView textview) { if (matchesResourceIdName(textview, "action_bar_title")) { return true; } if (parentIsToolbarV7(textview)) { return TextUtils.equals(((Toolbar)textview.getParent()).getTitle(), textview.getText()); } else { return false; } } protected static boolean matchesResourceIdName(View view, String s) { if (view.getId() == -1) { return false; } else { return view.getResources().getResourceEntryName(view.getId()).equalsIgnoreCase(s); } } protected static boolean parentIsToolbarV7(View view) { return CalligraphyUtils.canCheckForV7Toolbar() && view.getParent() != null && (view.getParent() instanceof Toolbar); } public View onViewCreated(View view, Context context, AttributeSet attributeset) { if (view != null && view.getTag(R.id.calligraphy_tag_id) != Boolean.TRUE) { onViewCreatedInternal(view, context, attributeset); view.setTag(R.id.calligraphy_tag_id, Boolean.TRUE); } return view; } void onViewCreatedInternal(final View parent, final Context context, AttributeSet attributeset) { boolean flag = false; if (!(parent instanceof TextView)) goto _L2; else goto _L1 _L1: if (!TypefaceUtils.isLoaded(((TextView)parent).getTypeface())) goto _L4; else goto _L3 _L3: return; _L4: String s1 = CalligraphyUtils.pullFontPathFromView(context, attributeset, mAttributeId); String s = s1; if (TextUtils.isEmpty(s1)) { s = CalligraphyUtils.pullFontPathFromStyle(context, attributeset, mAttributeId); } s1 = s; if (TextUtils.isEmpty(s)) { s1 = CalligraphyUtils.pullFontPathFromTextAppearance(context, attributeset, mAttributeId); } attributeset = s1; if (TextUtils.isEmpty(s1)) { attributeset = getStyleForTextView((TextView)parent); if (attributeset[1] != -1) { attributeset = CalligraphyUtils.pullFontPathFromTheme(context, attributeset[0], attributeset[1], mAttributeId); } else { attributeset = CalligraphyUtils.pullFontPathFromTheme(context, attributeset[0], mAttributeId); } } if (matchesResourceIdName(parent, "action_bar_title") || matchesResourceIdName(parent, "action_bar_subtitle")) { flag = true; } CalligraphyUtils.applyFontToTextView(context, (TextView)parent, CalligraphyConfig.get(), attributeset, flag); _L2: if (CalligraphyUtils.canCheckForV7Toolbar() && (parent instanceof Toolbar)) { parent = (ViewGroup)parent; parent.getViewTreeObserver().addOnGlobalLayoutListener(new android.view.ViewTreeObserver.OnGlobalLayoutListener() { final CalligraphyFactory this$0; final Context val$context; final ViewGroup val$parent; public void onGlobalLayout() { int j = parent.getChildCount(); if (j != 0) { for (int i = 0; i < j; i++) { onViewCreated(parent.getChildAt(i), context, null); } } if (android.os.Build.VERSION.SDK_INT < 16) { parent.getViewTreeObserver().removeGlobalOnLayoutListener(this); return; } else { parent.getViewTreeObserver().removeOnGlobalLayoutListener(this); return; } } { this$0 = CalligraphyFactory.this; parent = viewgroup; context = context1; super(); } }); return; } if (true) goto _L3; else goto _L5 _L5: } // Unreferenced inner class uk/co/chrisjenx/calligraphy/CalligraphyFactory$2 /* anonymous class */ class _cls2 implements android.view.ViewTreeObserver.OnGlobalLayoutListener { final CalligraphyFactory this$0; final Context val$context; final ViewGroup val$parent; public void onGlobalLayout() { int j = parent.getChildCount(); if (j != 0) { for (int i = 0; i < j; i++) { onViewCreated(parent.getChildAt(i), context, null); } } if (android.os.Build.VERSION.SDK_INT < 16) { parent.getViewTreeObserver().removeGlobalOnLayoutListener(this); return; } else { parent.getViewTreeObserver().removeOnGlobalLayoutListener(this); return; } } { this$0 = CalligraphyFactory.this; parent = viewgroup; context = context1; super(); } } }