package com.app.baselibrary.base.app;

import android.app.Application;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;

import com.app.baselibrary.commonUtil.PreferencesUtils;
import com.facebook.drawee.backends.pipeline.Fresco;

/**
 * 在此写用途
 * author: pl
 * date: 2017-03-10 10:05
 */

public class BaseApplication extends Application {

    private static BaseApplication mBaseApplication;

    private static Handler UIHANDLER;

    @Override
    public void onCreate() {
        super.onCreate();
        mBaseApplication = this;
        Fresco.initialize(this);
        PreferencesUtils.putLong( "device_on_time", System.currentTimeMillis() / 1000);
    }

    public static Context getAppContext() {
        return mBaseApplication;
    }

    public static Handler getUiHandler() {
        if (UIHANDLER == null) {
            UIHANDLER = new Handler(Looper.getMainLooper());
        }

        return UIHANDLER;
    }

}
