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
39cd7e51
Commit
39cd7e51
authored
Jan 30, 2021
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
1ea088ee
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
30 deletions
+66
-30
TzTaskBean.java
...c/main/java/com/mints/goodmoney/mvp/model/TzTaskBean.java
+9
-0
TaskCpdActivity.kt
.../java/com/mints/goodmoney/ui/activitys/TaskCpdActivity.kt
+2
-0
TaskCpdFragment.kt
...n/java/com/mints/goodmoney/ui/fragment/TaskCpdFragment.kt
+20
-25
TaskCpdHistoryFragment.kt
...com/mints/goodmoney/ui/fragment/TaskCpdHistoryFragment.kt
+34
-4
TaskCpdDialog.kt
...main/java/com/mints/goodmoney/ui/widgets/TaskCpdDialog.kt
+1
-1
No files found.
GoodMoney/app/src/main/java/com/mints/goodmoney/mvp/model/TzTaskBean.java
View file @
39cd7e51
...
@@ -37,6 +37,15 @@ public class TzTaskBean {
...
@@ -37,6 +37,15 @@ public class TzTaskBean {
this
.
downLoadPkgName
=
downLoadPkgName
;
this
.
downLoadPkgName
=
downLoadPkgName
;
}
}
public
TzTaskBean
(
String
icon
,
String
title
,
int
coin
,
int
state
,
String
currentPkgName
,
String
aid
)
{
this
.
icon
=
icon
;
this
.
title
=
title
;
this
.
coin
=
coin
;
this
.
state
=
state
;
this
.
currentPkgName
=
currentPkgName
;
this
.
aid
=
aid
;
}
public
String
getDownLoadPkgName
()
{
public
String
getDownLoadPkgName
()
{
return
downLoadPkgName
;
return
downLoadPkgName
;
}
}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/TaskCpdActivity.kt
View file @
39cd7e51
...
@@ -59,6 +59,8 @@ class TaskCpdActivity : BaseActivity(), View.OnClickListener {
...
@@ -59,6 +59,8 @@ class TaskCpdActivity : BaseActivity(), View.OnClickListener {
tabs
.
add
(
"试玩"
)
tabs
.
add
(
"试玩"
)
fragments
.
add
(
TaskCpdFragment
())
fragments
.
add
(
TaskCpdFragment
())
AppConfig
.
useAppCpdModelShow
=
true
if
(
AppConfig
.
useAppCpdModelShow
)
{
if
(
AppConfig
.
useAppCpdModelShow
)
{
tabs
.
add
(
"点击"
)
tabs
.
add
(
"点击"
)
fragments
.
add
(
TaskCpdHistoryFragment
())
fragments
.
add
(
TaskCpdHistoryFragment
())
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/TaskCpdFragment.kt
View file @
39cd7e51
...
@@ -35,14 +35,14 @@ import com.tz.sdk.coral.ad.CoralAD
...
@@ -35,14 +35,14 @@ import com.tz.sdk.coral.ad.CoralAD
import
com.tz.sdk.coral.callback.h5.DownloadProcess
import
com.tz.sdk.coral.callback.h5.DownloadProcess
import
kotlinx.android.synthetic.main.activity_task.*
import
kotlinx.android.synthetic.main.activity_task.*
private
val
TAG
=
TaskCpdFragment
::
class
.
java
.
simpleName
class
TaskCpdFragment
:
BaseFragment
(),
TaskView
,
class
TaskCpdFragment
:
BaseFragment
(),
TaskView
,
OnRefreshListener
,
OnRefreshListener
,
CoralDownload
.
OnAdLoadListener
,
CoralDownload
.
OnAdLoadListener
,
OnItemChildClickListener
,
OnItemChildClickListener
,
DownloadApkManager
.
OnMyDownloadListener
{
DownloadApkManager
.
OnMyDownloadListener
{
private
val
TAG
=
TaskCpdFragment
::
class
.
java
.
simpleName
private
val
taskPresenter
by
lazy
{
TaskPresenter
()
}
private
val
taskPresenter
by
lazy
{
TaskPresenter
()
}
private
var
mTaskAdapter
:
TaskAdapter
?
=
null
private
var
mTaskAdapter
:
TaskAdapter
?
=
null
...
@@ -168,7 +168,7 @@ class TaskCpdFragment : BaseFragment(), TaskView,
...
@@ -168,7 +168,7 @@ class TaskCpdFragment : BaseFragment(), TaskView,
LogUtil
.
d
(
TAG
,
"syd getCpdModelSuc"
)
LogUtil
.
d
(
TAG
,
"syd getCpdModelSuc"
)
for
(
material
in
dataBean
.
materials
)
{
for
(
material
in
dataBean
.
materials
)
{
val
tzTaskBean
=
TzTaskBean
(
material
.
icons
,
material
.
title
,
material
.
description
,
false
,
mCoin
,
0
,
material
.
app_apk_name
)
val
tzTaskBean
=
TzTaskBean
(
material
.
icons
,
material
.
description
,
material
.
title
,
false
,
mCoin
,
0
,
material
.
app_apk_name
)
tzTaskBean
.
app_url
=
material
.
app_url
tzTaskBean
.
app_url
=
material
.
app_url
tzTaskBean
.
trackerBean
=
material
.
tracker
tzTaskBean
.
trackerBean
=
material
.
tracker
mFakeTaskList
.
add
(
tzTaskBean
)
mFakeTaskList
.
add
(
tzTaskBean
)
...
@@ -176,8 +176,7 @@ class TaskCpdFragment : BaseFragment(), TaskView,
...
@@ -176,8 +176,7 @@ class TaskCpdFragment : BaseFragment(), TaskView,
// 圣于地广告 循环完成后去重
// 圣于地广告 循环完成后去重
if
(
cpdLoadCountTime
++
>=
cpdMax
-
1
)
{
if
(
cpdLoadCountTime
++
>=
cpdMax
-
1
)
{
notifyDataAndShowAd
()
getCpdRepeatPkg
()
// getCpdRepeatPkg()
}
}
}
}
...
@@ -220,7 +219,7 @@ class TaskCpdFragment : BaseFragment(), TaskView,
...
@@ -220,7 +219,7 @@ class TaskCpdFragment : BaseFragment(), TaskView,
if
(!
mFakeTaskList
[
i
].
isShCpd
&&
!
mFakeTaskList
[
j
].
isShCpd
)
{
if
(!
mFakeTaskList
[
i
].
isShCpd
&&
!
mFakeTaskList
[
j
].
isShCpd
)
{
// 数据重复
// 数据重复
if
(
i
!=
j
&&
mFakeTaskList
[
i
].
currentPkgName
==
mFakeTaskList
[
j
].
current
PkgName
)
{
if
(
i
!=
j
&&
mFakeTaskList
[
i
].
downLoadPkgName
==
mFakeTaskList
[
j
].
downLoad
PkgName
)
{
flag
=
false
flag
=
false
break
break
}
}
...
@@ -229,7 +228,7 @@ class TaskCpdFragment : BaseFragment(), TaskView,
...
@@ -229,7 +228,7 @@ class TaskCpdFragment : BaseFragment(), TaskView,
if
(
flag
)
{
if
(
flag
)
{
// 添加未安装app
// 添加未安装app
if
(!
DeviceInfo
.
instance
.
isLoadingPkg
(
mFakeTaskList
[
i
].
current
PkgName
))
{
if
(!
DeviceInfo
.
instance
.
isLoadingPkg
(
mFakeTaskList
[
i
].
downLoad
PkgName
))
{
cpdLoadCountTime
--
cpdLoadCountTime
--
newPkgData
.
add
(
mFakeTaskList
[
i
])
newPkgData
.
add
(
mFakeTaskList
[
i
])
}
}
...
@@ -244,17 +243,19 @@ class TaskCpdFragment : BaseFragment(), TaskView,
...
@@ -244,17 +243,19 @@ class TaskCpdFragment : BaseFragment(), TaskView,
mFakeTaskList
.
clear
()
mFakeTaskList
.
clear
()
mFakeTaskList
.
addAll
(
t
)
mFakeTaskList
.
addAll
(
t
)
// 重新获取数据
notifyDataAndShowAd
()
if
(
cpdLoadCountTime
in
1
..
cpdMax
)
{
isTwiceGetCpd
=
true
for
(
i
in
0
until
cpdLoadCountTime
)
{
// 重新获取数据
loadCPDData
()
// if (cpdLoadCountTime in 1..cpdMax) {
}
// isTwiceGetCpd = true
cpdLoadCountTime
=
cpdMax
-
cpdLoadCountTime
//
}
else
{
// for (i in 0 until cpdLoadCountTime) {
notifyDataAndShowAd
()
// loadCPDData()
}
// }
// cpdLoadCountTime = cpdMax - cpdLoadCountTime
// } else {
// notifyDataAndShowAd()
// }
}
}
})
})
...
@@ -492,7 +493,7 @@ class TaskCpdFragment : BaseFragment(), TaskView,
...
@@ -492,7 +493,7 @@ class TaskCpdFragment : BaseFragment(), TaskView,
if
(
mFakeTaskList
[
position
].
isShCpd
)
{
if
(
mFakeTaskList
[
position
].
isShCpd
)
{
// 上报后台珊瑚安装完成
// 上报后台珊瑚安装完成
TrackManager
.
getInstance
().
saveInstallAppRecord
(
pkg
,
mFakeTaskList
[
position
].
title
,
mFakeTaskList
[
position
].
icon
)
TrackManager
.
getInstance
().
saveInstallAppRecord
(
pkg
,
mFakeTaskList
[
position
].
description
,
mFakeTaskList
[
position
].
icon
)
// 上报珊瑚安装完成
// 上报珊瑚安装完成
mDownloadProcess
?.
reportInstallSuccess
(
false
)
mDownloadProcess
?.
reportInstallSuccess
(
false
)
...
@@ -542,14 +543,8 @@ class TaskCpdFragment : BaseFragment(), TaskView,
...
@@ -542,14 +543,8 @@ class TaskCpdFragment : BaseFragment(), TaskView,
}
else
{
}
else
{
val
trackerBean
=
mFakeTaskList
[
position
].
trackerBean
val
trackerBean
=
mFakeTaskList
[
position
].
trackerBean
if
(
trackerBean
!=
null
)
{
if
(
trackerBean
!=
null
)
{
// 上报CPD激活完成
LogUtil
.
d
(
"CPD -> install_start"
)
taskPresenter
.
cmtImp
(
trackerBean
.
install_start
[
0
])
LogUtil
.
d
(
"CPD -> install_finish"
)
taskPresenter
.
cmtImp
(
trackerBean
.
install_finish
[
0
])
// 上报CPD激活完成
LogUtil
.
d
(
"CPD -> activation"
)
LogUtil
.
d
(
"CPD -> activation"
)
taskPresenter
.
cmtImp
(
trackerBean
.
activation
[
0
])
taskPresenter
.
cmtImp
(
trackerBean
.
activation
[
0
])
}
}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/TaskCpdHistoryFragment.kt
View file @
39cd7e51
...
@@ -5,6 +5,7 @@ import android.view.View
...
@@ -5,6 +5,7 @@ import android.view.View
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.LinearLayoutManager
import
com.mints.goodmoney.R
import
com.mints.goodmoney.R
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.common.DeviceInfo
import
com.mints.goodmoney.manager.AppTryPlayManager
import
com.mints.goodmoney.manager.AppTryPlayManager
import
com.mints.goodmoney.mvp.model.TaskCpdBean
import
com.mints.goodmoney.mvp.model.TaskCpdBean
import
com.mints.goodmoney.mvp.model.TzTaskBean
import
com.mints.goodmoney.mvp.model.TzTaskBean
...
@@ -15,6 +16,8 @@ import com.mints.goodmoney.ui.adapter.TaskCpdHistoryAdapter
...
@@ -15,6 +16,8 @@ import com.mints.goodmoney.ui.adapter.TaskCpdHistoryAdapter
import
com.mints.goodmoney.ui.adapter.listener.OnItemChildClickListener
import
com.mints.goodmoney.ui.adapter.listener.OnItemChildClickListener
import
com.mints.goodmoney.ui.fragment.base.LazyLoadBaseFragment
import
com.mints.goodmoney.ui.fragment.base.LazyLoadBaseFragment
import
com.mints.goodmoney.utils.*
import
com.mints.goodmoney.utils.*
import
com.mints.goodmoney.utils.rxutil.CommonRxTask
import
com.mints.goodmoney.utils.rxutil.RxjavaUtil
import
com.scwang.smartrefresh.layout.api.RefreshLayout
import
com.scwang.smartrefresh.layout.api.RefreshLayout
import
com.scwang.smartrefresh.layout.listener.OnRefreshListener
import
com.scwang.smartrefresh.layout.listener.OnRefreshListener
import
kotlinx.android.synthetic.main.activity_task.*
import
kotlinx.android.synthetic.main.activity_task.*
...
@@ -206,12 +209,39 @@ class TaskCpdHistoryFragment : LazyLoadBaseFragment(), TaskCpdHistoryView,
...
@@ -206,12 +209,39 @@ class TaskCpdHistoryFragment : LazyLoadBaseFragment(), TaskCpdHistoryView,
mFakeTaskList
.
clear
()
mFakeTaskList
.
clear
()
needUseTime
=
taskCpdBean
.
needSeconds
needUseTime
=
taskCpdBean
.
needSeconds
for
(
bean
in
taskCpdBean
.
list
)
{
for
(
bean
in
taskCpdBean
.
list
)
{
val
tzTaskBean
=
TzTaskBean
(
bean
.
icon
,
bean
.
name
,
""
,
false
,
bean
.
coin
,
1
,
bean
.
pkg
)
mFakeTaskList
.
add
(
TzTaskBean
(
bean
.
icon
,
bean
.
name
,
bean
.
coin
,
1
,
bean
.
pkg
,
bean
.
aid
))
tzTaskBean
.
aid
=
bean
.
aid
mFakeTaskList
.
add
(
tzTaskBean
)
}
}
notifyDataAndShowAd
()
// 去除已经安装过的APP
getCpdRepeatPkg
()
}
/**
* 遍历去重APP包名
*/
private
fun
getCpdRepeatPkg
()
{
RxjavaUtil
.
executeRxTask
<
MutableList
<
TzTaskBean
>>(
object
:
CommonRxTask
<
MutableList
<
TzTaskBean
>>()
{
override
fun
doInIOThread
()
{
val
newPkgData
=
mutableListOf
<
TzTaskBean
>()
for
(
i
in
0
until
mFakeTaskList
.
size
)
{
// 添加安装过的app
if
(
DeviceInfo
.
instance
.
isLoadingPkg
(
mFakeTaskList
[
i
].
currentPkgName
))
{
newPkgData
.
add
(
mFakeTaskList
[
i
])
}
}
t
=
newPkgData
}
override
fun
doInUIThread
()
{
mFakeTaskList
.
clear
()
mFakeTaskList
.
addAll
(
t
)
notifyDataAndShowAd
()
}
})
}
}
override
fun
getCpdUseAppModelMsgFail
()
{
override
fun
getCpdUseAppModelMsgFail
()
{
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/widgets/TaskCpdDialog.kt
View file @
39cd7e51
...
@@ -12,7 +12,7 @@ import com.mints.library.utils.GlideUtils
...
@@ -12,7 +12,7 @@ import com.mints.library.utils.GlideUtils
/**
/**
* 提示弹框
* 提示弹框
*/
*/
class
TaskCpdDialog
(
context
:
Context
,
private
val
listener
:
DialogListener
)
:
class
TaskCpdDialog
(
context
:
Context
,
listener
:
DialogListener
)
:
Dialog
(
context
,
R
.
style
.
dialog
)
{
Dialog
(
context
,
R
.
style
.
dialog
)
{
private
val
lp
:
WindowManager
.
LayoutParams
private
val
lp
:
WindowManager
.
LayoutParams
private
val
tvTitle
:
TextView
private
val
tvTitle
:
TextView
...
...
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