Commit 852d2f43 authored by mengcuiguang's avatar mengcuiguang

bug优化

parent 36ad682f
......@@ -119,8 +119,15 @@ public class ShanhuVedioAdManager implements ShanhuVedioAdManagerView {
taskTypes.add(taskType);
int ret = mCoinManager.GetTasks(coinRequestInfo, taskTypes, coin, coinTaskTypes);
if (ret != ErrorCode.EC_SUCCESS) {
if (shanhuVedioAdListener != null) {
shanhuVedioAdListener.shanhuVedioAdFail();
if (activity != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (shanhuVedioAdListener != null) {
shanhuVedioAdListener.shanhuVedioAdFail();
}
}
});
}
return;
}
......@@ -157,16 +164,31 @@ public class ShanhuVedioAdManager implements ShanhuVedioAdManagerView {
}
} catch (Throwable t) {
t.printStackTrace();
if (shanhuVedioAdListener != null) {
LogUtil.d(TAG, "shanhu Throwable");
shanhuVedioAdListener.shanhuVedioAdFail();
if (activity != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (shanhuVedioAdListener != null) {
LogUtil.d(TAG, "shanhu Throwable");
shanhuVedioAdListener.shanhuVedioAdFail();
}
}
});
}
}
if (!showAdFlag) {
if (shanhuVedioAdListener != null) {
LogUtil.d(TAG, "no Ad show");
shanhuVedioAdListener.shanhuVedioAdFail();
if (activity != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (shanhuVedioAdListener != null) {
LogUtil.d(TAG, "no Ad show");
shanhuVedioAdListener.shanhuVedioAdFail();
}
}
});
}
}
}
......@@ -191,76 +213,77 @@ public class ShanhuVedioAdManager implements ShanhuVedioAdManagerView {
}
private List<AdMetaInfo> gotRewardVedio(int adId, List<Integer> styleId) {
mRewardVedio = new RewardVideo();
List<AdID> list = new ArrayList<>();
list.add(new AdID(adId, 968, 300));
if (activity != null) {
mRewardVedio.load(new RewardVideo.RVListener() {
activity.runOnUiThread(new Runnable() {
@Override
public void loaded() {
activity.runOnUiThread(new Runnable() {
public void run() {
mRewardVedio = new RewardVideo();
List<AdID> list = new ArrayList<>();
list.add(new AdID(adId, 968, 300));
mRewardVedio.load(new RewardVideo.RVListener() {
@Override
public void run() {
public void loaded() {
if (mRewardVedio != null) {
mRewardVedio.showAD();
}
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SHANHU, Constant.EVENT_TYPE_ZERO, "", "");
LogUtil.d(TAG, "gotRewardVedio loaded");
}
});
LogUtil.d(TAG, "gotRewardVedio loaded");
}
@Override
public void onAdError(ADError adError) {
if (adError != null) {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SHANHU, Constant.EVENT_TYPE_ONE, adError.code + "", adError.msg);
}
if (shanhuVedioAdListener != null) {
shanhuVedioAdListener.shanhuVedioAdFail();
}
LogUtil.d(TAG, "gotRewardVedio_onAdError code:" + adError.code + " msg:" + adError.msg);
}
@Override
public void onAdError(ADError adError) {
if (adError != null) {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SHANHU, Constant.EVENT_TYPE_ONE, adError.code + "", adError.msg);
}
if (shanhuVedioAdListener != null) {
shanhuVedioAdListener.shanhuVedioAdFail();
}
LogUtil.d(TAG, "gotRewardVedio_onAdError code:" + adError.code + " msg:" + adError.msg);
}
@Override
public void onVideoComplete() {
LogUtil.d(TAG, "gotRewardVedio onVideoComplete");
}
@Override
public void onVideoComplete() {
LogUtil.d(TAG, "gotRewardVedio onVideoComplete");
}
@Override
public void onVideoPlay() {
LogUtil.d(TAG, "gotRewardVedio onVideoPlay");
}
@Override
public void onVideoPlay() {
LogUtil.d(TAG, "gotRewardVedio onVideoPlay");
}
@Override
public void onClick() {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SHANHU, Constant.EVENT_TYPE_TWO, "", "");
@Override
public void onClick() {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SHANHU, Constant.EVENT_TYPE_TWO, "", "");
if (isClickScreen) {
// 防止重复
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SHANHU, Constant.EVENT_TYPE_FOUR, "", "");
isClickScreen = false;
}
if (isClickScreen) {
// 防止重复
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SHANHU, Constant.EVENT_TYPE_FOUR, "", "");
isClickScreen = false;
}
if (shanhuVedioAdListener != null) {
shanhuVedioAdListener.shanhuVedioAdDownload();
}
LogUtil.d(TAG, "gotRewardVedio onClick");
}
if (shanhuVedioAdListener != null) {
shanhuVedioAdListener.shanhuVedioAdDownload();
}
LogUtil.d(TAG, "gotRewardVedio onClick");
}
@Override
public void onClose() {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SHANHU, Constant.EVENT_TYPE_THREE, "", "");
LogUtil.d(TAG, "gotRewardVedio onClose");
@Override
public void onClose() {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SHANHU, Constant.EVENT_TYPE_THREE, "", "");
LogUtil.d(TAG, "gotRewardVedio onClose");
cmtTask();
cmtTask();
if (shanhuVedioAdListener != null) {
shanhuVedioAdListener.shanhuVedioAdAdSuccess();
}
}
}, activity, new AdID(adId, 968, 300));
if (shanhuVedioAdListener != null) {
shanhuVedioAdListener.shanhuVedioAdAdSuccess();
}
}
}, activity, new AdID(adId, 968, 300));
});
}
return null;
......
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