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
0120cce4
Commit
0120cce4
authored
Feb 25, 2021
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更换书城sdk,信息流改为权重调用
parent
9b9cf32a
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
196 additions
and
127 deletions
+196
-127
build.gradle
GoodMoney/app/build.gradle
+3
-4
PreLoadExpressManager.kt
...a/com/mints/goodmoney/ad/express/PreLoadExpressManager.kt
+90
-17
Constant.kt
.../app/src/main/java/com/mints/goodmoney/common/Constant.kt
+5
-0
ZhangyueManager.kt
.../main/java/com/mints/goodmoney/manager/ZhangyueManager.kt
+19
-14
DrawNativeVideoActivity.kt
...m/mints/goodmoney/ui/activitys/DrawNativeVideoActivity.kt
+1
-3
KuYinYuePageFragment.kt
...a/com/mints/goodmoney/ui/fragment/KuYinYuePageFragment.kt
+4
-3
MyFragment.kt
...c/main/java/com/mints/goodmoney/ui/fragment/MyFragment.kt
+2
-0
MyZhangyueFragment.kt
...ava/com/mints/goodmoney/ui/fragment/MyZhangyueFragment.kt
+29
-45
ZhangyueFragment.kt
.../java/com/mints/goodmoney/ui/fragment/ZhangyueFragment.kt
+43
-41
No files found.
GoodMoney/app/build.gradle
View file @
0120cce4
...
...
@@ -9,8 +9,8 @@ android {
applicationId
"com.mints.goodmoney"
minSdkVersion
rootProject
.
ext
.
androidMinSdkVersion
targetSdkVersion
rootProject
.
ext
.
androidTargetSdkVersion
versionCode
19
versionName
"1.1.
8
"
versionCode
20
versionName
"1.1.
9
"
flavorDimensions
"default"
// dex突破65535的限制
...
...
@@ -233,8 +233,7 @@ dependencies {
implementation
'com.liulishuo.filedownloader:library:1.7.7'
implementation
"org.greenrobot:eventbus:3.1.0-RC"
// 掌阅书城
// implementation(name: 'iReader-release-androidx-1.0.3.1_haozhuanqian', ext: 'aar')
implementation
(
name:
'iReader-release-1.0.1'
,
ext:
'aar'
)
implementation
(
name:
'iReader-release-androidx-1.0.3.1-haozhuanqian'
,
ext:
'aar'
)
implementation
'com.alibaba:fastjson:1.2.11'
implementation
'androidx.annotation:annotation:1.0.0'
implementation
'androidx.core:core:1.0.0'
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/express/PreLoadExpressManager.kt
View file @
0120cce4
...
...
@@ -4,7 +4,11 @@ import android.view.View
import
android.view.ViewGroup
import
android.widget.FrameLayout
import
com.mints.goodmoney.MintsApplication
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.mvp.model.WeightBean
import
com.mints.goodmoney.utils.LogUtil
import
com.qq.e.ads.nativ.NativeExpressADView
import
java.util.*
/**
...
...
@@ -12,6 +16,8 @@ import com.qq.e.ads.nativ.NativeExpressADView
*/
object
PreLoadExpressManager
:
TTADLoadSuccessListener
,
YLHADLoadSuccessListener
,
KSADLoadSuccessListener
{
private
val
TAG
=
PreLoadExpressManager
::
class
.
java
.
simpleName
// 是否是穿山甲信息流
@Volatile
private
var
currentIndex
=
0
...
...
@@ -19,6 +25,11 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
@Volatile
private
var
mAdFrameLayout
:
FrameLayout
?
=
null
private
var
weightList
:
MutableList
<
WeightBean
>
=
mutableListOf
()
private
var
csjWeight
=
0
private
var
ylhWeight
=
0
private
var
ksWeight
=
0
init
{
mAdFrameLayout
=
FrameLayout
(
MintsApplication
.
getContext
())
YlhPreLoadExpressManager
.
setListener
(
this
)
...
...
@@ -26,24 +37,83 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
KsPreLoadExpressManager
.
setListener
(
this
)
}
fun
init
(
csjWeight
:
Int
,
ylhWeight
:
Int
,
ksWeight
:
Int
)
{
this
.
csjWeight
=
csjWeight
this
.
ylhWeight
=
ylhWeight
this
.
ksWeight
=
ksWeight
}
fun
loadADFrameLayout
()
{
mAdFrameLayout
?.
removeAllViews
()
when
(++
currentIndex
)
{
1
->
{
// when (++currentIndex) {
// 1 -> {
// TTPreLoadExpressManager.getInstance().loadTtFrameLayout(mAdFrameLayout)
// }
// 2 -> {
// YlhPreLoadExpressManager.loadYlhFrameLayout()
// }
// 3 -> {
// KsPreLoadExpressManager.loadKsFrameLayout(mAdFrameLayout as ViewGroup)
// }
// }
when
(
getRandomWeight
())
{
Constant
.
CSJ_EXPRESS_AD
->
TTPreLoadExpressManager
.
getInstance
().
loadTtFrameLayout
(
mAdFrameLayout
)
Constant
.
YLH_EXPRESS_AD
->
YlhPreLoadExpressManager
.
loadYlhFrameLayout
()
Constant
.
KS_EXPRESS_AD
->
KsPreLoadExpressManager
.
loadKsFrameLayout
(
mAdFrameLayout
as
ViewGroup
)
else
->
{
TTPreLoadExpressManager
.
getInstance
().
loadTtFrameLayout
(
mAdFrameLayout
)
}
2
->
{
YlhPreLoadExpressManager
.
loadYlhFrameLayout
()
}
3
->
{
KsPreLoadExpressManager
.
loadKsFrameLayout
(
mAdFrameLayout
as
ViewGroup
)
}
}
/**
* 根据权重获取广告类型
*/
private
fun
getRandomWeight
():
String
{
if
(
weightList
!=
null
)
{
weightList
.
clear
()
}
var
weight
=
0
// 若没有视频完成数,不加入权重计算范围内
if
(
csjWeight
>
0
)
{
weightList
.
add
(
WeightBean
(
csjWeight
,
Constant
.
CSJ_EXPRESS_AD
))
weight
=
weight
+
csjWeight
LogUtil
.
d
(
TAG
,
"EXPRESS权重值:csjWeight:$csjWeight"
)
}
if
(
ylhWeight
>
0
)
{
weightList
.
add
(
WeightBean
(
ylhWeight
,
Constant
.
YLH_EXPRESS_AD
))
weight
=
weight
+
ylhWeight
LogUtil
.
d
(
TAG
,
"EXPRESS权重值:ylhWeight:$ylhWeight"
)
}
if
(
ksWeight
>
0
)
{
weightList
.
add
(
WeightBean
(
ksWeight
,
Constant
.
KS_EXPRESS_AD
))
weight
=
weight
+
ksWeight
LogUtil
.
d
(
TAG
,
"EXPRESS权重值:ksWeight:$ksWeight"
)
}
// 权重随机
if
(
weightList
!=
null
&&
weightList
.
size
>
0
&&
weight
>
0
)
{
LogUtil
.
d
(
TAG
,
"1、权重总值EXPRESS:$weight"
)
val
r
=
Random
()
var
randomWeight
=
r
.
nextInt
(
weight
)
+
1
LogUtil
.
d
(
TAG
,
"2、权重随机值EXPRESS:$randomWeight"
)
// ToastUtil.show(MintsApplication.getContext(), "权重随机值:" + randomWeight);
for
(
weightBean
in
weightList
)
{
randomWeight
-=
weightBean
.
weight
if
(
randomWeight
<=
0
)
{
LogUtil
.
d
(
TAG
,
"3、权重结果EXPRESS:"
+
weightBean
.
type
)
return
weightBean
.
type
}
}
}
return
""
}
fun
getADFrameLayout
():
FrameLayout
?
{
if
(
currentIndex
>=
3
)
currentIndex
=
0
//
if (currentIndex >= 3) currentIndex = 0
return
mAdFrameLayout
}
...
...
@@ -55,21 +125,24 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
}
override
fun
onTTAdLoadSuc
(
adFrameLayout
:
FrameLayout
?)
{
if
(
currentIndex
==
1
)
{
mAdFrameLayout
=
adFrameLayout
}
// if (currentIndex == 1) {
// mAdFrameLayout = adFrameLayout
// }
mAdFrameLayout
=
adFrameLayout
}
override
fun
onYlhAdLoadSuc
(
view
:
NativeExpressADView
?)
{
if
(
currentIndex
==
2
)
{
mAdFrameLayout
?.
addView
(
view
)
}
// if (currentIndex == 2) {
// mAdFrameLayout?.addView(view)
// }
mAdFrameLayout
?.
addView
(
view
)
}
override
fun
onKSAdLoadSuc
(
view
:
View
?)
{
if
(
currentIndex
==
3
)
{
mAdFrameLayout
?.
addView
(
view
)
}
// if (currentIndex == 3) {
// mAdFrameLayout?.addView(view)
// }
mAdFrameLayout
?.
addView
(
view
)
}
}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/common/Constant.kt
View file @
0120cce4
...
...
@@ -170,6 +170,11 @@ object Constant {
const
val
SH_VEDIO_AD
=
"SH_VEDIO_AD"
const
val
KS_VEDIO_AD
=
"KS_VEDIO_AD"
// 信息流广告类型
const
val
CSJ_EXPRESS_AD
=
"CSJ_EXPRESS_AD"
const
val
YLH_EXPRESS_AD
=
"YLH_EXPRESS_AD"
const
val
KS_EXPRESS_AD
=
"KS_EXPRESS_AD"
// 游戏类型
const
val
EVENT_TYPE_CLICK
=
"CLICK"
const
val
EVENT_TYPE_TIME
=
"TIME"
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/manager/ZhangyueManager.kt
View file @
0120cce4
package
com.mints.goodmoney.manager
import
android.app.Application
import
com.ireader.ireadersdk.Config
import
com.ireader.ireadersdk.IreaderApi
import
com.mints.goodmoney.MintsApplication
import
java.lang.Exception
...
...
@@ -14,24 +15,28 @@ object ZhangyueManager {
private
const
val
APPID
=
"10054"
fun
onCreateIreader
(
application
:
Application
)
{
// try {
// IreaderApi.onCreate(application)
// val config = Config.Builder()
// .setZYAppId(APPID)
// .setOaId(MintsApplication.OAID)
// .setSupportCSJ(true)
// .setSupportGDT(true)
// .build()
// IreaderApi.attachBaseContext(application, config)
// } catch (e: Exception) {
// e.printStackTrace()
// }
try
{
IreaderApi
.
attachBaseContext
(
application
)
IreaderApi
.
onCreate
(
application
,
APPID
)
IreaderApi
.
onCreate
(
application
)
val
config
=
Config
.
Builder
()
.
setZYAppId
(
APPID
)
.
setOaId
(
MintsApplication
.
OAID
)
.
setSupportCSJ
(
true
)
.
setSupportGDT
(
true
)
.
build
()
IreaderApi
.
attachBaseContext
(
application
,
config
)
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
}
// try {
// IreaderApi.attachBaseContext(application)
// IreaderApi.onCreate(application, APPID)
// } catch (e: Exception) {
// e.printStackTrace()
// }
}
fun
onDestory
()
{
IreaderApi
.
onAppExit
()
}
}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/DrawNativeVideoActivity.kt
View file @
0120cce4
...
...
@@ -315,9 +315,7 @@ class DrawNativeVideoActivity : BaseActivity(),
}
kylVideoPresenter
.
detachView
()
if
(
mLayoutManager
!=
null
)
{
mLayoutManager
!!
.
setOnViewPagerListener
(
null
)
}
mLayoutManager
?.
setOnViewPagerListener
(
null
)
}
/**
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/KuYinYuePageFragment.kt
View file @
0120cce4
...
...
@@ -73,10 +73,11 @@ class KuYinYuePageFragment(private val targetid: String) : LazyLoadBaseFragment(
val
index
=
position
%
PAGE_SIZE
// 余数
for
(
i
in
position
until
PAGE_SIZE
*
curPage
)
{
val
curVedioIndex
=
index
/
PAGE_SIZE
+
i
dataList
.
add
(
DrawVideoBean
(
DrawNativeVideoActivity
.
TYPE_COMMON_ITEM
,
null
,
kylData
[
index
/
PAGE_SIZE
+
i
].
vedioId
,
kylData
[
index
/
PAGE_SIZE
+
i
].
url
,
kylData
[
index
/
PAGE_SIZE
+
i
].
pvurl
))
kylData
[
curVedioIndex
].
vedioId
,
kylData
[
curVedioIndex
].
url
,
kylData
[
curVedioIndex
].
pvurl
))
}
val
bundle
=
Bundle
()
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/MyFragment.kt
View file @
0120cce4
...
...
@@ -288,6 +288,8 @@ class MyFragment : BaseFragment(),
}
override
fun
onRefresh
(
refreshLayout
:
RefreshLayout
)
{
onDestoryBroadcastReceiver
()
if
(
userManager
.
userID
.
isNotEmpty
())
{
myPresenter
.
getAutoUserHallBaseMsg
()
}
else
{
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/MyZhangyueFragment.kt
View file @
0120cce4
...
...
@@ -8,6 +8,7 @@ import com.ireader.ireadersdk.IreaderApi
import
com.mints.goodmoney.R
import
com.mints.goodmoney.common.AppConfig
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.manager.ZhangyueManager
import
com.mints.goodmoney.mvp.presenters.BookPresenter
import
com.mints.goodmoney.mvp.views.BookView
import
com.mints.goodmoney.ui.activitys.AwardActivity
...
...
@@ -52,28 +53,11 @@ class MyZhangyueFragment : LazyLoadBaseFragment(), BookView, IreaderApi.OnReadCh
}
}
override
fun
onReadStart
()
{
}
override
fun
onReadEnd
(
time
:
Long
)
{
// LogUtil.d(TAG, "onReadEnd time:" + time)
// LogUtil.d(TAG, "onReadEnd time(Int):" + (time/1000).toInt())
val
seconds
=
(
time
/
1000
).
toInt
()
// 阅读5秒以上 保存时长
if
(
seconds
>
5
)
{
bookPresenter
.
addReadSeconds
(
seconds
)
}
}
override
fun
onReadPage
(
time
:
Long
)
{
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
IreaderApi
.
setReadChangeListener
(
null
)
ZhangyueManager
.
onDestory
()
bookPresenter
.
detachView
()
}
...
...
@@ -100,31 +84,31 @@ class MyZhangyueFragment : LazyLoadBaseFragment(), BookView, IreaderApi.OnReadCh
}
}
//
override fun addBookShelf(p0: Bundle?) {
//
TODO("Not yet implemented")
//
}
//
//
override fun onReadStart(p0: Bundle?) {
//
TODO("Not yet implemented")
//
}
//
//
override fun onReadEnd(p0: Bundle?) {
// val seconds = (p0!!.getLong(IreaderApi.BOOK_TIME).toLong(
) / 1000).toInt()
//
// 阅读5秒以上 保存时长
//
if (seconds > 5) {
//
bookPresenter.addReadSeconds(seconds)
//
}
//
}
//
//
override fun onDeleteBook(p0: String?) {
//
TODO("Not yet implemented")
//
}
//
//
override fun onReadPage(p0: Bundle?) {
//
TODO("Not yet implemented")
//
}
//
//
override fun onChangeNight(p0: Boolean) {
//
TODO("Not yet implemented")
//
}
override
fun
addBookShelf
(
p0
:
Bundle
?)
{
TODO
(
"Not yet implemented"
)
}
override
fun
onReadStart
(
p0
:
Bundle
?)
{
TODO
(
"Not yet implemented"
)
}
override
fun
onReadEnd
(
p0
:
Bundle
?)
{
val
seconds
=
(
p0
!!
.
getLong
(
IreaderApi
.
BOOK_TIME
)
/
1000
).
toInt
()
// 阅读5秒以上 保存时长
if
(
seconds
>
5
)
{
bookPresenter
.
addReadSeconds
(
seconds
)
}
}
override
fun
onDeleteBook
(
p0
:
String
?)
{
TODO
(
"Not yet implemented"
)
}
override
fun
onReadPage
(
p0
:
Bundle
?)
{
TODO
(
"Not yet implemented"
)
}
override
fun
onChangeNight
(
p0
:
Boolean
)
{
TODO
(
"Not yet implemented"
)
}
}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/ZhangyueFragment.kt
View file @
0120cce4
...
...
@@ -8,6 +8,7 @@ import com.ireader.ireadersdk.IreaderApi
import
com.mints.goodmoney.R
import
com.mints.goodmoney.common.AppConfig
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.manager.ZhangyueManager
import
com.mints.goodmoney.mvp.presenters.BookPresenter
import
com.mints.goodmoney.mvp.views.BookView
import
com.mints.goodmoney.ui.activitys.AwardActivity
...
...
@@ -55,25 +56,26 @@ class ZhangyueFragment : LazyLoadBaseFragment(), BookView, IreaderApi.OnReadChan
super
.
onDestroy
()
IreaderApi
.
setReadChangeListener
(
null
)
ZhangyueManager
.
onDestory
()
bookPresenter
.
detachView
()
}
override
fun
onReadStart
()
{
}
override
fun
onReadEnd
(
time
:
Long
)
{
// LogUtil.d(TAG, "onReadEnd time:" + time)
// LogUtil.d(TAG, "onReadEnd time(Int):" + (time/1000).toInt())
val
seconds
=
(
time
/
1000
).
toInt
()
// 阅读5秒以上 保存时长
if
(
seconds
>
5
)
{
bookPresenter
.
addReadSeconds
(
seconds
)
}
}
override
fun
onReadPage
(
time
:
Long
)
{
}
//
override fun onReadStart() {
//
}
//
//
override fun onReadEnd(time: Long) {
//
//
LogUtil.d(TAG, "onReadEnd time:" + time)
//
//
LogUtil.d(TAG, "onReadEnd time(Int):" + (time/1000).toInt())
//
//
val seconds = (time / 1000).toInt()
//
// 阅读5秒以上 保存时长
//
if (seconds > 5) {
//
bookPresenter.addReadSeconds(seconds)
//
}
//
}
//
//
override fun onReadPage(time: Long) {
//
}
override
fun
readSecondsSuc
(
coin
:
Int
)
{
...
...
@@ -99,29 +101,29 @@ class ZhangyueFragment : LazyLoadBaseFragment(), BookView, IreaderApi.OnReadChan
}
}
//
override fun addBookShelf(p0: Bundle?) {
//
}
//
//
override fun onReadStart(p0: Bundle?) {
//
}
//
//
override fun onReadEnd(p0: Bundle?) {
//
// LogUtil.d(TAG, "onReadEnd time:" + time)
//
//
LogUtil.d(TAG, "onReadEnd time(Int):" + (time/1000).toInt())
//
//
val seconds = (p0!!.getLong(IreaderApi.BOOK_TIME).toLong() / 1000).toInt()
//
// 阅读5秒以上 保存时长
//
if (seconds > 5) {
//
bookPresenter.addReadSeconds(seconds)
//
}
//
}
//
//
override fun onDeleteBook(p0: String?) {
//
}
//
//
override fun onReadPage(p0: Bundle?) {
//
}
//
//
override fun onChangeNight(p0: Boolean) {
//
}
override
fun
addBookShelf
(
p0
:
Bundle
?)
{
}
override
fun
onReadStart
(
p0
:
Bundle
?)
{
}
override
fun
onReadEnd
(
p0
:
Bundle
?)
{
// LogUtil.d(TAG, "onReadEnd time:" + time)
// LogUtil.d(TAG, "onReadEnd time(Int):" + (time/1000).toInt())
val
seconds
=
(
p0
!!
.
getLong
(
IreaderApi
.
BOOK_TIME
).
toLong
()
/
1000
).
toInt
()
// 阅读5秒以上 保存时长
if
(
seconds
>
5
)
{
bookPresenter
.
addReadSeconds
(
seconds
)
}
}
override
fun
onDeleteBook
(
p0
:
String
?)
{
}
override
fun
onReadPage
(
p0
:
Bundle
?)
{
}
override
fun
onChangeNight
(
p0
:
Boolean
)
{
}
}
\ 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