// Path: nightowllib/src/main/java/com/asha/nightowllib/handler/ISkinHandler.java
// public interface ISkinHandler {
//     void collect(int mode, View view, Context context, AttributeSet attrs);
//     void onSkinChanged(int skin, View view);
// }
// 
// Path: nightowllib/src/main/java/com/asha/nightowllib/observer/OwlViewContext.java
// public class OwlViewContext {
//     private int mLastMode = -1;
//     private SparseArray<IOwlObserverWithId> observers;
//     public OwlViewContext() {
//         observers = new SparseArray<>();
//     }
// 
//     public void registerObserver( IOwlObserverWithId owlObserver ){
//         observers.put(owlObserver.getObserverId(), owlObserver);
//     }
// 
//     public void unregisterObserver( IOwlObserverWithId owlObserver ){
//         observers.delete(owlObserver.getObserverId());
//     }
// 
//     public void notifyObserver(int mode, Activity activity){
//         if ( mode == mLastMode ) return;
//         mLastMode = mode;
//         int size = observers.size();
//         for (int i = 0; i < size; i++) {
//             IOwlObserverWithId owlObserver = observers.valueAt(i);
//             owlObserver.onSkinChange(mode, activity);
//         }
//     }
// 
//     public void setupWithCurrentActivity(Activity activity){
//         Resources.Theme theme = activity.getTheme();
//         TypedArray a = theme.obtainStyledAttributes(R.styleable.NightOwl_Theme);
//         if (a != null) {
//             if ( !checkBeforeLollipop() ){
//                 if ( a.hasValue(R.styleable.NightOwl_Theme_night_navigationBarColor) )
//                     registerObserver(new NavBarObserver(activity, a, R.styleable.NightOwl_Theme_night_navigationBarColor));
//                 if ( a.hasValue(R.styleable.NightOwl_Theme_night_statusBarColor) )
//                     registerObserver(new StatusBarObserver(activity, a, R.styleable.NightOwl_Theme_night_statusBarColor));
//             }
// 
//             if ( a.hasValue(R.styleable.NightOwl_Theme_night_additionThemeDay)
//                     && a.hasValue(R.styleable.NightOwl_Theme_night_additionThemeNight) ){
//                 int themeDay = a.getResourceId(R.styleable.NightOwl_Theme_night_additionThemeDay,0 );
//                 int themeNight = a.getResourceId(R.styleable.NightOwl_Theme_night_additionThemeNight,0 );
//                 registerObserver(new AdditionThemeObserver(themeDay,themeNight));
//             }
//             a.recycle();
//         }
//     }
// 
//     public boolean needSync( int target ){
//         return mLastMode != target;
//     }
// }
// 
// Path: nightowllib/src/main/java/com/asha/nightowllib/paint/ColorBox.java
// public class ColorBox {
//     private int mMode = -1;
//     // may override the value, so we use SparseArray
//     private SparseArray<Object[]> mBox;
//     private ColorBox() {
//         mBox = new SparseArray<>(4);
//     }
// 
//     public void put(int attr, int scope, Object... objects){
//         mBox.put(attr + scope, objects);
//     }
// 
//     public void refreshSkin(int mode, View view, boolean force){
//         if ( force ) mMode = -1;
//         refreshSkin(mode,view);
//     }
// 
//     public Object[] get(int attr, int scope){
//         return mBox.get( attr + scope );
//     }
// 
//     public void refreshSkin(int mode, View view){
//         if ( mMode != mode ){
//             int size = mBox.size();
//             for (int i = 0; i < size; i++) {
//                 int attrWithScope = mBox.keyAt(i);
//                 Object[] res = mBox.valueAt(i);
//                 IOwlPaint paint = queryPaint(attrWithScope);
//                 if ( paint != null ) paint.draw(view, res[mode]);
//             }
//         }
//         mMode = mode;
//     }
// 
//     public int getMode() {
//         return mMode;
//     }
// 
//     public static ColorBox newInstance() {
//         return new ColorBox();
//     }
// 
// }


import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import com.asha.nightowllib.handler.ISkinHandler;
import com.asha.nightowllib.observer.OwlViewContext;
import com.asha.nightowllib.paint.ColorBox;
import java.lang.reflect.Field;
        return view.getTag( NIGHT_OWL_VIEW_TAG ) != null;
    }

    public static boolean checkBeforeLollipop(){
        if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) return true;
        else return false;
    }

    public static void insertSkinBox(View view, ColorBox box){
        view.setTag(NIGHT_OWL_VIEW_TAG, box);
    }

    public static void insertEmptyTag(View view){
        view.setTag(NIGHT_OWL_VIEW_TAG, EMPTY_TAG);
    }

    public static ColorBox obtainSkinBox(View view){
        Object box = view.getTag(NIGHT_OWL_VIEW_TAG);
        checkNonNull(box,"wtf, it can't be null.");
        if ( box instanceof ColorBox ){
            return (ColorBox) box;
        } else if ( box.equals(EMPTY_TAG) ) {
            Log.d(TAG, "EMPTY_TAG...");
            return null;
        } else {
            Log.e(TAG, "wtf, NIGHT_OWL_VIEW_TAG had been used by someone else.");
        }
        return null;
    }

// Path: nightowllib/src/main/java/com/asha/nightowllib/handler/ISkinHandler.java
// public interface ISkinHandler {
//     void collect(int mode, View view, Context context, AttributeSet attrs);
//     void onSkinChanged(int skin, View view);
// }
// 
// Path: nightowllib/src/main/java/com/asha/nightowllib/observer/OwlViewContext.java
// public class OwlViewContext {
//     private int mLastMode = -1;
//     private SparseArray<IOwlObserverWithId> observers;
//     public OwlViewContext() {
//         observers = new SparseArray<>();
//     }
// 
//     public void registerObserver( IOwlObserverWithId owlObserver ){
//         observers.put(owlObserver.getObserverId(), owlObserver);
//     }
// 
//     public void unregisterObserver( IOwlObserverWithId owlObserver ){
//         observers.delete(owlObserver.getObserverId());
//     }
// 
//     public void notifyObserver(int mode, Activity activity){
//         if ( mode == mLastMode ) return;
//         mLastMode = mode;
//         int size = observers.size();
//         for (int i = 0; i < size; i++) {
//             IOwlObserverWithId owlObserver = observers.valueAt(i);
//             owlObserver.onSkinChange(mode, activity);
//         }
//     }
// 
//     public void setupWithCurrentActivity(Activity activity){
//         Resources.Theme theme = activity.getTheme();
//         TypedArray a = theme.obtainStyledAttributes(R.styleable.NightOwl_Theme);
//         if (a != null) {
//             if ( !checkBeforeLollipop() ){
//                 if ( a.hasValue(R.styleable.NightOwl_Theme_night_navigationBarColor) )
//                     registerObserver(new NavBarObserver(activity, a, R.styleable.NightOwl_Theme_night_navigationBarColor));
//                 if ( a.hasValue(R.styleable.NightOwl_Theme_night_statusBarColor) )
//                     registerObserver(new StatusBarObserver(activity, a, R.styleable.NightOwl_Theme_night_statusBarColor));
//             }
// 
//             if ( a.hasValue(R.styleable.NightOwl_Theme_night_additionThemeDay)
//                     && a.hasValue(R.styleable.NightOwl_Theme_night_additionThemeNight) ){
//                 int themeDay = a.getResourceId(R.styleable.NightOwl_Theme_night_additionThemeDay,0 );
//                 int themeNight = a.getResourceId(R.styleable.NightOwl_Theme_night_additionThemeNight,0 );
//                 registerObserver(new AdditionThemeObserver(themeDay,themeNight));
//             }
//             a.recycle();
//         }
//     }
// 
//     public boolean needSync( int target ){
//         return mLastMode != target;
//     }
// }
// 
// Path: nightowllib/src/main/java/com/asha/nightowllib/paint/ColorBox.java
// public class ColorBox {
//     private int mMode = -1;
//     // may override the value, so we use SparseArray
//     private SparseArray<Object[]> mBox;
//     private ColorBox() {
//         mBox = new SparseArray<>(4);
//     }
// 
//     public void put(int attr, int scope, Object... objects){
//         mBox.put(attr + scope, objects);
//     }
// 
//     public void refreshSkin(int mode, View view, boolean force){
//         if ( force ) mMode = -1;
//         refreshSkin(mode,view);
//     }
// 
//     public Object[] get(int attr, int scope){
//         return mBox.get( attr + scope );
//     }
// 
//     public void refreshSkin(int mode, View view){
//         if ( mMode != mode ){
//             int size = mBox.size();
//             for (int i = 0; i < size; i++) {
//                 int attrWithScope = mBox.keyAt(i);
//                 Object[] res = mBox.valueAt(i);
//                 IOwlPaint paint = queryPaint(attrWithScope);
//                 if ( paint != null ) paint.draw(view, res[mode]);
//             }
//         }
//         mMode = mode;
//     }
// 
//     public int getMode() {
//         return mMode;
//     }
// 
//     public static ColorBox newInstance() {
//         return new ColorBox();
//     }
// 
// }


// Path: nightowllib/src/main/java/com/asha/nightowllib/NightOwlUtil.java
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import com.asha.nightowllib.handler.ISkinHandler;
import com.asha.nightowllib.observer.OwlViewContext;
import com.asha.nightowllib.paint.ColorBox;
import java.lang.reflect.Field;

        return view.getTag( NIGHT_OWL_VIEW_TAG ) != null;
    }

    public static boolean checkBeforeLollipop(){
        if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) return true;
        else return false;
    }

    public static void insertSkinBox(View view, ColorBox box){
        view.setTag(NIGHT_OWL_VIEW_TAG, box);
    }

    public static void insertEmptyTag(View view){
        view.setTag(NIGHT_OWL_VIEW_TAG, EMPTY_TAG);
    }

    public static ColorBox obtainSkinBox(View view){
        Object box = view.getTag(NIGHT_OWL_VIEW_TAG);
        checkNonNull(box,"wtf, it can't be null.");
        if ( box instanceof ColorBox ){
            return (ColorBox) box;
        } else if ( box.equals(EMPTY_TAG) ) {
            Log.d(TAG, "EMPTY_TAG...");
            return null;
        } else {
            Log.e(TAG, "wtf, NIGHT_OWL_VIEW_TAG had been used by someone else.");
        }
        return null;
    }

    public static void insertViewContext(View view, OwlViewContext viewContext){