Commit 852d2f43 authored by mengcuiguang's avatar mengcuiguang

bug优化

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