Commit 852d2f43 authored by mengcuiguang's avatar mengcuiguang

bug优化

parent 36ad682f
...@@ -119,9 +119,16 @@ public class ShanhuVedioAdManager implements ShanhuVedioAdManagerView { ...@@ -119,9 +119,16 @@ 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 (activity != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (shanhuVedioAdListener != null) { if (shanhuVedioAdListener != null) {
shanhuVedioAdListener.shanhuVedioAdFail(); shanhuVedioAdListener.shanhuVedioAdFail();
} }
}
});
}
return; return;
} }
...@@ -157,18 +164,33 @@ public class ShanhuVedioAdManager implements ShanhuVedioAdManagerView { ...@@ -157,18 +164,33 @@ public class ShanhuVedioAdManager implements ShanhuVedioAdManagerView {
} }
} catch (Throwable t) { } catch (Throwable t) {
t.printStackTrace(); t.printStackTrace();
if (activity != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (shanhuVedioAdListener != null) { if (shanhuVedioAdListener != null) {
LogUtil.d(TAG, "shanhu Throwable"); LogUtil.d(TAG, "shanhu Throwable");
shanhuVedioAdListener.shanhuVedioAdFail(); shanhuVedioAdListener.shanhuVedioAdFail();
} }
} }
});
}
}
if (!showAdFlag) { if (!showAdFlag) {
if (activity != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (shanhuVedioAdListener != null) { if (shanhuVedioAdListener != null) {
LogUtil.d(TAG, "no Ad show"); LogUtil.d(TAG, "no Ad show");
shanhuVedioAdListener.shanhuVedioAdFail(); shanhuVedioAdListener.shanhuVedioAdFail();
} }
} }
});
}
}
} }
}.start(); }.start();
} }
...@@ -191,24 +213,22 @@ public class ShanhuVedioAdManager implements ShanhuVedioAdManagerView { ...@@ -191,24 +213,22 @@ public class ShanhuVedioAdManager implements ShanhuVedioAdManagerView {
} }
private List<AdMetaInfo> gotRewardVedio(int adId, List<Integer> styleId) { private List<AdMetaInfo> gotRewardVedio(int adId, List<Integer> styleId) {
if (activity != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
mRewardVedio = new RewardVideo(); mRewardVedio = new RewardVideo();
List<AdID> list = new ArrayList<>(); List<AdID> list = new ArrayList<>();
list.add(new AdID(adId, 968, 300)); list.add(new AdID(adId, 968, 300));
if (activity != null) {
mRewardVedio.load(new RewardVideo.RVListener() { mRewardVedio.load(new RewardVideo.RVListener() {
@Override @Override
public void loaded() { public void loaded() {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
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");
} }
...@@ -261,6 +281,9 @@ public class ShanhuVedioAdManager implements ShanhuVedioAdManagerView { ...@@ -261,6 +281,9 @@ public class ShanhuVedioAdManager implements ShanhuVedioAdManagerView {
} }
} }
}, activity, new AdID(adId, 968, 300)); }, 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