package com.limpoxe.fairy.core;

import android.app.Application;

import com.limpoxe.fairy.util.LogUtil;

public class FairyGlobal {
    private static boolean sIsInited;
    private static Application sApplication;
    private static boolean sIsLocalHtmlEnable = false;
    private static int sLoadingResId;
    private static long sMinLoadingTime = 400;

    public static Application getApplication() {
        if (!isInited()) {
            throw new IllegalStateException("not inited yet");
        }
        return sApplication;
    }

    /*package*/ static void setApplication(Application application) {
        sApplication = application;
    }

    /*package*/ static void setIsInited(boolean isInited) {
        sIsInited = isInited;
    }

    /*package*/ static boolean isInited() {
        return sIsInited;
    }

    /**
     * 插件中是否支持使用本地html文件
     * @param isLocalHtmlEnable
     */
    public static void setLocalHtmlenable(boolean isLocalHtmlEnable) {
        sIsLocalHtmlEnable = isLocalHtmlEnable;
    }

    public static boolean isLocalHtmlEnable() {
        return sIsLocalHtmlEnable;
    }

    public static void setLogEnable(boolean isLogEnable) {
        LogUtil.setEnable(isLogEnable);
    }

    /**
     * 首次打开插件时，如果是通过Activity打开，会显示一个空白loading页，
     * 通过resId设置loading页ui
     * @param resId
     */
    public static void setLoadingResId(int resId) {
        sLoadingResId = resId;
    }

    public static int getLoadingResId() {
        return sLoadingResId;
    }

    /**
     * 设置loading页最小等待时间，用于在插件较简单，初始化较快时，避免loading页一闪而过
     * 时间设置为0表示无loading页
     * @param minLoadingTime
     */
    public static void setMinLoadingTime(long minLoadingTime) {
        sMinLoadingTime = minLoadingTime;
    }

    public static long getMinLoadingTime() {
        return sMinLoadingTime;
    }

}

@@ -1103,32 +1103,92 @@
 lEnable;%0A    %7D%0A%0A
+    /**%0A     * %E6%8E%A7%E5%88%B6%E6%A1%86%E6%9E%B6%E6%97%A5%E5%BF%97%E6%98%AF%E5%90%A6%E6%89%93%E5%8D%B0%0A     * @param isLogEnable%0A     */%0A
     public stati
@@ -1644,16 +1644,25 @@
 loading%E9%A1%B5
+%EF%BC%8C %E9%BB%98%E8%AE%A4400ms
 %0A     * 

modify comment