| | |
| | | |
| | | import android.content.Context; |
| | | import android.content.SharedPreferences; |
| | | import android.os.Build; |
| | | |
| | | import com.weikou.beibeivideo.entity.ad.AdPositionEnum; |
| | | import com.weikou.beibeivideo.entity.ad.AdTypeVO; |
| | | import com.weikou.beibeivideo.util.BeibeiConstant; |
| | | import com.weikou.beibeivideo.util.TimeUtil; |
| | | import com.weikou.beibeivideo.util.TimeUtils; |
| | | import com.weikou.beibeivideo.util.downutil.StringUtils; |
| | | |
| | | import org.json.JSONException; |
| | |
| | | return true; |
| | | } |
| | | |
| | | public static int getPPTVNoAdRewardLeftTimeWithMinute(Context context) { |
| | | SharedPreferences share = context.getSharedPreferences("adConfig", Context.MODE_PRIVATE); |
| | | long expireTime = share.getLong("pptvNoAdReward", 0); |
| | | if (System.currentTimeMillis() > expireTime) { |
| | | return 0; |
| | | } else { |
| | | return (int) ((expireTime - System.currentTimeMillis()) / (1000 * 60)); |
| | | } |
| | | } |
| | | |
| | | public static void setPPTVNoAdRewardSuccess(Context context) { |
| | | int hour = getPPTVNoAdRewardHour(context); |
| | | SharedPreferences share = context.getSharedPreferences("adConfig", Context.MODE_PRIVATE); |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 穿山甲广告是否需要初始化 |
| | | * |
| | | * @return |
| | | */ |
| | | public static boolean isCanInitCSJ() { |
| | | return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP; |
| | | // return true; |
| | | } |
| | | |
| | | |
| | | // 是否可以显示华为的广告 |
| | | public static boolean canShowAdHuaWei(Context context, AdPositionEnum position){ |
| | | SharedPreferences share = context.getSharedPreferences("adConfig", Context.MODE_PRIVATE); |
| | | Long lastTime = share.getLong("huawei_show_time_"+position.name(),0); |
| | | if( TimeUtils.millisToStringDate(System.currentTimeMillis(),"yyyyMMdd").equalsIgnoreCase( TimeUtils.millisToStringDate(lastTime,"yyyyMMdd"))) { |
| | | //同一天 |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | public static void showAdHuaWei(Context context, AdPositionEnum position){ |
| | | SharedPreferences share = context.getSharedPreferences("adConfig", Context.MODE_PRIVATE); |
| | | SharedPreferences.Editor editor = share.edit(); |
| | | editor.putLong("huawei_show_time_"+position.name(), System.currentTimeMillis()); |
| | | editor.commit(); |
| | | } |
| | | |
| | | |
| | | } |