AdFactory.java 1.39 KB
package com.manager;

import com.ad.lib.RequestInfo;
import com.controller.NotifyType;
import com.manager.scenes.EvRequestInfo;
import com.manager.scenes.PhoneOverRequestInfo;
import com.manager.scenes.ScreenOnRequestInfo;
import com.manager.scenes.UnPlugRequestInfo;
import com.manager.scenes.UnlockRequestInfo;
import com.manager.scenes.WifiRequestInfo;

public class AdFactory {

    public static RequestInfo getRequestInfo(int type){
        if(type == NotifyType.WIFI_CONNECTED_NOTIFY){
            return new WifiRequestInfo();
        } else if(type == NotifyType.PHONE_OVER_NOTIRY){
            return new PhoneOverRequestInfo();
        } else if(type == NotifyType.BATTERY_UNPLUG_NOTIFY){
            return new UnPlugRequestInfo();
        } else if(type == NotifyType.POP_NOTIFY_EVERYWHERE){
            return new EvRequestInfo();
        } else if(type == NotifyType.UNLOCK_NOTIRY){
            return new UnlockRequestInfo();
        } else if(type == NotifyType.SCREEN_ON_NOTIRY){
            int adType = 0;
            return new ScreenOnRequestInfo(adType);
        }
        return new PhoneOverRequestInfo();
    }


    private static boolean isLessOneDay(long lastTime){
        if(lastTime == 0){
            return true;
        }
        float s = (System.currentTimeMillis() - lastTime) / (1000 * 60)/60/24;
        if(s >1){
            return false;
        }
        return true;
    }
}