From 2c5b6e472c368e80d85b8ea2b461c9ea62981d9b Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期日, 08 十月 2023 11:28:56 +0800 Subject: [PATCH] 广告升级/bug修复 --- BuWanVideo/src/com/weikou/beibeivideo/util/ad/AdUtil.java | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 43 insertions(+), 0 deletions(-) diff --git a/BuWanVideo/src/com/weikou/beibeivideo/util/ad/AdUtil.java b/BuWanVideo/src/com/weikou/beibeivideo/util/ad/AdUtil.java index 077fdd0..25f2326 100644 --- a/BuWanVideo/src/com/weikou/beibeivideo/util/ad/AdUtil.java +++ b/BuWanVideo/src/com/weikou/beibeivideo/util/ad/AdUtil.java @@ -2,10 +2,13 @@ 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; @@ -120,6 +123,16 @@ 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); @@ -148,4 +161,34 @@ } + /** + * 绌垮北鐢插箍鍛婃槸鍚﹂渶瑕佸垵濮嬪寲 + * + * @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(); + } + + } -- Gitblit v1.8.0