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
552b120c
Commit
552b120c
authored
Apr 08, 2021
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
3b1813b5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
84 additions
and
39 deletions
+84
-39
ReaderManager.java
.../main/java/com/mints/goodmoney/manager/ReaderManager.java
+26
-6
ToutiaoAD.java
.../src/main/java/com/mints/goodmoney/manager/ToutiaoAD.java
+10
-13
TtCsjAdManager.java
...main/java/com/mints/goodmoney/manager/TtCsjAdManager.java
+1
-0
BookPresenter.kt
.../java/com/mints/goodmoney/mvp/presenters/BookPresenter.kt
+4
-4
WrapperActivity.kt
.../java/com/mints/goodmoney/ui/activitys/WrapperActivity.kt
+5
-4
MyFragment.kt
...c/main/java/com/mints/goodmoney/ui/fragment/MyFragment.kt
+0
-3
ReaderFragment.kt
...in/java/com/mints/goodmoney/ui/fragment/ReaderFragment.kt
+38
-9
No files found.
GoodMoney/app/src/main/java/com/mints/goodmoney/manager/ReaderManager.java
View file @
552b120c
...
...
@@ -34,8 +34,14 @@ import kotlin.jvm.functions.Function0;
public
class
ReaderManager
{
public
static
void
init
(
Application
applicationContext
)
{
ToutiaoAD
a
d
=
new
ToutiaoAD
();
ToutiaoAD
csjA
d
=
new
ToutiaoAD
();
ChineseAllReaderApplication
.
Companion
.
install
(
applicationContext
,
"1242"
,
"hzq@1242"
,
"32"
,
"0"
,
new
AdProvider
()
{
/**
* 阅读⻚弹窗广告确认按钮的点击回调-激励视频
* @param dialog
* @param block 对话框关闭回调,必须调用,否则计时每次切换章节都会出现弹窗
*/
@Override
public
void
onAdDialogPositiveClick
(
@Nullable
Dialog
dialog
,
@NotNull
Function0
<
Unit
>
function0
)
{
if
(
NetworkUtil
.
isNetworkAvailable
(
applicationContext
)
&&
!
NetworkUtil
.
INSTANCE
.
isWifiConnected
(
applicationContext
))
{
...
...
@@ -45,7 +51,7 @@ public class ReaderManager {
.
setPositiveButton
(
"观看视频"
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
a
d
.
showVideo
(
ActivityStackManager
.
getInstance
().
getTopActivity
(),
new
ToutiaoAD
.
OnVideoCloseCallBack
()
{
csjA
d
.
showVideo
(
ActivityStackManager
.
getInstance
().
getTopActivity
(),
new
ToutiaoAD
.
OnVideoCloseCallBack
()
{
@Override
public
void
onClose
()
{
function0
.
invoke
();
...
...
@@ -59,14 +65,24 @@ public class ReaderManager {
}
}).
create
().
show
();
return
;
}
else
{
csjAd
.
showVideo
(
ActivityStackManager
.
getInstance
().
getTopActivity
(),
new
ToutiaoAD
.
OnVideoCloseCallBack
()
{
@Override
public
void
onClose
()
{
function0
.
invoke
();
}
});
}
}
/**
* 阅读⻚首次打开 弹框广告(信息流) 广告宽度 320 高度 260 * @param adViewContainer 广告view的容器
*/
@Override
public
void
getReaderScreenAd
(
@NotNull
View
view
,
@NotNull
OnAdViewReceiver
receiver
,
@Nullable
Dialog
dialog
)
{
a
d
.
loadAD
(
applicationContext
,
receiver
,
320
,
260
,
new
ToutiaoAD
.
OnClickListener
()
{
csjA
d
.
loadAD
(
applicationContext
,
receiver
,
320
,
260
,
new
ToutiaoAD
.
OnClickListener
()
{
@Override
public
void
onClick
()
{
dialog
.
dismiss
();
...
...
@@ -74,16 +90,20 @@ public class ReaderManager {
});
}
/**
* 阅读⻚翻⻚广告(信息流) 广告宽度 320 高度 260 */
@Override
public
void
getReaderPageAd
(
@NotNull
OnAdViewReceiver
receiver
)
{
//加载阅读内容⻚广告 建议每次调用,更换不同的广告id
ad
.
loadAD
(
applicationContext
,
receiver
,
DensityUtil
.
px2dip
(
applicationContext
,
ScreenUtils
.
getScreenWidth
(
applicationContext
)
-
DensityUtil
.
dip2px
(
applicationContext
,
30
f
)),
DensityUtil
.
px2dip
(
applicationContext
,
854
f
),
null
);
csjAd
.
loadAD
(
applicationContext
,
receiver
,
DensityUtil
.
px2dip
(
applicationContext
,
ScreenUtils
.
getScreenWidth
(
applicationContext
)
-
DensityUtil
.
dip2px
(
applicationContext
,
30
f
)),
DensityUtil
.
px2dip
(
applicationContext
,
854
f
),
null
);
}
/**
* 阅读⻚定时弹窗广告 (激励视频)
*/
@Override
public
void
getReaderDialogAd
(
@NotNull
View
view
,
@NotNull
OnAdViewReceiver
receiver
,
@Nullable
Dialog
dialog
)
{
a
d
.
loadVideoAd
(
ActivityStackManager
.
getInstance
().
getTopActivity
(),
receiver
);
csjA
d
.
loadVideoAd
(
ActivityStackManager
.
getInstance
().
getTopActivity
(),
receiver
);
}
});
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/manager/ToutiaoAD.java
View file @
552b120c
...
...
@@ -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.library.utils.json.JsonUtil
;
import
java.util.List
;
...
...
@@ -102,7 +103,7 @@ public class ToutiaoAD {
LogUtils
.
d
(
tag
,
"load ad"
);
if
(
mTTAdNative
==
null
)
{
mTTAdNative
=
T
TAdSdk
.
getAdManager
().
createAdNative
(
context
);
mTTAdNative
=
T
tCsjAdManager
.
get
().
createAdNative
(
context
);
}
// if (ADConfig.TYPE_NATIVE.equals(adParamers.type)){
//信息流
...
...
@@ -125,7 +126,7 @@ public class ToutiaoAD {
this
.
context
=
context
;
if
(
mTTAdNative
==
null
)
{
mTTAdNative
=
T
TAdSdk
.
getAdManager
().
createAdNative
(
context
);
mTTAdNative
=
T
tCsjAdManager
.
get
().
createAdNative
(
context
);
}
initVedioAD
(
context
,
receiver
);
}
...
...
@@ -252,19 +253,15 @@ public class ToutiaoAD {
private
void
initVedioAD
(
final
Context
context
,
OnAdViewReceiver
receiver
)
{
// SharedPreferencesUtil.getInstance().putBoolean(StringConstants.VIDEO_TASK_FINISH, false);
AdSlot
adSlot
=
new
AdSlot
.
Builder
()
.
setCodeId
(
TtCsjAdManager
.
TT_AD_VEDIO_
MOREDIALOG
)
.
setCodeId
(
TtCsjAdManager
.
TT_AD_VEDIO_
READ
)
.
setSupportDeepLink
(
true
)
.
setAdCount
(
1
)
.
setImageAcceptedSize
(
ScreenUtils
.
getScreenWidth
(
ChineseAllReaderApplication
.
globalContext
)
/
4
,
ScreenUtils
.
getScreenHeight
(
ChineseAllReaderApplication
.
globalContext
)
/
4
)
.
setRewardName
(
"金币"
)
//奖励的名称
.
setRewardAmount
(
3
)
//奖励的数量
//必传参数,表来标识应用侧唯一用户;若非服务器回调模式或不需sdk透传
//可设置为空字符串
.
setUserID
(
""
)
.
setOrientation
(
TTAdConstant
.
VERTICAL
)
//设置期望视频播放的方向,为TTAdConstant.HORIZONTAL或TTAdConstant.VERTICAL
.
setMediaExtra
(
"media_extra"
)
//用户透传的信息,可不传
//个性化模板广告需要设置期望个性化模板广告的大小,单位dp,激励视频场景,只要设置的值大于0即可。仅模板广告需要设置此参数
.
setExpressViewAcceptedSize
(
500
,
500
)
.
setImageAcceptedSize
(
1080
,
1920
)
.
setUserID
(
UserManager
.
getInstance
().
getUserID
())
//用户id,必传参数
.
setMediaExtra
(
"media_extra"
)
.
setOrientation
(
TTAdConstant
.
VERTICAL
)
.
build
();
mTTAdNative
.
loadRewardVideoAd
(
adSlot
,
new
TTAdNative
.
RewardVideoAdListener
()
{
@Override
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/manager/TtCsjAdManager.java
View file @
552b120c
...
...
@@ -43,6 +43,7 @@ public class TtCsjAdManager {
public
static
String
TT_AD_VEDIO_HOMEVEDIO
=
"945744137"
;
// 首页视频翻倍
public
static
String
TT_AD_VEDIO_SMALLHOMEVEDIO
=
"945744186"
;
// 短视频翻倍
public
static
String
TT_AD_VEDIO_KYLVEDIO
=
"945791766"
;
// 来电秀视频
public
static
String
TT_AD_VEDIO_READ
=
"945997554"
;
// 听读
/*全屏视频*/
public
static
String
TT_AD_FULLVEDIO_ALL
=
"945752969"
;
// 通用
/*信息流*/
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/mvp/presenters/BookPresenter.kt
View file @
552b120c
...
...
@@ -28,10 +28,10 @@ class BookPresenter : BasePresenter<BookView>() {
val
data
=
baseResponse
.
data
when
(
code
)
{
200
->
{
if
(
data
!=
null
)
{
val
coin
=
data
[
"coin"
].
asInt
view
.
readSecondsSuc
(
coin
)
}
//
if (data != null) {
//
val coin = data["coin"].asInt
//
view.readSecondsSuc(coin)
//
}
}
else
->
view
.
showToast
(
baseResponse
.
getMessage
())
}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/WrapperActivity.kt
View file @
552b120c
...
...
@@ -8,10 +8,7 @@ import com.chineseall.reader17ksdk.feature.main.bookshop.wellchosen.WellChosenFr
import
com.mints.goodmoney.R
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.ui.activitys.base.BaseActivity
import
com.mints.goodmoney.ui.fragment.FriendsFragment
import
com.mints.goodmoney.ui.fragment.KuYinYueFragment
import
com.mints.goodmoney.ui.fragment.RsNewsFragment
import
com.mints.goodmoney.ui.fragment.WzFragment
import
com.mints.goodmoney.ui.fragment.*
import
com.mints.goodmoney.ui.widgets.seekbar.BubbleUtils
import
dagger.hilt.android.AndroidEntryPoint
import
kotlinx.android.synthetic.main.activity_wrapper.*
...
...
@@ -66,6 +63,10 @@ class WrapperActivity : BaseActivity(), View.OnClickListener {
// transaction.show(wellChosenFragment)
// transaction.commitAllowingStateLoss()
}
Constant
.
WRAPPER_TYPE_BOOK
->
{
tv_title
.
text
=
"书城"
currentFragment
=
ReaderFragment
()
}
Constant
.
WRAPPER_TYPE_FRIENDS
->
{
tv_title
.
text
=
"瓜分百万现金福利"
currentFragment
=
FriendsFragment
(
true
)
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/MyFragment.kt
View file @
552b120c
...
...
@@ -16,9 +16,6 @@ import android.widget.GridView
import
androidx.core.content.ContextCompat
import
androidx.recyclerview.widget.DividerItemDecoration
import
androidx.viewpager.widget.ViewPager
import
com.alibaba.android.arouter.launcher.ARouter
import
com.chineseall.reader17ksdk.feature.main.bookshop.wellchosen.WellChosenActionType
import
com.chineseall.reader17ksdk.utils.RouterPath
import
com.component.dly.xzzq_ywsdk.YwSDK_WebActivity.Companion.open
import
com.fly.scenemodule.SceneUtil
import
com.mints.goodmoney.BuildConfig
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/ReaderFragment.kt
View file @
552b120c
package
com.mints.goodmoney.ui.fragment
import
android.view.View
import
androidx.fragment.app.FragmentTransaction
import
com.chineseall.reader17ksdk.ChineseAllReaderApplication
import
com.chineseall.reader17ksdk.callbacks.OnReadCallBack
import
com.chineseall.reader17ksdk.feature.main.bookshop.wellchosen.WellChosenFragment
import
com.mints.goodmoney.R
import
com.mints.goodmoney.mvp.presenters.RsNewsPresenter
import
com.mints.goodmoney.mvp.views.RsNewsView
import
com.mints.goodmoney.common.AppConfig
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.mvp.presenters.BookPresenter
import
com.mints.goodmoney.mvp.views.BookView
import
com.mints.goodmoney.ui.fragment.base.LazyLoadBaseFragment
import
com.mints.goodmoney.utils.LogUtil
import
com.mints.goodmoney.utils.SpanUtils
import
kotlinx.android.synthetic.main.fragment_main_zy.*
/**
* 描述:听读
* 作者:孟崔广
* 时间:2021/04/08 10:55
*/
class
ReaderFragment
:
LazyLoadBaseFragment
(),
RsNews
View
,
OnReadCallBack
{
class
ReaderFragment
:
LazyLoadBaseFragment
(),
Book
View
,
OnReadCallBack
{
private
val
wellChosenFragment
by
lazy
{
WellChosenFragment
(
"home"
)
}
private
val
rsNewsPresenter
by
lazy
{
RsNews
Presenter
()
}
private
val
bookPresenter
by
lazy
{
Book
Presenter
()
}
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
fragment_main_zy
override
fun
initViewsAndEvents
()
{}
override
fun
onFragmentFirstVisible
()
{
rsNews
Presenter
.
attachView
(
this
)
book
Presenter
.
attachView
(
this
)
val
transaction
:
FragmentTransaction
=
supportFragmentManager
.
beginTransaction
()
transaction
.
add
(
R
.
id
.
fragment
,
wellChosenFragment
,
ReaderFragment
::
class
.
java
.
simpleName
)
...
...
@@ -36,20 +41,44 @@ class ReaderFragment : LazyLoadBaseFragment(), RsNewsView, OnReadCallBack {
ChineseAllReaderApplication
.
setOnReadCallBack
(
this
,
30
*
1000
)
}
override
fun
onFragmentResume
()
{
super
.
onFragmentResume
()
if
(
AppConfig
.
fragmentClickFlag
==
Constant
.
FRAGMENT_CLICK_ONE
)
{
bookPresenter
.
getReadInfo
()
}
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
ChineseAllReaderApplication
.
destory
()
rsNews
Presenter
.
detachView
()
book
Presenter
.
detachView
()
}
override
fun
readSecondsSuc
(
coin
:
Int
,
video
:
Int
,
supr
:
Int
)
{
override
fun
readSecondsSuc
(
coin
:
Int
)
{
}
override
fun
readInfo
(
sumTime
:
Int
,
sumCoin
:
Int
,
readTime
:
Int
)
{
//阅读{10}分钟,奖励{xx}金币,已读{x}分钟
tvZhangContent
.
visibility
=
View
.
VISIBLE
if
(
readTime
>=
sumTime
)
{
tvZhangContent
.
text
=
"今日阅读任务已完成"
}
else
{
tvZhangContent
.
text
=
SpanUtils
()
.
append
(
"阅读"
).
append
(
"${sumTime / 60}"
).
setForegroundColor
(
mContext
.
resources
.
getColor
(
R
.
color
.
color_FF9837
)).
append
(
"分钟, "
)
.
append
(
"奖励"
).
append
(
"$sumCoin"
).
setForegroundColor
(
mContext
.
resources
.
getColor
(
R
.
color
.
color_cb4a39
)).
append
(
"金币, "
)
.
append
(
"已读"
).
append
(
"${readTime / 60}"
).
setForegroundColor
(
mContext
.
resources
.
getColor
(
R
.
color
.
color_FF9837
)).
append
(
"分钟"
)
.
create
()
}
}
override
fun
onReceive
(
map
:
Map
<
String
,
Any
>)
{
val
time
=
map
.
get
(
"time"
).
toString
()
rsNewsPresenter
.
addNewsSeconds
(
time
.
toInt
())
val
time
=
map
.
get
(
"time"
).
toString
().
toInt
()
val
seconds
=
(
time
/
1000
)
// 阅读5秒以上 保存时长
if
(
seconds
>
5
)
{
bookPresenter
.
addReadSeconds
(
seconds
)
}
LogUtil
.
d
(
"ReaderFragment"
,
"time:-->${time}"
)
}
...
...
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