Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_goodnews
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_goodnews
Commits
d8132e4b
Commit
d8132e4b
authored
Jun 21, 2021
by
mengcuiguang2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化api
parent
f3daa0e9
Changes
17
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
446 additions
and
148 deletions
+446
-148
build.gradle
app/build.gradle
+15
-0
proguard-rules.pro
app/proguard-rules.pro
+253
-20
MintsApplication.java
app/src/main/java/com/mints/goodnews/MintsApplication.java
+4
-0
ExpressManager.kt
...main/java/com/mints/goodnews/ad/express/ExpressManager.kt
+1
-1
GroMoreCarrierExpressManager.kt
...mints/goodnews/ad/express/GroMoreCarrierExpressManager.kt
+27
-27
KsPreLoadExpressManager.kt
.../com/mints/goodnews/ad/express/KsPreLoadExpressManager.kt
+0
-1
PreLoadExpressManager.kt
...va/com/mints/goodnews/ad/express/PreLoadExpressManager.kt
+2
-2
YlhVideoAdManager.java
...n/java/com/mints/goodnews/ad/video/YlhVideoAdManager.java
+5
-4
TTGroMoreAdManagerHolder.java
.../com/mints/goodnews/manager/TTGroMoreAdManagerHolder.java
+1
-0
YlVideoManager.kt
...rc/main/java/com/mints/goodnews/manager/YlVideoManager.kt
+42
-0
FlowAdRulesBean.java
...in/java/com/mints/goodnews/mvp/model/FlowAdRulesBean.java
+5
-0
KylPageAdapter.kt
...main/java/com/mints/goodnews/ui/adapter/KylPageAdapter.kt
+5
-2
HorizonChannelFragment.kt
.../com/mints/goodnews/ui/fragment/HorizonChannelFragment.kt
+54
-86
MainFragment.kt
.../main/java/com/mints/goodnews/ui/fragment/MainFragment.kt
+2
-2
MyFragment.kt
...rc/main/java/com/mints/goodnews/ui/fragment/MyFragment.kt
+1
-1
fragment_main_horiz.xml
app/src/main/res/layout/fragment_main_horiz.xml
+15
-0
build.gradle
build.gradle
+14
-2
No files found.
app/build.gradle
View file @
d8132e4b
...
...
@@ -206,6 +206,21 @@ dependencies {
// TalkingDada(已集成)
// 数美
implementation
files
(
'libs/smantifraud.aar'
)
// 一览视频
implementation
(
"com.yilan.sdk:ui:3.3.3.6"
)
{
exclude
group:
'com.yilan.sdk'
,
module:
'yb_extra'
exclude
group:
'com.yilan.sdk'
,
module:
'gdt'
exclude
group:
'com.yilan.sdk'
,
module:
'ks'
}
implementation
(
'com.aliyun.ams:alicloud-android-httpdns:1.2.3@aar'
)
{
transitive
true
}
implementation
'tv.danmaku.ijk.media:ijkplayer-java:0.8.8'
implementation
'tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.8'
implementation
'tv.danmaku.ijk.media:ijkplayer-armv5:0.8.8'
implementation
'tv.danmaku.ijk.media:ijkplayer-arm64:0.8.8'
implementation
'tv.danmaku.ijk.media:ijkplayer-x86:0.8.8'
implementation
'tv.danmaku.ijk.media:ijkplayer-x86_64:0.8.8'
// 猎豹游戏
implementation
(
name:
'cmgame-sdk-tt3251-2.0.7'
,
ext:
'aar'
)
implementation
(
name:
'x5fit-2.0.7'
,
ext:
'aar'
)
...
...
app/proguard-rules.pro
View file @
d8132e4b
This diff is collapsed.
Click to expand it.
app/src/main/java/com/mints/goodnews/MintsApplication.java
View file @
d8132e4b
...
...
@@ -21,6 +21,7 @@ import com.mints.goodnews.manager.OwManager;
import
com.mints.goodnews.manager.TtCsjAdManager
;
import
com.mints.goodnews.manager.TzManager
;
import
com.mints.goodnews.manager.WnManager
;
import
com.mints.goodnews.manager.YlVideoManager
;
import
com.mints.goodnews.manager.YlhAdManager
;
import
com.mints.goodnews.net.LoanService
;
import
com.mints.goodnews.utils.ForegroundOrBackground
;
...
...
@@ -116,6 +117,9 @@ public class MintsApplication extends MultiDexApplication {
// 移动安全联盟 oaid
initMiitHelper
();
// 一览视频
YlVideoManager
.
INSTANCE
.
init
(
this
);
// GroMore
CsjGroMoreManager
.
INSTANCE
.
init
(
this
);
...
...
app/src/main/java/com/mints/goodnews/ad/express/ExpressManager.kt
View file @
d8132e4b
package
com.mints.goodnews.ad.express
import
android.widget.FrameLayout
import
com.min
gshu.goldcow
.ad.express.GroMoreCarrierExpressManager
import
com.min
ts.goodnews
.ad.express.GroMoreCarrierExpressManager
import
com.mints.goodnews.common.AppConfig
import
com.mints.goodnews.manager.TtCsjAdManager
...
...
app/src/main/java/com/mints/goodnews/ad/express/GroMoreCarrierExpressManager.kt
View file @
d8132e4b
package
com.min
gshu.goldcow
.ad.express
package
com.min
ts.goodnews
.ad.express
import
android.os.Handler
import
android.os.HandlerThread
...
...
@@ -11,16 +11,16 @@ import android.widget.*
import
com.bumptech.glide.Glide
import
com.bytedance.msdk.api.*
import
com.bytedance.msdk.api.nativeAd.*
import
com.min
gshu.goldcow
.R
import
com.min
gshu.goldcow.Wenshu
Application
import
com.min
gshu.goldcow
.common.AppConfig
import
com.min
gshu.goldcow
.common.Constant
import
com.min
gshu.goldcow
.manager.CsjGroMoreManager
import
com.min
gshu.goldcow
.manager.TrackManager
import
com.min
gshu.goldcow
.ui.widgets.seekbar.BubbleUtils
import
com.min
gshu.goldcow
.utils.LogUtil
import
com.min
gshu.goldcow
.utils.UIUtils
import
com.min
gshu.goldcow
.utils.VideoOptionUtil
import
com.min
ts.goodnews
.R
import
com.min
ts.goodnews.Mints
Application
import
com.min
ts.goodnews
.common.AppConfig
import
com.min
ts.goodnews
.common.Constant
import
com.min
ts.goodnews
.manager.CsjGroMoreManager
import
com.min
ts.goodnews
.manager.TrackManager
import
com.min
ts.goodnews
.ui.widgets.seekbar.BubbleUtils
import
com.min
ts.goodnews
.utils.LogUtil
import
com.min
ts.goodnews
.utils.UIUtils
import
com.min
ts.goodnews
.utils.VideoOptionUtil
import
java.util.ArrayList
import
java.util.HashMap
...
...
@@ -51,7 +51,7 @@ class GroMoreCarrierExpressManager : TTSettingConfigCallback {
fun
loadADFrameLayout
()
{
// 销毁及移除事件
destroy
()
frameLayout
=
FrameLayout
(
Wenshu
Application
.
getContext
())
frameLayout
=
FrameLayout
(
Mints
Application
.
getContext
())
if
(
TTMediationAdSdk
.
configLoadSuccess
())
{
loadAd
()
...
...
@@ -68,7 +68,7 @@ class GroMoreCarrierExpressManager : TTSettingConfigCallback {
}
private
fun
loadAd
()
{
mTTAdNative
=
TTUnifiedNativeAd
(
Wenshu
Application
.
getContext
(),
CsjGroMoreManager
.
AD_UNIT_EXPRESS_ID
)
mTTAdNative
=
TTUnifiedNativeAd
(
Mints
Application
.
getContext
(),
CsjGroMoreManager
.
AD_UNIT_EXPRESS_ID
)
//视频声音控制设置
var
videoOption
:
TTVideoOption
=
VideoOptionUtil
.
getTTVideoOption
()
...
...
@@ -205,7 +205,7 @@ class GroMoreCarrierExpressManager : TTSettingConfigCallback {
//渲染模板广告
private
fun
getExpressAdView
(
ad
:
TTNativeAd
):
View
?
{
val
adViewHolder
:
ExpressAdViewHolder
val
convertView
=
LayoutInflater
.
from
(
Wenshu
Application
.
getContext
()).
inflate
(
R
.
layout
.
listitem_ad_native_express
,
null
,
false
)
val
convertView
=
LayoutInflater
.
from
(
Mints
Application
.
getContext
()).
inflate
(
R
.
layout
.
listitem_ad_native_express
,
null
,
false
)
try
{
adViewHolder
=
ExpressAdViewHolder
()
adViewHolder
.
mAdContainerView
=
convertView
.
findViewById
(
R
.
id
.
iv_listitem_express
)
as
FrameLayout
...
...
@@ -250,7 +250,7 @@ class GroMoreCarrierExpressManager : TTSettingConfigCallback {
sWidth
=
FrameLayout
.
LayoutParams
.
MATCH_PARENT
sHeight
=
FrameLayout
.
LayoutParams
.
MATCH_PARENT
}
else
{
sWidth
=
UIUtils
.
getScreenWidth
(
Wenshu
Application
.
getContext
())
sWidth
=
UIUtils
.
getScreenWidth
(
Mints
Application
.
getContext
())
sHeight
=
(
sWidth
*
height
/
width
).
toInt
()
}
if
(
video
!=
null
)
{
...
...
@@ -308,7 +308,7 @@ class GroMoreCarrierExpressManager : TTSettingConfigCallback {
* @return
*/
private
fun
getVerticalAdView
(
ad
:
TTNativeAd
):
View
?
{
val
convertView
=
LayoutInflater
.
from
(
Wenshu
Application
.
getContext
()).
inflate
(
R
.
layout
.
listitem_ad_vertical_pic
,
null
,
false
)
val
convertView
=
LayoutInflater
.
from
(
Mints
Application
.
getContext
()).
inflate
(
R
.
layout
.
listitem_ad_vertical_pic
,
null
,
false
)
val
adViewHolder
=
VerticalAdViewHolder
()
adViewHolder
.
mTitle
=
convertView
!!
.
findViewById
(
R
.
id
.
tv_listitem_ad_title
)
as
TextView
adViewHolder
.
mSource
=
convertView
.
findViewById
(
R
.
id
.
tv_listitem_ad_source
)
as
TextView
...
...
@@ -331,7 +331,7 @@ class GroMoreCarrierExpressManager : TTSettingConfigCallback {
convertView
.
tag
=
adViewHolder
bindData
(
convertView
,
adViewHolder
,
ad
,
viewBinder
)
if
(
ad
.
imageUrl
!=
null
)
{
adViewHolder
.
mVerticalImage
?.
let
{
Glide
.
with
(
Wenshu
Application
.
getContext
()).
load
(
ad
.
imageUrl
).
into
(
it
)
}
adViewHolder
.
mVerticalImage
?.
let
{
Glide
.
with
(
Mints
Application
.
getContext
()).
load
(
ad
.
imageUrl
).
into
(
it
)
}
}
return
convertView
}
...
...
@@ -340,7 +340,7 @@ class GroMoreCarrierExpressManager : TTSettingConfigCallback {
private
fun
getVideoView
(
ad
:
TTNativeAd
):
View
?
{
val
adViewHolder
:
VideoAdViewHolder
val
viewBinder
:
TTViewBinder
val
convertView
=
LayoutInflater
.
from
(
Wenshu
Application
.
getContext
()).
inflate
(
R
.
layout
.
listitem_ad_large_video
,
null
,
false
)
val
convertView
=
LayoutInflater
.
from
(
Mints
Application
.
getContext
()).
inflate
(
R
.
layout
.
listitem_ad_large_video
,
null
,
false
)
try
{
adViewHolder
=
VideoAdViewHolder
()
adViewHolder
.
mTitle
=
convertView
!!
.
findViewById
<
View
>(
R
.
id
.
tv_listitem_ad_title
)
as
TextView
...
...
@@ -397,7 +397,7 @@ class GroMoreCarrierExpressManager : TTSettingConfigCallback {
}
private
fun
getLargeAdView
(
ad
:
TTNativeAd
):
View
?
{
val
convertView
=
LayoutInflater
.
from
(
Wenshu
Application
.
getContext
()).
inflate
(
R
.
layout
.
listitem_ad_large_pic
,
null
,
false
)
val
convertView
=
LayoutInflater
.
from
(
Mints
Application
.
getContext
()).
inflate
(
R
.
layout
.
listitem_ad_large_pic
,
null
,
false
)
val
adViewHolder
=
LargeAdViewHolder
()
adViewHolder
.
mTitle
=
convertView
!!
.
findViewById
<
View
>(
R
.
id
.
tv_listitem_ad_title
)
as
TextView
adViewHolder
.
mDescription
=
convertView
.
findViewById
<
View
>(
R
.
id
.
tv_listitem_ad_desc
)
as
TextView
...
...
@@ -420,13 +420,13 @@ class GroMoreCarrierExpressManager : TTSettingConfigCallback {
convertView
.
tag
=
adViewHolder
bindData
(
convertView
,
adViewHolder
,
ad
,
viewBinder
)
if
(
ad
.
imageUrl
!=
null
)
{
adViewHolder
.
mLargeImage
?.
let
{
Glide
.
with
(
Wenshu
Application
.
getContext
()).
load
(
ad
.
imageUrl
).
into
(
it
)
}
adViewHolder
.
mLargeImage
?.
let
{
Glide
.
with
(
Mints
Application
.
getContext
()).
load
(
ad
.
imageUrl
).
into
(
it
)
}
}
return
convertView
}
private
fun
getGroupAdView
(
ad
:
TTNativeAd
):
View
?
{
val
convertView
=
LayoutInflater
.
from
(
Wenshu
Application
.
getContext
()).
inflate
(
R
.
layout
.
listitem_ad_group_pic
,
null
,
false
)
val
convertView
=
LayoutInflater
.
from
(
Mints
Application
.
getContext
()).
inflate
(
R
.
layout
.
listitem_ad_group_pic
,
null
,
false
)
val
adViewHolder
=
GroupAdViewHolder
()
adViewHolder
.
mTitle
=
convertView
!!
.
findViewById
(
R
.
id
.
tv_listitem_ad_title
)
as
TextView
adViewHolder
.
mSource
=
convertView
.
findViewById
(
R
.
id
.
tv_listitem_ad_source
)
as
TextView
...
...
@@ -455,20 +455,20 @@ class GroMoreCarrierExpressManager : TTSettingConfigCallback {
val
image2
=
ad
.
imageList
[
1
]
val
image3
=
ad
.
imageList
[
2
]
if
(
image1
!=
null
)
{
adViewHolder
.
mGroupImage1
?.
let
{
Glide
.
with
(
Wenshu
Application
.
getContext
()).
load
(
image1
).
into
(
it
)
}
adViewHolder
.
mGroupImage1
?.
let
{
Glide
.
with
(
Mints
Application
.
getContext
()).
load
(
image1
).
into
(
it
)
}
}
if
(
image2
!=
null
)
{
adViewHolder
.
mGroupImage2
?.
let
{
Glide
.
with
(
Wenshu
Application
.
getContext
()).
load
(
image2
).
into
(
it
)
}
adViewHolder
.
mGroupImage2
?.
let
{
Glide
.
with
(
Mints
Application
.
getContext
()).
load
(
image2
).
into
(
it
)
}
}
if
(
image3
!=
null
)
{
adViewHolder
.
mGroupImage3
?.
let
{
Glide
.
with
(
Wenshu
Application
.
getContext
()).
load
(
image3
).
into
(
it
)
}
adViewHolder
.
mGroupImage3
?.
let
{
Glide
.
with
(
Mints
Application
.
getContext
()).
load
(
image3
).
into
(
it
)
}
}
}
return
convertView
}
private
fun
getSmallAdView
(
ad
:
TTNativeAd
):
View
?
{
val
convertView
=
LayoutInflater
.
from
(
Wenshu
Application
.
getContext
()).
inflate
(
R
.
layout
.
listitem_ad_small_pic
,
null
,
false
)
val
convertView
=
LayoutInflater
.
from
(
Mints
Application
.
getContext
()).
inflate
(
R
.
layout
.
listitem_ad_small_pic
,
null
,
false
)
val
adViewHolder
=
SmallAdViewHolder
()
adViewHolder
.
mTitle
=
convertView
!!
.
findViewById
<
View
>(
R
.
id
.
tv_listitem_ad_title
)
as
TextView
adViewHolder
.
mSource
=
convertView
.
findViewById
<
View
>(
R
.
id
.
tv_listitem_ad_source
)
as
TextView
...
...
@@ -491,7 +491,7 @@ class GroMoreCarrierExpressManager : TTSettingConfigCallback {
bindData
(
convertView
,
adViewHolder
,
ad
,
viewBinder
)
if
(
ad
.
imageUrl
!=
null
)
{
adViewHolder
.
mSmallImage
?.
let
{
Glide
.
with
(
Wenshu
Application
.
getContext
()).
load
(
ad
.
imageUrl
).
into
(
it
)
}
adViewHolder
.
mSmallImage
?.
let
{
Glide
.
with
(
Mints
Application
.
getContext
()).
load
(
ad
.
imageUrl
).
into
(
it
)
}
}
return
convertView
}
...
...
@@ -556,7 +556,7 @@ class GroMoreCarrierExpressManager : TTSettingConfigCallback {
adViewHolder
.
mSource
?.
text
=
if
(
TextUtils
.
isEmpty
(
ad
.
source
))
"广告来源"
else
ad
.
source
val
icon
=
ad
.
iconUrl
if
(
icon
!=
null
)
{
adViewHolder
.
mIcon
?.
let
{
Glide
.
with
(
Wenshu
Application
.
getContext
()).
load
(
icon
).
into
(
it
)
}
adViewHolder
.
mIcon
?.
let
{
Glide
.
with
(
Mints
Application
.
getContext
()).
load
(
icon
).
into
(
it
)
}
}
val
adCreativeButton
:
Button
?
=
adViewHolder
.
mCreativeButton
when
(
ad
.
interactionType
)
{
...
...
app/src/main/java/com/mints/goodnews/ad/express/KsPreLoadExpressManager.kt
View file @
d8132e4b
...
...
@@ -13,7 +13,6 @@ import android.widget.TextView
import
com.bumptech.glide.Glide
import
com.kwad.sdk.api.*
import
com.kwad.sdk.api.KsNativeAd.VideoPlayListener
import
com.mingshu.goldcow.ad.express.KSADLoadSuccessListener
import
com.mints.goodnews.MintsApplication
import
com.mints.goodnews.R
import
com.mints.goodnews.common.AppConfig
...
...
app/src/main/java/com/mints/goodnews/ad/express/PreLoadExpressManager.kt
View file @
d8132e4b
...
...
@@ -4,8 +4,8 @@ import android.annotation.SuppressLint
import
android.view.View
import
android.view.ViewGroup
import
android.widget.FrameLayout
import
com.min
gshu.goldcow
.ad.express.GroMoreExpressManager
import
com.min
gshu.goldcow
.ad.express.YlhPreLoadExpressManager
import
com.min
ts.goodnews
.ad.express.GroMoreExpressManager
import
com.min
ts.goodnews
.ad.express.YlhPreLoadExpressManager
import
com.mints.goodnews.MintsApplication
import
com.mints.goodnews.common.AppConfig
import
com.mints.goodnews.common.Constant
...
...
app/src/main/java/com/mints/goodnews/ad/video/YlhVideoAdManager.java
View file @
d8132e4b
...
...
@@ -99,6 +99,11 @@ public class YlhVideoAdManager extends BaseVideoAd {
}
@Override
public
void
onReward
(
Map
<
String
,
Object
>
map
)
{
}
@Override
public
void
onADClick
()
{
//激励视频广告被点击
if
(
AppConfig
.
needReportClickAdEvent
)
{
...
...
@@ -147,10 +152,6 @@ public class YlhVideoAdManager extends BaseVideoAd {
}
}
@Override
public
void
onReward
()
{
}
});
rewardVideoAD
.
loadAD
();
...
...
app/src/main/java/com/mints/goodnews/manager/TTGroMoreAdManagerHolder.java
View file @
d8132e4b
...
...
@@ -9,6 +9,7 @@ import com.bytedance.msdk.api.TTAdConfig;
import
com.bytedance.msdk.api.TTAdConstant
;
import
com.bytedance.msdk.api.TTMediationAdSdk
;
import
com.bytedance.msdk.api.UserInfoForSegment
;
import
com.mints.goodnews.BuildConfig
;
import
com.mints.goodnews.MintsApplication
;
import
com.mints.goodnews.common.Constant
;
import
com.mints.library.utils.CommonUtils
;
...
...
app/src/main/java/com/mints/goodnews/manager/YlVideoManager.kt
0 → 100644
View file @
d8132e4b
package
com.mints.goodnews.manager
import
android.app.Application
import
com.yilan.sdk.ui.YLUIInit
import
com.yilan.sdk.ui.configs.CommentConfig
import
com.yilan.sdk.ui.configs.FeedConfig
import
com.yilan.sdk.ui.configs.YLUIConfig
/**
* 描述:一览视频(好兔)
* 作者:孟崔广
*/
object
YlVideoManager
{
private
const
val
ACCESSKEY
=
"yl1q5rcjsb05"
private
const
val
ACCESSTOKEN
=
"9qitn62coocwcjjwhs95re24poaf9q7j"
fun
init
(
application
:
Application
)
{
YLUIInit
.
getInstance
()
.
setCrashOpen
(
false
)
.
setApplication
(
application
)
.
setAccessKey
(
ACCESSKEY
)
.
setAccessToken
(
ACCESSTOKEN
)
.
build
()
//页面个性化配置
YLUIConfig
.
getInstance
()
//抖音样式小视频配置
.
littleLikeShow
(
true
)
//是否显示点赞
.
littleShareShow
(
false
)
//是否显示分享
.
littleShowGuide
(
true
)
//是否显示新手引导滑动浮层(第一次安装进入显示)
.
littleComment
(
CommentConfig
.
CommentType
.
DISMISS_COMMENT
)
//评论,参数详见文档;
//feed流短视频样式配置
.
videoComment
(
CommentConfig
.
CommentType
.
DISMISS_COMMENT
)
//评论,参数详见文档;
.
videoLikeShow
(
false
)
//是否显示点赞
.
videoShareShow
(
false
)
//是否显示分享
.
followAvailable
(
false
)
//关注功能是否可用
.
feedAvatarClickable
(
true
)
//头像是否支持点击跳转到作者页面
.
feedPlayAuto
(
true
)
//feed自动播放
.
feedSwipeRefreshEnable
(
true
)
//feed是否可以下拉刷新
FeedConfig
.
getInstance
().
playerStyle
=
FeedConfig
.
STYLE_FEED_PLAY
//FeedConfig.STYLE_FEED_PLAY当前页面播放
}
}
\ No newline at end of file
app/src/main/java/com/mints/goodnews/mvp/model/FlowAdRulesBean.java
View file @
d8132e4b
...
...
@@ -10,6 +10,7 @@ public class FlowAdRulesBean implements Serializable {
private
int
YLH
;
private
int
KS
;
private
int
CSJ
;
private
int
GROMORE
;
public
int
getYLH
()
{
return
YLH
;
...
...
@@ -22,4 +23,8 @@ public class FlowAdRulesBean implements Serializable {
public
int
getCSJ
()
{
return
CSJ
;
}
public
int
getGROMORE
()
{
return
GROMORE
;
}
}
app/src/main/java/com/mints/goodnews/ui/adapter/KylPageAdapter.kt
View file @
d8132e4b
...
...
@@ -170,10 +170,13 @@ class KylPageAdapter(val kylPageList: MutableList<KylBean.Data>) :
val
ttAdDislike
=
ad
.
getDislikeDialog
(
context
as
Activity
?)
if
(
ttAdDislike
!=
null
)
{
ad
.
getDislikeDialog
(
context
as
Activity
?).
setDislikeInteractionCallback
(
object
:
DislikeInteractionCallback
{
override
fun
onSelected
(
p
osition
:
Int
,
value
:
String
)
{
override
fun
onSelected
(
p
0
:
Int
,
p1
:
String
?,
p2
:
Boolean
)
{
}
override
fun
onCancel
()
{}
override
fun
onRefuse
()
{}
override
fun
onShow
()
{
}
})
}
dislike
.
setOnClickListener
{
ttAdDislike
!!
.
showDislikeDialog
()
}
...
...
app/src/main/java/com/mints/goodnews/ui/fragment/HorizonChannelFragment.kt
View file @
d8132e4b
...
...
@@ -13,7 +13,6 @@ import androidx.fragment.app.FragmentTransaction
import
com.daimajia.androidanimations.library.Techniques
import
com.daimajia.androidanimations.library.YoYo
import
com.kwad.sdk.api.KsAdSDK
import
com.kwad.sdk.api.KsContentPage
import
com.kwad.sdk.api.KsScene
import
com.mints.goodnews.MintsApplication
import
com.mints.goodnews.R
...
...
@@ -41,6 +40,10 @@ import com.mints.goodnews.ui.widgets.seekbar.BubbleUtils
import
com.mints.goodnews.utils.LogUtil
import
com.mints.goodnews.utils.TimeRender
import
com.mints.library.utils.CommonUtils
import
com.yilan.sdk.player.ylplayer.YLPlayerConfig
import
com.yilan.sdk.player.ylplayer.callback.OnPlayerCallBack
import
com.yilan.sdk.ui.configs.YLUIConfig
import
com.yilan.sdk.ui.little.YLLittleVideoFragment
import
kotlinx.android.synthetic.main.layout_red_bag.*
import
kotlinx.android.synthetic.main.layout_red_box.*
import
net.grandcentrix.tray.AppPreferences
...
...
@@ -58,13 +61,10 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis
private
val
ps
by
lazy
{
AppPreferences
(
context
)
}
// 快手视频相关
private
var
ksFragment
:
Fragment
?
=
null
private
var
mKsContentPage
:
KsContentPage
?
=
null
// 视频相关
private
var
rewardDoubleCoin
=
0
// 大金币
private
var
rewardCoin
=
0
// 小金币
private
var
littleVideoFragment
:
YLLittleVideoFragment
?
=
null
private
val
videoMaxCount
=
12
// 当前缓存视频id最大数
private
val
videoIdList
by
lazy
{
ArrayList
<
String
>()
}
//记录播放的视频id
...
...
@@ -82,7 +82,7 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis
private
var
mRedBoxCoin
=
0
private
var
mRedBoxCoinDouble
=
0
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
fragment_main_
first
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
fragment_main_
horiz
override
fun
initViewsAndEvents
()
{
horizChannelPresenter
.
attachView
(
this
)
...
...
@@ -93,7 +93,7 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis
}
override
fun
onHiddenChanged
(
hidden
:
Boolean
)
{
ks
Fragment
?.
onHiddenChanged
(
hidden
)
littleVideo
Fragment
?.
onHiddenChanged
(
hidden
)
if
(
hidden
)
{
onPause
()
...
...
@@ -119,8 +119,7 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis
}
}
registerPlayerCallBack
()
ksFragment
?.
onResume
()
littleVideoFragment
?.
onResume
()
}
}
...
...
@@ -133,7 +132,7 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis
pauseDownloadTime
()
destroyTimerRedbox
()
ks
Fragment
?.
onPause
()
littleVideo
Fragment
?.
onPause
()
if
(
isToCreateReward
)
{
// 防止界面切换 重置红包动画
...
...
@@ -146,7 +145,7 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis
override
fun
setUserVisibleHint
(
isVisibleToUser
:
Boolean
)
{
super
.
setUserVisibleHint
(
isVisibleToUser
)
ks
Fragment
?.
userVisibleHint
=
isVisibleToUser
littleVideo
Fragment
?.
userVisibleHint
=
isVisibleToUser
}
override
fun
onDestroyView
()
{
...
...
@@ -163,6 +162,8 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis
override
fun
onDestroy
()
{
super
.
onDestroy
()
// 广告回调解绑
YLUIConfig
.
getInstance
().
unRegisterAdListener
()
YLPlayerConfig
.
config
().
unRegisterPlayerCallback
()
horizChannelPresenter
.
detachView
()
}
...
...
@@ -236,100 +237,67 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis
}
/**
*
快手
视频初始化
*
一览
视频初始化
*/
private
fun
showLittle
()
{
val
adScene
=
KsScene
.
Builder
(
5746000026L
).
build
()
mKsContentPage
=
KsAdSDK
.
getLoadManager
().
loadContentPage
(
adScene
)
registerPlayerCallBack
()
val
transaction
:
FragmentTransaction
=
childFragmentManager
.
beginTransaction
()
if
(
ksFragment
==
null
)
{
ksFragment
=
mKsContentPage
?.
fragment
transaction
.
add
(
R
.
id
.
yilan_fragment_frame_container
,
ksFragment
!!
,
"ks_fragment"
)
val
transaction
:
FragmentTransaction
=
supportFragmentManager
.
beginTransaction
()
if
(
littleVideoFragment
==
null
)
{
littleVideoFragment
=
YLLittleVideoFragment
.
newInstance
()
transaction
.
add
(
R
.
id
.
yilan_fragment_frame_container_horic
,
littleVideoFragment
!!
,
YLLittleVideoFragment
::
class
.
java
.
simpleName
)
}
else
{
transaction
.
show
(
ks
Fragment
!!
)
transaction
.
show
(
littleVideo
Fragment
!!
)
}
transaction
.
commitAllowingStateLoss
()
}
registerPlayerCallBack
()
}
private
fun
registerPlayerCallBack
()
{
mKsContentPage
?.
let
{
it
.
setPageListener
(
object
:
KsContentPage
.
PageListener
{
override
fun
onPagePause
(
p0
:
KsContentPage
.
ContentItem
?)
{
LogUtil
.
d
(
"onPagePause"
)
YLPlayerConfig
.
config
().
registerPlayerCallBack
(
object
:
OnPlayerCallBack
{
override
fun
onStart
(
pager
:
String
,
videoid
:
String
,
p2
:
String
?)
{
// 防止网络异常时, 第一次加载倒计时红包
if
(
isFirstLoadVideo
)
{
isFirstLoadVideo
=
false
initTimeview
()
}
else
{
resumeDownloadTime
(
videoid
)
}
}
override
fun
onPageResume
(
p0
:
KsContentPage
.
ContentItem
?)
{
LogUtil
.
d
(
"onPageResume"
)
}
override
fun
onPageEnter
(
p0
:
KsContentPage
.
ContentItem
?)
{
LogUtil
.
d
(
"onPageEnter"
)
}
override
fun
onPageLeave
(
p0
:
KsContentPage
.
ContentItem
?)
{
LogUtil
.
d
(
"onPageLeave"
)
}
})
// 视频播放回调
it
.
setVideoListener
(
object
:
KsContentPage
.
VideoListener
{
override
fun
onVideoPlayCompleted
(
p0
:
KsContentPage
.
ContentItem
?)
{
LogUtil
.
d
(
"onVideoPlayCompleted"
)
addVideoIdList
(
p0
!!
.
id
)
pauseDownloadTime
()
}
override
fun
onVideoPlayPaused
(
p0
:
KsContentPage
.
ContentItem
?)
{
LogUtil
.
d
(
"onVideoPlayPaused"
)
pauseDownloadTime
()
}
override
fun
onPause
(
pager
:
String
,
p1
:
String
?,
p2
:
String
?)
{
pauseDownloadTime
()
}
override
fun
onVideoPlayStart
(
p0
:
KsContentPage
.
ContentItem
?)
{
LogUtil
.
d
(
"onVideoPlayStart"
)
override
fun
onResume
(
pager
:
String
,
videoid
:
String
,
p2
:
String
?)
{
resumeDownloadTime
(
videoid
)
}
// 防止网络异常时, 第一次加载倒计时红包
if
(
isFirstLoadVideo
)
{
isFirstLoadVideo
=
false
initTimeview
()
}
else
{
resumeDownloadTime
(
p0
!!
.
id
)
}
}
override
fun
onComplete
(
pager
:
String
,
videoid
:
String
,
p2
:
String
?)
{
override
fun
onVideoPlayError
(
p0
:
KsContentPage
.
ContentItem
?,
p1
:
Int
,
p2
:
Int
)
{
LogUtil
.
d
(
"onVideoPlayError"
)
}
override
fun
onLoopComplete
(
pager
:
String
?,
videoID
:
String
,
taskID
:
String
?,
num
:
Int
)
{
// LogUtil.d(TAG, "registerPlayerCallBack onLoopComplete")
addVideoIdList
(
videoID
)
pauseDownloadTime
()
}
pauseDownloadTime
()
}
override
fun
onStuckStart
(
pager
:
String
,
p1
:
String
?,
p2
:
String
?)
{
}
override
fun
onVideoPlayResume
(
p0
:
KsContentPage
.
ContentItem
?)
{
LogUtil
.
d
(
"onVideoPlayResume"
)
override
fun
onStuckEnd
(
pager
:
String
,
p1
:
String
?,
p2
:
String
?)
{
}
// 防止网络异常时, 第一次加载倒计时红包
if
(
isFirstLoadVideo
)
{
isFirstLoadVideo
=
false
initTimeview
()
}
else
{
resumeDownloadTime
(
p0
!!
.
id
)
}
}
override
fun
onError
(
pager
:
String
,
p1
:
String
?,
p2
:
String
?)
{
})
pauseDownloadTime
()
}
}
override
fun
onStop
(
pager
:
String
,
p1
:
String
?,
p2
:
String
?)
{
// LogUtil.d(TAG, "registerPlayerCallBack onStop")
// pauseDownloadTime()
}
})
}
private
fun
initListener
()
{
...
...
app/src/main/java/com/mints/goodnews/ui/fragment/MainFragment.kt
View file @
d8132e4b
...
...
@@ -14,7 +14,6 @@ import com.daimajia.androidanimations.library.Techniques
import
com.daimajia.androidanimations.library.YoYo
import
com.daimajia.androidanimations.library.YoYo.YoYoString
import
com.kwad.sdk.api.KsAdSDK
import
com.kwad.sdk.api.KsContentPage
import
com.kwad.sdk.api.KsScene
import
com.mints.goodnews.MintsApplication
import
com.mints.goodnews.R
...
...
@@ -184,6 +183,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener {
private
fun
initExpress
(
flowAdRules
:
FlowAdRulesBean
)
{
PreLoadExpressManager
.
init
(
flowAdRules
.
csj
,
flowAdRules
.
ylh
,
flowAdRules
.
ks
)
PreLoadExpressManager
.
init
(
flowAdRules
.
csj
,
flowAdRules
.
ylh
,
flowAdRules
.
ks
,
flowAdRules
.
gromore
)
}
}
\ No newline at end of file
app/src/main/java/com/mints/goodnews/ui/fragment/MyFragment.kt
View file @
d8132e4b
...
...
@@ -1207,7 +1207,7 @@ class MyFragment : BaseFragment(),
}
private
fun
initExpress
(
flowAdRules
:
FlowAdRulesBean
)
{
PreLoadExpressManager
.
init
(
flowAdRules
.
csj
,
flowAdRules
.
ylh
,
flowAdRules
.
ks
)
PreLoadExpressManager
.
init
(
flowAdRules
.
csj
,
flowAdRules
.
ylh
,
flowAdRules
.
ks
,
flowAdRules
.
gromore
)
}
/**
...
...
app/src/main/res/layout/fragment_main_horiz.xml
0 → 100644
View file @
d8132e4b
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<FrameLayout
android:id=
"@+id/yilan_fragment_frame_container_horic"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
<include
layout=
"@layout/layout_red_bag"
/>
<include
layout=
"@layout/layout_red_box"
/>
</FrameLayout>
\ No newline at end of file
build.gradle
View file @
d8132e4b
...
...
@@ -5,7 +5,13 @@ buildscript {
google
()
jcenter
()
maven
{
url
"https://jitpack.io"
}
//添加一览视频 maven地址
maven
{
url
'http://nexus.1lan.tv/repository/maven-releases/'
}
maven
{
url
'http://maven.aliyun.com/nexus/content/repositories/releases/'
}
}
dependencies
{
classpath
'com.android.tools.build:gradle:4.0.1'
...
...
@@ -18,7 +24,13 @@ allprojects {
google
()
jcenter
()
maven
{
url
"https://jitpack.io"
}
//添加一览 maven地址
maven
{
url
'http://nexus.1lan.tv/repository/maven-releases/'
}
maven
{
url
'http://maven.aliyun.com/nexus/content/repositories/releases/'
}
}
}
...
...
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