Commit 7e38fad0 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent 93c590d6
......@@ -19,6 +19,7 @@ import com.chineseall.reader17ksdk.ChineseAllReaderApplication;
import com.chineseall.reader17ksdk.aop.AspectTest;
import com.chineseall.reader17ksdk.utils.LogUtils;
import com.chineseall.reader17ksdk.utils.book.ScreenUtils;
import com.mints.goodmoney.utils.ToastUtil;
import com.mints.library.utils.json.JsonUtil;
import java.util.List;
......@@ -55,7 +56,7 @@ public class ReadToutiaoAD {
private void initFeedAD(OnAdViewReceiver receiver, int width, int height, OnClickListener clickListener) {
//设置广告参数
AdSlot adSlot = new AdSlot.Builder()
.setCodeId(TtCsjAdManager.TT_AD_NATIVEEXPRESS_READ) //广告位id
.setCodeId(TtCsjAdManager.TT_AD_NATIVEEXPRESS_AWARD) //广告位id
.setSupportDeepLink(true)
.setAdCount(1) //请求广告数量为1到3条
.setExpressViewAcceptedSize(width, height) //必填:期望个性化模板广告view的size,单位dp
......@@ -185,6 +186,7 @@ public class ReadToutiaoAD {
LogUtils.i("ToutiaoAd", message);
// adParamers.listener.onAdFailed("error");
receiver.onReceive(false, null);
ToastUtil.show(context,"视频加载失败,请退出重试");
}
......@@ -242,8 +244,9 @@ public class ReadToutiaoAD {
public void onVideoError() {
LogUtils.i("ToutiaoAd", "rewardVideoAd onVideoError");
// if (com.burst.ad_toutiao_lib.BuildConfig.DEBUG){
Toast.makeText(context, "视频播放错误", Toast.LENGTH_SHORT).show();
// Toast.makeText(context, "视频播放错误", Toast.LENGTH_SHORT).show();
// }
// ToastUtil.show(context,"视频加载失败,请退出重试");
}
@Override
......
......@@ -8,6 +8,7 @@ import com.chineseall.reader.lib.reader.callbacks.OnAdViewReceiver;
import com.mints.goodmoney.common.AppConfig;
import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.utils.LogUtil;
import com.mints.goodmoney.utils.ToastUtil;
import com.qq.e.ads.rewardvideo.RewardVideoAD;
import com.qq.e.ads.rewardvideo.RewardVideoADListener;
import com.qq.e.comm.util.AdError;
......@@ -89,7 +90,8 @@ public class ReadYlhAd {
@Override
public void onError(AdError adError) {//广告流程出错,AdError中包含错误码和错误描述
receiver.onReceive(false, null);
Toast.makeText(context, "视频播放错误", Toast.LENGTH_SHORT).show();
ToastUtil.show(context,"视频加载失败,请退出重试");
// Toast.makeText(context, "视频播放错误", Toast.LENGTH_SHORT).show();
if (adError != null) {
LogUtil.d("YlhVideoAdManager", "onError " + adError.getErrorCode() + adError.getErrorMsg());
......@@ -113,9 +115,11 @@ public class ReadYlhAd {
rewardVideoAD.showAD();
} else {
// showToast("广告已过期,请再次请求广告后进行广告展示!");
ToastUtil.show(context,"视频加载失败,请退出重试");
}
} else {
// showToast("此条广告已经展示过,请再次请求广告后进行广告展示!");
ToastUtil.show(context,"视频加载失败,请退出重试");
}
} catch (Exception e) {
e.printStackTrace();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment