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
544333b1
Commit
544333b1
authored
Jan 27, 2021
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复珊瑚自有CPD下载问题
parent
4a5b6586
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
29 deletions
+37
-29
CoralDownload.java
...n/java/com/mints/goodmoney/ad/download/CoralDownload.java
+21
-4
TaskActivity.kt
...ain/java/com/mints/goodmoney/ui/activitys/TaskActivity.kt
+13
-21
MyFragment.kt
...c/main/java/com/mints/goodmoney/ui/fragment/MyFragment.kt
+2
-3
TaskDialog.kt
...rc/main/java/com/mints/goodmoney/ui/widgets/TaskDialog.kt
+1
-1
No files found.
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/download/CoralDownload.java
View file @
544333b1
...
...
@@ -2,10 +2,10 @@ package com.mints.goodmoney.ad.download;
import
androidx.annotation.Nullable
;
import
com.mints.goodmoney.BuildConfig
;
import
com.mints.goodmoney.MintsApplication
;
import
com.mints.goodmoney.common.Constant
;
import
com.mints.goodmoney.manager.UserManager
;
import
com.mints.goodmoney.utils.LogUtil
;
import
com.mints.library.utils.json.JsonUtil
;
import
com.tz.sdk.coral.ad.CoralAD
;
import
com.tz.sdk.coral.callback.CoralADListener
;
...
...
@@ -16,8 +16,10 @@ import com.tz.sdk.core.ad.ADSource;
import
com.tz.sdk.core.ad.ADType
;
import
com.tz.sdk.core.loader.ADLoader
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Random
;
/**
* 珊瑚CPD下载安装试玩
...
...
@@ -99,6 +101,7 @@ public final class CoralDownload {
*/
@Override
public
boolean
download
(
DownloadProcess
downloadProcess
)
{
LogUtil
.
d
(
"download"
);
if
(
mOnAdLoadListener
!=
null
)
{
mOnAdLoadListener
.
onGetDownloadProcess
(
downloadProcess
);
}
...
...
@@ -113,6 +116,7 @@ public final class CoralDownload {
@Override
public
void
onAdFailed
(
ADError
adError
)
{
super
.
onAdFailed
(
adError
);
LogUtil
.
d
(
"onAdFailed"
);
if
(
mOnAdLoadListener
!=
null
)
{
mOnAdLoadListener
.
onLoadFail
();
}
...
...
@@ -127,7 +131,13 @@ public final class CoralDownload {
public
void
onAdLoaded
(
List
<
CoralAD
>
adList
)
{
if
(
adList
!=
null
&&
adList
.
size
()
>
0
)
{
if
(
mOnAdLoadListener
!=
null
)
{
mOnAdLoadListener
.
onLoadSuccess
(
adList
);
try
{
Random
r
=
new
Random
();
int
randomWeight
=
r
.
nextInt
(
adList
.
size
());
mOnAdLoadListener
.
onLoadSuccess
(
Collections
.
singletonList
(
adList
.
get
(
randomWeight
)));
}
catch
(
Exception
e
)
{
mOnAdLoadListener
.
onLoadSuccess
(
Collections
.
singletonList
(
adList
.
get
(
0
)));
}
}
}
else
{
if
(
mOnAdLoadListener
!=
null
)
{
...
...
@@ -146,6 +156,7 @@ public final class CoralDownload {
*/
@Override
public
boolean
onAdShow
(
@Nullable
CoralAD
ad
)
{
LogUtil
.
d
(
"onAdShow"
);
return
false
;
}
...
...
@@ -159,6 +170,7 @@ public final class CoralDownload {
*/
@Override
public
boolean
onAdClicked
(
@Nullable
CoralAD
ad
)
{
LogUtil
.
d
(
"onAdClicked"
);
if
(
mOnAdLoadListener
!=
null
)
{
mOnAdLoadListener
.
onSDKDownloadStart
();
}
...
...
@@ -176,6 +188,7 @@ public final class CoralDownload {
*/
@Override
public
boolean
onAppDownloading
(
@Nullable
CoralAD
ad
,
@Nullable
String
downloadUrl
)
{
LogUtil
.
d
(
"onAppDownloading"
);
if
(
mOnAdLoadListener
!=
null
)
{
mOnAdLoadListener
.
onSDKDownloadStart
();
}
...
...
@@ -194,8 +207,9 @@ public final class CoralDownload {
*/
@Override
public
boolean
onAppDownloaded
(
@Nullable
CoralAD
ad
,
@Nullable
String
downloadUrl
,
@Nullable
String
localFile
)
{
LogUtil
.
d
(
"onAppDownloaded"
);
if
(
mOnAdLoadListener
!=
null
)
{
mOnAdLoadListener
.
onSDKDownloaded
();
mOnAdLoadListener
.
onSDKDownloaded
(
localFile
);
}
return
false
;
}
...
...
@@ -212,6 +226,8 @@ public final class CoralDownload {
*/
@Override
public
boolean
onAppInstalled
(
@Nullable
CoralAD
ad
,
@Nullable
String
downloadUrl
,
@Nullable
String
localFile
)
{
LogUtil
.
d
(
"onAppInstalled"
);
if
(
mOnAdLoadListener
!=
null
)
{
mOnAdLoadListener
.
onSDKInstalled
();
}
...
...
@@ -230,6 +246,7 @@ public final class CoralDownload {
*/
@Override
public
boolean
onAppActivated
(
CoralAD
ad
,
String
downloadUrl
,
String
localFile
)
{
LogUtil
.
d
(
"onAppActivated"
);
return
false
;
}
});
...
...
@@ -253,7 +270,7 @@ public final class CoralDownload {
void
onSDKDownloadStart
();
void
onSDKDownloaded
();
void
onSDKDownloaded
(
String
localFilePath
);
void
onSDKInstalled
();
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/TaskActivity.kt
View file @
544333b1
...
...
@@ -70,6 +70,8 @@ class TaskActivity : BaseActivity(), TaskView,
// 第二次拉取重复不拉取
private
var
isTwiceGetCpd
=
false
private
val
outNetIp
by
lazy
{
SPUtil
.
getInstance
().
getString
(
Constant
.
OUT_NET_IP
)
}
companion
object
{
const
val
TASK_COIN
=
"task_coin"
const
val
TASK_USE_MAX
=
"task_use_max"
...
...
@@ -110,7 +112,7 @@ class TaskActivity : BaseActivity(), TaskView,
}
private
fun
loadCPDData
()
{
taskPresenter
.
getCpdDetail
(
SPUtil
.
getInstance
().
getString
(
Constant
.
OUT_NET_IP
)
)
taskPresenter
.
getCpdDetail
(
outNetIp
)
}
private
fun
initView
()
{
...
...
@@ -163,7 +165,6 @@ class TaskActivity : BaseActivity(), TaskView,
mFakeTaskList
.
clear
()
if
(
shMax
>
0
&&
(
cpdMax
>
0
||
cpdMax
==
0
))
{
for
(
i
in
0
until
shMax
)
{
mCoralDownload
?.
pull
()
...
...
@@ -183,9 +184,6 @@ class TaskActivity : BaseActivity(), TaskView,
mFakeTaskList
.
add
(
tzTaskBean
)
}
LogUtil
.
d
(
TAG_LOG
,
"CPD -> getCpdModelSuc CPD-PKG -> "
+
dataBean
.
materials
[
0
].
app_apk_name
)
LogUtil
.
d
(
TAG_LOG
,
"CPD -> getCpdModelSuc cpdLoadCountTime -> "
+
cpdLoadCountTime
)
// 多拉取的CPD广告
if
(
cpdLoadCountTime
++
>=
cpdMax
-
1
)
{
getCpdRepeatPkg
()
...
...
@@ -198,7 +196,6 @@ class TaskActivity : BaseActivity(), TaskView,
private
fun
getCpdRepeatPkg
()
{
if
(
isTwiceGetCpd
)
{
if
(
cpdLoadCountTime
>=
cpdMax
)
{
LogUtil
.
d
(
"BBBBBB"
)
notifyDataAndShowAd
()
}
return
...
...
@@ -215,7 +212,6 @@ class TaskActivity : BaseActivity(), TaskView,
if
(
mFakeTaskList
[
i
].
isShCpd
)
{
newPkgData
.
add
(
mFakeTaskList
[
i
])
}
else
{
var
flag
=
true
for
(
j
in
0
until
mFakeTaskList
.
size
)
{
...
...
@@ -243,15 +239,9 @@ class TaskActivity : BaseActivity(), TaskView,
}
override
fun
doInUIThread
()
{
LogUtil
.
d
(
"数据源 列表数据"
+
"-->"
+
mFakeTaskList
.
size
)
mFakeTaskList
.
clear
()
mFakeTaskList
.
addAll
(
t
)
LogUtil
.
d
(
"列表数据"
+
"-->"
+
t
.
size
)
LogUtil
.
d
(
"thatCpdLoadCountTime-->$cpdLoadCountTime"
)
// 重新获取数据
if
(
cpdLoadCountTime
in
1
..
cpdMax
)
{
isTwiceGetCpd
=
true
...
...
@@ -276,14 +266,18 @@ class TaskActivity : BaseActivity(), TaskView,
srl_task
.
finishRefresh
()
mTaskAdapter
?.
notifyDataSetChanged
()
if
(
mFakeTaskList
.
size
==
0
)
{
iv_empty
.
visibility
=
View
.
VISIBLE
return
}
else
{
iv_empty
.
visibility
=
View
.
GONE
}
for
(
tzTaskBean
in
mFakeTaskList
)
{
if
(!
tzTaskBean
.
isShCpd
)
{
val
trackerBean
=
tzTaskBean
.
trackerBean
if
(
trackerBean
!=
null
)
{
LogUtil
.
d
(
"AAAAA"
)
LogUtil
.
d
(
TAG_LOG
,
"CPD -> show"
)
// 上报CPD显示
...
...
@@ -342,20 +336,18 @@ class TaskActivity : BaseActivity(), TaskView,
override
fun
onSDKDownloadStart
()
{
taskDialog
?.
dismiss
()
// SDK上报开始下载
mDownloadProcess
?.
reportDownloadStart
(
false
)
registerBroad
()
}
override
fun
onSDKDownloaded
()
{
override
fun
onSDKDownloaded
(
localFilePath
:
String
)
{
// SDK上报下载完成
mDownloadProcess
?.
reportInstallSuccess
(
false
)
// mDownloadProcess?.reportDownloadSuccess(localFilePath,
false)
}
override
fun
onSDKInstalled
()
{
// SDK上报安装完成
mDownloadProcess
?.
reportInstallSuccess
(
false
)
//
mDownloadProcess?.reportInstallSuccess(false)
}
override
fun
onGetDownloadProcess
(
downloadProcess
:
DownloadProcess
?)
{
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/MyFragment.kt
View file @
544333b1
...
...
@@ -12,7 +12,6 @@ import androidx.core.content.ContextCompat
import
androidx.recyclerview.widget.DividerItemDecoration
import
com.component.dly.xzzq_ywsdk.YwSDK_WebActivity.Companion.open
import
com.fly.scenemodule.SceneUtil
import
com.mints.goodmoney.BuildConfig
import
com.mints.goodmoney.R
import
com.mints.goodmoney.ad.banner.BannerManager
import
com.mints.goodmoney.ad.express.TTPreLoadCarrierExpressManager
...
...
@@ -249,8 +248,8 @@ class MyFragment : BaseFragment(),
return
}
if
(
data
?
.
shareNews
!=
null
)
{
AppConfig
.
wzReadCoin
=
data
!!
.
shareNews
.
readCoin
if
(
data
.
shareNews
!=
null
)
{
AppConfig
.
wzReadCoin
=
data
.
shareNews
.
readCoin
}
// 更新权重
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/widgets/TaskDialog.kt
View file @
544333b1
...
...
@@ -66,7 +66,7 @@ class TaskDialog(context: Context) : Dialog(context, R.style.dialog) {
override
fun
dismiss
()
{
super
.
dismiss
()
adContainer
?.
removeAllViews
()
//
adContainer?.removeAllViews()
adContainer
=
null
}
}
\ No newline at end of file
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