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
4d71e0ed
Commit
4d71e0ed
authored
Mar 05, 2021
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CPD数据拉取顺序优化
parent
0887ddbc
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
37 additions
and
51 deletions
+37
-51
PreLoadExpressManager.kt
...a/com/mints/goodmoney/ad/express/PreLoadExpressManager.kt
+2
-3
TTPreLoadExpressManager.java
...m/mints/goodmoney/ad/express/TTPreLoadExpressManager.java
+0
-1
VersionUpdatePresenter.java
...ints/goodmoney/mvp/presenters/VersionUpdatePresenter.java
+0
-3
UpdateService.java
.../main/java/com/mints/goodmoney/service/UpdateService.java
+6
-4
TaskAdapter.kt
...c/main/java/com/mints/goodmoney/ui/adapter/TaskAdapter.kt
+1
-2
TaskCpdFragment.kt
...n/java/com/mints/goodmoney/ui/fragment/TaskCpdFragment.kt
+23
-38
GlideUtils.java
...app/src/main/java/com/mints/library/utils/GlideUtils.java
+5
-0
No files found.
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/express/PreLoadExpressManager.kt
View file @
4d71e0ed
...
@@ -7,7 +7,6 @@ import com.mints.goodmoney.MintsApplication
...
@@ -7,7 +7,6 @@ import com.mints.goodmoney.MintsApplication
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.mvp.model.WeightBean
import
com.mints.goodmoney.mvp.model.WeightBean
import
com.mints.goodmoney.utils.LogUtil
import
com.mints.goodmoney.utils.LogUtil
import
com.mints.goodmoney.utils.ToastUtil
import
com.qq.e.ads.nativ.NativeExpressADView
import
com.qq.e.ads.nativ.NativeExpressADView
import
java.util.*
import
java.util.*
...
@@ -19,8 +18,8 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
...
@@ -19,8 +18,8 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
private
val
TAG
=
PreLoadExpressManager
::
class
.
java
.
simpleName
private
val
TAG
=
PreLoadExpressManager
::
class
.
java
.
simpleName
@Volatile
//
@Volatile
private
var
currentIndex
=
0
//
private var currentIndex = 0
@Volatile
@Volatile
private
var
mAdFrameLayout
:
FrameLayout
?
=
null
private
var
mAdFrameLayout
:
FrameLayout
?
=
null
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/express/TTPreLoadExpressManager.java
View file @
4d71e0ed
...
@@ -6,7 +6,6 @@ import android.widget.FrameLayout;
...
@@ -6,7 +6,6 @@ import android.widget.FrameLayout;
import
com.mints.goodmoney.MintsApplication
;
import
com.mints.goodmoney.MintsApplication
;
import
com.mints.goodmoney.manager.TTNativeExpressManager
;
import
com.mints.goodmoney.manager.TTNativeExpressManager
;
import
com.mints.goodmoney.manager.TtCsjAdManager
;
import
com.mints.goodmoney.manager.TtCsjAdManager
;
import
com.mints.goodmoney.utils.Utils
;
public
class
TTPreLoadExpressManager
{
public
class
TTPreLoadExpressManager
{
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/mvp/presenters/VersionUpdatePresenter.java
View file @
4d71e0ed
...
@@ -284,9 +284,6 @@ public class VersionUpdatePresenter {
...
@@ -284,9 +284,6 @@ public class VersionUpdatePresenter {
@Override
@Override
public
void
finishProgress
()
{
public
void
finishProgress
()
{
if
(
pbDuUpdating
!=
null
)
{
pbDuUpdating
.
setProgress
(
100
);
}
if
(
btnDuUpdate
!=
null
)
{
if
(
btnDuUpdate
!=
null
)
{
btnDuUpdate
.
setEnabled
(
true
);
btnDuUpdate
.
setEnabled
(
true
);
btnDuUpdate
.
setText
(
"立即安装"
);
btnDuUpdate
.
setText
(
"立即安装"
);
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/service/UpdateService.java
View file @
4d71e0ed
...
@@ -259,18 +259,20 @@ public class UpdateService extends Service {
...
@@ -259,18 +259,20 @@ public class UpdateService extends Service {
if
(
httpURLConnection
.
getResponseCode
()
==
404
)
{
if
(
httpURLConnection
.
getResponseCode
()
==
404
)
{
throw
new
Exception
(
"fail!"
);
throw
new
Exception
(
"fail!"
);
}
}
inputStream
=
httpURLConnection
.
getInputStream
();
inputStream
=
httpURLConnection
.
getInputStream
();
outputStream
=
new
FileOutputStream
(
file
,
false
);
// 文件存在则覆盖掉
outputStream
=
new
FileOutputStream
(
file
,
false
);
// 文件存在则覆盖掉
byte
buffer
[]
=
new
byte
[
1024
];
byte
[]
buffer
=
new
byte
[
2048
];
int
readsize
=
0
;
int
readsize
;
while
((
readsize
=
inputStream
.
read
(
buffer
))
!=
-
1
)
{
while
((
readsize
=
inputStream
.
read
(
buffer
))
!=
-
1
)
{
outputStream
.
write
(
buffer
,
0
,
readsize
);
outputStream
.
write
(
buffer
,
0
,
readsize
);
downloadCount
+=
readsize
;
// 时时获取下载到的大小
downloadCount
+=
readsize
;
// 时时获取下载到的大小
/*
*
/*
* 每次增张5%
* 每次增张5%
*/
*/
if
(
updateCount
==
0
if
(
updateCount
==
0
||
(
downloadCount
*
100
/
totalSize
-
down_step
)
>=
updateCount
)
{
||
(
downloadCount
/
(
totalSize
/
100
)
-
down_step
)
>=
updateCount
)
{
updateCount
+=
down_step
;
updateCount
+=
down_step
;
message
=
new
Message
();
message
=
new
Message
();
message
.
what
=
DOWN_PROGRESS
;
message
.
what
=
DOWN_PROGRESS
;
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/adapter/TaskAdapter.kt
View file @
4d71e0ed
...
@@ -16,7 +16,6 @@ import com.mints.goodmoney.ui.adapter.listener.OnItemChildClickListener
...
@@ -16,7 +16,6 @@ import com.mints.goodmoney.ui.adapter.listener.OnItemChildClickListener
import
com.mints.goodmoney.ui.adapter.listener.OnItemClickListener
import
com.mints.goodmoney.ui.adapter.listener.OnItemClickListener
import
com.mints.library.utils.GlideUtils
import
com.mints.library.utils.GlideUtils
import
com.tz.sdk.core.ui.ADContainer
import
com.tz.sdk.core.ui.ADContainer
import
java.lang.ref.WeakReference
class
TaskAdapter
(
val
dataList
:
List
<
TzTaskBean
>,
val
context
:
Context
)
:
RecyclerView
.
Adapter
<
RecyclerView
.
ViewHolder
>()
{
class
TaskAdapter
(
val
dataList
:
List
<
TzTaskBean
>,
val
context
:
Context
)
:
RecyclerView
.
Adapter
<
RecyclerView
.
ViewHolder
>()
{
...
@@ -60,7 +59,7 @@ class TaskAdapter(val dataList: List<TzTaskBean>, val context: Context) : Recycl
...
@@ -60,7 +59,7 @@ class TaskAdapter(val dataList: List<TzTaskBean>, val context: Context) : Recycl
}
}
val
holder
=
viewHolder
as
BaseViewHolder
val
holder
=
viewHolder
as
BaseViewHolder
GlideUtils
.
loadImageView
(
context
,
data
.
icon
,
holder
.
ivAvatar
)
GlideUtils
.
loadImageView
NoAnim
(
context
,
data
.
icon
,
holder
.
ivAvatar
)
holder
.
tvTitle
.
text
=
data
.
title
holder
.
tvTitle
.
text
=
data
.
title
holder
.
tvCoin
.
text
=
"+"
+
data
.
coin
+
"金币"
holder
.
tvCoin
.
text
=
"+"
+
data
.
coin
+
"金币"
when
(
data
.
state
)
{
when
(
data
.
state
)
{
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/TaskCpdFragment.kt
View file @
4d71e0ed
...
@@ -167,7 +167,10 @@ class TaskCpdFragment : BaseFragment(), TaskView,
...
@@ -167,7 +167,10 @@ class TaskCpdFragment : BaseFragment(), TaskView,
// 珊瑚和CPD展示顺序
// 珊瑚和CPD展示顺序
if
(
CPD_ORDER
==
"CPD_SYD"
)
{
if
(
CPD_ORDER
==
"CPD_SYD"
)
{
if
(
cpdMax
>
0
)
{
if
(
cpdMax
>
0
)
{
loadCPDDataList
()
// 拉取数组数据
// loadCPDDataList()
// 循环拉取数据
loadCPDDataCycle
()
}
}
}
else
if
(
CPD_ORDER
==
"CPD_SH"
)
{
}
else
if
(
CPD_ORDER
==
"CPD_SH"
)
{
if
(
shMax
>
0
)
{
if
(
shMax
>
0
)
{
...
@@ -176,26 +179,6 @@ class TaskCpdFragment : BaseFragment(), TaskView,
...
@@ -176,26 +179,6 @@ class TaskCpdFragment : BaseFragment(), TaskView,
}
else
{
}
else
{
notifyDataAndShowAd
()
notifyDataAndShowAd
()
}
}
// when {
// shMax > 0 -> {
// // 先加载珊瑚广告,珊瑚回调判断圣于地
// for (i in 0 until shMax) {
// mCoralDownload?.pull()
// }
// }
// cpdMax > 0 -> {
// for (i in 0 until cpdMax) {
// loadCPDData()
// }
// loadCPDDataList()
// }
// else -> {
// notifyDataAndShowAd()
// }
// }
}
}
private
fun
loadShDataList
()
{
private
fun
loadShDataList
()
{
...
@@ -205,17 +188,17 @@ class TaskCpdFragment : BaseFragment(), TaskView,
...
@@ -205,17 +188,17 @@ class TaskCpdFragment : BaseFragment(), TaskView,
}
}
}
}
//
private fun loadCPDDataCycle() {
private
fun
loadCPDDataCycle
()
{
//
// 循环拉取圣于地CPD广告拉取
// 循环拉取圣于地CPD广告拉取
//
for (i in cpdLoadCountTime until cpdMax) {
for
(
i
in
cpdLoadCountTime
until
cpdMax
)
{
//
loadCPDData()
loadCPDData
()
//
}
}
//
}
}
//
private fun loadCPDData() {
private
fun
loadCPDData
()
{
//
LogUtil.d(TAG, "syd loadCPDData")
LogUtil
.
d
(
TAG
,
"syd loadCPDData"
)
//
taskPresenter.getCpdDetail(outNetIp)
taskPresenter
.
getCpdDetail
(
outNetIp
)
//
}
}
private
fun
loadCPDDataList
()
{
private
fun
loadCPDDataList
()
{
// 圣于地CPD广告拉取
// 圣于地CPD广告拉取
...
@@ -243,13 +226,6 @@ class TaskCpdFragment : BaseFragment(), TaskView,
...
@@ -243,13 +226,6 @@ class TaskCpdFragment : BaseFragment(), TaskView,
if
(
cpdLoadCountTime
++
>=
cpdMax
-
1
)
{
if
(
cpdLoadCountTime
++
>=
cpdMax
-
1
)
{
getCpdRepeatPkg
()
getCpdRepeatPkg
()
if
(
shMax
==
0
||
shLoadCountTime
>=
shMax
)
{
notifyDataAndShowAd
()
}
else
{
// 圣于地拉取完成后 调用珊瑚广告
loadShDataList
()
}
}
}
LogUtil
.
d
(
TAG
,
"syd getCpdModelSuc $cpdLoadCountTime"
)
LogUtil
.
d
(
TAG
,
"syd getCpdModelSuc $cpdLoadCountTime"
)
...
@@ -297,6 +273,8 @@ class TaskCpdFragment : BaseFragment(), TaskView,
...
@@ -297,6 +273,8 @@ class TaskCpdFragment : BaseFragment(), TaskView,
if
(
shMax
==
0
||
shLoadCountTime
>=
shMax
)
{
if
(
shMax
==
0
||
shLoadCountTime
>=
shMax
)
{
notifyDataAndShowAd
()
notifyDataAndShowAd
()
}
else
{
}
else
{
cpdLoadCountTime
=
cpdMax
// 圣于地拉取完成后 调用珊瑚广告
// 圣于地拉取完成后 调用珊瑚广告
loadShDataList
()
loadShDataList
()
}
}
...
@@ -380,6 +358,13 @@ class TaskCpdFragment : BaseFragment(), TaskView,
...
@@ -380,6 +358,13 @@ class TaskCpdFragment : BaseFragment(), TaskView,
mFakeTaskList
.
clear
()
mFakeTaskList
.
clear
()
mFakeTaskList
.
addAll
(
t
)
mFakeTaskList
.
addAll
(
t
)
if
(
shMax
==
0
||
shLoadCountTime
>=
shMax
)
{
notifyDataAndShowAd
()
}
else
{
// 圣于地拉取完成后 调用珊瑚广告
loadShDataList
()
}
// notifyDataAndShowAd()
// notifyDataAndShowAd()
// 重新获取数据
// 重新获取数据
...
...
GoodMoney/app/src/main/java/com/mints/library/utils/GlideUtils.java
View file @
4d71e0ed
...
@@ -33,6 +33,11 @@ public class GlideUtils {
...
@@ -33,6 +33,11 @@ public class GlideUtils {
Glide
.
with
(
mContext
).
load
(
path
).
into
(
mImageView
);
Glide
.
with
(
mContext
).
load
(
path
).
into
(
mImageView
);
}
}
//默认加载
public
static
void
loadImageViewNoAnim
(
Context
mContext
,
String
path
,
ImageView
mImageView
)
{
Glide
.
with
(
mContext
).
load
(
path
).
dontAnimate
().
into
(
mImageView
);
}
//设置加载中图片
//设置加载中图片
public
static
void
loadImageViewLoding
(
Context
mContext
,
String
path
,
ImageView
mImageView
,
int
lodingImage
)
{
public
static
void
loadImageViewLoding
(
Context
mContext
,
String
path
,
ImageView
mImageView
,
int
lodingImage
)
{
RequestOptions
requestOptions
=
new
RequestOptions
();
RequestOptions
requestOptions
=
new
RequestOptions
();
...
...
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