AdFactory.java
1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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;
}
}