IADController.java 1.89 KB
package com.controller;

import android.content.SharedPreferences;
import android.text.TextUtils;

import com.sdk.Sdk;
import com.sdk.SharedPref;
import com.sdk.utils.TimeUtils;

import org.json.JSONException;
import org.json.JSONObject;

public class IADController {


    private static IADController controller = new IADController();
    private SharedPreferences mSharedPref;
    public static IADController getInstance(){
        if(controller == null){
            controller = new IADController();
        }
        return controller;
    }

    private IADController(){
        mSharedPref = Sdk.app().getSharedPreferences("a_d_c",0);
    }

    public boolean isShowOuter(){
        return false;
    }

    public boolean isShowInner(){
        return true;
    }


    private IADConfig getIAD(String input){
        IADConfig config = new IADConfig();
        try {
            JSONObject object = new JSONObject(input);
            if(object.has("open")){
                config.setOpen(object.getBoolean("open"));
            }
            if(object.has("type")){
                config.setType(object.getInt("type"));
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return config;
    }

    public IADConfig getAdConfig(int type){
        if(type == NotifyType.UNLOCK_NOTIRY){
            return new IADConfig(true,0);
        } else if(type == NotifyType.POP_NOTIFY_EVERYWHERE){
            return new IADConfig(true,0);
        } else if(type == NotifyType.BATTERY_UNPLUG_NOTIFY){
            return new IADConfig(true,0);
        } else if(type == NotifyType.WIFI_CONNECTED_NOTIFY){
            return new IADConfig(true,0);
        } else if(type == NotifyType.PHONE_OVER_NOTIRY){
            return new IADConfig(true,0);
        } else if(type == NotifyType.SCREEN_ON_NOTIRY){
            return new IADConfig(true,0);
        }
        return null;
    }

}