Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_goodmoney
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
android
android_goodmoney
Commits
7e38fad0
Commit
7e38fad0
authored
Apr 13, 2021
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
93c590d6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
ReadToutiaoAD.java
.../main/java/com/mints/goodmoney/manager/ReadToutiaoAD.java
+5
-2
ReadYlhAd.java
.../src/main/java/com/mints/goodmoney/manager/ReadYlhAd.java
+5
-1
No files found.
GoodMoney/app/src/main/java/com/mints/goodmoney/manager/ReadToutiaoAD.java
View file @
7e38fad0
...
...
@@ -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_
REA
D
)
//广告位id
.
setCodeId
(
TtCsjAdManager
.
TT_AD_NATIVEEXPRESS_
AWAR
D
)
//广告位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
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/manager/ReadYlhAd.java
View file @
7e38fad0
...
...
@@ -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
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment