// Path: nightowllib/src/main/java/com/asha/nightowllib/NightOwlTable.java
// public class NightOwlTable {
//     protected static void init(){
//         registerHandler(ListViewHandler.class);
//         registerHandler(ImageViewHandler.class);
//         registerHandler(TextViewHandler.class);
//         registerHandler(ButtonHandler.class);
//         registerHandler(ViewHandler.class);
//     }
// 
//     @OwlAttrScope(2000) public interface OwlView {
//         @OwlStyleable int[] NightOwl_View = R.styleable.NightOwl_View;
//         @OwlAttr(BackgroundPaint.class) int NightOwl_View_night_background = R.styleable.NightOwl_View_night_background;
//         @OwlAttr(AlphaPaint.class) int NightOwl_View_night_alpha = R.styleable.NightOwl_View_night_alpha;
//     }
// 
//     @OwlAttrScope(2100) public interface OwlTextView extends OwlView {
//         @OwlStyleable int[] NightOwl_TextView = R.styleable.NightOwl_TextView;
//         @OwlAttr(TextColorPaint.class) int NightOwl_TextView_night_textColor = R.styleable.NightOwl_TextView_night_textColor;
//         @OwlAttr(TextColorPaint.class) int NightOwl_TextView_night_textColorHint = R.styleable.NightOwl_TextView_night_textColorHint;
//     }
// 
//     @OwlAttrScope(2200) public interface OwlButton extends OwlTextView {
//     }
// 
//     @OwlAttrScope(2300) public interface OwlImageView extends OwlView {
//         @OwlStyleable int[] NightOwl_ImageView =  R.styleable.NightOwl_ImageView;
//         @OwlAttr(ImageViewSrcPaint.class) int NightOwl_ImageView_night_src = R.styleable.NightOwl_ImageView_night_src;
//     }
// 
//     @OwlAttrScope(2400) public interface OwlListView extends OwlView {
//         @OwlStyleable int[] NightOwl_ListView =  R.styleable.NightOwl_ListView;
//         @OwlAttr(ListViewDividerPaint.class) int NightOwl_ListView_night_divider = R.styleable.NightOwl_ListView_night_divider;
//         @OwlAttr(ListViewSelectorPaint.class) int NightOwl_ListView_night_listSelector = R.styleable.NightOwl_ListView_night_listSelector;
//     }
// }
// 
// Path: nightowllib/src/main/java/com/asha/nightowllib/NightOwlUtil.java
// public static int getStaticFieldIntSafely(Field field){
//     try {
//         return field.getInt(null);
//     } catch (IllegalAccessException e) {
//         e.printStackTrace();
//     }
//     return 0;
// }
// 
// Path: nightowllib/src/main/java/com/asha/nightowllib/NightOwlUtil.java
// public static <T> T newInstanceSafely(Class<T> clz){
//     try {
//         return clz.newInstance();
//     } catch (InstantiationException e) {
//         e.printStackTrace();
//     } catch (IllegalAccessException e) {
//         e.printStackTrace();
//     }
//     return null;
// }


import android.util.SparseArray;
import com.asha.nightowllib.NightOwlTable;
import com.asha.nightowllib.handler.annotations.OwlAttr;
import com.asha.nightowllib.handler.annotations.OwlAttrScope;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
import static com.asha.nightowllib.NightOwlUtil.getStaticFieldIntSafely;
import static com.asha.nightowllib.NightOwlUtil.newInstanceSafely;
package com.asha.nightowllib.paint;





/**
 * Created by hzqiujiadi on 15/11/8.
 * hzqiujiadi ashqalcn@gmail.com
 */
public class OwlPaintManager {
    private static final SparseArray<Class< ? extends IOwlPaint>> sPaints = new SparseArray<>();
    private static final Map<Class< ? extends IOwlPaint>,IOwlPaint> sPaintInstances = new HashMap<>();
    static {
        // traverse all subclass.
// Path: nightowllib/src/main/java/com/asha/nightowllib/NightOwlTable.java
// public class NightOwlTable {
//     protected static void init(){
//         registerHandler(ListViewHandler.class);
//         registerHandler(ImageViewHandler.class);
//         registerHandler(TextViewHandler.class);
//         registerHandler(ButtonHandler.class);
//         registerHandler(ViewHandler.class);
//     }
// 
//     @OwlAttrScope(2000) public interface OwlView {
//         @OwlStyleable int[] NightOwl_View = R.styleable.NightOwl_View;
//         @OwlAttr(BackgroundPaint.class) int NightOwl_View_night_background = R.styleable.NightOwl_View_night_background;
//         @OwlAttr(AlphaPaint.class) int NightOwl_View_night_alpha = R.styleable.NightOwl_View_night_alpha;
//     }
// 
//     @OwlAttrScope(2100) public interface OwlTextView extends OwlView {
//         @OwlStyleable int[] NightOwl_TextView = R.styleable.NightOwl_TextView;
//         @OwlAttr(TextColorPaint.class) int NightOwl_TextView_night_textColor = R.styleable.NightOwl_TextView_night_textColor;
//         @OwlAttr(TextColorPaint.class) int NightOwl_TextView_night_textColorHint = R.styleable.NightOwl_TextView_night_textColorHint;
//     }
// 
//     @OwlAttrScope(2200) public interface OwlButton extends OwlTextView {
//     }
// 
//     @OwlAttrScope(2300) public interface OwlImageView extends OwlView {
//         @OwlStyleable int[] NightOwl_ImageView =  R.styleable.NightOwl_ImageView;
//         @OwlAttr(ImageViewSrcPaint.class) int NightOwl_ImageView_night_src = R.styleable.NightOwl_ImageView_night_src;
//     }
// 
//     @OwlAttrScope(2400) public interface OwlListView extends OwlView {
//         @OwlStyleable int[] NightOwl_ListView =  R.styleable.NightOwl_ListView;
//         @OwlAttr(ListViewDividerPaint.class) int NightOwl_ListView_night_divider = R.styleable.NightOwl_ListView_night_divider;
//         @OwlAttr(ListViewSelectorPaint.class) int NightOwl_ListView_night_listSelector = R.styleable.NightOwl_ListView_night_listSelector;
//     }
// }
// 
// Path: nightowllib/src/main/java/com/asha/nightowllib/NightOwlUtil.java
// public static int getStaticFieldIntSafely(Field field){
//     try {
//         return field.getInt(null);
//     } catch (IllegalAccessException e) {
//         e.printStackTrace();
//     }
//     return 0;
// }
// 
// Path: nightowllib/src/main/java/com/asha/nightowllib/NightOwlUtil.java
// public static <T> T newInstanceSafely(Class<T> clz){
//     try {
//         return clz.newInstance();
//     } catch (InstantiationException e) {
//         e.printStackTrace();
//     } catch (IllegalAccessException e) {
//         e.printStackTrace();
//     }
//     return null;
// }


// Path: nightowllib/src/main/java/com/asha/nightowllib/paint/OwlPaintManager.java
import android.util.SparseArray;
import com.asha.nightowllib.NightOwlTable;
import com.asha.nightowllib.handler.annotations.OwlAttr;
import com.asha.nightowllib.handler.annotations.OwlAttrScope;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
import static com.asha.nightowllib.NightOwlUtil.getStaticFieldIntSafely;
import static com.asha.nightowllib.NightOwlUtil.newInstanceSafely;

package com.asha.nightowllib.paint;





/**
 * Created by hzqiujiadi on 15/11/8.
 * hzqiujiadi ashqalcn@gmail.com
 */
public class OwlPaintManager {
    private static final SparseArray<Class< ? extends IOwlPaint>> sPaints = new SparseArray<>();
    private static final Map<Class< ? extends IOwlPaint>,IOwlPaint> sPaintInstances = new HashMap<>();
    static {
        // traverse all subclass.
        Class<?>[] classes = NightOwlTable.class.getDeclaredClasses();