Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_vedio
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_vedio
Commits
dfb91e38
Commit
dfb91e38
authored
Jul 28, 2023
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加draw信息流及信息流广告
parent
d966e4f8
Changes
39
Hide whitespace changes
Inline
Side-by-side
Showing
39 changed files
with
3357 additions
and
1061 deletions
+3357
-1061
build.gradle
video/app/build.gradle
+2
-0
DrawExpressManager.kt
...in/java/com/mints/helivideo/ad/draw/DrawExpressManager.kt
+925
-0
ExpressManager.kt
...ain/java/com/mints/helivideo/ad/express/ExpressManager.kt
+915
-783
Constant.kt
.../app/src/main/java/com/mints/helivideo/common/Constant.kt
+3
-0
VideoMultiItemEntity.kt
...ava/com/mints/helivideo/mvp/model/VideoMultiItemEntity.kt
+14
-8
MainActivity.kt
...ain/java/com/mints/helivideo/ui/activitys/MainActivity.kt
+3
-0
RoundRectLayout.java
.../java/com/mints/helivideo/ui/widgets/RoundRectLayout.java
+134
-0
VideoEpisodeDialog.kt
...java/com/mints/helivideo/ui/widgets/VideoEpisodeDialog.kt
+9
-1
UIUtils.java
.../app/src/main/java/com/mints/helivideo/utils/UIUtils.java
+1
-1
DramaApiDetailActivity.kt
.../java/com/mints/helivideo/video/DramaApiDetailActivity.kt
+32
-2
TxVideoActivity.kt
...rc/main/java/com/mints/helivideo/video/TxVideoActivity.kt
+60
-18
PlayerManager.java
...main/java/com/mints/helivideo/video/tx/PlayerManager.java
+15
-13
RecommendVideoView.java
...java/com/mints/helivideo/video/tx/RecommendVideoView.java
+71
-49
SuperShortVideoView.java
...ava/com/mints/helivideo/video/tx/SuperShortVideoView.java
+59
-35
TXVideoBaseView.java
...in/java/com/mints/helivideo/video/tx/TXVideoBaseView.java
+15
-7
TXVodPlayerWrapper.java
...java/com/mints/helivideo/video/tx/TXVodPlayerWrapper.java
+1
-1
TxVideoFragment.kt
...main/java/com/mints/helivideo/video/tx/TxVideoFragment.kt
+17
-17
ShortVideoPlayAdapter.java
...nts/helivideo/video/tx/adapter/ShortVideoPlayAdapter.java
+0
-75
TxRecommendVideo2Adapter.kt
...ts/helivideo/video/tx/adapter/TxRecommendVideo2Adapter.kt
+191
-0
TxRecommendVideoAdapter.kt
...nts/helivideo/video/tx/adapter/TxRecommendVideoAdapter.kt
+0
-3
TxVideoAdapter.kt
...va/com/mints/helivideo/video/tx/adapter/TxVideoAdapter.kt
+92
-41
dislike_icon.png
video/app/src/main/res/drawable-xhdpi/dislike_icon.png
+0
-0
tt_mute.png
video/app/src/main/res/drawable-xhdpi/tt_mute.png
+0
-0
btn_bg_blue.xml
video/app/src/main/res/drawable/btn_bg_blue.xml
+7
-0
btn_bg_red.xml
video/app/src/main/res/drawable/btn_bg_red.xml
+7
-0
mediation_btn_bg_creative.xml
...o/app/src/main/res/drawable/mediation_btn_bg_creative.xml
+7
-0
tt_ad_cover_btn_begin_bg.xml
video/app/src/main/res/drawable/tt_ad_cover_btn_begin_bg.xml
+17
-0
drama_activity_api_detail.xml
video/app/src/main/res/layout/drama_activity_api_detail.xml
+9
-0
item_block_view.xml
video/app/src/main/res/layout/item_block_view.xml
+17
-6
item_draw_ad.xml
video/app/src/main/res/layout/item_draw_ad.xml
+14
-0
mediation_listitem_ad_download_btn_layout.xml
.../res/layout/mediation_listitem_ad_download_btn_layout.xml
+31
-0
mediation_listitem_ad_group_pic.xml
...p/src/main/res/layout/mediation_listitem_ad_group_pic.xml
+102
-0
mediation_listitem_ad_icon_source_layout.xml
...n/res/layout/mediation_listitem_ad_icon_source_layout.xml
+59
-0
mediation_listitem_ad_large_pic.xml
...p/src/main/res/layout/mediation_listitem_ad_large_pic.xml
+56
-0
mediation_listitem_ad_large_video.xml
...src/main/res/layout/mediation_listitem_ad_large_video.xml
+58
-0
mediation_listitem_ad_small_pic.xml
...p/src/main/res/layout/mediation_listitem_ad_small_pic.xml
+112
-0
mediation_listitem_ad_title_creative_btn_layout.xml
...ayout/mediation_listitem_ad_title_creative_btn_layout.xml
+121
-0
mediation_listitem_ad_vertical_pic.xml
...rc/main/res/layout/mediation_listitem_ad_vertical_pic.xml
+179
-0
gradle.properties
video/gradle.properties
+2
-1
No files found.
video/app/build.gradle
View file @
dfb91e38
...
@@ -64,6 +64,7 @@ android {
...
@@ -64,6 +64,7 @@ android {
buildConfigField
"String"
,
"GROMORE_APP_ID"
,
GROMORE_APP_ID
buildConfigField
"String"
,
"GROMORE_APP_ID"
,
GROMORE_APP_ID
buildConfigField
"String"
,
"GROMORE_SPLASH_CODE"
,
GROMORE_SPLASH_CODE
buildConfigField
"String"
,
"GROMORE_SPLASH_CODE"
,
GROMORE_SPLASH_CODE
buildConfigField
"String"
,
"GROMORE_VIDEO_CODE"
,
GROMORE_VIDEO_CODE
buildConfigField
"String"
,
"GROMORE_VIDEO_CODE"
,
GROMORE_VIDEO_CODE
buildConfigField
"String"
,
"GROMORE_DRAW_CODE"
,
GROMORE_DRAW_CODE
buildConfigField
"String"
,
"GROMORE_EXPRESS_CODE"
,
GROMORE_EXPRESS_CODE
buildConfigField
"String"
,
"GROMORE_EXPRESS_CODE"
,
GROMORE_EXPRESS_CODE
buildConfigField
"String"
,
"WEIXIN_APP_PAY_ID"
,
WEIXIN_APP_PAY_ID
buildConfigField
"String"
,
"WEIXIN_APP_PAY_ID"
,
WEIXIN_APP_PAY_ID
...
@@ -84,6 +85,7 @@ android {
...
@@ -84,6 +85,7 @@ android {
buildConfigField
"String"
,
"GROMORE_APP_ID"
,
GROMORE_APP_ID
buildConfigField
"String"
,
"GROMORE_APP_ID"
,
GROMORE_APP_ID
buildConfigField
"String"
,
"GROMORE_SPLASH_CODE"
,
GROMORE_SPLASH_CODE
buildConfigField
"String"
,
"GROMORE_SPLASH_CODE"
,
GROMORE_SPLASH_CODE
buildConfigField
"String"
,
"GROMORE_VIDEO_CODE"
,
GROMORE_VIDEO_CODE
buildConfigField
"String"
,
"GROMORE_VIDEO_CODE"
,
GROMORE_VIDEO_CODE
buildConfigField
"String"
,
"GROMORE_DRAW_CODE"
,
GROMORE_DRAW_CODE
buildConfigField
"String"
,
"GROMORE_EXPRESS_CODE"
,
GROMORE_EXPRESS_CODE
buildConfigField
"String"
,
"GROMORE_EXPRESS_CODE"
,
GROMORE_EXPRESS_CODE
buildConfigField
"String"
,
"WEIXIN_APP_PAY_ID"
,
WEIXIN_APP_PAY_ID
buildConfigField
"String"
,
"WEIXIN_APP_PAY_ID"
,
WEIXIN_APP_PAY_ID
...
...
video/app/src/main/java/com/mints/helivideo/ad/draw/DrawExpressManager.kt
0 → 100644
View file @
dfb91e38
package
com.mints.helivideo.ad.draw
import
android.net.Uri
import
android.text.TextUtils
import
android.util.Log
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
android.widget.*
import
com.bumptech.glide.Glide
import
com.bytedance.sdk.openadsdk.*
import
com.bytedance.sdk.openadsdk.mediation.ad.MediationExpressRenderListener
import
com.bytedance.sdk.openadsdk.mediation.ad.MediationViewBinder
import
com.mints.helivideo.BuildConfig
import
com.mints.helivideo.MintsApplication
import
com.mints.helivideo.R
import
com.mints.helivideo.ad.AdManager
import
com.mints.helivideo.ad.express.ExpressAdCallback
import
com.mints.helivideo.utils.ForegroundOrBackground
import
com.mints.helivideo.utils.LogUtil
import
com.mints.helivideo.utils.TimeRender
import
com.mints.helivideo.utils.UIUtils
import
java.lang.Exception
import
java.util.*
private
val
TAG
=
DrawExpressManager
::
class
.
java
.
simpleName
/**
* 信息流
*/
class
DrawExpressManager
{
companion
object
{
val
instance
:
DrawExpressManager
by
lazy
(
mode
=
LazyThreadSafetyMode
.
SYNCHRONIZED
)
{
DrawExpressManager
()
}
}
private
var
viewCache
=
Stack
<
FrameLayout
>()
private
var
adShowTime
:
Long
=
0
// 防止预加载超时 2秒
private
var
isShowAd
=
false
// 广告是否展示
private
var
frameLayout
:
FrameLayout
?
=
null
private
var
expressId
:
String
=
""
private
var
isClickScreen
=
true
// 是否点击屏幕跳转广告
private
val
adLoadTime
:
Long
=
0
// 广告展示时间,45分钟后当前广告失效,重新预加载广告
private
var
adPreingTime
:
Long
=
0
// 防止预加载超时 2分钟
private
var
isLoadSuccess
=
0
//0-加载失败/未加载 1-加载中 2-加载成功
private
var
mExpressAdCallback
:
ExpressAdCallback
?
=
null
// 载体
private
var
adcode
=
""
private
var
ecpm
=
""
private
var
adSource
=
""
private
var
mTTFeedAd
:
TTFeedAd
?
=
null
fun
getAdIsLoadSuc
():
Boolean
{
val
isOversped
=
TimeRender
.
isOverspedMin
(
adLoadTime
,
AdManager
.
AD_NO_SHOWTIME_OUT
)
return
isLoadSuccess
==
2
&&
!
isOversped
}
fun
preLoadAd
()
{
val
isOversped
=
TimeRender
.
isOverspedMin
(
adLoadTime
,
AdManager
.
AD_NO_SHOWTIME_OUT
)
val
isPreingOversped
=
TimeRender
.
isOverspedMin
(
adPreingTime
,
AdManager
.
AD_REQUEST_TIME_OUT
)
LogUtil
.
d
(
TAG
,
"gromore draw信息流--> 1、进入预加载 isLoadSuccess=$isLoadSuccess isOversped=$isOversped isPreingOversped=$isPreingOversped"
)
if
((
isLoadSuccess
==
0
// 加载失败
||
adLoadTime
>
0
&&
isOversped
// 超过45分钟
||
adPreingTime
>
0
&&
isPreingOversped
&&
isLoadSuccess
==
1
)
// 预加载超时
)
{
LogUtil
.
d
(
TAG
,
"gromore draw信息流--> 2、执行预加载去了=$isLoadSuccess"
)
adPreingTime
=
System
.
currentTimeMillis
()
isLoadSuccess
=
1
// 销毁及移除事件
// destroy()
this
.
frameLayout
=
FrameLayout
(
MintsApplication
.
getContext
())
loadAd
()
}
}
private
fun
loadAd
()
{
isClickScreen
=
true
expressId
=
BuildConfig
.
GROMORE_DRAW_CODE
val
activity
=
ForegroundOrBackground
.
getTopActivity
()
val
adNativeLoader
=
TTAdSdk
.
getAdManager
().
createAdNative
(
activity
)
val
adslot
=
AdSlot
.
Builder
()
.
setCodeId
(
BuildConfig
.
GROMORE_DRAW_CODE
)
/**
* 注:
* 1:单位为px
* 2:如果是信息流自渲染广告,设置广告图片期望的图片宽高 ,不能为0
* 2:如果是信息流模板广告,宽度设置为希望的宽度,高度设置为0(0为高度选择自适应参数)
*/
.
setImageAcceptedSize
(
UIUtils
.
getScreenWidth
(
activity
),
UIUtils
.
getScreenHeight
(
activity
)
)
.
setAdCount
(
1
)
//请求广告数量为1到3条 (优先采用平台配置的数量)
.
build
()
adNativeLoader
.
loadDrawFeedAd
(
adslot
,
object
:
TTAdNative
.
DrawFeedAdListener
{
override
fun
onError
(
p0
:
Int
,
p1
:
String
?)
{
LogUtil
.
e
(
TAG
,
"greenroom draw信息流--> 3、load feed ad error : $p0, $p1"
)
isLoadSuccess
=
0
}
override
fun
onDrawFeedAdLoad
(
ads
:
MutableList
<
TTDrawFeedAd
>?)
{
LogUtil
.
d
(
TAG
,
"gromore draw信息流--> 3、Gromore onAdLoaded expressId=${expressId} "
)
ads
?.
let
{
if
(
it
.
isEmpty
())
{
isLoadSuccess
=
0
return
}
if
(
it
.
size
>
0
)
{
mTTFeedAd
=
it
[
0
]
isLoadSuccess
=
2
showAd
()
}
}
}
})
}
private
fun
showAd
()
{
mTTFeedAd
?.
let
{
if
(
it
.
mediationManager
.
isExpress
)
{
//--------------信息流模板广告渲染----------------
showExpressView
(
it
)
}
else
{
//--------------信息流自渲染广告渲染----------------
// val view: View? = when (it.imageMode) {
// TTAdConstant.IMAGE_MODE_SMALL_IMG -> getSmallAdView(frameLayout)//信息流自渲染广告渲染 :小图广告
// TTAdConstant.IMAGE_MODE_LARGE_IMG -> getLargeAdView(frameLayout)//信息流自渲染广告渲染 :大图广告
// TTAdConstant.IMAGE_MODE_GROUP_IMG -> getGroupAdView(frameLayout)//信息流自渲染广告渲染 :组图广告
// TTAdConstant.IMAGE_MODE_VIDEO -> getVideoView(frameLayout)//信息流自渲染广告渲染 :视频广告
// TTAdConstant.IMAGE_MODE_VERTICAL_IMG -> getVerticalAdView(frameLayout)//信息流自渲染广告渲染 :竖图广告
// TTAdConstant.IMAGE_MODE_VIDEO_VERTICAL -> getVideoView(frameLayout)//信息流自渲染广告渲染 :竖版视频广告
// else -> {
// Log.i(TAG, "展示样式错误")
// null
// }
// }
// view?.let { it2 ->
// it2.layoutParams = ViewGroup.LayoutParams(
// ViewGroup.LayoutParams.MATCH_PARENT,
// ViewGroup.LayoutParams.MATCH_PARENT
// )
// frameLayout?.removeAllViews()
// frameLayout?.addView(it2)
// viewCache.add(frameLayout?.getChildAt(0))
// }
}
}
}
fun
getAdView
(
callback
:
ExpressAdCallback
?)
{
val
isOversped
=
TimeRender
.
isOverspedMin
(
adLoadTime
,
AdManager
.
AD_NO_SHOWTIME_OUT
)
// 若上一个广告还在加载中则返回
if
(
isLoadSuccess
==
1
)
{
this
.
mExpressAdCallback
=
callback
LogUtil
.
e
(
TAG
,
"gromore draw信息流--> 3.9、广告加载中 LoadSuccess = $isLoadSuccess"
)
return
}
this
.
mExpressAdCallback
=
null
if
(
isLoadSuccess
==
2
&&
!
isOversped
)
{
LogUtil
.
d
(
TAG
,
"gromore draw信息流--> 4、展示广告 LoadSuccess=$isLoadSuccess isOversped=$isOversped"
)
isShowAd
=
true
adShowTime
=
System
.
currentTimeMillis
()
isLoadSuccess
=
0
isClickScreen
=
true
callback
?.
loadSuccess
(
frameLayout
)
// callback?.loadSuccess(viewCache.lastElement())
}
else
{
LogUtil
.
e
(
TAG
,
"gromore draw信息流--> 5、展示广告时失败了,广告可能超时45分钟 onError "
)
// 状态重置
isLoadSuccess
=
0
callback
?.
loadFail
()
}
}
private
fun
showExpressView
(
it
:
TTFeedAd
)
{
it
.
setExpressRenderListener
(
object
:
MediationExpressRenderListener
{
override
fun
onRenderSuccess
(
p0
:
View
?,
p1
:
Float
,
p2
:
Float
,
p3
:
Boolean
)
{
Log
.
i
(
TAG
,
"onRenderSuccess"
)
it
.
setDislikeCallback
(
ForegroundOrBackground
.
getTopActivity
(),
object
:
TTAdDislike
.
DislikeInteractionCallback
{
override
fun
onShow
()
{
Log
.
i
(
TAG
,
"express dislike 点击show"
)
}
override
fun
onSelected
(
position
:
Int
,
value
:
String
?,
enforce
:
Boolean
)
{
Log
.
i
(
TAG
,
"express 点击 $value"
)
}
override
fun
onCancel
()
{
Log
.
i
(
TAG
,
"express dislike 点击了取消"
)
}
})
it
.
adView
?.
let
{
view
->
if
(
view
.
parent
!=
null
)
{
(
view
.
parent
as
ViewGroup
).
removeView
(
view
)
}
frameLayout
?.
addView
(
view
)
// val view: FrameLayout = frameLayout!!
// val frameLayout = FrameLayout(MintsApplication.getContext())
// frameLayout.addView(view)
// viewCache.add(frameLayout)
}
}
override
fun
onRenderFail
(
p0
:
View
?,
p1
:
String
?,
p2
:
Int
)
{
Log
.
i
(
TAG
,
"onRenderFail"
)
}
override
fun
onAdClick
()
{
Log
.
i
(
TAG
,
"onAdClick"
)
}
override
fun
onAdShow
()
{
Log
.
i
(
TAG
,
"onAdShow"
)
Log
.
i
(
TAG
,
"ad mediaExtraInfo ${it.mediaExtraInfo}"
)
}
})
it
.
render
()
//必须要调用render方法进行渲染,在onRenderSuccess中处理模板的view
}
/**
* 销毁
*/
fun
destroy
()
{
frameLayout
?.
removeAllViews
()
frameLayout
=
null
// 数据重置
adcode
=
""
ecpm
=
""
adSource
=
""
mTTFeedAd
?.
destroy
()
this
.
mExpressAdCallback
=
null
}
private
fun
getSmallAdView
(
parent
:
ViewGroup
?):
View
?
{
val
convertView
=
LayoutInflater
.
from
(
ForegroundOrBackground
.
getTopActivity
())
.
inflate
(
R
.
layout
.
mediation_listitem_ad_small_pic
,
parent
,
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
adViewHolder
.
mDescription
=
convertView
.
findViewById
<
View
>(
R
.
id
.
tv_listitem_ad_desc
)
as
TextView
adViewHolder
.
mSmallImage
=
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_image
)
as
ImageView
adViewHolder
.
mIcon
=
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_icon
)
as
ImageView
adViewHolder
.
mDislike
=
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_dislike
)
as
ImageView
adViewHolder
.
mCreativeButton
=
convertView
.
findViewById
<
View
>(
R
.
id
.
btn_listitem_creative
)
as
Button
adViewHolder
.
app_info
=
convertView
.
findViewById
<
LinearLayout
>(
R
.
id
.
app_info
)
adViewHolder
.
app_name
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
app_name
)
adViewHolder
.
author_name
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
author_name
)
adViewHolder
.
package_size
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
package_size
)
adViewHolder
.
permissions_url
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
permissions_url
)
adViewHolder
.
permissions_content
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
permissions_content
)
adViewHolder
.
privacy_agreement
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
privacy_agreement
)
adViewHolder
.
version_name
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
version_name
)
val
viewBinder
=
MediationViewBinder
.
Builder
(
R
.
layout
.
mediation_listitem_ad_small_pic
)
.
titleId
(
R
.
id
.
tv_listitem_ad_title
)
.
sourceId
(
R
.
id
.
tv_listitem_ad_source
).
descriptionTextId
(
R
.
id
.
tv_listitem_ad_desc
)
.
mainImageId
(
R
.
id
.
iv_listitem_image
)
.
logoLayoutId
(
R
.
id
.
tt_ad_logo
)
.
callToActionId
(
R
.
id
.
btn_listitem_creative
)
.
iconImageId
(
R
.
id
.
iv_listitem_icon
).
build
()
adViewHolder
.
viewBinder
=
viewBinder
bindData
(
convertView
,
adViewHolder
)
if
(
mTTFeedAd
?.
imageList
?.
size
!=
0
)
{
mTTFeedAd
?.
let
{
ttfeedad
->
ttfeedad
.
imageList
[
0
]
?.
imageUrl
?.
let
{
Glide
.
with
(
ForegroundOrBackground
.
getTopActivity
()).
load
(
it
)
.
into
(
adViewHolder
.
mSmallImage
!!
)
}
}
}
return
convertView
;
}
private
fun
getLargeAdView
(
parent
:
ViewGroup
?):
View
{
val
adViewHolder
=
LargeAdViewHolder
()
var
convertView
:
View
=
LayoutInflater
.
from
(
ForegroundOrBackground
.
getTopActivity
())
.
inflate
(
R
.
layout
.
mediation_listitem_ad_large_pic
,
parent
,
false
)
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
adViewHolder
.
mSource
=
convertView
.
findViewById
<
View
>(
R
.
id
.
tv_listitem_ad_source
)
as
TextView
adViewHolder
.
mLargeImage
=
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_image
)
as
ImageView
adViewHolder
.
mIcon
=
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_icon
)
as
ImageView
adViewHolder
.
mDislike
=
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_dislike
)
as
ImageView
adViewHolder
.
mCreativeButton
=
convertView
.
findViewById
<
View
>(
R
.
id
.
btn_listitem_creative
)
as
Button
adViewHolder
.
mLogo
=
convertView
.
findViewById
<
RelativeLayout
>(
R
.
id
.
tt_ad_logo
)
//logoView 建议传入GroupView类型
adViewHolder
.
app_info
=
convertView
.
findViewById
<
LinearLayout
>(
R
.
id
.
app_info
)
adViewHolder
.
app_name
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
app_name
)
adViewHolder
.
author_name
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
author_name
)
adViewHolder
.
package_size
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
package_size
)
adViewHolder
.
permissions_url
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
permissions_url
)
adViewHolder
.
permissions_content
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
permissions_content
)
adViewHolder
.
privacy_agreement
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
privacy_agreement
)
adViewHolder
.
version_name
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
version_name
)
val
viewBinder
=
MediationViewBinder
.
Builder
(
R
.
layout
.
mediation_listitem_ad_large_pic
)
.
titleId
(
R
.
id
.
tv_listitem_ad_title
)
.
descriptionTextId
(
R
.
id
.
tv_listitem_ad_desc
).
sourceId
(
R
.
id
.
tv_listitem_ad_source
)
.
mainImageId
(
R
.
id
.
iv_listitem_image
)
.
callToActionId
(
R
.
id
.
btn_listitem_creative
)
.
logoLayoutId
(
R
.
id
.
tt_ad_logo
)
.
iconImageId
(
R
.
id
.
iv_listitem_icon
).
build
()
adViewHolder
.
viewBinder
=
viewBinder
bindData
(
convertView
,
adViewHolder
)
if
(
mTTFeedAd
?.
imageList
?.
size
!=
0
)
{
mTTFeedAd
?.
let
{
ttfeedad
->
ttfeedad
.
imageList
[
0
]
?.
imageUrl
?.
let
{
Glide
.
with
(
ForegroundOrBackground
.
getTopActivity
()).
load
(
it
)
.
into
(
adViewHolder
.
mLargeImage
!!
)
}
}
}
return
convertView
}
private
fun
getGroupAdView
(
parent
:
ViewGroup
?):
View
?
{
val
adViewHolder
=
GroupAdViewHolder
()
var
convertView
:
View
=
LayoutInflater
.
from
(
ForegroundOrBackground
.
getTopActivity
())
.
inflate
(
R
.
layout
.
mediation_listitem_ad_group_pic
,
parent
,
false
)
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
adViewHolder
.
mDescription
=
convertView
.
findViewById
<
View
>(
R
.
id
.
tv_listitem_ad_desc
)
as
TextView
adViewHolder
.
mGroupImage1
=
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_image1
)
as
ImageView
adViewHolder
.
mGroupImage2
=
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_image2
)
as
ImageView
adViewHolder
.
mGroupImage3
=
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_image3
)
as
ImageView
adViewHolder
.
mIcon
=
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_icon
)
as
ImageView
adViewHolder
.
mDislike
=
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_dislike
)
as
ImageView
adViewHolder
.
mCreativeButton
=
convertView
.
findViewById
<
View
>(
R
.
id
.
btn_listitem_creative
)
as
Button
adViewHolder
.
mLogo
=
convertView
.
findViewById
<
RelativeLayout
>(
R
.
id
.
tt_ad_logo
)
//logoView 建议传入GroupView类型
adViewHolder
.
app_info
=
convertView
.
findViewById
<
LinearLayout
>(
R
.
id
.
app_info
)
adViewHolder
.
app_name
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
app_name
)
adViewHolder
.
author_name
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
author_name
)
adViewHolder
.
package_size
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
package_size
)
adViewHolder
.
permissions_url
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
permissions_url
)
adViewHolder
.
permissions_content
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
permissions_content
)
adViewHolder
.
privacy_agreement
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
privacy_agreement
)
adViewHolder
.
version_name
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
version_name
)
val
viewBinder
=
MediationViewBinder
.
Builder
(
R
.
layout
.
mediation_listitem_ad_group_pic
)
.
titleId
(
R
.
id
.
tv_listitem_ad_title
)
.
descriptionTextId
(
R
.
id
.
tv_listitem_ad_desc
).
sourceId
(
R
.
id
.
tv_listitem_ad_source
)
.
mainImageId
(
R
.
id
.
iv_listitem_image1
)
.
logoLayoutId
(
R
.
id
.
tt_ad_logo
).
callToActionId
(
R
.
id
.
btn_listitem_creative
).
iconImageId
(
R
.
id
.
iv_listitem_icon
)
.
groupImage1Id
(
R
.
id
.
iv_listitem_image1
).
groupImage2Id
(
R
.
id
.
iv_listitem_image2
)
.
groupImage3Id
(
R
.
id
.
iv_listitem_image3
).
build
()
adViewHolder
.
viewBinder
=
viewBinder
bindData
(
convertView
,
adViewHolder
)
if
(
mTTFeedAd
?.
imageList
?.
size
?:
0
>=
3
)
{
val
image1
:
String
?
=
mTTFeedAd
?.
imageList
?.
get
(
0
)
?.
imageUrl
val
image2
:
String
?
=
mTTFeedAd
?.
imageList
?.
get
(
1
)
?.
imageUrl
val
image3
:
String
?
=
mTTFeedAd
?.
imageList
?.
get
(
2
)
?.
imageUrl
if
(
image1
!=
null
)
{
Glide
.
with
(
ForegroundOrBackground
.
getTopActivity
()).
load
(
image1
)
.
into
(
adViewHolder
.
mGroupImage1
!!
)
}
if
(
image2
!=
null
)
{
Glide
.
with
(
ForegroundOrBackground
.
getTopActivity
()).
load
(
image2
)
.
into
(
adViewHolder
.
mGroupImage2
!!
)
}
if
(
image3
!=
null
)
{
Glide
.
with
(
ForegroundOrBackground
.
getTopActivity
()).
load
(
image3
)
.
into
(
adViewHolder
.
mGroupImage3
!!
)
}
}
return
convertView
}
private
fun
getVideoView
(
parent
:
ViewGroup
?):
View
?
{
val
adViewHolder
=
VideoAdViewHolder
()
var
convertView
:
View
?
=
null
try
{
convertView
=
LayoutInflater
.
from
(
ForegroundOrBackground
.
getTopActivity
())
.
inflate
(
R
.
layout
.
mediation_listitem_ad_large_video
,
parent
,
false
)
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
adViewHolder
.
mSource
=
convertView
.
findViewById
<
View
>(
R
.
id
.
tv_listitem_ad_source
)
as
TextView
adViewHolder
.
videoView
=
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_video
)
as
FrameLayout
adViewHolder
.
mIcon
=
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_icon
)
as
ImageView
adViewHolder
.
mDislike
=
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_dislike
)
as
ImageView
adViewHolder
.
mCreativeButton
=
convertView
.
findViewById
<
View
>(
R
.
id
.
btn_listitem_creative
)
as
Button
adViewHolder
.
mLogo
=
convertView
.
findViewById
<
RelativeLayout
>(
R
.
id
.
tt_ad_logo
)
//logoView 建议传入GroupView类型
adViewHolder
.
app_info
=
convertView
.
findViewById
<
LinearLayout
>(
R
.
id
.
app_info
)
adViewHolder
.
app_name
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
app_name
)
adViewHolder
.
author_name
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
author_name
)
adViewHolder
.
package_size
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
package_size
)
adViewHolder
.
permissions_url
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
permissions_url
)
adViewHolder
.
permissions_content
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
permissions_content
)
adViewHolder
.
privacy_agreement
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
privacy_agreement
)
adViewHolder
.
version_name
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
version_name
)
val
viewBinder
=
MediationViewBinder
.
Builder
(
R
.
layout
.
mediation_listitem_ad_large_video
)
.
titleId
(
R
.
id
.
tv_listitem_ad_title
)
.
sourceId
(
R
.
id
.
tv_listitem_ad_source
)
.
descriptionTextId
(
R
.
id
.
tv_listitem_ad_desc
)
.
mediaViewIdId
(
R
.
id
.
iv_listitem_video
)
.
callToActionId
(
R
.
id
.
btn_listitem_creative
)
.
logoLayoutId
(
R
.
id
.
tt_ad_logo
)
.
iconImageId
(
R
.
id
.
iv_listitem_icon
).
build
()
adViewHolder
.
viewBinder
=
viewBinder
// 如果自己有需求进行视频播放操作,则按如下步骤进行。注意:不是所有adn都支持,因此需要进行判空操作。
// mTTFeedAd?.csjmAdInfo?.setUseCustomVideo(true) // 注意:要在registerView之前调用
val
videoUrl
:
String
?
=
mTTFeedAd
?.
customVideo
?.
videoUrl
// 注意:不是所有adn都支持,这里务必要进行判空操作
if
(!
TextUtils
.
isEmpty
(
videoUrl
))
{
// 如果通过getVideoUrl返回的url不是空,则自己处理视频播放操作,并通过reporter上报视频状态
playAdVideo
(
adViewHolder
.
videoView
as
FrameLayout
,
videoUrl
?:
""
)
}
else
{
// 注意:即使该adn支持返回url,但某次偶然原因返回的videoUrl为空,则仍然会用adn自己的视频播放作为兜底
}
//视频广告设置播放状态回调(可选)
mTTFeedAd
?.
setVideoAdListener
(
object
:
TTFeedAd
.
VideoAdListener
{
override
fun
onVideoLoad
(
ad
:
TTFeedAd
?)
{
Log
.
i
(
TAG
,
"onVideoLoad"
)
}
override
fun
onVideoError
(
errorCode
:
Int
,
extraCode
:
Int
)
{
Log
.
i
(
TAG
,
"onVideoError"
)
}
override
fun
onVideoAdStartPlay
(
ad
:
TTFeedAd
?)
{
Log
.
i
(
TAG
,
"onVideoAdStartPlay"
)
}
override
fun
onVideoAdPaused
(
ad
:
TTFeedAd
?)
{
Log
.
i
(
TAG
,
"onVideoAdPaused"
)
}
override
fun
onVideoAdContinuePlay
(
ad
:
TTFeedAd
?)
{
Log
.
i
(
TAG
,
"onVideoAdContinuePlay"
)
}
override
fun
onProgressUpdate
(
current
:
Long
,
duration
:
Long
)
{
Log
.
i
(
TAG
,
"onProgressUpdate"
)
}
override
fun
onVideoAdComplete
(
ad
:
TTFeedAd
?)
{
Log
.
i
(
TAG
,
"onVideoAdComplete"
)
}
})
mTTFeedAd
?.
setDownloadListener
(
object
:
TTAppDownloadListener
{
override
fun
onIdle
()
{
Log
.
i
(
TAG
,
"setDownloadListener"
)
}
override
fun
onDownloadActive
(
totalBytes
:
Long
,
currBytes
:
Long
,
fileName
:
String
?,
appName
:
String
?
)
{
Log
.
i
(
TAG
,
"onDownloadActive"
)
}
override
fun
onDownloadPaused
(
totalBytes
:
Long
,
currBytes
:
Long
,
fileName
:
String
?,
appName
:
String
?
)
{
Log
.
i
(
TAG
,
"onDownloadPaused"
)
}
override
fun
onDownloadFailed
(
totalBytes
:
Long
,
currBytes
:
Long
,
fileName
:
String
?,
appName
:
String
?
)
{
Log
.
i
(
TAG
,
"onDownloadFailed"
)
}
override
fun
onDownloadFinished
(
totalBytes
:
Long
,
fileName
:
String
?,
appName
:
String
?
)
{
Log
.
i
(
TAG
,
"onDownloadFinished"
)
}
override
fun
onInstalled
(
fileName
:
String
?,
appName
:
String
?)
{
Log
.
i
(
TAG
,
"onInstalled"
)
}
})
//绑定广告数据、设置交互回调
bindData
(
convertView
,
adViewHolder
)
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
}
return
convertView
}
private
var
mVideoView
:
VideoView
?
=
null
private
var
customVideoReporter
:
TTFeedAd
.
CustomizeVideo
?
=
null
private
fun
playAdVideo
(
videoContainer
:
ViewGroup
,
videoUrl
:
String
)
{
mVideoView
=
VideoView
(
MintsApplication
.
getContext
())
videoContainer
.
addView
(
mVideoView
)
customVideoReporter
=
mTTFeedAd
?.
customVideo
// 开发者根据自己的需求,做相应的视频控制界面,播放暂停等
mVideoView
?.
setVideoURI
(
Uri
.
parse
(
videoUrl
))
mVideoView
?.
setOnErrorListener
{
mp
,
what
,
extra
->
if
(
customVideoReporter
!=
null
)
{
customVideoReporter
?.
reportVideoError
(
mVideoView
!!
.
currentPosition
.
toLong
(),
what
,
extra
)
}
false
}
mVideoView
?.
setOnCompletionListener
{
if
(
customVideoReporter
!=
null
)
{
customVideoReporter
?.
reportVideoFinish
()
}
}
mVideoView
?.
start
()
customVideoReporter
?.
reportVideoStart
()
}
private
fun
getVerticalAdView
(
parent
:
ViewGroup
?):
View
?
{
val
adViewHolder
=
VerticalAdViewHolder
()
var
convertView
=
LayoutInflater
.
from
(
ForegroundOrBackground
.
getTopActivity
())
.
inflate
(
R
.
layout
.
mediation_listitem_ad_vertical_pic
,
parent
,
false
)
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
adViewHolder
.
mDescription
=
convertView
?.
findViewById
<
View
>(
R
.
id
.
tv_listitem_ad_desc
)
as
TextView
adViewHolder
.
mVerticalImage
=
convertView
.
findViewById
<
ImageView
>(
R
.
id
.
iv_listitem_image
)
adViewHolder
.
mIcon
=
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_icon
)
as
ImageView
adViewHolder
.
mDislike
=
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_dislike
)
as
ImageView
adViewHolder
.
mCreativeButton
=
convertView
.
findViewById
<
View
>(
R
.
id
.
btn_listitem_creative
)
as
Button
// adViewHolder.mLogo =
// convertView.findViewById<RelativeLayout>(R.id.tt_ad_logo) //logoView 建议传入GroupView类型
adViewHolder
.
app_info
=
convertView
.
findViewById
<
LinearLayout
>(
R
.
id
.
app_info
)
adViewHolder
.
app_name
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
app_name
)
adViewHolder
.
author_name
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
author_name
)
adViewHolder
.
package_size
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
package_size
)
adViewHolder
.
permissions_url
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
permissions_url
)
adViewHolder
.
permissions_content
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
permissions_content
)
adViewHolder
.
privacy_agreement
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
privacy_agreement
)
adViewHolder
.
version_name
=
convertView
.
findViewById
<
TextView
>(
R
.
id
.
version_name
)
val
viewBinder
=
MediationViewBinder
.
Builder
(
R
.
layout
.
mediation_listitem_ad_vertical_pic
)
.
titleId
(
R
.
id
.
tv_listitem_ad_title
)
.
descriptionTextId
(
R
.
id
.
tv_listitem_ad_desc
)
.
mainImageId
(
R
.
id
.
iv_listitem_image
)
.
iconImageId
(
R
.
id
.
iv_listitem_icon
)
.
callToActionId
(
R
.
id
.
btn_listitem_creative
)
.
sourceId
(
R
.
id
.
tv_listitem_ad_source
)
.
logoLayoutId
(
R
.
id
.
tt_ad_logo
)
//logoView 建议传入GroupView类型
.
build
()
adViewHolder
.
viewBinder
=
viewBinder
bindData
(
convertView
,
adViewHolder
)
if
(
mTTFeedAd
?.
imageList
?.
size
!=
0
)
{
mTTFeedAd
?.
let
{
ttfeedad
->
ttfeedad
.
imageList
[
0
]
?.
imageUrl
?.
let
{
Glide
.
with
(
ForegroundOrBackground
.
getTopActivity
()).
load
(
it
)
.
into
(
adViewHolder
.
mVerticalImage
!!
)
}
}
}
return
convertView
}
private
fun
bindData
(
convertView
:
View
,
adViewHolder
:
AdViewHolder
)
{
mTTFeedAd
?.
let
{
if
(
it
.
mediationManager
?.
hasDislike
()
==
true
)
{
val
ttAdDislike
:
TTAdDislike
=
it
.
getDislikeDialog
(
ForegroundOrBackground
.
getTopActivity
())
adViewHolder
.
mDislike
?.
visibility
=
View
.
VISIBLE
adViewHolder
.
mDislike
?.
setOnClickListener
(
View
.
OnClickListener
{
//使用接口来展示
ttAdDislike
.
showDislikeDialog
()
ttAdDislike
.
setDislikeInteractionCallback
(
object
:
TTAdDislike
.
DislikeInteractionCallback
{
override
fun
onShow
()
{
Log
.
i
(
TAG
,
"dislike 点击show"
)
}
override
fun
onSelected
(
position
:
Int
,
value
:
String
?,
enforce
:
Boolean
)
{
Log
.
i
(
TAG
,
"点击 $value"
)
//用户选择不喜欢原因后,移除广告展示
// frameLayout?.removeAllViews()
}
override
fun
onCancel
()
{
Log
.
i
(
TAG
,
"dislike 点击了取消"
)
}
})
})
}
else
{
if
(
adViewHolder
.
mDislike
!=
null
)
adViewHolder
.
mDislike
?.
visibility
=
View
.
GONE
}
setDownLoadAppInfo
(
it
,
adViewHolder
)
//可以被点击的view, 也可以把convertView放进来意味item可被点击
val
clickViewList
:
MutableList
<
View
?>
=
ArrayList
()
clickViewList
.
add
(
convertView
)
clickViewList
.
add
(
adViewHolder
.
mSource
)
clickViewList
.
add
(
adViewHolder
.
mTitle
)
clickViewList
.
add
(
adViewHolder
.
mDescription
)
clickViewList
.
add
(
adViewHolder
.
mIcon
)
//添加点击区域
if
(
adViewHolder
is
LargeAdViewHolder
)
{
clickViewList
.
add
(
adViewHolder
.
mLargeImage
)
}
else
if
(
adViewHolder
is
SmallAdViewHolder
)
{
clickViewList
.
add
(
adViewHolder
.
mSmallImage
)
}
else
if
(
adViewHolder
is
VerticalAdViewHolder
)
{
clickViewList
.
add
(
adViewHolder
.
mVerticalImage
)
}
else
if
(
adViewHolder
is
VideoAdViewHolder
)
{
clickViewList
.
add
(
adViewHolder
.
videoView
)
}
else
if
(
adViewHolder
is
GroupAdViewHolder
)
{
clickViewList
.
add
(
adViewHolder
.
mGroupImage1
)
clickViewList
.
add
(
adViewHolder
.
mGroupImage2
)
clickViewList
.
add
(
adViewHolder
.
mGroupImage3
)
}
//触发创意广告的view(点击下载或拨打电话)
val
creativeViewList
:
MutableList
<
View
?>
=
ArrayList
()
creativeViewList
.
add
(
adViewHolder
.
mCreativeButton
)
//重要! 这个涉及到广告计费,必须正确调用。**** convertView必须是com.bytedance.msdk.api.format.TTNativeAdView ****
it
.
registerViewForInteraction
(
ForegroundOrBackground
.
getTopActivity
(),
convertView
as
ViewGroup
,
clickViewList
,
creativeViewList
,
null
,
object
:
TTNativeAd
.
AdInteractionListener
{
override
fun
onAdClicked
(
view
:
View
?,
ad
:
TTNativeAd
?)
{
Log
.
i
(
TAG
,
"onAdClicked"
)
}
override
fun
onAdCreativeClick
(
view
:
View
?,
ad
:
TTNativeAd
?)
{
Log
.
i
(
TAG
,
"onAdCreativeClick"
)
}
override
fun
onAdShow
(
ad
:
TTNativeAd
?)
{
Log
.
i
(
TAG
,
"onAdShow"
)
ad
?.
let
{
// PrintUtil.printShowInfo(ad.mediationManager)
}
}
},
adViewHolder
.
viewBinder
)
adViewHolder
.
mTitle
?.
text
=
it
.
title
//title为广告的简单信息提示
adViewHolder
.
mDescription
?.
text
=
it
.
description
//description为广告的较长的说明
adViewHolder
.
mSource
?.
text
=
if
(
TextUtils
.
isEmpty
(
it
.
source
))
"广告来源"
else
it
.
source
val
icon
:
TTImage
?
=
it
.
icon
if
(
icon
!=
null
)
{
Glide
.
with
(
ForegroundOrBackground
.
getTopActivity
()).
load
(
icon
.
imageUrl
)
.
into
(
adViewHolder
.
mIcon
!!
)
}
val
adCreativeButton
=
adViewHolder
.
mCreativeButton
when
(
it
.
interactionType
)
{
TTAdConstant
.
INTERACTION_TYPE_DOWNLOAD
->
{
adCreativeButton
?.
visibility
=
View
.
VISIBLE
;
adCreativeButton
?.
setText
(
it
.
buttonText
?:
"立即下载"
)
}
TTAdConstant
.
INTERACTION_TYPE_DIAL
->
{
adCreativeButton
?.
visibility
=
View
.
VISIBLE
;
adCreativeButton
?.
setText
(
"立即拨打"
);
}
TTAdConstant
.
INTERACTION_TYPE_LANDING_PAGE
,
TTAdConstant
.
INTERACTION_TYPE_BROWSER
->
{
adCreativeButton
?.
visibility
=
View
.
VISIBLE
;
adCreativeButton
?.
setText
(
it
.
buttonText
?:
"查看详情"
)
}
else
->
{
adCreativeButton
?.
visibility
=
View
.
GONE
Log
.
i
(
TAG
,
"交互类型异常"
)
}
}
}
}
private
fun
setDownLoadAppInfo
(
ttNativeAd
:
TTFeedAd
,
adViewHolder
:
AdViewHolder
)
{
if
(
ttNativeAd
.
complianceInfo
==
null
)
{
adViewHolder
.
app_info
?.
visibility
=
View
.
GONE
}
else
{
adViewHolder
.
app_info
?.
visibility
=
View
.
VISIBLE
val
appInfo
=
ttNativeAd
.
complianceInfo
adViewHolder
.
app_name
?.
text
=
"应用名称:"
+
appInfo
.
appName
adViewHolder
.
author_name
?.
text
=
"开发者:"
+
appInfo
.
developerName
adViewHolder
.
package_size
?.
text
=
"包大小:不支持"
adViewHolder
.
permissions_url
?.
text
=
"权限url:不支持"
adViewHolder
.
privacy_agreement
?.
text
=
"隐私url:"
+
appInfo
.
privacyUrl
adViewHolder
.
version_name
?.
text
=
"版本号:"
+
appInfo
.
appVersion
adViewHolder
.
permissions_content
!!
.
text
=
"权限内容:"
+
getPermissionsContent
(
appInfo
.
permissionsMap
)
}
}
private
fun
getPermissionsContent
(
permissionsMap
:
Map
<
String
,
String
>?):
String
{
if
(
permissionsMap
==
null
)
{
return
""
}
val
stringBuffer
=
StringBuffer
()
val
keyList
=
permissionsMap
.
keys
for
(
s
in
keyList
)
{
stringBuffer
.
append
(
"""$s : ${permissionsMap[s]} """
)
}
return
stringBuffer
.
toString
()
}
private
class
VideoAdViewHolder
:
AdViewHolder
()
{
var
videoView
:
FrameLayout
?
=
null
}
private
class
LargeAdViewHolder
:
AdViewHolder
()
{
var
mLargeImage
:
ImageView
?
=
null
}
private
class
SmallAdViewHolder
:
AdViewHolder
()
{
var
mSmallImage
:
ImageView
?
=
null
}
private
class
VerticalAdViewHolder
:
AdViewHolder
()
{
var
mVerticalImage
:
ImageView
?
=
null
}
private
class
GroupAdViewHolder
:
AdViewHolder
()
{
var
mGroupImage1
:
ImageView
?
=
null
var
mGroupImage2
:
ImageView
?
=
null
var
mGroupImage3
:
ImageView
?
=
null
}
private
class
ExpressAdViewHolder
{
var
mAdContainerView
:
FrameLayout
?
=
null
}
open
private
class
AdViewHolder
{
var
viewBinder
:
MediationViewBinder
?
=
null
var
mIcon
:
ImageView
?
=
null
var
mDislike
:
ImageView
?
=
null
var
mCreativeButton
:
Button
?
=
null
var
mTitle
:
TextView
?
=
null
var
mDescription
:
TextView
?
=
null
var
mSource
:
TextView
?
=
null
var
mLogo
:
RelativeLayout
?
=
null
var
app_info
:
LinearLayout
?
=
null
var
app_name
:
TextView
?
=
null
var
author_name
:
TextView
?
=
null
var
package_size
:
TextView
?
=
null
var
permissions_url
:
TextView
?
=
null
var
privacy_agreement
:
TextView
?
=
null
var
version_name
:
TextView
?
=
null
var
permissions_content
:
TextView
?
=
null
}
}
\ No newline at end of file
video/app/src/main/java/com/mints/helivideo/ad/express/ExpressManager.kt
View file @
dfb91e38
//package com.mints.helivideo.ad.express
package
com.mints.helivideo.ad.express
//
//import android.text.TextUtils
import
android.net.Uri
//import android.view.Gravity
import
android.text.TextUtils
//import android.view.LayoutInflater
import
android.util.Log
//import android.view.View
import
android.view.LayoutInflater
//import android.view.ViewGroup
import
android.view.View
//import android.widget.*
import
android.view.ViewGroup
//import com.bumptech.glide.Glide
import
android.widget.*
//import com.bytedance.msdk.api.AdError
import
com.bumptech.glide.Glide
//import com.bytedance.msdk.api.AdSlot
import
com.bytedance.sdk.openadsdk.*
//import com.bytedance.msdk.api.AdmobNativeAdOptions
import
com.bytedance.sdk.openadsdk.mediation.ad.MediationExpressRenderListener
//import com.bytedance.msdk.api.v2.*
import
com.bytedance.sdk.openadsdk.mediation.ad.MediationViewBinder
//import com.bytedance.msdk.api.v2.ad.nativeAd.*
import
com.mints.helivideo.BuildConfig
//import com.bytedance.msdk.api.v2.slot.GMAdOptionUtil
import
com.mints.helivideo.MintsApplication
//import com.bytedance.msdk.api.v2.slot.GMAdSlotNative
import
com.mints.helivideo.R
//import com.mints.helivideo.BuildConfig
import
com.mints.helivideo.ad.AdManager
//import com.mints.helivideo.MintsApplication
import
com.mints.helivideo.utils.ForegroundOrBackground
//import com.mints.helivideo.R
import
com.mints.helivideo.utils.LogUtil
//import com.mints.helivideo.ad.AdManager
import
com.mints.helivideo.utils.TimeRender
//import com.mints.helivideo.utils.ForegroundOrBackground
import
com.mints.helivideo.utils.UIUtils
//import com.mints.helivideo.utils.LogUtil
import
java.lang.Exception
//import com.mints.helivideo.utils.TimeRender
import
java.util.ArrayList
//import com.mints.helivideo.utils.UIUtils
//
private
val
TAG
=
ExpressManager
::
class
.
java
.
simpleName
//private val TAG = ExpressManager::class.java.simpleName
//
/**
///**
* 信息流
// * 应用内-信息流
*/
// */
class
ExpressManager
{
//class ExpressManager : GMSettingConfigCallback {
//
companion
object
{
// companion object {
val
instance
:
ExpressManager
by
lazy
(
mode
=
LazyThreadSafetyMode
.
SYNCHRONIZED
)
{
// val instance: ExpressManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
ExpressManager
()
// ExpressManager()
}
// }
}
// }
//
private
var
adShowTime
:
Long
=
0
// 防止预加载超时 2秒
// private var isShowAd = false // 广告是否展示
// private var mAdStyle = 0
private
var
isShowAd
=
false
// 广告是否展示
//
// private var frameLayout: FrameLayout? = null
private
var
frameLayout
:
FrameLayout
?
=
null
//
// private var mTTAdNative: GMUnifiedNativeAd? = null
private
var
expressId
:
String
=
""
//
// private var expressId: String = ""
private
var
isClickScreen
=
true
// 是否点击屏幕跳转广告
//
// private var isClickScreen = true // 是否点击屏幕跳转广告
private
val
adLoadTime
:
Long
=
0
// 广告展示时间,45分钟后当前广告失效,重新预加载广告
//
// private val adLoadTime: Long = 0 // 广告展示时间,45分钟后当前广告失效,重新预加载广告
private
var
adPreingTime
:
Long
=
0
// 防止预加载超时 2分钟
//
// private var adPreingTime: Long = 0 // 防止预加载超时 2分钟
private
var
isLoadSuccess
=
0
//0-加载失败/未加载 1-加载中 2-加载成功
//
// private var isLoadSuccess = 0 //0-加载失败/未加载 1-加载中 2-加载成功
private
var
mExpressAdCallback
:
ExpressAdCallback
?
=
null
//
// private var mExpressAdCallback: ExpressAdCallback? = null
private
var
adcode
=
""
//
private
var
ecpm
=
""
// // 载体
private
var
adSource
=
""
// private var mCarrier = ""
private
var
mTTFeedAd
:
TTFeedAd
?
=
null
// private var adcode = ""
// private var ecpm = ""
fun
preLoadAd
()
{
// private var adSource = ""
val
isOversped
=
TimeRender
.
isOverspedMin
(
adLoadTime
,
AdManager
.
AD_NO_SHOWTIME_OUT
)
// private var mTtNativeAd: GMNativeAd? = null
val
isPreingOversped
=
TimeRender
.
isOverspedMin
(
adPreingTime
,
AdManager
.
AD_REQUEST_TIME_OUT
)
//
// init {
LogUtil
.
d
(
// mAdStyle = AdSlot.TYPE_EXPRESS_AD
TAG
,
// }
"gromore信息流--> 1、进入预加载 isLoadSuccess=$isLoadSuccess isOversped=$isOversped isPreingOversped=$isPreingOversped"
//
)
// fun loadADFrameLayout(carrier: String) {
//
if
((
isLoadSuccess
==
0
// 加载失败
// this.mCarrier = carrier
||
adLoadTime
>
0
&&
isOversped
// 超过45分钟
// val isOversped = TimeRender.isOverspedMin(adLoadTime, AdManager.AD_NO_SHOWTIME_OUT)
||
adPreingTime
>
0
&&
isPreingOversped
&&
isLoadSuccess
==
1
)
// 预加载超时
// val isPreingOversped = TimeRender.isOverspedMin(adPreingTime, AdManager.AD_REQUEST_TIME_OUT)
)
{
//
LogUtil
.
d
(
TAG
,
"gromore信息流--> 2、执行预加载去了=$isLoadSuccess"
)
// LogUtil.d(
adPreingTime
=
System
.
currentTimeMillis
()
// TAG,
isLoadSuccess
=
1
// "gromore应用内网赚信息流--> 1、进入预加载 isLoadSuccess=$isLoadSuccess isOversped=$isOversped isPreingOversped=$isPreingOversped"
// )
// 销毁及移除事件
//
// if ((isLoadSuccess == 0 // 加载失败
// || adLoadTime > 0 && isOversped // 超过45分钟
// || adPreingTime > 0 && isPreingOversped && isLoadSuccess == 1) // 预加载超时
// ) {
// LogUtil.d(TAG, "gromore应用内网赚信息流--> 2、执行预加载去了=$isLoadSuccess")
// adPreingTime = System.currentTimeMillis()
// isLoadSuccess = 1
//
// // 销毁及移除事件
// destroy()
// destroy()
//
// this.frameLayout = FrameLayout(MintsApplication.getContext())
this
.
frameLayout
=
FrameLayout
(
MintsApplication
.
getContext
())
//
// if (GMMediationAdSdk.configLoadSuccess()) {
loadAd
()
// loadAd()
}
// } else {
}
// GMMediationAdSdk.registerConfigCallback(this)
// }
private
fun
loadAd
()
{
// }
// }
isClickScreen
=
true
//
expressId
=
BuildConfig
.
GROMORE_VIDEO_CODE
// /**
val
activity
=
ForegroundOrBackground
.
getTopActivity
()
// * config成功,加载信息流
// */
val
adNativeLoader
=
TTAdSdk
.
getAdManager
().
createAdNative
(
activity
)
// override fun configLoad() {
val
adslot
=
AdSlot
.
Builder
()
// loadAd()
.
setCodeId
(
BuildConfig
.
GROMORE_EXPRESS_CODE
)
// }
/**
//
* 注:
// private fun loadAd() {
* 1:单位为px
//
* 2:如果是信息流自渲染广告,设置广告图片期望的图片宽高 ,不能为0
// isClickScreen = true
* 2:如果是信息流模板广告,宽度设置为希望的宽度,高度设置为0(0为高度选择自适应参数)
// expressId = BuildConfig.GROMORE_VIDEO_CODE
*/
// val activity = ForegroundOrBackground.getTopActivity()
.
setImageAcceptedSize
(
// if (activity != null) {
UIUtils
.
getAdWidth
(
activity
).
toInt
(),
// mTTAdNative = GMUnifiedNativeAd(activity, expressId)
0
// } else {
)
// mTTAdNative = GMUnifiedNativeAd(MintsApplication.getContext(), expressId)
.
setAdCount
(
1
)
//请求广告数量为1到3条 (优先采用平台配置的数量)
// }
.
build
()
//
// //针对Admob Native的特殊配置项
adNativeLoader
.
loadFeedAd
(
adslot
,
object
:
TTAdNative
.
FeedAdListener
{
// val admobNativeAdOptions = AdmobNativeAdOptions()
override
fun
onError
(
p0
:
Int
,
p1
:
String
?)
{
// admobNativeAdOptions.setAdChoicesPlacement(AdmobNativeAdOptions.ADCHOICES_TOP_RIGHT) //设置广告小标默认情况下,广告选择叠加层会显示在右上角。
LogUtil
.
e
(
TAG
,
"greenroom信息流--> 3、load feed ad error : $p0, $p1"
)
// .setRequestMultipleImages(true).isReturnUrlsForImageAssets =
isLoadSuccess
=
0
// true //设置为true,SDK会仅提供Uri字段的值,允许自行决定是否下载实际图片,同时不会提供Drawable字段的值
}
//
// // 针对Gdt Native自渲染广告,可以自定义gdt logo的布局参数。该参数可选,非必须。
override
fun
onFeedAdLoad
(
ads
:
MutableList
<
TTFeedAd
>?)
{
// val gdtNativeAdLogoParams = FrameLayout.LayoutParams(
LogUtil
.
d
(
// UIUtils.dp2px(40),
TAG
,
// UIUtils.dp2px(13),
"gromore信息流--> 3、Gromore onAdLoaded expressId=${expressId} "
// Gravity.RIGHT or Gravity.TOP
)
// ) // 例如,放在右上角
ads
?.
let
{
//
if
(
it
.
isEmpty
())
{
// val adSlotNativeBuilder = GMAdOptionUtil.getGMAdSlotGDTOption()
isLoadSuccess
=
0
// .setNativeAdLogoParams(gdtNativeAdLogoParams)
return
// /**
}
// * 创建feed广告请求类型参数AdSlot,具体参数含义参考文档
// * 备注
if
(
it
.
size
>
0
)
{
// * 1: 如果是信息流自渲染广告,设置广告图片期望的图片宽高 ,不能为0
mTTFeedAd
=
it
[
0
]
// * 2:如果是信息流模板广告,宽度设置为希望的宽度,高度设置为0(0为高度选择自适应参数)
isLoadSuccess
=
2
// */
showAd
()
// /**
}
// * 创建feed广告请求类型参数AdSlot,具体参数含义参考文档
}
// * 备注
}
// * 1: 如果是信息流自渲染广告,设置广告图片期望的图片宽高 ,不能为0
// * 2:如果是信息流模板广告,宽度设置为希望的宽度,高度设置为0(0为高度选择自适应参数)
})
// */
}
//// val adSlotNative = GMAdSlotNative.Builder()
//// .setGMAdSlotGDTOption(adSlotNativeBuilder.build()) //gdt相关的配置
private
fun
showAd
()
{
//// .setAdmobNativeAdOptions(GMAdOptionUtil.getAdmobNativeAdOptions()) //admob相关配置
mTTFeedAd
?.
let
{
//// .setAdStyleType(mAdStyle) //必传,表示请求的模板广告还是原生广告,AdSlot.TYPE_EXPRESS_AD:模板广告 ; AdSlot.TYPE_NATIVE_AD:原生广告
if
(
it
.
mediationManager
.
isExpress
)
{
//// // 备注
//--------------信息流模板广告渲染----------------
//// // 1:如果是信息流自渲染广告,设置广告图片期望的图片宽高 ,不能为0
showExpressView
(
it
)
//// // 2:如果是信息流模板广告,宽度设置为希望的宽度,高度设置为0(0为高度选择自适应参数)
}
else
{
//// .setImageAdSize(
//--------------信息流自渲染广告渲染----------------
//// UIUtils.getAdWidth(MintsApplication.getContext()),
val
view
:
View
?
=
when
(
it
.
imageMode
)
{
//// 340
TTAdConstant
.
IMAGE_MODE_SMALL_IMG
->
getSmallAdView
(
frameLayout
)
//信息流自渲染广告渲染 :小图广告
//// ) // 必选参数 单位dp ,详情见上面备注解释
TTAdConstant
.
IMAGE_MODE_LARGE_IMG
->
getLargeAdView
(
frameLayout
)
//信息流自渲染广告渲染 :大图广告
//// .setAdCount(3) //请求广告数量为1到3条
TTAdConstant
.
IMAGE_MODE_GROUP_IMG
->
getGroupAdView
(
frameLayout
)
//信息流自渲染广告渲染 :组图广告
//// .build()
TTAdConstant
.
IMAGE_MODE_VIDEO
->
getVideoView
(
frameLayout
)
//信息流自渲染广告渲染 :视频广告
//
TTAdConstant
.
IMAGE_MODE_VERTICAL_IMG
->
getVerticalAdView
(
frameLayout
)
//信息流自渲染广告渲染 :竖图广告
// //请求广告,调用feed广告异步请求接口,加载到广告后,拿到广告素材自定义渲染
TTAdConstant
.
IMAGE_MODE_VIDEO_VERTICAL
->
getVideoView
(
frameLayout
)
//信息流自渲染广告渲染 :竖版视频广告
// /**
else
->
{
// * 注:每次加载信息流广告的时候需要新建一个TTUnifiedNativeAd,否则可能会出现广告填充问题
Log
.
i
(
TAG
,
"展示样式错误"
)
// * (例如:mTTAdNative = new TTUnifiedNativeAd(this, mAdUnitId);)
null
// */
}
//// mTTAdNative?.loadAd(adSlotNative, object : GMNativeAdLoadCallback {
}
//// override fun onAdLoadedFail(adError: AdError) {
view
?.
let
{
//// LogUtil.e(
it
.
layoutParams
=
ViewGroup
.
LayoutParams
(
//// TAG,
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
//// "gromore应用内网赚信息流--> 3、load feed ad error : " + adError.code + ", " + adError.message
ViewGroup
.
LayoutParams
.
MATCH_PARENT
//// )
)
//// isLoadSuccess = 0
frameLayout
?.
removeAllViews
()
//// }
frameLayout
?.
addView
(
it
)
////
}
//// override fun onAdLoaded(ads: MutableList<GMNativeAd>) {
}
//// LogUtil.d(
}
//// TAG,
}
//// "gromore应用内网赚信息流--> 3、Gromore onAdLoaded expressId=${expressId} "
//// )
fun
getAdView
(
callback
:
ExpressAdCallback
?)
{
//// if (ads.isEmpty()) {
//// isLoadSuccess = 0
val
isOversped
=
TimeRender
.
isOverspedMin
(
adLoadTime
,
AdManager
.
AD_NO_SHOWTIME_OUT
)
//// return
// 若上一个广告还在加载中则返回
//// }
if
(
isLoadSuccess
==
1
)
{
////
this
.
mExpressAdCallback
=
callback
//// if (ads.size > 0) {
LogUtil
.
e
(
TAG
,
"gromore信息流--> 3.9、广告加载中 LoadSuccess = $isLoadSuccess"
)
//// frameLayout?.removeAllViews()
return
//// frameLayout?.addView(createAdView(ads[0]))
}
////
//// isLoadSuccess = 2
this
.
mExpressAdCallback
=
null
////
//// val ttNativeAd = ads[0]
if
(
isLoadSuccess
==
2
&&
!
isOversped
)
{
////
LogUtil
.
d
(
//// mTtNativeAd = ttNativeAd
TAG
,
//// }
"gromore信息流--> 4、展示广告 LoadSuccess=$isLoadSuccess isOversped=$isOversped"
//// }
)
////
isShowAd
=
true
//// })
adShowTime
=
System
.
currentTimeMillis
()
// }
isLoadSuccess
=
0
//
isClickScreen
=
true
// private var type: String? = ""
callback
?.
loadSuccess
(
frameLayout
)
//
}
else
{
// fun getAdView(callback: ExpressAdCallback?, carrier: String?, type: String? = "") {
LogUtil
.
e
(
TAG
,
"gromore信息流--> 5、展示广告时失败了,广告可能超时45分钟 onError "
)
// this.type = type
// 状态重置
// if (carrier != null) {
isLoadSuccess
=
0
// mCarrier = carrier
callback
?.
loadFail
()
// }
}
//
}
// val isOversped = TimeRender.isOverspedMin(adLoadTime, AdManager.AD_NO_SHOWTIME_OUT)
// // 若上一个广告还在加载中则返回
private
fun
showExpressView
(
it
:
TTFeedAd
)
{
// if (isLoadSuccess == 1) {
it
.
setExpressRenderListener
(
object
:
MediationExpressRenderListener
{
// this.mExpressAdCallback = callback
override
fun
onRenderSuccess
(
p0
:
View
?,
p1
:
Float
,
p2
:
Float
,
p3
:
Boolean
)
{
// LogUtil.e(TAG, "gromore应用内网赚信息流--> 3.9、广告加载中 LoadSuccess = $isLoadSuccess")
Log
.
i
(
TAG
,
"onRenderSuccess"
)
// return
it
.
setDislikeCallback
(
ForegroundOrBackground
.
getTopActivity
(),
// }
object
:
TTAdDislike
.
DislikeInteractionCallback
{
//
override
fun
onShow
()
{
// this.mExpressAdCallback = null
Log
.
i
(
TAG
,
"express dislike 点击show"
)
//
}
// if (isLoadSuccess == 2 && !isOversped) {
// LogUtil.d(
override
fun
onSelected
(
position
:
Int
,
value
:
String
?,
enforce
:
Boolean
)
{
// TAG,
Log
.
i
(
TAG
,
"express 点击 $value"
)
// "gromore应用内网赚信息流--> 4、展示广告 LoadSuccess=$isLoadSuccess isOversped=$isOversped"
}
// )
// isShowAd = true
override
fun
onCancel
()
{
// adShowTime = System.currentTimeMillis()
Log
.
i
(
TAG
,
"express dislike 点击了取消"
)
// isLoadSuccess = 0
}
// isClickScreen = true
})
// callback?.loadSuccess(frameLayout)
it
.
adView
?.
let
{
view
->
// } else {
if
(
view
.
parent
!=
null
)
{
// LogUtil.e(TAG, "gromore应用内网赚信息流--> 5、展示广告时失败了,广告可能超时45分钟 onError ")
(
view
.
parent
as
ViewGroup
).
removeView
(
view
)
//
}
// // 状态重置
frameLayout
?.
addView
(
view
)
// isLoadSuccess = 0
}
// callback?.loadFail()
}
// }
// }
override
fun
onRenderFail
(
p0
:
View
?,
p1
:
String
?,
p2
:
Int
)
{
//
Log
.
i
(
TAG
,
"onRenderFail"
)
// /**
}
// * 销毁
// */
override
fun
onAdClick
()
{
// fun destroy() {
Log
.
i
(
TAG
,
"onAdClick"
)
//// frameLayout?.removeAllViews()
}
//// frameLayout = null
//
override
fun
onAdShow
()
{
// // 数据重置
Log
.
i
(
TAG
,
"onAdShow"
)
// adcode = ""
Log
.
i
(
TAG
,
"ad mediaExtraInfo ${it.mediaExtraInfo}"
)
// ecpm = ""
}
// adSource = ""
//
})
// mTTAdNative?.destroy()
it
.
render
()
//必须要调用render方法进行渲染,在onRenderSuccess中处理模板的view
// this.mExpressAdCallback = null
}
// GMMediationAdSdk.unregisterConfigCallback(this)
// }
/**
//
* 销毁
// fun getFrameLayout(): View? {
*/
// return frameLayout
fun
destroy
()
{
// }
// frameLayout?.removeAllViews()
//
// frameLayout = null
// private fun createAdView(ad: GMNativeAd?): View? {
//
// 数据重置
// if (ad != null && ad.isExpressAd) {
adcode
=
""
// return getExpressAdView(ad)
ecpm
=
""
// }
adSource
=
""
//
// return when {
mTTFeedAd
?.
destroy
()
// ad == null -> {
this
.
mExpressAdCallback
=
null
// return null
}
// }
// ad.adImageMode == GMAdConstant.IMAGE_MODE_SMALL_IMG -> {
fun
getFrameLayout
():
View
?
{
// return getSmallAdView(ad)
return
frameLayout
// }
}
// ad.adImageMode == GMAdConstant.IMAGE_MODE_LARGE_IMG -> {
// return getLargeAdView(ad)
private
fun
getSmallAdView
(
parent
:
ViewGroup
?):
View
?
{
// }
val
convertView
=
// ad.adImageMode == GMAdConstant.IMAGE_MODE_GROUP_IMG -> {
LayoutInflater
.
from
(
ForegroundOrBackground
.
getTopActivity
())
// return getGroupAdView(ad)
.
inflate
(
// }
R
.
layout
.
mediation_listitem_ad_small_pic
,
// ad.adImageMode == GMAdConstant.IMAGE_MODE_VIDEO -> {
parent
,
// return getVideoView(ad)
false
// }
)
// ad.adImageMode == GMAdConstant.IMAGE_MODE_VERTICAL_IMG -> {
val
adViewHolder
=
SmallAdViewHolder
()
// return getVerticalAdView(ad)
adViewHolder
.
mTitle
=
// }
convertView
.
findViewById
<
View
>(
R
.
id
.
tv_listitem_ad_title
)
as
TextView
// ad.adImageMode == GMAdConstant.IMAGE_MODE_VIDEO_VERTICAL -> {
adViewHolder
.
mSource
=
// return getVideoView(ad)
convertView
.
findViewById
<
View
>(
R
.
id
.
tv_listitem_ad_source
)
as
TextView
// }
adViewHolder
.
mDescription
=
// else -> {
convertView
.
findViewById
<
View
>(
R
.
id
.
tv_listitem_ad_desc
)
as
TextView
// return null
adViewHolder
.
mSmallImage
=
// }
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_image
)
as
ImageView
// }
adViewHolder
.
mIcon
=
// }
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_icon
)
as
ImageView
//
adViewHolder
.
mDislike
=
// //渲染模板广告
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_dislike
)
as
ImageView
// private fun getExpressAdView(ad: GMNativeAd): View? {
adViewHolder
.
mCreativeButton
=
// val adViewHolder: ExpressAdViewHolder
convertView
.
findViewById
<
View
>(
R
.
id
.
btn_listitem_creative
)
as
Button
// val convertView = LayoutInflater.from(MintsApplication.getContext())
// .inflate(R.layout.listitem_ad_native_express, null, false)
adViewHolder
.
app_info
=
// try {
convertView
.
findViewById
<
LinearLayout
>(
R
.
id
.
app_info
)
// adViewHolder = ExpressAdViewHolder()
adViewHolder
.
app_name
=
// adViewHolder.mAdContainerView =
convertView
.
findViewById
<
TextView
>(
R
.
id
.
app_name
)
// convertView.findViewById(R.id.iv_listitem_express) as FrameLayout
adViewHolder
.
author_name
=
// convertView.tag = adViewHolder
convertView
.
findViewById
<
TextView
>(
R
.
id
.
author_name
)
//
adViewHolder
.
package_size
=
// //判断是否存在dislike按钮
convertView
.
findViewById
<
TextView
>(
R
.
id
.
package_size
)
// if (ad.hasDislike() && ForegroundOrBackground.getTopActivity() != null) {
adViewHolder
.
permissions_url
=
// ad.setDislikeCallback(
convertView
.
findViewById
<
TextView
>(
R
.
id
.
permissions_url
)
// ForegroundOrBackground.getTopActivity(),
adViewHolder
.
permissions_content
=
// object : GMDislikeCallback {
convertView
.
findViewById
<
TextView
>(
R
.
id
.
permissions_content
)
// override fun onSelected(position: Int, value: String?) {
adViewHolder
.
privacy_agreement
=
// //用户选择不喜欢原因后,移除广告展示
convertView
.
findViewById
<
TextView
>(
R
.
id
.
privacy_agreement
)
// frameLayout?.removeAllViews()
adViewHolder
.
version_name
=
// }
convertView
.
findViewById
<
TextView
>(
R
.
id
.
version_name
)
//
// override fun onCancel() {
val
viewBinder
=
// }
MediationViewBinder
.
Builder
(
R
.
layout
.
mediation_listitem_ad_small_pic
)
//
.
titleId
(
R
.
id
.
tv_listitem_ad_title
)
// /**
.
sourceId
(
R
.
id
.
tv_listitem_ad_source
).
descriptionTextId
(
// * 拒绝再次提交
R
.
id
.
tv_listitem_ad_desc
// */
)
// override fun onRefuse() {}
.
mainImageId
(
R
.
id
.
iv_listitem_image
)
// override fun onShow() {}
.
logoLayoutId
(
R
.
id
.
tt_ad_logo
)
// })
.
callToActionId
(
R
.
id
.
btn_listitem_creative
)
// }
.
iconImageId
(
R
.
id
.
iv_listitem_icon
).
build
()
//
adViewHolder
.
viewBinder
=
viewBinder
// //设置点击展示回调监听
bindData
(
convertView
,
adViewHolder
)
// ad.setNativeAdListener(object : GMNativeExpressAdListener {
if
(
mTTFeedAd
?.
imageList
?.
size
!=
0
)
{
// override fun onAdClick() {
mTTFeedAd
?.
let
{
ttfeedad
->
// if (isClickScreen) {
ttfeedad
.
imageList
[
0
]
?.
imageUrl
?.
let
{
// // 防止重复
Glide
.
with
(
ForegroundOrBackground
.
getTopActivity
()).
load
(
it
)
// isClickScreen = false
.
into
(
adViewHolder
.
mSmallImage
!!
)
// }
}
//
}
// }
}
//
return
convertView
;
// // ** 注意点 ** 不要在广告加载成功回调里进行广告view展示,要在onRenderSucces进行广告view展示,否则会导致广告无法展示。
}
// // 另外,不要直接使用参数view,而是通过ad.getExpressView()来获取广告view。
// override fun onRenderSuccess(width: Float, height: Float) {
private
fun
getLargeAdView
(
parent
:
ViewGroup
?):
View
{
//
val
adViewHolder
=
LargeAdViewHolder
()
// //回调渲染成功后将模板布局添加的父View中
var
convertView
:
View
=
// if (adViewHolder.mAdContainerView != null) {
LayoutInflater
.
from
(
ForegroundOrBackground
.
getTopActivity
())
// //获取视频播放view,该view SDK内部渲染,在媒体平台可配置视频是否自动播放等设置。
.
inflate
(
// val sWidth: Int
R
.
layout
.
mediation_listitem_ad_large_pic
,
// val sHeight: Int
parent
,
// val video = ad.expressView // 使用该方式获取广告view,而不是直接使用onRenderSuccess的参数view。
false
// if (width == GMAdSize.FULL_WIDTH.toFloat() && height == GMAdSize.AUTO_HEIGHT.toFloat()) {
)
// sWidth = FrameLayout.LayoutParams.MATCH_PARENT
adViewHolder
.
mTitle
=
// sHeight = FrameLayout.LayoutParams.MATCH_PARENT
convertView
.
findViewById
<
View
>(
R
.
id
.
tv_listitem_ad_title
)
as
TextView
// } else {
adViewHolder
.
mDescription
=
// sWidth = UIUtils.getScreenWidth(MintsApplication.getContext())
convertView
.
findViewById
<
View
>(
R
.
id
.
tv_listitem_ad_desc
)
as
TextView
// sHeight = (sWidth * height / width).toInt()
adViewHolder
.
mSource
=
// }
convertView
.
findViewById
<
View
>(
R
.
id
.
tv_listitem_ad_source
)
as
TextView
// if (video != null) {
adViewHolder
.
mLargeImage
=
// if (video.parent == null) {
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_image
)
as
ImageView
// val layoutParams = FrameLayout.LayoutParams(sWidth, sHeight)
adViewHolder
.
mIcon
=
// adViewHolder.mAdContainerView!!.removeAllViews()
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_icon
)
as
ImageView
// adViewHolder.mAdContainerView!!.addView(video, layoutParams)
adViewHolder
.
mDislike
=
// }
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_dislike
)
as
ImageView
// }
adViewHolder
.
mCreativeButton
=
// }
convertView
.
findViewById
<
View
>(
R
.
id
.
btn_listitem_creative
)
as
Button
//
adViewHolder
.
mLogo
=
// mExpressAdCallback?.let {
convertView
.
findViewById
<
RelativeLayout
>(
R
.
id
.
tt_ad_logo
)
//logoView 建议传入GroupView类型
// if (it.renderSuccess(frameLayout)) {
// adcode = ad.showEcpm?.adNetworkRitId ?: ""
// ecpm = ad.showEcpm?.preEcpm ?: ""
adViewHolder
.
app_info
=
// adSource = ad.showEcpm?.adNetworkPlatformName ?: ""
convertView
.
findViewById
<
LinearLayout
>(
R
.
id
.
app_info
)
//
adViewHolder
.
app_name
=
// LogUtil.d(
convertView
.
findViewById
<
TextView
>(
R
.
id
.
app_name
)
// TAG,
adViewHolder
.
author_name
=
// "gromore应用内网赚信息流 onRenderSuccess -> showAd->$isShowAd \n adcode->$adcode ecpm->$ecpm"
convertView
.
findViewById
<
TextView
>(
R
.
id
.
author_name
)
// )
adViewHolder
.
package_size
=
//
convertView
.
findViewById
<
TextView
>(
R
.
id
.
package_size
)
// isLoadSuccess = 0
adViewHolder
.
permissions_url
=
// isShowAd = true
convertView
.
findViewById
<
TextView
>(
R
.
id
.
permissions_url
)
// adShowTime = System.currentTimeMillis()
adViewHolder
.
permissions_content
=
// }
convertView
.
findViewById
<
TextView
>(
R
.
id
.
permissions_content
)
// }
adViewHolder
.
privacy_agreement
=
// mExpressAdCallback = null
convertView
.
findViewById
<
TextView
>(
R
.
id
.
privacy_agreement
)
// }
adViewHolder
.
version_name
=
//
convertView
.
findViewById
<
TextView
>(
R
.
id
.
version_name
)
// override fun onAdShow() {
// adcode = mTtNativeAd?.showEcpm?.adNetworkRitId ?: ""
val
viewBinder
=
// ecpm = mTtNativeAd?.showEcpm?.preEcpm ?: ""
MediationViewBinder
.
Builder
(
R
.
layout
.
mediation_listitem_ad_large_pic
)
// adSource = mTtNativeAd?.showEcpm?.adNetworkPlatformName ?: ""
.
titleId
(
R
.
id
.
tv_listitem_ad_title
)
// }
.
descriptionTextId
(
R
.
id
.
tv_listitem_ad_desc
).
sourceId
(
//
R
.
id
.
tv_listitem_ad_source
// override fun onRenderFail(view: View, msg: String, code: Int) {
)
// LogUtil.e(TAG, "gromore应用内网赚信息流--> 3、onRewardVideoLoadFail onError $code$msg")
.
mainImageId
(
R
.
id
.
iv_listitem_image
)
// isLoadSuccess = 0
.
callToActionId
(
R
.
id
.
btn_listitem_creative
)
// }
.
logoLayoutId
(
R
.
id
.
tt_ad_logo
)
//
.
iconImageId
(
R
.
id
.
iv_listitem_icon
).
build
()
// })
adViewHolder
.
viewBinder
=
viewBinder
//
bindData
(
convertView
,
adViewHolder
)
//
if
(
mTTFeedAd
?.
imageList
?.
size
!=
0
)
{
// //视频广告设置播放状态回调(可选)
mTTFeedAd
?.
let
{
ttfeedad
->
// ad.setVideoListener(object : GMVideoListener {
ttfeedad
.
imageList
[
0
]
?.
imageUrl
?.
let
{
// override fun onVideoStart() {
Glide
.
with
(
ForegroundOrBackground
.
getTopActivity
()).
load
(
it
)
// }
.
into
(
adViewHolder
.
mLargeImage
!!
)
//
}
// override fun onVideoPause() {
}
// }
}
//
return
convertView
// override fun onVideoResume() {
}
// }
//
private
fun
getGroupAdView
(
parent
:
ViewGroup
?):
View
?
{
// override fun onVideoCompleted() {
val
adViewHolder
=
GroupAdViewHolder
()
// }
var
convertView
:
View
=
LayoutInflater
.
from
(
ForegroundOrBackground
.
getTopActivity
())
//
.
inflate
(
// override fun onVideoError(adError: AdError) {
R
.
layout
.
mediation_listitem_ad_group_pic
,
// }
parent
,
//
false
// override fun onProgressUpdate(p0: Long, p1: Long) {
)
// }
adViewHolder
.
mTitle
=
// })
convertView
.
findViewById
<
View
>(
R
.
id
.
tv_listitem_ad_title
)
as
TextView
// ad.render()
adViewHolder
.
mSource
=
// } catch (e: Exception) {
convertView
.
findViewById
<
View
>(
R
.
id
.
tv_listitem_ad_source
)
as
TextView
// e.printStackTrace()
adViewHolder
.
mDescription
=
// }
convertView
.
findViewById
<
View
>(
R
.
id
.
tv_listitem_ad_desc
)
as
TextView
// return convertView
adViewHolder
.
mGroupImage1
=
// }
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_image1
)
as
ImageView
//
adViewHolder
.
mGroupImage2
=
//
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_image2
)
as
ImageView
// private fun getVerticalAdView(ad: GMNativeAd): View {
adViewHolder
.
mGroupImage3
=
// val convertView = LayoutInflater.from(MintsApplication.getContext())
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_image3
)
as
ImageView
// .inflate(R.layout.listitem_ad_vertical_pic, null, false)
adViewHolder
.
mIcon
=
// val adViewHolder = VerticalAdViewHolder()
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_icon
)
as
ImageView
// adViewHolder.mTitle = convertView!!.findViewById(R.id.tv_listitem_ad_title) as TextView
adViewHolder
.
mDislike
=
// adViewHolder.mSource = convertView.findViewById(R.id.tv_listitem_ad_source) as TextView
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_dislike
)
as
ImageView
// adViewHolder.mDescription =
adViewHolder
.
mCreativeButton
=
// convertView.findViewById<View>(R.id.tv_listitem_ad_desc) as TextView
convertView
.
findViewById
<
View
>(
R
.
id
.
btn_listitem_creative
)
as
Button
// adViewHolder.mVerticalImage = convertView.findViewById(R.id.iv_listitem_image)
adViewHolder
.
mLogo
=
// adViewHolder.mIcon = convertView.findViewById<View>(R.id.iv_listitem_icon) as ImageView
convertView
.
findViewById
<
RelativeLayout
>(
R
.
id
.
tt_ad_logo
)
//logoView 建议传入GroupView类型
// adViewHolder.mDislike =
// convertView.findViewById<View>(R.id.iv_listitem_dislike) as ImageView
// adViewHolder.mCreativeButton =
adViewHolder
.
app_info
=
// convertView.findViewById<View>(R.id.btn_listitem_creative) as Button
convertView
.
findViewById
<
LinearLayout
>(
R
.
id
.
app_info
)
// adViewHolder.mLogo = convertView.findViewById(R.id.tt_ad_logo) //logoView 建议传入GroupView类型
adViewHolder
.
app_name
=
// val viewBinder: GMViewBinder = GMViewBinder.Builder(R.layout.listitem_ad_vertical_pic)
convertView
.
findViewById
<
TextView
>(
R
.
id
.
app_name
)
// .titleId(R.id.tv_listitem_ad_title)
adViewHolder
.
author_name
=
// .mainImageId(R.id.iv_listitem_image)
convertView
.
findViewById
<
TextView
>(
R
.
id
.
author_name
)
// .iconImageId(R.id.iv_listitem_icon)
adViewHolder
.
package_size
=
// .callToActionId(R.id.btn_listitem_creative)
convertView
.
findViewById
<
TextView
>(
R
.
id
.
package_size
)
// .sourceId(R.id.tv_listitem_ad_source)
adViewHolder
.
permissions_url
=
// .logoLayoutId(R.id.tt_ad_logo) //logoView 建议传入GroupView类型
convertView
.
findViewById
<
TextView
>(
R
.
id
.
permissions_url
)
// .build()
adViewHolder
.
permissions_content
=
// adViewHolder.viewBinder = viewBinder
convertView
.
findViewById
<
TextView
>(
R
.
id
.
permissions_content
)
// convertView.tag = adViewHolder
adViewHolder
.
privacy_agreement
=
// bindData(convertView, adViewHolder, ad, viewBinder)
convertView
.
findViewById
<
TextView
>(
R
.
id
.
privacy_agreement
)
// if (ad.imageUrl != null) {
adViewHolder
.
version_name
=
// adViewHolder.mVerticalImage?.let {
convertView
.
findViewById
<
TextView
>(
R
.
id
.
version_name
)
// Glide.with(MintsApplication.getContext()).load(ad.imageUrl).into(it)
// }
val
viewBinder
=
// }
MediationViewBinder
.
Builder
(
R
.
layout
.
mediation_listitem_ad_group_pic
)
// return convertView
.
titleId
(
R
.
id
.
tv_listitem_ad_title
)
// }
.
descriptionTextId
(
R
.
id
.
tv_listitem_ad_desc
).
sourceId
(
//
R
.
id
.
tv_listitem_ad_source
// //渲染视频广告,以视频广告为例,以下说明
)
// private fun getVideoView(ad: GMNativeAd): View? {
.
mainImageId
(
R
.
id
.
iv_listitem_image1
)
// val adViewHolder: VideoAdViewHolder
.
logoLayoutId
(
R
.
id
.
tt_ad_logo
).
callToActionId
(
// val viewBinder: GMViewBinder
R
.
id
.
btn_listitem_creative
// val convertView = LayoutInflater.from(MintsApplication.getContext())
).
iconImageId
(
R
.
id
.
iv_listitem_icon
)
// .inflate(R.layout.listitem_ad_large_video, null, false)
.
groupImage1Id
(
R
.
id
.
iv_listitem_image1
).
groupImage2Id
(
// try {
R
.
id
.
iv_listitem_image2
// adViewHolder = VideoAdViewHolder()
)
// adViewHolder.mTitle =
.
groupImage3Id
(
R
.
id
.
iv_listitem_image3
).
build
()
// convertView!!.findViewById<View>(R.id.tv_listitem_ad_title) as TextView
adViewHolder
.
viewBinder
=
viewBinder
// adViewHolder.mDescription =
// convertView.findViewById<View>(R.id.tv_listitem_ad_desc) as TextView
bindData
(
convertView
,
adViewHolder
)
// adViewHolder.mSource =
if
(
mTTFeedAd
?.
imageList
?.
size
?:
0
>=
3
)
{
// convertView.findViewById<View>(R.id.tv_listitem_ad_source) as TextView
val
image1
:
String
?
=
mTTFeedAd
?.
imageList
?.
get
(
0
)
?.
imageUrl
// adViewHolder.videoView =
val
image2
:
String
?
=
mTTFeedAd
?.
imageList
?.
get
(
1
)
?.
imageUrl
// convertView.findViewById<View>(R.id.iv_listitem_video) as FrameLayout
val
image3
:
String
?
=
mTTFeedAd
?.
imageList
?.
get
(
2
)
?.
imageUrl
// adViewHolder.mIcon = convertView.findViewById<View>(R.id.iv_listitem_icon) as ImageView
if
(
image1
!=
null
)
{
// adViewHolder.mDislike =
Glide
.
with
(
ForegroundOrBackground
.
getTopActivity
()).
load
(
image1
)
// convertView.findViewById<View>(R.id.iv_listitem_dislike) as ImageView
.
into
(
adViewHolder
.
mGroupImage1
!!
)
// adViewHolder.mCreativeButton =
}
// convertView.findViewById<View>(R.id.btn_listitem_creative) as Button
if
(
image2
!=
null
)
{
// adViewHolder.mLogo =
Glide
.
with
(
ForegroundOrBackground
.
getTopActivity
()).
load
(
image2
)
// convertView.findViewById(R.id.tt_ad_logo) //logoView 建议传入GroupView类型
.
into
(
adViewHolder
.
mGroupImage2
!!
)
//
}
// //TTViewBinder 是必须类,需要开发者在确定好View之后把Id设置给TTViewBinder类,并在注册事件时传递给SDK
if
(
image3
!=
null
)
{
// viewBinder = GMViewBinder.Builder(R.layout.listitem_ad_large_video)
Glide
.
with
(
ForegroundOrBackground
.
getTopActivity
()).
load
(
image3
)
// .titleId(R.id.tv_listitem_ad_title)
.
into
(
adViewHolder
.
mGroupImage3
!!
)
// .sourceId(R.id.tv_listitem_ad_source)
}
// .mediaViewIdId(R.id.iv_listitem_video)
}
// .callToActionId(R.id.btn_listitem_creative)
return
convertView
// .logoLayoutId(R.id.tt_ad_logo)//logoView 建议传入GroupView类型
}
// .iconImageId(R.id.iv_listitem_icon)
// .build()
private
fun
getVideoView
(
parent
:
ViewGroup
?):
View
?
{
// adViewHolder.viewBinder = viewBinder
val
adViewHolder
=
VideoAdViewHolder
()
// convertView.tag = adViewHolder
var
convertView
:
View
?
=
null
//
try
{
// //视频广告设置播放状态回调(可选)
convertView
=
LayoutInflater
.
from
(
ForegroundOrBackground
.
getTopActivity
())
// ad.setVideoListener(object : GMVideoListener {
.
inflate
(
// override fun onVideoStart() {
R
.
layout
.
mediation_listitem_ad_large_video
,
// }
parent
,
//
false
// override fun onVideoPause() {
)
// }
adViewHolder
.
mTitle
=
//
convertView
.
findViewById
<
View
>(
R
.
id
.
tv_listitem_ad_title
)
as
TextView
// override fun onVideoResume() {
adViewHolder
.
mDescription
=
// }
convertView
.
findViewById
<
View
>(
R
.
id
.
tv_listitem_ad_desc
)
as
TextView
//
adViewHolder
.
mSource
=
// override fun onVideoCompleted() {
convertView
.
findViewById
<
View
>(
R
.
id
.
tv_listitem_ad_source
)
as
TextView
// }
adViewHolder
.
videoView
=
//
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_video
)
as
FrameLayout
// override fun onVideoError(adError: AdError) {
adViewHolder
.
mIcon
=
// }
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_icon
)
as
ImageView
//
adViewHolder
.
mDislike
=
// override fun onProgressUpdate(p0: Long, p1: Long) {
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_dislike
)
as
ImageView
// }
adViewHolder
.
mCreativeButton
=
// })
convertView
.
findViewById
<
View
>(
R
.
id
.
btn_listitem_creative
)
as
Button
//
adViewHolder
.
mLogo
=
// //绑定广告数据、设置交互回调
convertView
.
findViewById
<
RelativeLayout
>(
R
.
id
.
tt_ad_logo
)
//logoView 建议传入GroupView类型
// bindData(convertView, adViewHolder, ad, viewBinder)
adViewHolder
.
app_info
=
// } catch (e: Exception) {
convertView
.
findViewById
<
LinearLayout
>(
R
.
id
.
app_info
)
// e.printStackTrace()
adViewHolder
.
app_name
=
// }
convertView
.
findViewById
<
TextView
>(
R
.
id
.
app_name
)
// return convertView
adViewHolder
.
author_name
=
// }
convertView
.
findViewById
<
TextView
>(
R
.
id
.
author_name
)
//
adViewHolder
.
package_size
=
// private fun getLargeAdView(ad: GMNativeAd): View {
convertView
.
findViewById
<
TextView
>(
R
.
id
.
package_size
)
// val convertView = LayoutInflater.from(MintsApplication.getContext())
adViewHolder
.
permissions_url
=
// .inflate(R.layout.listitem_ad_large_pic, null, false)
convertView
.
findViewById
<
TextView
>(
R
.
id
.
permissions_url
)
// val adViewHolder = LargeAdViewHolder()
adViewHolder
.
permissions_content
=
// adViewHolder.mTitle =
convertView
.
findViewById
<
TextView
>(
R
.
id
.
permissions_content
)
// convertView!!.findViewById<View>(R.id.tv_listitem_ad_title) as TextView
adViewHolder
.
privacy_agreement
=
// adViewHolder.mDescription =
convertView
.
findViewById
<
TextView
>(
R
.
id
.
privacy_agreement
)
// convertView.findViewById<View>(R.id.tv_listitem_ad_desc) as TextView
adViewHolder
.
version_name
=
// adViewHolder.mSource =
convertView
.
findViewById
<
TextView
>(
R
.
id
.
version_name
)
// convertView.findViewById<View>(R.id.tv_listitem_ad_source) as TextView
// adViewHolder.mLargeImage =
val
viewBinder
=
// convertView.findViewById<View>(R.id.iv_listitem_image) as ImageView
MediationViewBinder
.
Builder
(
R
.
layout
.
mediation_listitem_ad_large_video
)
// adViewHolder.mIcon = convertView.findViewById<View>(R.id.iv_listitem_icon) as ImageView
.
titleId
(
R
.
id
.
tv_listitem_ad_title
)
// adViewHolder.mDislike =
.
sourceId
(
R
.
id
.
tv_listitem_ad_source
)
// convertView.findViewById<View>(R.id.iv_listitem_dislike) as ImageView
.
descriptionTextId
(
R
.
id
.
tv_listitem_ad_desc
)
// adViewHolder.mCreativeButton =
.
mediaViewIdId
(
// convertView.findViewById<View>(R.id.btn_listitem_creative) as Button
R
.
id
.
iv_listitem_video
// adViewHolder.mLogo = convertView.findViewById(R.id.tt_ad_logo) //logoView 建议传入GroupView类型
)
// val viewBinder: GMViewBinder = GMViewBinder.Builder(R.layout.listitem_ad_large_pic)
.
callToActionId
(
R
.
id
.
btn_listitem_creative
)
// .titleId(R.id.tv_listitem_ad_title)
.
logoLayoutId
(
R
.
id
.
tt_ad_logo
)
// .sourceId(R.id.tv_listitem_ad_source)
.
iconImageId
(
R
.
id
.
iv_listitem_icon
).
build
()
// .mainImageId(R.id.iv_listitem_image)
adViewHolder
.
viewBinder
=
viewBinder
// .callToActionId(R.id.btn_listitem_creative)
// .logoLayoutId(R.id.tt_ad_logo)//logoView 建议传入GroupView类型
// 如果自己有需求进行视频播放操作,则按如下步骤进行。注意:不是所有adn都支持,因此需要进行判空操作。
// .iconImageId(R.id.iv_listitem_icon)
// mTTFeedAd?.csjmAdInfo?.setUseCustomVideo(true) // 注意:要在registerView之前调用
// .build()
val
videoUrl
:
String
?
=
mTTFeedAd
?.
customVideo
?.
videoUrl
// 注意:不是所有adn都支持,这里务必要进行判空操作
// adViewHolder.viewBinder = viewBinder
if
(!
TextUtils
.
isEmpty
(
videoUrl
))
{
// convertView.tag = adViewHolder
// 如果通过getVideoUrl返回的url不是空,则自己处理视频播放操作,并通过reporter上报视频状态
// bindData(convertView, adViewHolder, ad, viewBinder)
playAdVideo
(
adViewHolder
.
videoView
as
FrameLayout
,
videoUrl
?:
""
)
// if (ad.imageUrl != null) {
}
else
{
// adViewHolder.mLargeImage?.let {
// 注意:即使该adn支持返回url,但某次偶然原因返回的videoUrl为空,则仍然会用adn自己的视频播放作为兜底
// Glide.with(MintsApplication.getContext()).load(ad.imageUrl).into(it)
}
// }
// }
//视频广告设置播放状态回调(可选)
// return convertView
mTTFeedAd
?.
setVideoAdListener
(
object
:
TTFeedAd
.
VideoAdListener
{
// }
override
fun
onVideoLoad
(
ad
:
TTFeedAd
?)
{
//
Log
.
i
(
TAG
,
"onVideoLoad"
)
// private fun getGroupAdView(ad: GMNativeAd): View {
}
// val convertView = LayoutInflater.from(MintsApplication.getContext())
// .inflate(R.layout.listitem_ad_group_pic, null, false)
override
fun
onVideoError
(
errorCode
:
Int
,
extraCode
:
Int
)
{
// val adViewHolder = GroupAdViewHolder()
Log
.
i
(
TAG
,
"onVideoError"
)
// adViewHolder.mTitle = convertView!!.findViewById(R.id.tv_listitem_ad_title) as TextView
}
// adViewHolder.mSource = convertView.findViewById(R.id.tv_listitem_ad_source) as TextView
// adViewHolder.mDescription = convertView.findViewById(R.id.tv_listitem_ad_desc) as TextView
override
fun
onVideoAdStartPlay
(
ad
:
TTFeedAd
?)
{
// adViewHolder.mGroupImage1 = convertView.findViewById(R.id.iv_listitem_image1) as ImageView
Log
.
i
(
TAG
,
"onVideoAdStartPlay"
)
// adViewHolder.mGroupImage2 = convertView.findViewById(R.id.iv_listitem_image2) as ImageView
}
// adViewHolder.mGroupImage3 = convertView.findViewById(R.id.iv_listitem_image3) as ImageView
// adViewHolder.mIcon = convertView.findViewById(R.id.iv_listitem_icon) as ImageView
override
fun
onVideoAdPaused
(
ad
:
TTFeedAd
?)
{
// adViewHolder.mDislike = convertView.findViewById(R.id.iv_listitem_dislike) as ImageView
Log
.
i
(
TAG
,
"onVideoAdPaused"
)
// adViewHolder.mCreativeButton =
}
// convertView.findViewById(R.id.btn_listitem_creative) as Button
// adViewHolder.mLogo = convertView.findViewById(R.id.tt_ad_logo) //logoView 建议传入GroupView类型
override
fun
onVideoAdContinuePlay
(
ad
:
TTFeedAd
?)
{
// val viewBinder: GMViewBinder = GMViewBinder.Builder(R.layout.listitem_ad_group_pic)
Log
.
i
(
TAG
,
"onVideoAdContinuePlay"
)
// .titleId(R.id.tv_listitem_ad_title)
}
// .sourceId(R.id.tv_listitem_ad_source)//传第一张即可
// .mainImageId(R.id.iv_listitem_image1)
override
fun
onProgressUpdate
(
current
:
Long
,
duration
:
Long
)
{
// .logoLayoutId(R.id.tt_ad_logo)//logoView 建议传入GroupView类型
Log
.
i
(
TAG
,
"onProgressUpdate"
)
// .callToActionId(R.id.btn_listitem_creative)
}
// .iconImageId(R.id.iv_listitem_icon)
// .build()
override
fun
onVideoAdComplete
(
ad
:
TTFeedAd
?)
{
// adViewHolder.viewBinder = viewBinder
Log
.
i
(
TAG
,
"onVideoAdComplete"
)
// convertView.tag = adViewHolder
}
// bindData(convertView, adViewHolder, ad, viewBinder)
// if (ad.imageList != null && ad.imageList!!.size >= 3) {
})
// val image1 = ad.imageList!![0]
mTTFeedAd
?.
setDownloadListener
(
object
:
TTAppDownloadListener
{
// val image2 = ad.imageList!![1]
override
fun
onIdle
()
{
// val image3 = ad.imageList!![2]
Log
.
i
(
TAG
,
"setDownloadListener"
)
// if (image1 != null) {
}
// adViewHolder.mGroupImage1?.let {
// Glide.with(MintsApplication.getContext()).load(image1).into(it)
override
fun
onDownloadActive
(
// }
totalBytes
:
Long
,
// }
currBytes
:
Long
,
// if (image2 != null) {
fileName
:
String
?,
// adViewHolder.mGroupImage2?.let {
appName
:
String
?
// Glide.with(MintsApplication.getContext()).load(image2).into(it)
)
{
// }
Log
.
i
(
TAG
,
"onDownloadActive"
)
// }
}
// if (image3 != null) {
// adViewHolder.mGroupImage3?.let {
override
fun
onDownloadPaused
(
// Glide.with(MintsApplication.getContext()).load(image3).into(it)
totalBytes
:
Long
,
// }
currBytes
:
Long
,
// }
fileName
:
String
?,
// }
appName
:
String
?
// return convertView
)
{
// }
Log
.
i
(
TAG
,
"onDownloadPaused"
)
//
}
// private fun getSmallAdView(ad: GMNativeAd): View {
// val convertView = LayoutInflater.from(MintsApplication.getContext())
override
fun
onDownloadFailed
(
// .inflate(R.layout.listitem_ad_small_pic, null, false)
totalBytes
:
Long
,
// val adViewHolder = SmallAdViewHolder()
currBytes
:
Long
,
// adViewHolder.mTitle =
fileName
:
String
?,
// convertView!!.findViewById<View>(R.id.tv_listitem_ad_title) as TextView
appName
:
String
?
// adViewHolder.mSource =
)
{
// convertView.findViewById<View>(R.id.tv_listitem_ad_source) as TextView
Log
.
i
(
TAG
,
"onDownloadFailed"
)
// adViewHolder.mDescription =
}
// convertView.findViewById<View>(R.id.tv_listitem_ad_desc) as TextView
// adViewHolder.mSmallImage =
override
fun
onDownloadFinished
(
// convertView.findViewById<View>(R.id.iv_listitem_image) as ImageView
totalBytes
:
Long
,
// adViewHolder.mIcon = convertView.findViewById<View>(R.id.iv_listitem_icon) as ImageView
fileName
:
String
?,
// adViewHolder.mDislike =
appName
:
String
?
// convertView.findViewById<View>(R.id.iv_listitem_dislike) as ImageView
)
{
// adViewHolder.mCreativeButton =
Log
.
i
(
TAG
,
"onDownloadFinished"
)
// convertView.findViewById<View>(R.id.btn_listitem_creative) as Button
}
// val viewBinder: GMViewBinder = GMViewBinder.Builder(R.layout.listitem_ad_small_pic)
// .titleId(R.id.tv_listitem_ad_title)
override
fun
onInstalled
(
fileName
:
String
?,
appName
:
String
?)
{
// .sourceId(R.id.tv_listitem_ad_source)
Log
.
i
(
TAG
,
"onInstalled"
)
// .mainImageId(R.id.iv_listitem_image)
}
// .logoLayoutId(R.id.tt_ad_logo)//logoView 建议为GroupView 类型
// .callToActionId(R.id.btn_listitem_creative)
})
// .iconImageId(R.id.iv_listitem_icon)
//绑定广告数据、设置交互回调
// .build()
bindData
(
convertView
,
adViewHolder
)
// adViewHolder.viewBinder = viewBinder
}
catch
(
e
:
Exception
)
{
// convertView.tag = adViewHolder
e
.
printStackTrace
()
//
}
// bindData(convertView, adViewHolder, ad, viewBinder)
// if (ad.imageUrl != null) {
return
convertView
// adViewHolder.mSmallImage?.let {
}
// Glide.with(MintsApplication.getContext()).load(ad.imageUrl).into(it)
// }
private
var
mVideoView
:
VideoView
?
=
null
// }
private
var
customVideoReporter
:
TTFeedAd
.
CustomizeVideo
?
=
null
// return convertView
// }
private
fun
playAdVideo
(
videoContainer
:
ViewGroup
,
videoUrl
:
String
)
{
//
mVideoView
=
VideoView
(
MintsApplication
.
getContext
())
// private fun bindData(
videoContainer
.
addView
(
mVideoView
)
// convertView: View,
customVideoReporter
=
mTTFeedAd
?.
customVideo
// adViewHolder: AdViewHolder,
// 开发者根据自己的需求,做相应的视频控制界面,播放暂停等
// ad: GMNativeAd,
mVideoView
?.
setVideoURI
(
Uri
.
parse
(
videoUrl
))
// viewBinder: GMViewBinder
mVideoView
?.
setOnErrorListener
{
mp
,
what
,
extra
->
// ) {
if
(
customVideoReporter
!=
null
)
{
// //设置dislike弹窗,如果有
customVideoReporter
?.
reportVideoError
(
//// if (ad.hasDislike()) {
mVideoView
!!
.
currentPosition
.
toLong
(),
//// val ttAdDislike = ad.getDislikeDialog( MintsApplication.getContext() as Activity?)
what
,
//// adViewHolder.mDislike.setVisibility(View.VISIBLE)
extra
//// adViewHolder.mDislike.setOnClickListener(View.OnClickListener {
)
//// //使用接口来展示
}
//// ttAdDislike.showDislikeDialog()
false
//// ttAdDislike.setDislikeCallback(object : TTDislikeCallback {
}
//// override fun onSelected(position: Int, value: String) {}
mVideoView
?.
setOnCompletionListener
{
////
if
(
customVideoReporter
!=
null
)
{
//// override fun onCancel() {}
customVideoReporter
?.
reportVideoFinish
()
////
}
//// /**
}
//// * 拒绝再次提交
mVideoView
?.
start
()
//// */
customVideoReporter
?.
reportVideoStart
()
//// /**
}
//// * 拒绝再次提交
//// */
private
fun
getVerticalAdView
(
parent
:
ViewGroup
?):
View
?
{
//// override fun onRefuse() {}
val
adViewHolder
=
VerticalAdViewHolder
()
//// override fun onShow() {}
var
convertView
=
LayoutInflater
.
from
(
ForegroundOrBackground
.
getTopActivity
())
//// })
.
inflate
(
//// })
R
.
layout
.
mediation_listitem_ad_vertical_pic
,
//// } else {
parent
,
//// if (adViewHolder.mDislike != null) adViewHolder.mDislike.setVisibility(View.GONE)
false
//// }
)
//
adViewHolder
.
mTitle
=
// //设置事件回调
convertView
.
findViewById
<
View
>(
R
.
id
.
tv_listitem_ad_title
)
as
TextView
// ad.setNativeAdListener(mTTNativeAdListener)
adViewHolder
.
mSource
=
// //可以被点击的view, 也可以把convertView放进来意味item可被点击
convertView
.
findViewById
<
View
>(
R
.
id
.
tv_listitem_ad_source
)
as
TextView
// val clickViewList: MutableList<View> = ArrayList()
adViewHolder
.
mDescription
=
// clickViewList.add(convertView)
convertView
?.
findViewById
<
View
>(
R
.
id
.
tv_listitem_ad_desc
)
as
TextView
// adViewHolder.mSource?.let { clickViewList.add(it) }
adViewHolder
.
mVerticalImage
=
// adViewHolder.mTitle?.let { clickViewList.add(it) }
convertView
.
findViewById
<
ImageView
>(
R
.
id
.
iv_listitem_image
)
// adViewHolder.mDescription?.let { clickViewList.add(it) }
adViewHolder
.
mIcon
=
// adViewHolder.mIcon?.let { clickViewList.add(it) }
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_icon
)
as
ImageView
// //添加点击区域
adViewHolder
.
mDislike
=
// if (adViewHolder is LargeAdViewHolder) {
convertView
.
findViewById
<
View
>(
R
.
id
.
iv_listitem_dislike
)
as
ImageView
// adViewHolder.mLargeImage?.let { clickViewList.add(it) }
adViewHolder
.
mCreativeButton
=
// } else if (adViewHolder is SmallAdViewHolder) {
convertView
.
findViewById
<
View
>(
R
.
id
.
btn_listitem_creative
)
as
Button
// adViewHolder.mSmallImage?.let { clickViewList.add(it) }
// adViewHolder.mLogo =
// } else if (adViewHolder is VerticalAdViewHolder) {
// convertView.findViewById<RelativeLayout>(R.id.tt_ad_logo) //logoView 建议传入GroupView类型
// adViewHolder.mVerticalImage?.let { clickViewList.add(it) }
// } else if (adViewHolder is VideoAdViewHolder) {
// adViewHolder.videoView?.let { clickViewList.add(it) }
adViewHolder
.
app_info
=
// } else if (adViewHolder is GroupAdViewHolder) {
convertView
.
findViewById
<
LinearLayout
>(
R
.
id
.
app_info
)
// adViewHolder.mGroupImage1?.let { clickViewList.add(it) }
adViewHolder
.
app_name
=
// adViewHolder.mGroupImage2?.let { clickViewList.add(it) }
convertView
.
findViewById
<
TextView
>(
R
.
id
.
app_name
)
// adViewHolder.mGroupImage3?.let { clickViewList.add(it) }
adViewHolder
.
author_name
=
// }
convertView
.
findViewById
<
TextView
>(
R
.
id
.
author_name
)
// //触发创意广告的view(点击下载或拨打电话)
adViewHolder
.
package_size
=
// val creativeViewList: MutableList<View> = ArrayList()
convertView
.
findViewById
<
TextView
>(
R
.
id
.
package_size
)
// adViewHolder.mCreativeButton?.let { creativeViewList.add(it) }
adViewHolder
.
permissions_url
=
// //重要! 这个涉及到广告计费,必须正确调用。convertView必须使用ViewGroup。
convertView
.
findViewById
<
TextView
>(
R
.
id
.
permissions_url
)
// ad.registerView((convertView as ViewGroup), clickViewList, creativeViewList, viewBinder)
adViewHolder
.
permissions_content
=
// adViewHolder.mTitle?.text = ad.title //title为广告的简单信息提示
convertView
.
findViewById
<
TextView
>(
R
.
id
.
permissions_content
)
// adViewHolder.mDescription?.text = ad.description //description为广告的较长的说明
adViewHolder
.
privacy_agreement
=
// adViewHolder.mSource?.text = if (TextUtils.isEmpty(ad.source)) "广告来源" else ad.source
convertView
.
findViewById
<
TextView
>(
R
.
id
.
privacy_agreement
)
// val icon = ad.iconUrl
adViewHolder
.
version_name
=
// if (icon != null) {
convertView
.
findViewById
<
TextView
>(
R
.
id
.
version_name
)
// adViewHolder.mIcon?.let {
// Glide.with(MintsApplication.getContext()).load(icon).into(it)
val
viewBinder
=
// }
MediationViewBinder
.
Builder
(
R
.
layout
.
mediation_listitem_ad_vertical_pic
)
// }
.
titleId
(
R
.
id
.
tv_listitem_ad_title
)
// val adCreativeButton: Button? = adViewHolder.mCreativeButton
.
descriptionTextId
(
R
.
id
.
tv_listitem_ad_desc
)
// when (ad.interactionType) {
.
mainImageId
(
R
.
id
.
iv_listitem_image
)
// GMAdConstant.INTERACTION_TYPE_DOWNLOAD -> {
.
iconImageId
(
R
.
id
.
iv_listitem_icon
)
// adCreativeButton?.visibility = View.VISIBLE
.
callToActionId
(
R
.
id
.
btn_listitem_creative
)
// adCreativeButton?.text =
.
sourceId
(
R
.
id
.
tv_listitem_ad_source
)
// if (TextUtils.isEmpty(ad.actionText)) "立即下载" else ad.actionText
.
logoLayoutId
(
R
.
id
.
tt_ad_logo
)
//logoView 建议传入GroupView类型
// }
.
build
()
// GMAdConstant.INTERACTION_TYPE_DIAL -> {
adViewHolder
.
viewBinder
=
viewBinder
// adCreativeButton?.visibility = View.VISIBLE
bindData
(
convertView
,
adViewHolder
)
// adCreativeButton?.text = "立即拨打"
if
(
mTTFeedAd
?.
imageList
?.
size
!=
0
)
{
// }
mTTFeedAd
?.
let
{
ttfeedad
->
// GMAdConstant.INTERACTION_TYPE_LANDING_PAGE, GMAdConstant.INTERACTION_TYPE_BROWSER -> {
ttfeedad
.
imageList
[
0
]
?.
imageUrl
?.
let
{
// adCreativeButton?.visibility = View.VISIBLE
Glide
.
with
(
ForegroundOrBackground
.
getTopActivity
()).
load
(
it
)
// adCreativeButton?.text =
.
into
(
adViewHolder
.
mVerticalImage
!!
)
// if (TextUtils.isEmpty(ad.actionText)) "查看详情" else ad.actionText
}
// }
}
// else -> {
}
// adCreativeButton?.visibility = View.GONE
return
convertView
// }
}
// }
// }
private
fun
bindData
(
convertView
:
View
,
adViewHolder
:
AdViewHolder
)
{
//
mTTFeedAd
?.
let
{
// private class VideoAdViewHolder : AdViewHolder() {
if
(
it
.
mediationManager
?.
hasDislike
()
==
true
)
{
// var videoView: FrameLayout? = null
val
ttAdDislike
:
TTAdDislike
=
// }
it
.
getDislikeDialog
(
ForegroundOrBackground
.
getTopActivity
())
//
adViewHolder
.
mDislike
?.
visibility
=
View
.
VISIBLE
// private class LargeAdViewHolder : AdViewHolder() {
adViewHolder
.
mDislike
?.
setOnClickListener
(
View
.
OnClickListener
{
// var mLargeImage: ImageView? = null
//使用接口来展示
// }
ttAdDislike
.
showDislikeDialog
()
//
ttAdDislike
.
setDislikeInteractionCallback
(
object
:
// private class SmallAdViewHolder : AdViewHolder() {
TTAdDislike
.
DislikeInteractionCallback
{
// var mSmallImage: ImageView? = null
override
fun
onShow
()
{
// }
Log
.
i
(
TAG
,
"dislike 点击show"
)
//
}
// private class VerticalAdViewHolder : AdViewHolder() {
// var mVerticalImage: ImageView? = null
override
fun
onSelected
(
position
:
Int
,
value
:
String
?,
enforce
:
Boolean
)
{
// }
Log
.
i
(
TAG
,
"点击 $value"
)
//
//用户选择不喜欢原因后,移除广告展示
// private class GroupAdViewHolder : AdViewHolder() {
frameLayout
?.
removeAllViews
()
// var mGroupImage1: ImageView? = null
}
// var mGroupImage2: ImageView? = null
// var mGroupImage3: ImageView? = null
override
fun
onCancel
()
{
// }
Log
.
i
(
TAG
,
"dislike 点击了取消"
)
//
}
// private class ExpressAdViewHolder {
// var mAdContainerView: FrameLayout? = null
})
// }
})
//
}
else
{
// private open class AdViewHolder {
if
(
adViewHolder
.
mDislike
!=
null
)
adViewHolder
.
mDislike
?.
visibility
=
View
.
GONE
// var viewBinder: GMViewBinder? = null
}
// var mIcon: ImageView? = null
// var mDislike: ImageView? = null
setDownLoadAppInfo
(
it
,
adViewHolder
)
// var mCreativeButton: Button? = null
// var mTitle: TextView? = null
//可以被点击的view, 也可以把convertView放进来意味item可被点击
// var mDescription: TextView? = null
val
clickViewList
:
MutableList
<
View
?>
=
ArrayList
()
// var mSource: TextView? = null
clickViewList
.
add
(
convertView
)
// var mLogo: RelativeLayout? = null
clickViewList
.
add
(
adViewHolder
.
mSource
)
// }
clickViewList
.
add
(
adViewHolder
.
mTitle
)
//
clickViewList
.
add
(
adViewHolder
.
mDescription
)
// private var mTTNativeAdListener: GMNativeAdListener = object : GMNativeAdListener {
clickViewList
.
add
(
adViewHolder
.
mIcon
)
// override fun onAdClick() {
//
//添加点击区域
// if (isClickScreen) {
if
(
adViewHolder
is
LargeAdViewHolder
)
{
// // 防止重复
clickViewList
.
add
(
adViewHolder
.
mLargeImage
)
// isClickScreen = false
}
else
if
(
adViewHolder
is
SmallAdViewHolder
)
{
// }
clickViewList
.
add
(
adViewHolder
.
mSmallImage
)
// }
}
else
if
(
adViewHolder
is
VerticalAdViewHolder
)
{
//
clickViewList
.
add
(
adViewHolder
.
mVerticalImage
)
// override fun onAdShow() {
}
else
if
(
adViewHolder
is
VideoAdViewHolder
)
{
// }
clickViewList
.
add
(
adViewHolder
.
videoView
)
// }
}
else
if
(
adViewHolder
is
GroupAdViewHolder
)
{
//
clickViewList
.
add
(
adViewHolder
.
mGroupImage1
)
// private var adShowTime: Long = 0 // 防止预加载超时 2秒
clickViewList
.
add
(
adViewHolder
.
mGroupImage2
)
//}
clickViewList
.
add
(
adViewHolder
.
mGroupImage3
)
\ No newline at end of file
}
//触发创意广告的view(点击下载或拨打电话)
val
creativeViewList
:
MutableList
<
View
?>
=
ArrayList
()
creativeViewList
.
add
(
adViewHolder
.
mCreativeButton
)
//重要! 这个涉及到广告计费,必须正确调用。**** convertView必须是com.bytedance.msdk.api.format.TTNativeAdView ****
it
.
registerViewForInteraction
(
ForegroundOrBackground
.
getTopActivity
(),
convertView
as
ViewGroup
,
clickViewList
,
creativeViewList
,
null
,
object
:
TTNativeAd
.
AdInteractionListener
{
override
fun
onAdClicked
(
view
:
View
?,
ad
:
TTNativeAd
?)
{
Log
.
i
(
TAG
,
"onAdClicked"
)
}
override
fun
onAdCreativeClick
(
view
:
View
?,
ad
:
TTNativeAd
?)
{
Log
.
i
(
TAG
,
"onAdCreativeClick"
)
}
override
fun
onAdShow
(
ad
:
TTNativeAd
?)
{
Log
.
i
(
TAG
,
"onAdShow"
)
ad
?.
let
{
// PrintUtil.printShowInfo(ad.mediationManager)
}
}
},
adViewHolder
.
viewBinder
)
adViewHolder
.
mTitle
?.
text
=
it
.
title
//title为广告的简单信息提示
adViewHolder
.
mDescription
?.
text
=
it
.
description
//description为广告的较长的说明
adViewHolder
.
mSource
?.
text
=
if
(
TextUtils
.
isEmpty
(
it
.
source
))
"广告来源"
else
it
.
source
val
icon
:
TTImage
?
=
it
.
icon
if
(
icon
!=
null
)
{
Glide
.
with
(
ForegroundOrBackground
.
getTopActivity
()).
load
(
icon
.
imageUrl
)
.
into
(
adViewHolder
.
mIcon
!!
)
}
val
adCreativeButton
=
adViewHolder
.
mCreativeButton
when
(
it
.
interactionType
)
{
TTAdConstant
.
INTERACTION_TYPE_DOWNLOAD
->
{
adCreativeButton
?.
visibility
=
View
.
VISIBLE
;
adCreativeButton
?.
setText
(
it
.
buttonText
?:
"立即下载"
)
}
TTAdConstant
.
INTERACTION_TYPE_DIAL
->
{
adCreativeButton
?.
visibility
=
View
.
VISIBLE
;
adCreativeButton
?.
setText
(
"立即拨打"
);
}
TTAdConstant
.
INTERACTION_TYPE_LANDING_PAGE
,
TTAdConstant
.
INTERACTION_TYPE_BROWSER
->
{
adCreativeButton
?.
visibility
=
View
.
VISIBLE
;
adCreativeButton
?.
setText
(
it
.
buttonText
?:
"查看详情"
)
}
else
->
{
adCreativeButton
?.
visibility
=
View
.
GONE
Log
.
i
(
TAG
,
"交互类型异常"
)
}
}
}
}
private
fun
setDownLoadAppInfo
(
ttNativeAd
:
TTFeedAd
,
adViewHolder
:
AdViewHolder
)
{
if
(
ttNativeAd
.
complianceInfo
==
null
)
{
adViewHolder
.
app_info
?.
visibility
=
View
.
GONE
}
else
{
adViewHolder
.
app_info
?.
visibility
=
View
.
VISIBLE
val
appInfo
=
ttNativeAd
.
complianceInfo
adViewHolder
.
app_name
?.
text
=
"应用名称:"
+
appInfo
.
appName
adViewHolder
.
author_name
?.
text
=
"开发者:"
+
appInfo
.
developerName
adViewHolder
.
package_size
?.
text
=
"包大小:不支持"
adViewHolder
.
permissions_url
?.
text
=
"权限url:不支持"
adViewHolder
.
privacy_agreement
?.
text
=
"隐私url:"
+
appInfo
.
privacyUrl
adViewHolder
.
version_name
?.
text
=
"版本号:"
+
appInfo
.
appVersion
adViewHolder
.
permissions_content
!!
.
text
=
"权限内容:"
+
getPermissionsContent
(
appInfo
.
permissionsMap
)
}
}
private
fun
getPermissionsContent
(
permissionsMap
:
Map
<
String
,
String
>?):
String
{
if
(
permissionsMap
==
null
)
{
return
""
}
val
stringBuffer
=
StringBuffer
()
val
keyList
=
permissionsMap
.
keys
for
(
s
in
keyList
)
{
stringBuffer
.
append
(
"""$s : ${permissionsMap[s]} """
)
}
return
stringBuffer
.
toString
()
}
private
class
VideoAdViewHolder
:
AdViewHolder
()
{
var
videoView
:
FrameLayout
?
=
null
}
private
class
LargeAdViewHolder
:
AdViewHolder
()
{
var
mLargeImage
:
ImageView
?
=
null
}
private
class
SmallAdViewHolder
:
AdViewHolder
()
{
var
mSmallImage
:
ImageView
?
=
null
}
private
class
VerticalAdViewHolder
:
AdViewHolder
()
{
var
mVerticalImage
:
ImageView
?
=
null
}
private
class
GroupAdViewHolder
:
AdViewHolder
()
{
var
mGroupImage1
:
ImageView
?
=
null
var
mGroupImage2
:
ImageView
?
=
null
var
mGroupImage3
:
ImageView
?
=
null
}
private
class
ExpressAdViewHolder
{
var
mAdContainerView
:
FrameLayout
?
=
null
}
open
private
class
AdViewHolder
{
var
viewBinder
:
MediationViewBinder
?
=
null
var
mIcon
:
ImageView
?
=
null
var
mDislike
:
ImageView
?
=
null
var
mCreativeButton
:
Button
?
=
null
var
mTitle
:
TextView
?
=
null
var
mDescription
:
TextView
?
=
null
var
mSource
:
TextView
?
=
null
var
mLogo
:
RelativeLayout
?
=
null
var
app_info
:
LinearLayout
?
=
null
var
app_name
:
TextView
?
=
null
var
author_name
:
TextView
?
=
null
var
package_size
:
TextView
?
=
null
var
permissions_url
:
TextView
?
=
null
var
privacy_agreement
:
TextView
?
=
null
var
version_name
:
TextView
?
=
null
var
permissions_content
:
TextView
?
=
null
}
}
\ No newline at end of file
video/app/src/main/java/com/mints/helivideo/common/Constant.kt
View file @
dfb91e38
...
@@ -31,6 +31,9 @@ object Constant {
...
@@ -31,6 +31,9 @@ object Constant {
const
val
CARRIERTYPE_NINE
=
"2"
const
val
CARRIERTYPE_NINE
=
"2"
const
val
CARRIERTYPE_NINE3
=
"3"
const
val
CARRIERTYPE_NINE3
=
"3"
const
val
CARRIERTYPE_DRAW_EXPRESS
=
"4"
/**
/**
* app应用首页 0-主页 1-中间 2-我
* app应用首页 0-主页 1-中间 2-我
*/
*/
...
...
video/app/src/main/java/com/mints/helivideo/mvp/model/VideoMultiItemEntity.kt
View file @
dfb91e38
package
com.mints.helivideo.mvp.model
package
com.mints.helivideo.mvp.model
import
com.chad.library.adapter.base.entity.MultiItemEntity
import
com.chad.library.adapter.base.entity.MultiItemEntity
import
com.mints.helivideo.video.tx.VideoModel
const
val
MULTI_ITEM_1
=
1
const
val
MULTI_ITEM_2
=
2
const
val
MULTI_ITEM_3
=
3
data class
VideoMultiItemEntity
(
data class
VideoMultiItemEntity
(
override
val
itemType
:
Int
,
override
val
itemType
:
Int
,
var
video
:
IndexList
.
VedioEpisodeBean
var
video
:
IndexList
.
VedioEpisodeBean
?,
)
:
MultiItemEntity
,
var
videoModel
:
VideoModel
?
java
.
io
.
Serializable
{
)
:
MultiItemEntity
,
java
.
io
.
Serializable
companion
object
{
const
val
MULTI_ITEM_1
=
1
data class
VideoMultiItemEntity2
(
const
val
MULTI_ITEM_2
=
2
override
val
itemType
:
Int
,
}
var
video
:
VedioBean
?,
}
var
videoModel
:
VideoModel
?
\ No newline at end of file
)
:
MultiItemEntity
,
java
.
io
.
Serializable
video/app/src/main/java/com/mints/helivideo/ui/activitys/MainActivity.kt
View file @
dfb91e38
...
@@ -20,6 +20,7 @@ import com.lzf.easyfloat.enums.SidePattern
...
@@ -20,6 +20,7 @@ import com.lzf.easyfloat.enums.SidePattern
import
com.mints.helivideo.MintsApplication
import
com.mints.helivideo.MintsApplication
import
com.mints.helivideo.R
import
com.mints.helivideo.R
import
com.mints.helivideo.ad.AdManager
import
com.mints.helivideo.ad.AdManager
import
com.mints.helivideo.ad.express.ExpressManager
import
com.mints.helivideo.common.AppConfig
import
com.mints.helivideo.common.AppConfig
import
com.mints.helivideo.common.Constant
import
com.mints.helivideo.common.Constant
import
com.mints.helivideo.ui.activitys.base.BaseActivity
import
com.mints.helivideo.ui.activitys.base.BaseActivity
...
@@ -61,6 +62,8 @@ class MainActivity : BaseActivity(), View.OnClickListener {
...
@@ -61,6 +62,8 @@ class MainActivity : BaseActivity(), View.OnClickListener {
override
fun
initViewsAndEvents
()
{
override
fun
initViewsAndEvents
()
{
DPHolderManager
.
initDpSdk
(
MintsApplication
.
getContext
());
DPHolderManager
.
initDpSdk
(
MintsApplication
.
getContext
());
ExpressManager
.
instance
.
preLoadAd
()
audioManager
=
getSystemService
(
Context
.
AUDIO_SERVICE
)
as
AudioManager
audioManager
=
getSystemService
(
Context
.
AUDIO_SERVICE
)
as
AudioManager
contentLayout
=
findViewById
(
R
.
id
.
content_layout
)
contentLayout
=
findViewById
(
R
.
id
.
content_layout
)
...
...
video/app/src/main/java/com/mints/helivideo/ui/widgets/RoundRectLayout.java
0 → 100644
View file @
dfb91e38
package
com
.
mints
.
helivideo
.
ui
.
widgets
;
import
android.content.Context
;
import
android.content.res.Resources
;
import
android.graphics.Canvas
;
import
android.graphics.Path
;
import
android.graphics.RectF
;
import
android.util.AttributeSet
;
import
android.util.TypedValue
;
import
android.widget.FrameLayout
;
/**
* @author jyx
* @date 2021/6/30
* @des 圆角view
*/
public
class
RoundRectLayout
extends
FrameLayout
{
private
Path
mPath
;
private
int
mRadius
;
private
int
mWidth
;
private
int
mHeight
;
private
int
mLastRadius
;
public
static
final
int
MODE_NONE
=
0
;
public
static
final
int
MODE_ALL
=
1
;
public
static
final
int
MODE_LEFT
=
2
;
public
static
final
int
MODE_TOP
=
3
;
public
static
final
int
MODE_RIGHT
=
4
;
public
static
final
int
MODE_BOTTOM
=
5
;
private
int
mRoundMode
=
MODE_ALL
;
public
RoundRectLayout
(
Context
context
)
{
super
(
context
);
init
();
}
public
RoundRectLayout
(
Context
context
,
AttributeSet
attrs
)
{
super
(
context
,
attrs
);
init
();
}
private
void
init
()
{
// setBackgroundDrawable(new ColorDrawable(0x33ff0000));
mPath
=
new
Path
();
mPath
.
setFillType
(
Path
.
FillType
.
EVEN_ODD
);
setCornerRadius
(
dp2px
(
10
));
}
/**
* 设置是否圆角裁边
*
* @param roundMode
*/
public
void
setRoundMode
(
int
roundMode
)
{
mRoundMode
=
roundMode
;
}
/**
* 设置圆角半径
*
* @param radius
*/
public
void
setCornerRadius
(
int
radius
)
{
mRadius
=
radius
;
}
private
void
checkPathChanged
()
{
if
(
getWidth
()
==
mWidth
&&
getHeight
()
==
mHeight
&&
mLastRadius
==
mRadius
)
{
return
;
}
mWidth
=
getWidth
();
mHeight
=
getHeight
();
mLastRadius
=
mRadius
;
mPath
.
reset
();
switch
(
mRoundMode
)
{
case
MODE_ALL:
mPath
.
addRoundRect
(
new
RectF
(
0
,
0
,
mWidth
,
mHeight
),
mRadius
,
mRadius
,
Path
.
Direction
.
CW
);
break
;
case
MODE_LEFT:
mPath
.
addRoundRect
(
new
RectF
(
0
,
0
,
mWidth
,
mHeight
),
new
float
[]{
mRadius
,
mRadius
,
0
,
0
,
0
,
0
,
mRadius
,
mRadius
},
Path
.
Direction
.
CW
);
break
;
case
MODE_TOP:
mPath
.
addRoundRect
(
new
RectF
(
0
,
0
,
mWidth
,
mHeight
),
new
float
[]{
mRadius
,
mRadius
,
mRadius
,
mRadius
,
0
,
0
,
0
,
0
},
Path
.
Direction
.
CW
);
break
;
case
MODE_RIGHT:
mPath
.
addRoundRect
(
new
RectF
(
0
,
0
,
mWidth
,
mHeight
),
new
float
[]{
0
,
0
,
mRadius
,
mRadius
,
mRadius
,
mRadius
,
0
,
0
},
Path
.
Direction
.
CW
);
break
;
case
MODE_BOTTOM:
mPath
.
addRoundRect
(
new
RectF
(
0
,
0
,
mWidth
,
mHeight
),
new
float
[]{
0
,
0
,
0
,
0
,
mRadius
,
mRadius
,
mRadius
,
mRadius
},
Path
.
Direction
.
CW
);
break
;
}
}
@Override
public
void
draw
(
Canvas
canvas
)
{
if
(
mRoundMode
!=
MODE_NONE
)
{
int
saveCount
=
canvas
.
save
();
checkPathChanged
();
canvas
.
clipPath
(
mPath
);
super
.
draw
(
canvas
);
canvas
.
restoreToCount
(
saveCount
);
}
else
{
super
.
draw
(
canvas
);
}
}
public
static
int
dp2px
(
int
dp
)
{
return
(
int
)
TypedValue
.
applyDimension
(
TypedValue
.
COMPLEX_UNIT_DIP
,
dp
,
Resources
.
getSystem
().
getDisplayMetrics
());
}
}
\ No newline at end of file
video/app/src/main/java/com/mints/helivideo/ui/widgets/VideoEpisodeDialog.kt
View file @
dfb91e38
...
@@ -26,6 +26,8 @@ class VideoEpisodeDialog(
...
@@ -26,6 +26,8 @@ class VideoEpisodeDialog(
)
:
)
:
Dialog
(
context
,
R
.
style
.
dialog
)
{
Dialog
(
context
,
R
.
style
.
dialog
)
{
private
var
mRealSeeIndex
=
0
private
val
lp
:
WindowManager
.
LayoutParams
private
val
lp
:
WindowManager
.
LayoutParams
private
val
vp2
:
ViewPager2
private
val
vp2
:
ViewPager2
...
@@ -107,9 +109,14 @@ class VideoEpisodeDialog(
...
@@ -107,9 +109,14 @@ class VideoEpisodeDialog(
}
}
})
})
tab
.
getTabAt
(
vedioBean
.
seeIndex
/
30
)
?.
select
()
if
(
mRealSeeIndex
==
0
)
{
tab
.
getTabAt
(
vedioBean
.
seeIndex
/
30
)
?.
select
()
}
else
{
tab
.
getTabAt
(
mRealSeeIndex
/
30
)
?.
select
()
}
}
}
private
fun
getTabView
(
text
:
String
,
position
:
Int
):
View
{
private
fun
getTabView
(
text
:
String
,
position
:
Int
):
View
{
val
view
=
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
item_epsiode_tab
,
null
)
val
view
=
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
item_epsiode_tab
,
null
)
val
viewText
=
view
.
findViewById
<
TextView
>(
R
.
id
.
item_tv
)
val
viewText
=
view
.
findViewById
<
TextView
>(
R
.
id
.
item_tv
)
...
@@ -139,6 +146,7 @@ class VideoEpisodeDialog(
...
@@ -139,6 +146,7 @@ class VideoEpisodeDialog(
}
}
fun
setCurrentIndex
(
position
:
Int
)
{
fun
setCurrentIndex
(
position
:
Int
)
{
mRealSeeIndex
=
position
for
(
mDatum
in
mData
)
{
for
(
mDatum
in
mData
)
{
mDatum
.
playing
=
false
mDatum
.
playing
=
false
}
}
...
...
video/app/src/main/java/com/mints/helivideo/utils/UIUtils.java
View file @
dfb91e38
...
@@ -282,6 +282,6 @@ public class UIUtils {
...
@@ -282,6 +282,6 @@ public class UIUtils {
}
}
public
static
float
getAdWidth
(
Context
context
)
{
public
static
float
getAdWidth
(
Context
context
)
{
return
getScreenWidth
(
context
)
/
getDensity
(
context
)
-
40
;
return
getScreenWidth
(
context
)
-
dp2px
(
30
)
;
}
}
}
}
video/app/src/main/java/com/mints/helivideo/video/DramaApiDetailActivity.kt
View file @
dfb91e38
...
@@ -5,6 +5,7 @@ import android.os.Bundle
...
@@ -5,6 +5,7 @@ import android.os.Bundle
import
android.util.Log
import
android.util.Log
import
android.view.View
import
android.view.View
import
android.widget.Button
import
android.widget.Button
import
android.widget.FrameLayout
import
android.widget.ImageView
import
android.widget.ImageView
import
android.widget.LinearLayout
import
android.widget.LinearLayout
import
com.airbnb.lottie.LottieAnimationView
import
com.airbnb.lottie.LottieAnimationView
...
@@ -17,6 +18,8 @@ import com.mints.helivideo.R
...
@@ -17,6 +18,8 @@ import com.mints.helivideo.R
import
com.mints.helivideo.ad.AdManager
import
com.mints.helivideo.ad.AdManager
import
com.mints.helivideo.ad.AdStatusListener
import
com.mints.helivideo.ad.AdStatusListener
import
com.mints.helivideo.ad.NoPreAdManager
import
com.mints.helivideo.ad.NoPreAdManager
import
com.mints.helivideo.ad.express.ExpressAdCallback
import
com.mints.helivideo.ad.express.ExpressManager
import
com.mints.helivideo.common.Constant
import
com.mints.helivideo.common.Constant
import
com.mints.helivideo.manager.LocalVedioManager
import
com.mints.helivideo.manager.LocalVedioManager
import
com.mints.helivideo.manager.UserManager
import
com.mints.helivideo.manager.UserManager
...
@@ -34,6 +37,7 @@ import com.mints.helivideo.ui.widgets.VideoEpisodeDialog
...
@@ -34,6 +37,7 @@ import com.mints.helivideo.ui.widgets.VideoEpisodeDialog
import
com.mints.helivideo.ui.widgets.VipCountDialog
import
com.mints.helivideo.ui.widgets.VipCountDialog
import
com.mints.helivideo.utils.AppPreferencesManager
import
com.mints.helivideo.utils.AppPreferencesManager
import
com.mints.helivideo.utils.SpanUtils
import
com.mints.helivideo.utils.SpanUtils
import
com.mints.helivideo.utils.UIUtils
import
com.mints.library.utils.nodoubleclick.AntiShake
import
com.mints.library.utils.nodoubleclick.AntiShake
import
kotlinx.android.synthetic.main.drama_activity_api_detail.*
import
kotlinx.android.synthetic.main.drama_activity_api_detail.*
...
@@ -62,7 +66,6 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
...
@@ -62,7 +66,6 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
private
var
orderTagsList
:
ArrayList
<
String
>?
=
null
private
var
orderTagsList
:
ArrayList
<
String
>?
=
null
private
var
isLuckyShow
=
false
private
var
isLuckyShow
=
false
private
var
unlockCallback
:
IDPDramaListener
.
Callback
?
=
null
private
var
unlockCallback
:
IDPDramaListener
.
Callback
?
=
null
private
var
mInitUnlockIndex
=
0
private
var
mInitUnlockIndex
=
0
...
@@ -105,7 +108,6 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
...
@@ -105,7 +108,6 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
isThirdId
=
extras
?.
getBoolean
(
Constant
.
VEDIO_THIRD
,
false
)
==
true
isThirdId
=
extras
?.
getBoolean
(
Constant
.
VEDIO_THIRD
,
false
)
==
true
isPlayNext
=
extras
?.
getBoolean
(
Constant
.
VEDIO_NEXT
,
false
)
==
true
isPlayNext
=
extras
?.
getBoolean
(
Constant
.
VEDIO_NEXT
,
false
)
==
true
mVedioBean
=
Gson
().
fromJson
(
json
,
VedioBean
::
class
.
java
)
mVedioBean
=
Gson
().
fromJson
(
json
,
VedioBean
::
class
.
java
)
orderTagsList
=
mVedioBean
?.
orderTags
orderTagsList
=
mVedioBean
?.
orderTags
...
@@ -125,6 +127,10 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
...
@@ -125,6 +127,10 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
videoPresenter
.
attachView
(
this
)
videoPresenter
.
attachView
(
this
)
mVedioBean
?.
let
{
videoPresenter
.
getIndexList
(
it
.
thirdId
,
true
)
}
mVedioBean
?.
let
{
videoPresenter
.
getIndexList
(
it
.
thirdId
,
true
)
}
if
(!
UserManager
.
getInstance
().
vipFlag
)
{
ExpressManager
.
instance
.
preLoadAd
()
}
fm_bottom
.
setOnClickListener
{
fm_bottom
.
setOnClickListener
{
if
(
AntiShake
.
check
(
it
.
id
))
return
@setOnClickListener
if
(
AntiShake
.
check
(
it
.
id
))
return
@setOnClickListener
showEpisodeDialog
()
showEpisodeDialog
()
...
@@ -399,6 +405,9 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
...
@@ -399,6 +405,9 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
blockView
?.
visibility
=
View
.
VISIBLE
blockView
?.
visibility
=
View
.
VISIBLE
unlockCallback
=
callback
unlockCallback
=
callback
// 展示广告
showAdView
()
dpWidget
?.
let
{
widget
->
dpWidget
?.
let
{
widget
->
unlockBtn
?.
setOnClickListener
{
unlockBtn
?.
setOnClickListener
{
val
carrierType
=
Constant
.
CARRIERTYPE_CSJ_VEDIO
val
carrierType
=
Constant
.
CARRIERTYPE_CSJ_VEDIO
...
@@ -761,6 +770,27 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
...
@@ -761,6 +770,27 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
}
}
}
}
}
}
}
private
fun
showAdView
()
{
if
(
UserManager
.
getInstance
().
vipFlag
)
return
ExpressManager
.
instance
.
getAdView
(
object
:
ExpressAdCallback
{
override
fun
loadSuccess
(
adView
:
FrameLayout
?)
{
adView
?.
let
{
UIUtils
.
removeFromParent
(
it
)
fl_ad
.
removeAllViews
()
fl_ad
.
addView
(
it
)
}
}
override
fun
renderSuccess
(
adView
:
FrameLayout
?):
Boolean
{
return
false
}
override
fun
loadFail
()
{
}
})
}
}
}
}
\ No newline at end of file
video/app/src/main/java/com/mints/helivideo/video/TxVideoActivity.kt
View file @
dfb91e38
...
@@ -10,14 +10,13 @@ import com.mints.helivideo.R
...
@@ -10,14 +10,13 @@ import com.mints.helivideo.R
import
com.mints.helivideo.ad.AdManager
import
com.mints.helivideo.ad.AdManager
import
com.mints.helivideo.ad.AdStatusListener
import
com.mints.helivideo.ad.AdStatusListener
import
com.mints.helivideo.ad.NoPreAdManager
import
com.mints.helivideo.ad.NoPreAdManager
import
com.mints.helivideo.ad.draw.DrawExpressManager
import
com.mints.helivideo.ad.express.ExpressManager
import
com.mints.helivideo.common.Constant
import
com.mints.helivideo.common.Constant
import
com.mints.helivideo.manager.LocalVedioManager
import
com.mints.helivideo.manager.LocalVedioManager
import
com.mints.helivideo.manager.UserManager
import
com.mints.helivideo.manager.UserManager
import
com.mints.helivideo.mvp.model.
IndexList
import
com.mints.helivideo.mvp.model.
*
import
com.mints.helivideo.mvp.model.IndexList.VedioEpisodeBean
import
com.mints.helivideo.mvp.model.IndexList.VedioEpisodeBean
import
com.mints.helivideo.mvp.model.NineShowBean
import
com.mints.helivideo.mvp.model.VedioBean
import
com.mints.helivideo.mvp.model.VideoMultiItemEntity
import
com.mints.helivideo.mvp.presenters.VideoPresenter
import
com.mints.helivideo.mvp.presenters.VideoPresenter
import
com.mints.helivideo.mvp.views.VideoView
import
com.mints.helivideo.mvp.views.VideoView
import
com.mints.helivideo.ui.activitys.NineActivity
import
com.mints.helivideo.ui.activitys.NineActivity
...
@@ -29,6 +28,7 @@ import com.mints.helivideo.ui.widgets.VideoEpisodeDialog
...
@@ -29,6 +28,7 @@ import com.mints.helivideo.ui.widgets.VideoEpisodeDialog
import
com.mints.helivideo.ui.widgets.VipCountDialog
import
com.mints.helivideo.ui.widgets.VipCountDialog
import
com.mints.helivideo.utils.AppPreferencesManager
import
com.mints.helivideo.utils.AppPreferencesManager
import
com.mints.helivideo.utils.SpanUtils
import
com.mints.helivideo.utils.SpanUtils
import
com.mints.helivideo.video.tx.VideoModel
import
com.mints.helivideo.video.tx.adapter.TxVideoAdapter
import
com.mints.helivideo.video.tx.adapter.TxVideoAdapter
import
com.mints.library.utils.nodoubleclick.AntiShake
import
com.mints.library.utils.nodoubleclick.AntiShake
import
kotlinx.android.synthetic.main.activity_tx_video.*
import
kotlinx.android.synthetic.main.activity_tx_video.*
...
@@ -102,6 +102,11 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
...
@@ -102,6 +102,11 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
}
}
private
fun
initView
()
{
private
fun
initView
()
{
if
(!
UserManager
.
getInstance
().
vipFlag
)
{
ExpressManager
.
instance
.
preLoadAd
()
DrawExpressManager
.
instance
.
preLoadAd
()
}
episode_tv
.
text
=
String
.
format
(
episode_tv
.
text
=
String
.
format
(
"共%d集 %s"
,
"共%d集 %s"
,
mVedioBean
?.
vedioTotal
,
mVedioBean
?.
vedioTotal
,
...
@@ -110,12 +115,23 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
...
@@ -110,12 +115,23 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
super_short_video_view
.
setOnCustomChildClickListener
(
this
)
super_short_video_view
.
setOnCustomChildClickListener
(
this
)
super_short_video_view
.
setOnPageChangeListener
{
super_short_video_view
.
setOnPageChangeListener
{
showVipCountDialog
(
it
)
if
(
super_short_video_view
.
isAdPosition
(
it
))
{
localShowLucky
(
it
)
fm_bottom
.
visibility
=
View
.
GONE
super_short_video_view
.
pause
()
return
@setOnPageChangeListener
}
fm_bottom
.
visibility
=
View
.
VISIBLE
val
readPosition
=
getRealPosition
(
it
)
showVipCountDialog
(
readPosition
)
localShowLucky
(
readPosition
)
// VIdeoindex -> seeIndex
// VIdeoindex -> seeIndex
if
(
videos
.
size
>
it
)
{
val
data
=
super_short_video_view
.
data
mVedioBean
!!
.
seeIndex
=
videos
[
it
].
vedioIndex
if
(
data
.
size
>
it
&&
data
[
it
].
itemType
==
MULTI_ITEM_1
)
{
mVedioBean
!!
.
seeIndex
=
data
[
it
].
video
!!
.
vedioIndex
mVedioBean
!!
.
orderTags
=
orderTagsList
mVedioBean
!!
.
orderTags
=
orderTagsList
LocalVedioManager
.
commitVedio
(
mVedioBean
!!
)
LocalVedioManager
.
commitVedio
(
mVedioBean
!!
)
}
}
...
@@ -153,7 +169,7 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
...
@@ -153,7 +169,7 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
dialog
?.
dismiss
()
dialog
?.
dismiss
()
}
}
})
})
dialog
?.
setCurrentIndex
(
getPosition
()
)
dialog
?.
setCurrentIndex
(
super_short_video_view
.
realSeeIndex
)
dialog
?.
setOnEpisodeClickListener
(
this
)
dialog
?.
setOnEpisodeClickListener
(
this
)
dialog
?.
show
()
dialog
?.
show
()
}
}
...
@@ -238,14 +254,23 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
...
@@ -238,14 +254,23 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
override
fun
onEpisodeClick
(
position
:
Int
)
{
override
fun
onEpisodeClick
(
position
:
Int
)
{
dialog
?.
dismiss
()
dialog
?.
dismiss
()
val
data
=
super_short_video_view
.
data
if
(
position
>=
mVedioBean
!!
.
unlockIndex
)
{
if
(
position
>=
mVedioBean
!!
.
unlockIndex
)
{
super_short_video_view
.
onItemClick
(
mVedioBean
!!
.
unlockIndex
)
super_short_video_view
.
onItemClick
(
data
.
size
-
1
)
// super_short_video_view.onItemClick(mVedioBean!!.unlockIndex)
return
return
}
}
super_short_video_view
.
onItemClick
(
position
)
val
readPosition
=
getRealPosition
(
position
)
if
(
readPosition
!=
position
)
{
super_short_video_view
.
pause
()
}
super_short_video_view
.
onItemClick
(
readPosition
)
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
showVipCountDialog
(
p
osition
)
showVipCountDialog
(
readP
osition
)
localShowLucky
(
p
osition
)
localShowLucky
(
readP
osition
)
},
300
)
},
300
)
}
}
...
@@ -253,11 +278,12 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
...
@@ -253,11 +278,12 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
val
data
=
mutableListOf
<
VideoMultiItemEntity
>()
val
data
=
mutableListOf
<
VideoMultiItemEntity
>()
if
(
videos
.
size
>
0
)
{
if
(
videos
.
size
>
0
)
{
for
(
video
in
videos
)
{
for
(
video
in
videos
)
{
val
item
=
VideoMultiItemEntity
(
VideoMultiItemEntity
.
MULTI_ITEM_1
,
video
)
val
item
=
VideoMultiItemEntity
(
MULTI_ITEM_1
,
video
,
VideoModel
(
video
.
vedioUrl
)
)
data
.
add
(
item
)
data
.
add
(
item
)
}
}
if
(
mVedioBean
!!
.
unlockIndex
<
mVedioBean
!!
.
vedioTotal
)
{
if
(
mVedioBean
!!
.
unlockIndex
<
mVedioBean
!!
.
vedioTotal
)
{
val
item
=
VideoMultiItemEntity
(
VideoMultiItemEntity
.
MULTI_ITEM_2
,
videos
[
0
])
val
item
=
VideoMultiItemEntity
(
MULTI_ITEM_2
,
videos
[
0
],
VideoModel
(
videos
[
0
].
vedioUrl
))
data
.
add
(
item
)
data
.
add
(
item
)
}
}
}
}
...
@@ -338,7 +364,6 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
...
@@ -338,7 +364,6 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
private
fun
showVipCountDialog
(
position
:
Int
)
{
private
fun
showVipCountDialog
(
position
:
Int
)
{
if
(
isFinishing
)
return
if
(
isFinishing
)
return
if
(
position
==
0
||
mVedioBean
!!
.
tipMaxIndex
==
0
||
mVedioBean
!!
.
tipMaxIndex
-
1
<
position
)
{
if
(
position
==
0
||
mVedioBean
!!
.
tipMaxIndex
==
0
||
mVedioBean
!!
.
tipMaxIndex
-
1
<
position
)
{
return
return
}
}
...
@@ -354,8 +379,13 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
...
@@ -354,8 +379,13 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
private
fun
localShowLucky
(
position
:
Int
)
{
private
fun
localShowLucky
(
position
:
Int
)
{
val
localLucky
=
AppPreferencesManager
.
get
()
val
localLucky
=
AppPreferencesManager
.
get
()
.
getBoolean
(
Constant
.
LUCKY_FLAG
,
false
)
.
getBoolean
(
Constant
.
LUCKY_FLAG
,
false
)
val
data
=
super_short_video_view
.
data
if
(
mVedioBean
!=
null
&&
(
isLuckyShow
||
localLucky
))
{
if
(
mVedioBean
!=
null
&&
(
isLuckyShow
||
localLucky
))
{
if
(
position
>
mVedioBean
!!
.
unlockIndex
-
1
)
{
// if (position > mVedioBean!!.unlockIndex - 1) {
if
(
data
[
position
].
itemType
!=
MULTI_ITEM_1
||
UserManager
.
getInstance
().
vipFlag
||
position
>
mVedioBean
!!
.
unlockIndex
-
1
)
{
// 解锁界面
// 解锁界面
ll_lucky
.
visibility
=
View
.
GONE
ll_lucky
.
visibility
=
View
.
GONE
}
else
{
}
else
{
...
@@ -369,5 +399,17 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
...
@@ -369,5 +399,17 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
}
}
}
}
private
fun
getPosition
()
=
super_short_video_view
.
currentPosition
private
fun
getRealPosition
(
position
:
Int
):
Int
{
var
readPosition
=
position
val
data
=
super_short_video_view
.
data
for
(
i
in
0
until
data
.
size
)
{
if
(
data
[
i
].
itemType
==
MULTI_ITEM_1
)
{
if
(
data
[
i
].
video
!!
.
vedioIndex
==
position
+
1
)
{
readPosition
=
i
break
}
}
}
return
readPosition
}
}
}
\ No newline at end of file
video/app/src/main/java/com/mints/helivideo/video/tx/PlayerManager.java
View file @
dfb91e38
package
com
.
mints
.
helivideo
.
video
.
tx
;
package
com
.
mints
.
helivideo
.
video
.
tx
;
import
android.content.Context
;
import
android.content.Context
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.util.Log
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -14,7 +15,7 @@ public class PlayerManager {
...
@@ -14,7 +15,7 @@ public class PlayerManager {
private
Map
<
VideoModel
,
TXVodPlayerWrapper
>
mUrlPlayerMap
;
private
Map
<
VideoModel
,
TXVodPlayerWrapper
>
mUrlPlayerMap
;
private
VideoModel
mLastPlayedVideoBean
;
private
VideoModel
mLastPlayedVideoBean
;
private
Context
mContext
;
private
final
Context
mContext
;
public
PlayerManager
(
Context
context
)
{
public
PlayerManager
(
Context
context
)
{
mContext
=
context
.
getApplicationContext
();
mContext
=
context
.
getApplicationContext
();
...
@@ -36,16 +37,16 @@ public class PlayerManager {
...
@@ -36,16 +37,16 @@ public class PlayerManager {
List
<
VideoModel
>
exprList
=
findDiffBeanList
(
shortVideoBeanList
,
lastBeanList
);
List
<
VideoModel
>
exprList
=
findDiffBeanList
(
shortVideoBeanList
,
lastBeanList
);
//找到 urlList中不包含lastUrlList的
//找到 urlList中不包含lastUrlList的
List
<
VideoModel
>
newList
=
findDiffBeanList
(
lastBeanList
,
shortVideoBeanList
);
List
<
VideoModel
>
newList
=
findDiffBeanList
(
lastBeanList
,
shortVideoBeanList
);
if
(
exprList
!=
null
)
{
//
if (exprList != null) {
for
(
int
i
=
0
;
i
<
exprList
.
size
();
i
++)
{
//
for (int i = 0; i < exprList.size(); i++) {
Log
.
i
(
TAG
,
"[updateManager] exprUrl "
+
exprList
.
get
(
i
).
videoURL
);
//
Log.i(TAG, "[updateManager] exprUrl " + exprList.get(i).videoURL);
}
//
}
}
//
}
if
(
newList
!=
null
)
{
//
if (newList != null) {
for
(
int
i
=
0
;
i
<
newList
.
size
();
i
++)
{
//
for (int i = 0; i < newList.size(); i++) {
Log
.
i
(
TAG
,
"[updateManager] newUrl "
+
newList
.
get
(
i
).
videoURL
);
//
Log.i(TAG, "[updateManager] newUrl " + newList.get(i).videoURL);
}
//
}
}
//
}
if
(
newList
.
size
()
>
0
)
{
if
(
newList
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
newList
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
newList
.
size
();
i
++)
{
TXVodPlayerWrapper
tempPlayer
=
null
;
TXVodPlayerWrapper
tempPlayer
=
null
;
...
@@ -56,8 +57,9 @@ public class PlayerManager {
...
@@ -56,8 +57,9 @@ public class PlayerManager {
tempPlayer
=
new
TXVodPlayerWrapper
(
mContext
);
tempPlayer
=
new
TXVodPlayerWrapper
(
mContext
);
}
}
tempPlayer
.
preStartPlay
(
newList
.
get
(
i
));
if
(!
TextUtils
.
isEmpty
(
newList
.
get
(
i
).
videoURL
))
{
tempPlayer
.
preStartPlay
(
newList
.
get
(
i
));
}
mUrlPlayerMap
.
put
(
newList
.
get
(
i
),
tempPlayer
);
mUrlPlayerMap
.
put
(
newList
.
get
(
i
),
tempPlayer
);
}
}
}
}
...
...
video/app/src/main/java/com/mints/helivideo/video/tx/RecommendVideoView.java
View file @
dfb91e38
package
com
.
mints
.
helivideo
.
video
.
tx
;
package
com
.
mints
.
helivideo
.
video
.
tx
;
import
static
com
.
mints
.
helivideo
.
mvp
.
model
.
VideoMultiItemEntityKt
.
MULTI_ITEM_1
;
import
static
com
.
mints
.
helivideo
.
mvp
.
model
.
VideoMultiItemEntityKt
.
MULTI_ITEM_3
;
import
android.content.Context
;
import
android.content.Context
;
import
android.util.AttributeSet
;
import
android.util.AttributeSet
;
import
android.util.Log
;
import
android.util.Log
;
...
@@ -7,39 +10,41 @@ import android.view.LayoutInflater;
...
@@ -7,39 +10,41 @@ import android.view.LayoutInflater;
import
android.view.View
;
import
android.view.View
;
import
android.widget.RelativeLayout
;
import
android.widget.RelativeLayout
;
import
androidx.annotation.NonNull
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
androidx.recyclerview.widget.PagerSnapHelper
;
import
androidx.recyclerview.widget.PagerSnapHelper
;
import
androidx.recyclerview.widget.RecyclerView
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.mints.helivideo.ad.draw.DrawExpressManager
;
import
com.mints.helivideo.manager.UserManager
;
import
com.mints.helivideo.mvp.model.VideoMultiItemEntity2
;
import
com.mints.helivideo.video.tx.adapter.TxRecommendVideo2Adapter
;
import
com.scwang.smartrefresh.layout.SmartRefreshLayout
;
import
com.scwang.smartrefresh.layout.SmartRefreshLayout
;
import
com.scwang.smartrefresh.layout.listener.OnLoadMoreListener
;
import
com.scwang.smartrefresh.layout.listener.OnLoadMoreListener
;
import
com.mints.helivideo.R
;
import
com.mints.helivideo.R
;
import
com.mints.helivideo.mvp.model.VedioBean
;
import
com.mints.helivideo.mvp.model.VedioBean
;
import
com.mints.helivideo.video.tx.adapter.TxRecommendVideoAdapter
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
public
class
RecommendVideoView
extends
RelativeLayout
{
public
class
RecommendVideoView
extends
RelativeLayout
{
private
static
final
String
TAG
=
"
SuperShort
VideoView"
;
private
static
final
String
TAG
=
"
Recommend
VideoView"
;
private
static
final
int
MAX_PLAYER_COUNT_ON_PASS
=
3
;
private
static
final
int
MAX_PLAYER_COUNT_ON_PASS
=
3
;
private
RecyclerView
mRecyclerView
;
private
RecyclerView
mRecyclerView
;
private
SmartRefreshLayout
mSmartRefreshLayout
;
private
SmartRefreshLayout
mSmartRefreshLayout
;
private
TxRecommendVideoAdapter
mAdapter
;
private
TxRecommendVideo2Adapter
mAdapter
;
private
List
<
VideoModel
>
mUrlList
;
private
LinearLayoutManager
mLayoutManager
;
private
LinearLayoutManager
mLayoutManager
;
private
PagerSnapHelper
mSnapHelper
;
private
PagerSnapHelper
mSnapHelper
;
private
int
mLastPositionInIDLE
=
-
1
;
private
int
mLastPositionInIDLE
=
-
1
;
private
TXVideoBaseView
mBaseItemView
;
private
TXVideoBaseView
mBaseItemView
;
private
Context
mContext
;
private
boolean
mIsOnDestroy
;
private
boolean
mIsOnDestroy
;
private
PlayerManager
mPlayerManager
;
private
PlayerManager
mPlayerManager
;
private
int
mCurrentPosition
=
0
;
private
int
mCurrentPosition
=
0
;
private
List
<
V
edioBean
>
mList
;
private
List
<
V
ideoMultiItemEntity2
>
mList
;
public
RecommendVideoView
(
Context
context
)
{
public
RecommendVideoView
(
Context
context
)
{
this
(
context
,
null
);
this
(
context
,
null
);
...
@@ -51,34 +56,20 @@ public class RecommendVideoView extends RelativeLayout {
...
@@ -51,34 +56,20 @@ public class RecommendVideoView extends RelativeLayout {
public
RecommendVideoView
(
Context
context
,
AttributeSet
attrs
,
int
defStyleAttr
)
{
public
RecommendVideoView
(
Context
context
,
AttributeSet
attrs
,
int
defStyleAttr
)
{
super
(
context
,
attrs
,
defStyleAttr
);
super
(
context
,
attrs
,
defStyleAttr
);
mContext
=
context
;
init
(
context
);
init
(
mContext
);
}
}
public
void
loadData
(
List
<
VedioBean
>
list
)
{
public
void
loadData
(
List
<
VedioBean
>
list
)
{
if
(
this
.
mList
!=
null
)
{
if
(
this
.
mList
!=
null
)
{
this
.
mList
.
clear
();
this
.
mList
.
clear
();
}
}
if
(
this
.
mUrlList
!=
null
)
{
this
.
mUrlList
.
clear
();
}
this
.
mList
=
list
;
this
.
mList
=
getAdapterData
(
list
);
List
<
VideoModel
>
videoList
=
new
ArrayList
();
mAdapter
.
setNewInstance
(
this
.
mList
);
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
videoList
.
add
(
new
VideoModel
(
list
.
get
(
i
).
getRecommendUrl
()));
}
mUrlList
.
addAll
(
videoList
);
mAdapter
.
setNewInstance
(
mList
);
}
}
public
void
loadMoreData
(
List
<
VedioBean
>
list
)
{
public
void
loadMoreData
(
List
<
VedioBean
>
list
)
{
List
<
VideoModel
>
videoList
=
new
ArrayList
();
this
.
mList
.
addAll
(
getAdapterData
(
list
));
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
videoList
.
add
(
new
VideoModel
(
list
.
get
(
i
).
getRecommendUrl
()));
}
this
.
mList
.
addAll
(
list
);
mUrlList
.
addAll
(
videoList
);
mAdapter
.
notifyItemRangeInserted
(
this
.
mList
.
size
()
-
list
.
size
(),
list
.
size
());
mAdapter
.
notifyItemRangeInserted
(
this
.
mList
.
size
()
-
list
.
size
(),
list
.
size
());
}
}
...
@@ -89,11 +80,10 @@ public class RecommendVideoView extends RelativeLayout {
...
@@ -89,11 +80,10 @@ public class RecommendVideoView extends RelativeLayout {
mRecyclerView
=
mRootView
.
findViewById
(
R
.
id
.
rv_super_short_video
);
mRecyclerView
=
mRootView
.
findViewById
(
R
.
id
.
rv_super_short_video
);
mSmartRefreshLayout
=
mRootView
.
findViewById
(
R
.
id
.
src_video
);
mSmartRefreshLayout
=
mRootView
.
findViewById
(
R
.
id
.
src_video
);
mSmartRefreshLayout
.
setEnableRefresh
(
false
);
mSmartRefreshLayout
.
setEnableRefresh
(
false
);
mUrlList
=
new
ArrayList
<>();
mSnapHelper
=
new
PagerSnapHelper
();
mSnapHelper
=
new
PagerSnapHelper
();
mSnapHelper
.
attachToRecyclerView
(
mRecyclerView
);
mSnapHelper
.
attachToRecyclerView
(
mRecyclerView
);
mAdapter
=
new
TxRecommendVideoAdapter
();
mAdapter
=
new
TxRecommendVideo
2
Adapter
();
mAdapter
.
setNewInstance
(
mList
);
mAdapter
.
setNewInstance
(
getAdapterData
(
null
)
);
mLayoutManager
=
new
LinearLayoutManager
(
getContext
(),
LinearLayoutManager
.
VERTICAL
,
false
)
{
mLayoutManager
=
new
LinearLayoutManager
(
getContext
(),
LinearLayoutManager
.
VERTICAL
,
false
)
{
@Override
@Override
protected
int
getExtraLayoutSpace
(
RecyclerView
.
State
state
)
{
protected
int
getExtraLayoutSpace
(
RecyclerView
.
State
state
)
{
...
@@ -112,14 +102,14 @@ public class RecommendVideoView extends RelativeLayout {
...
@@ -112,14 +102,14 @@ public class RecommendVideoView extends RelativeLayout {
private
void
addListener
()
{
private
void
addListener
()
{
mRecyclerView
.
addOnScrollListener
(
new
RecyclerView
.
OnScrollListener
()
{
mRecyclerView
.
addOnScrollListener
(
new
RecyclerView
.
OnScrollListener
()
{
@Override
@Override
public
void
onScrolled
(
RecyclerView
recyclerView
,
int
dx
,
int
dy
)
{
public
void
onScrolled
(
@NonNull
RecyclerView
recyclerView
,
int
dx
,
int
dy
)
{
if
(!
recyclerView
.
canScrollVertically
(
1
)
||
!
recyclerView
.
canScrollVertically
(-
1
))
{
if
(!
recyclerView
.
canScrollVertically
(
1
)
||
!
recyclerView
.
canScrollVertically
(-
1
))
{
onScrollStateChanged
(
recyclerView
,
RecyclerView
.
SCROLL_STATE_IDLE
);
onScrollStateChanged
(
recyclerView
,
RecyclerView
.
SCROLL_STATE_IDLE
);
}
}
}
}
@Override
@Override
public
void
onScrollStateChanged
(
RecyclerView
recyclerView
,
int
newState
)
{
public
void
onScrollStateChanged
(
@NonNull
RecyclerView
recyclerView
,
int
newState
)
{
switch
(
newState
)
{
switch
(
newState
)
{
case
RecyclerView
.
SCROLL_STATE_IDLE
:
//停止滚动
case
RecyclerView
.
SCROLL_STATE_IDLE
:
//停止滚动
View
view
=
mSnapHelper
.
findSnapView
(
mLayoutManager
);
View
view
=
mSnapHelper
.
findSnapView
(
mLayoutManager
);
...
@@ -127,6 +117,9 @@ public class RecommendVideoView extends RelativeLayout {
...
@@ -127,6 +117,9 @@ public class RecommendVideoView extends RelativeLayout {
Log
.
i
(
TAG
,
"[SCROLL_STATE_IDLE] mLastPositionInIDLE "
+
mLastPositionInIDLE
+
" position "
+
position
);
Log
.
i
(
TAG
,
"[SCROLL_STATE_IDLE] mLastPositionInIDLE "
+
mLastPositionInIDLE
+
" position "
+
position
);
mCurrentPosition
=
position
;
mCurrentPosition
=
position
;
onPageSelectedMethod
(
position
);
onPageSelectedMethod
(
position
);
mAdapter
.
setCurrentPosition
(
mCurrentPosition
);
addAdView
(
position
);
break
;
break
;
case
RecyclerView
.
SCROLL_STATE_DRAGGING
:
//拖动
case
RecyclerView
.
SCROLL_STATE_DRAGGING
:
//拖动
break
;
break
;
...
@@ -140,7 +133,10 @@ public class RecommendVideoView extends RelativeLayout {
...
@@ -140,7 +133,10 @@ public class RecommendVideoView extends RelativeLayout {
private
void
onPageSelectedMethod
(
int
position
)
{
private
void
onPageSelectedMethod
(
int
position
)
{
if
(
mOnPageChangeListener
!=
null
)
mOnPageChangeListener
.
onPageChange
(
position
);
if
(
mOnPageChangeListener
!=
null
)
mOnPageChangeListener
.
onPageChange
(
position
);
if
(
position
>=
mUrlList
.
size
())
return
;
if
(
position
>=
mList
.
size
()
||
this
.
mList
.
get
(
position
).
getItemType
()
!=
MULTI_ITEM_1
)
{
mBaseItemView
.
stopForPlaying
();
return
;
}
if
(
mLastPositionInIDLE
!=
position
)
{
if
(
mLastPositionInIDLE
!=
position
)
{
View
view
=
mSnapHelper
.
findSnapView
(
mLayoutManager
);
View
view
=
mSnapHelper
.
findSnapView
(
mLayoutManager
);
...
@@ -151,9 +147,9 @@ public class RecommendVideoView extends RelativeLayout {
...
@@ -151,9 +147,9 @@ public class RecommendVideoView extends RelativeLayout {
Log
.
i
(
TAG
,
"onPageSelected "
+
position
);
Log
.
i
(
TAG
,
"onPageSelected "
+
position
);
List
<
VideoModel
>
tempUrlList
=
initUrlList
(
position
,
MAX_PLAYER_COUNT_ON_PASS
);
List
<
VideoModel
>
tempUrlList
=
initUrlList
(
position
,
MAX_PLAYER_COUNT_ON_PASS
);
mPlayerManager
.
updateManager
(
tempUrlList
);
mPlayerManager
.
updateManager
(
tempUrlList
);
TXVodPlayerWrapper
txVodPlayerWrapper
=
mPlayerManager
.
getPlayer
(
m
UrlList
.
get
(
position
));
TXVodPlayerWrapper
txVodPlayerWrapper
=
mPlayerManager
.
getPlayer
(
m
List
.
get
(
position
).
getVideoModel
(
));
if
(
txVodPlayerWrapper
!=
null
)
{
if
(
txVodPlayerWrapper
!=
null
)
{
Log
.
i
(
TAG
,
"txVodPlayerWrapper "
+
txVodPlayerWrapper
+
"url-- "
+
m
UrlList
.
get
(
position
).
videoURL
);
Log
.
i
(
TAG
,
"txVodPlayerWrapper "
+
txVodPlayerWrapper
+
"url-- "
+
m
List
.
get
(
position
).
getVideoModel
(
).
videoURL
);
Log
.
i
(
TAG
,
"txVodPlayerWrapper "
+
txVodPlayerWrapper
);
Log
.
i
(
TAG
,
"txVodPlayerWrapper "
+
txVodPlayerWrapper
);
mBaseItemView
.
setTXVodPlayer
(
txVodPlayerWrapper
);
mBaseItemView
.
setTXVodPlayer
(
txVodPlayerWrapper
);
}
}
...
@@ -173,17 +169,21 @@ public class RecommendVideoView extends RelativeLayout {
...
@@ -173,17 +169,21 @@ public class RecommendVideoView extends RelativeLayout {
* @return
* @return
*/
*/
private
List
<
VideoModel
>
initUrlList
(
int
startIndex
,
int
maxCount
)
{
private
List
<
VideoModel
>
initUrlList
(
int
startIndex
,
int
maxCount
)
{
List
<
VideoModel
>
videoModels
=
new
ArrayList
<>();
for
(
VideoMultiItemEntity2
videoMultiItemEntity2
:
this
.
mList
)
{
videoModels
.
add
(
videoMultiItemEntity2
.
getVideoModel
());
}
int
i
=
startIndex
-
1
;
int
i
=
startIndex
-
1
;
if
(
i
+
maxCount
>
mUrlList
.
size
())
{
if
(
i
+
maxCount
>
videoModels
.
size
())
{
i
=
mUrlList
.
size
()
-
maxCount
;
i
=
videoModels
.
size
()
-
maxCount
;
}
}
if
(
i
<
0
)
{
if
(
i
<
0
)
{
i
=
0
;
i
=
0
;
}
}
int
addedCount
=
0
;
int
addedCount
=
0
;
List
<
VideoModel
>
cacheList
=
new
ArrayList
<>();
List
<
VideoModel
>
cacheList
=
new
ArrayList
<>();
while
(
i
<
mUrlList
.
size
()
&&
addedCount
<
maxCount
)
{
while
(
i
<
videoModels
.
size
()
&&
addedCount
<
maxCount
)
{
cacheList
.
add
(
mUrlList
.
get
(
i
));
cacheList
.
add
(
videoModels
.
get
(
i
));
addedCount
++;
addedCount
++;
i
++;
i
++;
}
}
...
@@ -209,12 +209,6 @@ public class RecommendVideoView extends RelativeLayout {
...
@@ -209,12 +209,6 @@ public class RecommendVideoView extends RelativeLayout {
mPlayerManager
.
releasePlayer
();
mPlayerManager
.
releasePlayer
();
}
}
public
void
onListPageScrolled
()
{
if
(
mBaseItemView
!=
null
)
{
mBaseItemView
.
pausePlayer
();
}
}
public
void
onItemClick
(
final
int
position
)
{
public
void
onItemClick
(
final
int
position
)
{
mRecyclerView
.
scrollToPosition
(
position
);
mRecyclerView
.
scrollToPosition
(
position
);
mRecyclerView
.
post
(()
->
{
mRecyclerView
.
post
(()
->
{
...
@@ -242,7 +236,7 @@ public class RecommendVideoView extends RelativeLayout {
...
@@ -242,7 +236,7 @@ public class RecommendVideoView extends RelativeLayout {
this
.
mOnPageChangeListener
=
onPageChangeListener
;
this
.
mOnPageChangeListener
=
onPageChangeListener
;
}
}
public
void
setOnCustomChildClickListener
(
TxRecommendVideoAdapter
.
OnCustomChildClickListener
onCustomChildClickListener
)
{
public
void
setOnCustomChildClickListener
(
TxRecommendVideo
2
Adapter
.
OnCustomChildClickListener
onCustomChildClickListener
)
{
mAdapter
.
setOnCustomChildClickListener
(
onCustomChildClickListener
);
mAdapter
.
setOnCustomChildClickListener
(
onCustomChildClickListener
);
}
}
...
@@ -254,16 +248,44 @@ public class RecommendVideoView extends RelativeLayout {
...
@@ -254,16 +248,44 @@ public class RecommendVideoView extends RelativeLayout {
public
void
hideLoadMore
()
{
public
void
hideLoadMore
()
{
mSmartRefreshLayout
.
finishLoadMore
();
mSmartRefreshLayout
.
finishLoadMore
();
mSmartRefreshLayout
.
postDelayed
(
new
Runnable
()
{
mSmartRefreshLayout
.
postDelayed
(()
->
@Override
mRecyclerView
.
smoothScrollToPosition
(
mCurrentPosition
),
200
);
public
void
run
()
{
mRecyclerView
.
smoothScrollToPosition
(
mCurrentPosition
);
}
},
200
);
}
}
public
void
setOnLoadMoreListener
(
OnLoadMoreListener
onLoadMoreListener
)
{
public
void
setOnLoadMoreListener
(
OnLoadMoreListener
onLoadMoreListener
)
{
mSmartRefreshLayout
.
setOnLoadMoreListener
(
onLoadMoreListener
);
mSmartRefreshLayout
.
setOnLoadMoreListener
(
onLoadMoreListener
);
}
}
public
List
<
VideoMultiItemEntity2
>
getData
()
{
return
mList
;
}
private
List
<
VideoMultiItemEntity2
>
getAdapterData
(
List
<
VedioBean
>
list
)
{
List
<
VideoMultiItemEntity2
>
data
=
new
ArrayList
<>();
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
VideoMultiItemEntity2
item
=
new
VideoMultiItemEntity2
(
MULTI_ITEM_1
,
list
.
get
(
i
),
new
VideoModel
(
list
.
get
(
i
).
getRecommendUrl
()));
data
.
add
(
item
);
}
}
return
data
;
}
private
int
lastAddAdPosition
=
0
;
private
void
addAdView
(
int
position
)
{
// VIP 不展示
if
(
UserManager
.
getInstance
().
getVipFlag
())
return
;
// 每隔3个视频出现一个广告
if
(
position
+
1
<
2
||
(
position
+
1
)
%
3
!=
0
||
lastAddAdPosition
>
position
)
return
;
if
(
DrawExpressManager
.
Companion
.
getInstance
().
getAdIsLoadSuc
())
{
VideoMultiItemEntity2
itemAD
=
new
VideoMultiItemEntity2
(
MULTI_ITEM_3
,
null
,
new
VideoModel
(
""
));
mList
.
add
(
position
+
1
,
itemAD
);
mAdapter
.
notifyItemInserted
(
position
+
1
);
lastAddAdPosition
=
position
+
1
;
}
}
}
}
video/app/src/main/java/com/mints/helivideo/video/tx/SuperShortVideoView.java
View file @
dfb91e38
package
com
.
mints
.
helivideo
.
video
.
tx
;
package
com
.
mints
.
helivideo
.
video
.
tx
;
import
static
com
.
mints
.
helivideo
.
mvp
.
model
.
VideoMultiItemEntityKt
.
MULTI_ITEM_1
;
import
static
com
.
mints
.
helivideo
.
mvp
.
model
.
VideoMultiItemEntityKt
.
MULTI_ITEM_3
;
import
android.content.Context
;
import
android.content.Context
;
import
android.util.AttributeSet
;
import
android.util.AttributeSet
;
...
@@ -13,6 +15,8 @@ import androidx.recyclerview.widget.PagerSnapHelper;
...
@@ -13,6 +15,8 @@ import androidx.recyclerview.widget.PagerSnapHelper;
import
androidx.recyclerview.widget.RecyclerView
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.mints.helivideo.R
;
import
com.mints.helivideo.R
;
import
com.mints.helivideo.ad.draw.DrawExpressManager
;
import
com.mints.helivideo.manager.UserManager
;
import
com.mints.helivideo.mvp.model.VedioBean
;
import
com.mints.helivideo.mvp.model.VedioBean
;
import
com.mints.helivideo.mvp.model.VideoMultiItemEntity
;
import
com.mints.helivideo.mvp.model.VideoMultiItemEntity
;
import
com.mints.helivideo.video.tx.adapter.TxVideoAdapter
;
import
com.mints.helivideo.video.tx.adapter.TxVideoAdapter
;
...
@@ -27,12 +31,10 @@ public class SuperShortVideoView extends RelativeLayout {
...
@@ -27,12 +31,10 @@ public class SuperShortVideoView extends RelativeLayout {
private
RecyclerView
mRecyclerView
;
private
RecyclerView
mRecyclerView
;
private
TxVideoAdapter
mAdapter
;
private
TxVideoAdapter
mAdapter
;
private
List
<
VideoModel
>
mUrlList
;
private
LinearLayoutManager
mLayoutManager
;
private
LinearLayoutManager
mLayoutManager
;
private
PagerSnapHelper
mSnapHelper
;
private
PagerSnapHelper
mSnapHelper
;
private
int
mLastPositionInIDLE
=
-
1
;
private
int
mLastPositionInIDLE
=
-
1
;
private
TXVideoBaseView
mBaseItemView
;
private
TXVideoBaseView
mBaseItemView
;
private
Context
mContext
;
private
boolean
mIsOnDestroy
;
private
boolean
mIsOnDestroy
;
private
PlayerManager
mPlayerManager
;
private
PlayerManager
mPlayerManager
;
...
@@ -50,20 +52,12 @@ public class SuperShortVideoView extends RelativeLayout {
...
@@ -50,20 +52,12 @@ public class SuperShortVideoView extends RelativeLayout {
public
SuperShortVideoView
(
Context
context
,
AttributeSet
attrs
,
int
defStyleAttr
)
{
public
SuperShortVideoView
(
Context
context
,
AttributeSet
attrs
,
int
defStyleAttr
)
{
super
(
context
,
attrs
,
defStyleAttr
);
super
(
context
,
attrs
,
defStyleAttr
);
mContext
=
context
;
init
(
context
);
init
(
mContext
);
}
}
public
void
loadMoreData
(
List
<
VideoMultiItemEntity
>
list
)
{
public
void
loadMoreData
(
List
<
VideoMultiItemEntity
>
list
)
{
this
.
mList
.
clear
();
this
.
mList
=
list
;
this
.
mList
=
list
;
this
.
mUrlList
.
clear
();
List
<
VideoModel
>
videoList
=
new
ArrayList
();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
if
(
list
.
get
(
i
).
getItemType
()
==
VideoMultiItemEntity
.
MULTI_ITEM_1
)
{
videoList
.
add
(
new
VideoModel
(
list
.
get
(
i
).
getVideo
().
getVedioUrl
()));
}
}
mUrlList
.
addAll
(
videoList
);
mAdapter
.
setNewInstance
(
mList
);
mAdapter
.
setNewInstance
(
mList
);
onItemClick
(
mCurrentPosition
);
onItemClick
(
mCurrentPosition
);
...
@@ -72,14 +66,6 @@ public class SuperShortVideoView extends RelativeLayout {
...
@@ -72,14 +66,6 @@ public class SuperShortVideoView extends RelativeLayout {
public
void
loadData
(
VedioBean
vedioBean
,
List
<
VideoMultiItemEntity
>
list
,
int
currentPosition
)
{
public
void
loadData
(
VedioBean
vedioBean
,
List
<
VideoMultiItemEntity
>
list
,
int
currentPosition
)
{
this
.
mList
=
list
;
this
.
mList
=
list
;
this
.
mCurrentPosition
=
currentPosition
;
this
.
mCurrentPosition
=
currentPosition
;
List
<
VideoModel
>
videoList
=
new
ArrayList
();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
if
(
list
.
get
(
i
).
getItemType
()
==
VideoMultiItemEntity
.
MULTI_ITEM_1
)
{
videoList
.
add
(
new
VideoModel
(
list
.
get
(
i
).
getVideo
().
getVedioUrl
()));
}
}
mUrlList
.
clear
();
mUrlList
.
addAll
(
videoList
);
mAdapter
.
setVedioBean
(
vedioBean
);
mAdapter
.
setVedioBean
(
vedioBean
);
mAdapter
.
setNewInstance
(
mList
);
mAdapter
.
setNewInstance
(
mList
);
...
@@ -91,7 +77,6 @@ public class SuperShortVideoView extends RelativeLayout {
...
@@ -91,7 +77,6 @@ public class SuperShortVideoView extends RelativeLayout {
addView
(
mRootView
);
addView
(
mRootView
);
mPlayerManager
=
new
PlayerManager
(
getContext
());
mPlayerManager
=
new
PlayerManager
(
getContext
());
mRecyclerView
=
mRootView
.
findViewById
(
R
.
id
.
rv_super_short_video
);
mRecyclerView
=
mRootView
.
findViewById
(
R
.
id
.
rv_super_short_video
);
mUrlList
=
new
ArrayList
<>();
mSnapHelper
=
new
PagerSnapHelper
();
mSnapHelper
=
new
PagerSnapHelper
();
mSnapHelper
.
attachToRecyclerView
(
mRecyclerView
);
mSnapHelper
.
attachToRecyclerView
(
mRecyclerView
);
mAdapter
=
new
TxVideoAdapter
();
mAdapter
=
new
TxVideoAdapter
();
...
@@ -109,7 +94,6 @@ public class SuperShortVideoView extends RelativeLayout {
...
@@ -109,7 +94,6 @@ public class SuperShortVideoView extends RelativeLayout {
mRecyclerView
.
setDrawingCacheEnabled
(
true
);
mRecyclerView
.
setDrawingCacheEnabled
(
true
);
mRecyclerView
.
setDrawingCacheQuality
(
View
.
DRAWING_CACHE_QUALITY_LOW
);
mRecyclerView
.
setDrawingCacheQuality
(
View
.
DRAWING_CACHE_QUALITY_LOW
);
mRecyclerView
.
setAdapter
(
mAdapter
);
mRecyclerView
.
setAdapter
(
mAdapter
);
// mLayoutManager.scrollToPosition(0);
addListener
();
addListener
();
}
}
...
@@ -131,6 +115,8 @@ public class SuperShortVideoView extends RelativeLayout {
...
@@ -131,6 +115,8 @@ public class SuperShortVideoView extends RelativeLayout {
if
(
position
==
mCurrentPosition
)
return
;
if
(
position
==
mCurrentPosition
)
return
;
Log
.
i
(
TAG
,
"[SCROLL_STATE_IDLE] mLastPositionInIDLE "
+
mLastPositionInIDLE
+
" position "
+
position
);
Log
.
i
(
TAG
,
"[SCROLL_STATE_IDLE] mLastPositionInIDLE "
+
mLastPositionInIDLE
+
" position "
+
position
);
mCurrentPosition
=
position
;
mCurrentPosition
=
position
;
addAdView
(
position
);
onPageSelectedMethod
(
position
);
onPageSelectedMethod
(
position
);
break
;
break
;
case
RecyclerView
.
SCROLL_STATE_DRAGGING
:
//拖动
case
RecyclerView
.
SCROLL_STATE_DRAGGING
:
//拖动
...
@@ -145,7 +131,10 @@ public class SuperShortVideoView extends RelativeLayout {
...
@@ -145,7 +131,10 @@ public class SuperShortVideoView extends RelativeLayout {
private
void
onPageSelectedMethod
(
int
position
)
{
private
void
onPageSelectedMethod
(
int
position
)
{
if
(
mOnPageChangeListener
!=
null
)
mOnPageChangeListener
.
onPageChange
(
position
);
if
(
mOnPageChangeListener
!=
null
)
mOnPageChangeListener
.
onPageChange
(
position
);
if
(
position
==
mUrlList
.
size
())
{
if
(
position
>=
mList
.
size
()
||
this
.
mList
.
get
(
position
).
getItemType
()
!=
MULTI_ITEM_1
)
return
;
if
(
position
==
mList
.
size
())
{
if
(
mBaseItemView
!=
null
)
{
if
(
mBaseItemView
!=
null
)
{
mLastPositionInIDLE
=
-
1
;
mLastPositionInIDLE
=
-
1
;
mBaseItemView
.
stopForPlaying
();
mBaseItemView
.
stopForPlaying
();
...
@@ -162,9 +151,9 @@ public class SuperShortVideoView extends RelativeLayout {
...
@@ -162,9 +151,9 @@ public class SuperShortVideoView extends RelativeLayout {
Log
.
i
(
TAG
,
"onPageSelected "
+
position
);
Log
.
i
(
TAG
,
"onPageSelected "
+
position
);
List
<
VideoModel
>
tempUrlList
=
initUrlList
(
position
,
MAX_PLAYER_COUNT_ON_PASS
);
List
<
VideoModel
>
tempUrlList
=
initUrlList
(
position
,
MAX_PLAYER_COUNT_ON_PASS
);
mPlayerManager
.
updateManager
(
tempUrlList
);
mPlayerManager
.
updateManager
(
tempUrlList
);
TXVodPlayerWrapper
txVodPlayerWrapper
=
mPlayerManager
.
getPlayer
(
m
UrlList
.
get
(
position
));
TXVodPlayerWrapper
txVodPlayerWrapper
=
mPlayerManager
.
getPlayer
(
m
List
.
get
(
position
).
getVideoModel
(
));
if
(
txVodPlayerWrapper
!=
null
)
{
if
(
txVodPlayerWrapper
!=
null
)
{
Log
.
i
(
TAG
,
"txVodPlayerWrapper "
+
txVodPlayerWrapper
+
"url-- "
+
m
UrlList
.
get
(
position
).
videoURL
);
Log
.
i
(
TAG
,
"txVodPlayerWrapper "
+
txVodPlayerWrapper
+
"url-- "
+
m
List
.
get
(
position
).
getVideoModel
(
).
videoURL
);
Log
.
i
(
TAG
,
"txVodPlayerWrapper "
+
txVodPlayerWrapper
);
Log
.
i
(
TAG
,
"txVodPlayerWrapper "
+
txVodPlayerWrapper
);
mBaseItemView
.
setTXVodPlayer
(
txVodPlayerWrapper
);
mBaseItemView
.
setTXVodPlayer
(
txVodPlayerWrapper
);
}
}
...
@@ -183,17 +172,21 @@ public class SuperShortVideoView extends RelativeLayout {
...
@@ -183,17 +172,21 @@ public class SuperShortVideoView extends RelativeLayout {
* @return
* @return
*/
*/
private
List
<
VideoModel
>
initUrlList
(
int
startIndex
,
int
maxCount
)
{
private
List
<
VideoModel
>
initUrlList
(
int
startIndex
,
int
maxCount
)
{
List
<
VideoModel
>
videoModels
=
new
ArrayList
<>();
for
(
VideoMultiItemEntity
videoMultiItemEntity
:
this
.
mList
)
{
videoModels
.
add
(
videoMultiItemEntity
.
getVideoModel
());
}
int
i
=
startIndex
-
1
;
int
i
=
startIndex
-
1
;
if
(
i
+
maxCount
>
mUrlList
.
size
())
{
if
(
i
+
maxCount
>
videoModels
.
size
())
{
i
=
mUrlList
.
size
()
-
maxCount
;
i
=
videoModels
.
size
()
-
maxCount
;
}
}
if
(
i
<
0
)
{
if
(
i
<
0
)
{
i
=
0
;
i
=
0
;
}
}
int
addedCount
=
0
;
int
addedCount
=
0
;
List
<
VideoModel
>
cacheList
=
new
ArrayList
<>();
List
<
VideoModel
>
cacheList
=
new
ArrayList
<>();
while
(
i
<
mUrlList
.
size
()
&&
addedCount
<
maxCount
)
{
while
(
i
<
videoModels
.
size
()
&&
addedCount
<
maxCount
)
{
cacheList
.
add
(
mUrlList
.
get
(
i
));
cacheList
.
add
(
videoModels
.
get
(
i
));
addedCount
++;
addedCount
++;
i
++;
i
++;
}
}
...
@@ -219,12 +212,6 @@ public class SuperShortVideoView extends RelativeLayout {
...
@@ -219,12 +212,6 @@ public class SuperShortVideoView extends RelativeLayout {
mPlayerManager
.
releasePlayer
();
mPlayerManager
.
releasePlayer
();
}
}
public
void
onListPageScrolled
()
{
if
(
mBaseItemView
!=
null
)
{
mBaseItemView
.
pausePlayer
();
}
}
public
void
onItemClick
(
final
int
position
)
{
public
void
onItemClick
(
final
int
position
)
{
mRecyclerView
.
scrollToPosition
(
position
);
mRecyclerView
.
scrollToPosition
(
position
);
mRecyclerView
.
post
(()
->
{
mRecyclerView
.
post
(()
->
{
...
@@ -234,6 +221,20 @@ public class SuperShortVideoView extends RelativeLayout {
...
@@ -234,6 +221,20 @@ public class SuperShortVideoView extends RelativeLayout {
});
});
}
}
public
List
<
VideoMultiItemEntity
>
getData
()
{
return
mList
;
}
public
int
getRealSeeIndex
()
{
if
(
mList
!=
null
&&
mList
.
size
()
>
0
)
{
VideoMultiItemEntity
videoMultiItemEntity
=
mList
.
get
(
mCurrentPosition
);
if
(
videoMultiItemEntity
.
getItemType
()
==
MULTI_ITEM_1
)
{
return
videoMultiItemEntity
.
getVideo
().
getVedioIndex
()
-
1
;
}
}
return
mCurrentPosition
;
}
public
int
getCurrentPosition
()
{
public
int
getCurrentPosition
()
{
return
mCurrentPosition
;
return
mCurrentPosition
;
}
}
...
@@ -255,4 +256,27 @@ public class SuperShortVideoView extends RelativeLayout {
...
@@ -255,4 +256,27 @@ public class SuperShortVideoView extends RelativeLayout {
public
void
setOnPageChangeListener
(
OnPageChangeListener
onPageChangeListener
)
{
public
void
setOnPageChangeListener
(
OnPageChangeListener
onPageChangeListener
)
{
this
.
mOnPageChangeListener
=
onPageChangeListener
;
this
.
mOnPageChangeListener
=
onPageChangeListener
;
}
}
public
boolean
isAdPosition
(
int
position
)
{
if
(
mList
!=
null
&&
mList
.
size
()
>
0
)
{
return
mList
.
get
(
position
).
getItemType
()
==
MULTI_ITEM_3
;
}
return
false
;
}
private
int
lastAddAdPosition
=
0
;
private
void
addAdView
(
int
position
)
{
// VIP 不展示
if
(
UserManager
.
getInstance
().
getVipFlag
())
return
;
// 每隔3个视频出现一个广告
if
(
position
+
1
<
2
||
(
position
+
1
)
%
3
!=
0
||
lastAddAdPosition
>
position
)
return
;
if
(
DrawExpressManager
.
Companion
.
getInstance
().
getAdIsLoadSuc
())
{
VideoMultiItemEntity
itemAD
=
new
VideoMultiItemEntity
(
MULTI_ITEM_3
,
null
,
new
VideoModel
(
""
));
mList
.
add
(
position
+
1
,
itemAD
);
mAdapter
.
notifyItemInserted
(
position
+
1
);
lastAddAdPosition
=
position
+
1
;
}
}
}
}
video/app/src/main/java/com/mints/helivideo/video/tx/TXVideoBaseView.java
View file @
dfb91e38
...
@@ -3,7 +3,6 @@ package com.mints.helivideo.video.tx;
...
@@ -3,7 +3,6 @@ package com.mints.helivideo.video.tx;
import
android.annotation.SuppressLint
;
import
android.annotation.SuppressLint
;
import
android.content.Context
;
import
android.content.Context
;
import
android.graphics.Color
;
import
android.graphics.Color
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.text.SpannableStringBuilder
;
import
android.text.SpannableStringBuilder
;
import
android.text.Spanned
;
import
android.text.Spanned
;
...
@@ -32,7 +31,7 @@ import java.util.Locale;
...
@@ -32,7 +31,7 @@ import java.util.Locale;
public
class
TXVideoBaseView
extends
RelativeLayout
implements
View
.
OnClickListener
,
public
class
TXVideoBaseView
extends
RelativeLayout
implements
View
.
OnClickListener
,
SeekBar
.
OnSeekBarChangeListener
,
TXVodPlayerWrapper
.
OnPlayEventChangedListener
{
SeekBar
.
OnSeekBarChangeListener
,
TXVodPlayerWrapper
.
OnPlayEventChangedListener
{
private
static
final
String
TAG
=
"TXVideoBaseView"
;
private
static
final
String
TAG
=
"TXVideoBaseView"
;
private
View
mRootView
;
private
SeekBar
mSeekBar
;
private
SeekBar
mSeekBar
;
private
TXCloudVideoView
mTXCloudVideoView
;
private
TXCloudVideoView
mTXCloudVideoView
;
private
ImageView
mIvCover
;
private
ImageView
mIvCover
;
...
@@ -58,17 +57,17 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe
...
@@ -58,17 +57,17 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe
init
(
context
);
init
(
context
);
}
}
public
void
setTXVodPlayer
(
TXVodPlayerWrapper
T
XVodPlayerWrapper
)
{
public
void
setTXVodPlayer
(
TXVodPlayerWrapper
t
XVodPlayerWrapper
)
{
mTXVodPlayerWrapper
=
T
XVodPlayerWrapper
;
mTXVodPlayerWrapper
=
t
XVodPlayerWrapper
;
mTXVodPlayerWrapper
.
setPlayerView
(
mTXCloudVideoView
);
mTXVodPlayerWrapper
.
setPlayerView
(
mTXCloudVideoView
);
mTXVodPlayerWrapper
.
setVodChangeListener
(
this
);
mTXVodPlayerWrapper
.
setVodChangeListener
(
this
);
mTXCloudVideoView
.
requestLayout
();
mTXCloudVideoView
.
requestLayout
();
Log
.
i
(
TAG
,
"[setTXVodPlayer] , PLAY_EVT_PLAY_PROGRESS,"
+
mTXVodPlayerWrapper
.
getVodPlayer
().
hashCode
()
+
" url "
+
T
XVodPlayerWrapper
.
getUrl
());
Log
.
i
(
TAG
,
"[setTXVodPlayer] , PLAY_EVT_PLAY_PROGRESS,"
+
mTXVodPlayerWrapper
.
getVodPlayer
().
hashCode
()
+
" url "
+
t
XVodPlayerWrapper
.
getUrl
());
}
}
@SuppressLint
(
"ClickableViewAccessibility"
)
@SuppressLint
(
"ClickableViewAccessibility"
)
private
void
init
(
Context
context
)
{
private
void
init
(
Context
context
)
{
mRootView
=
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
player_item_base_view
,
null
);
View
mRootView
=
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
player_item_base_view
,
null
);
addView
(
mRootView
);
addView
(
mRootView
);
mSeekBar
=
mRootView
.
findViewById
(
R
.
id
.
seekbar_short_video
);
mSeekBar
=
mRootView
.
findViewById
(
R
.
id
.
seekbar_short_video
);
mSeekBar
.
setOnSeekBarChangeListener
(
this
);
mSeekBar
.
setOnSeekBarChangeListener
(
this
);
...
@@ -217,9 +216,11 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe
...
@@ -217,9 +216,11 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe
}
}
}
}
public
void
startPlay
()
{
public
void
startPlay
()
{
if
(
mTXVodPlayerWrapper
!=
null
)
{
if
(
mTXVodPlayerWrapper
!=
null
)
{
if
(
mIvCover
.
getVisibility
()
==
View
.
VISIBLE
)
{
mIvCover
.
setVisibility
(
View
.
GONE
);
}
mPauseImageView
.
setVisibility
(
View
.
GONE
);
mPauseImageView
.
setVisibility
(
View
.
GONE
);
mTXVodPlayerWrapper
.
setVodChangeListener
(
this
);
mTXVodPlayerWrapper
.
setVodChangeListener
(
this
);
mTXVodPlayerWrapper
.
resumePlay
();
mTXVodPlayerWrapper
.
resumePlay
();
...
@@ -227,6 +228,13 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe
...
@@ -227,6 +228,13 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe
}
}
}
}
public
TXVodPlayerWrapper
getPlayer
()
{
if
(
mTXVodPlayerWrapper
!=
null
)
{
return
mTXVodPlayerWrapper
;
}
return
null
;
}
public
void
stopPlayer
()
{
public
void
stopPlayer
()
{
if
(
mTXVodPlayerWrapper
!=
null
)
{
if
(
mTXVodPlayerWrapper
!=
null
)
{
mTXVodPlayerWrapper
.
stopPlay
();
mTXVodPlayerWrapper
.
stopPlay
();
...
...
video/app/src/main/java/com/mints/helivideo/video/tx/TXVodPlayerWrapper.java
View file @
dfb91e38
...
@@ -102,7 +102,6 @@ public class TXVodPlayerWrapper implements ITXVodPlayListener {
...
@@ -102,7 +102,6 @@ public class TXVodPlayerWrapper implements ITXVodPlayListener {
playerStatusChanged
(
TxVodStatus
.
TX_VIDEO_PLAYER_STATUS_PAUSED
);
playerStatusChanged
(
TxVodStatus
.
TX_VIDEO_PLAYER_STATUS_PAUSED
);
}
}
public
void
resumePlay
()
{
public
void
resumePlay
()
{
Log
.
i
(
TAG
,
"[resumePlay] , startOnPrepare, "
+
mStartOnPrepare
Log
.
i
(
TAG
,
"[resumePlay] , startOnPrepare, "
+
mStartOnPrepare
+
" mVodPlayer "
+
mVodPlayer
.
hashCode
()
+
" url "
+
mUrl
);
+
" mVodPlayer "
+
mVodPlayer
.
hashCode
()
+
" url "
+
mUrl
);
...
@@ -185,6 +184,7 @@ public class TXVodPlayerWrapper implements ITXVodPlayListener {
...
@@ -185,6 +184,7 @@ public class TXVodPlayerWrapper implements ITXVodPlayListener {
void
onRcvFirstFrame
();
void
onRcvFirstFrame
();
void
onEnded
();
void
onEnded
();
void
onResume
();
void
onResume
();
}
}
...
...
video/app/src/main/java/com/mints/helivideo/video/tx/TxVideoFragment.kt
View file @
dfb91e38
...
@@ -4,18 +4,16 @@ import android.os.Bundle
...
@@ -4,18 +4,16 @@ import android.os.Bundle
import
android.view.View
import
android.view.View
import
androidx.fragment.app.Fragment
import
androidx.fragment.app.Fragment
import
com.mints.helivideo.R
import
com.mints.helivideo.R
import
com.mints.helivideo.ad.draw.DrawExpressManager
import
com.mints.helivideo.common.AppConfig
import
com.mints.helivideo.common.AppConfig
import
com.mints.helivideo.common.Constant
import
com.mints.helivideo.common.Constant
import
com.mints.helivideo.manager.LocalVedioManager
import
com.mints.helivideo.manager.LocalVedioManager
import
com.mints.helivideo.manager.UserManager
import
com.mints.helivideo.mvp.model.BannerList
import
com.mints.helivideo.mvp.model.BannerList
import
com.mints.helivideo.mvp.model.NineShowBean
import
com.mints.helivideo.mvp.model.VedioBean
import
com.mints.helivideo.mvp.presenters.RecommendPresenter
import
com.mints.helivideo.mvp.presenters.RecommendPresenter
import
com.mints.helivideo.mvp.views.RecommendView
import
com.mints.helivideo.mvp.views.RecommendView
import
com.mints.helivideo.ui.activitys.NineActivity
import
com.mints.helivideo.ui.fragment.base.BaseFragment
import
com.mints.helivideo.ui.fragment.base.BaseFragment
import
com.mints.helivideo.utils.AppPreferencesManager
import
com.mints.helivideo.video.tx.adapter.TxRecommendVideo2Adapter
import
com.mints.helivideo.video.tx.adapter.TxRecommendVideoAdapter
import
kotlinx.android.synthetic.main.fragment_tx_video.*
import
kotlinx.android.synthetic.main.fragment_tx_video.*
/**
/**
...
@@ -27,7 +25,6 @@ class TxVideoFragment : BaseFragment(), RecommendView {
...
@@ -27,7 +25,6 @@ class TxVideoFragment : BaseFragment(), RecommendView {
private
val
recommendPresenter
by
lazy
{
RecommendPresenter
()
}
private
val
recommendPresenter
by
lazy
{
RecommendPresenter
()
}
var
videos
=
arrayListOf
<
VedioBean
>()
private
var
recommendPage
=
1
// 分页
private
var
recommendPage
=
1
// 分页
companion
object
{
companion
object
{
...
@@ -42,6 +39,10 @@ class TxVideoFragment : BaseFragment(), RecommendView {
...
@@ -42,6 +39,10 @@ class TxVideoFragment : BaseFragment(), RecommendView {
override
fun
initViewsAndEvents
()
{
override
fun
initViewsAndEvents
()
{
recommendPresenter
.
attachView
(
this
)
recommendPresenter
.
attachView
(
this
)
if
(!
UserManager
.
getInstance
().
vipFlag
)
{
DrawExpressManager
.
instance
.
preLoadAd
()
}
recommendPresenter
.
autoList
()
recommendPresenter
.
autoList
()
recommend_view
.
setOnLoadMoreListener
{
recommend_view
.
setOnLoadMoreListener
{
...
@@ -51,28 +52,28 @@ class TxVideoFragment : BaseFragment(), RecommendView {
...
@@ -51,28 +52,28 @@ class TxVideoFragment : BaseFragment(), RecommendView {
recommend_view
.
setOnVideoEndListener
{
recommend_view
.
setOnVideoEndListener
{
LocalVedioManager
.
startVedioDetailActivityForType
(
LocalVedioManager
.
startVedioDetailActivityForType
(
requireActivity
(),
requireActivity
(),
videos
[
recommend_view
.
currentPosition
]
,
recommend_view
.
data
[
recommend_view
.
currentPosition
].
video
,
true
true
)
)
}
}
recommend_view
.
setOnCustomChildClickListener
(
object
:
recommend_view
.
setOnCustomChildClickListener
(
object
:
TxRecommendVideoAdapter
.
OnCustomChildClickListener
{
TxRecommendVideo
2
Adapter
.
OnCustomChildClickListener
{
override
fun
onCustomChildClick
(
view
:
View
,
position
:
Int
)
{
override
fun
onCustomChildClick
(
view
:
View
,
position
:
Int
)
{
when
(
view
.
id
)
{
when
(
view
.
id
)
{
R
.
id
.
ll_bottom
->
{
R
.
id
.
ll_bottom
->
{
LocalVedioManager
.
startVedioDetailActivityForType
(
LocalVedioManager
.
startVedioDetailActivityForType
(
requireActivity
(),
requireActivity
(),
videos
[
position
]
,
recommend_view
.
data
[
position
].
video
,
true
true
)
)
}
}
R
.
id
.
ll_collect
->
{
R
.
id
.
ll_collect
->
{
if
(
videos
[
position
]
.
collect
==
0
)
{
if
(
recommend_view
.
data
[
position
].
video
?
.
collect
==
0
)
{
videos
[
position
]
.
collect
=
1
recommend_view
.
data
[
position
].
video
?
.
collect
=
1
recommendPresenter
.
collect
(
""
+
videos
[
position
]
.
vedioId
)
recommendPresenter
.
collect
(
""
+
recommend_view
.
data
[
position
].
video
?
.
vedioId
)
}
else
{
}
else
{
videos
[
position
]
.
collect
=
0
recommend_view
.
data
[
position
].
video
?
.
collect
=
0
recommendPresenter
.
cancelCollect
(
""
+
videos
[
position
]
.
vedioId
)
recommendPresenter
.
cancelCollect
(
""
+
recommend_view
.
data
[
position
].
video
?
.
vedioId
)
}
}
}
}
else
->
{}
else
->
{}
...
@@ -108,6 +109,8 @@ class TxVideoFragment : BaseFragment(), RecommendView {
...
@@ -108,6 +109,8 @@ class TxVideoFragment : BaseFragment(), RecommendView {
recommend_view
.
onDestroy
()
recommend_view
.
onDestroy
()
super
.
onDestroyView
()
super
.
onDestroyView
()
recommend_view
.
releasePlayer
()
recommend_view
.
releasePlayer
()
DrawExpressManager
.
instance
.
destroy
()
}
}
override
fun
onDetach
()
{
override
fun
onDetach
()
{
...
@@ -133,11 +136,8 @@ class TxVideoFragment : BaseFragment(), RecommendView {
...
@@ -133,11 +136,8 @@ class TxVideoFragment : BaseFragment(), RecommendView {
override
fun
autoListSuc
(
list
:
BannerList
)
{
override
fun
autoListSuc
(
list
:
BannerList
)
{
if
(
recommendPage
==
1
)
{
if
(
recommendPage
==
1
)
{
videos
.
clear
()
videos
.
addAll
(
list
.
list
)
recommend_view
.
loadData
(
list
.
list
)
recommend_view
.
loadData
(
list
.
list
)
}
else
{
}
else
{
videos
.
addAll
(
list
.
list
)
recommend_view
.
loadMoreData
(
list
.
list
)
recommend_view
.
loadMoreData
(
list
.
list
)
recommend_view
.
hideLoadMore
()
recommend_view
.
hideLoadMore
()
}
}
...
...
video/app/src/main/java/com/mints/helivideo/video/tx/adapter/ShortVideoPlayAdapter.java
deleted
100644 → 0
View file @
d966e4f8
package
com
.
mints
.
helivideo
.
video
.
tx
.
adapter
;
import
android.content.Context
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
androidx.annotation.NonNull
;
import
com.bumptech.glide.Glide
;
import
com.bumptech.glide.load.engine.DiskCacheStrategy
;
import
com.tencent.rtmp.ui.TXCloudVideoView
;
import
com.mints.helivideo.R
;
import
com.mints.helivideo.video.tx.TXVideoBaseView
;
import
com.mints.helivideo.video.tx.VideoModel
;
import
java.util.List
;
public
class
ShortVideoPlayAdapter
extends
AbsPlayerRecyclerViewAdapter
<
VideoModel
,
ShortVideoPlayAdapter
.
VideoViewHolder
>
{
private
static
final
String
TAG
=
"ShortVideoDemo:ShortVideoPlayAdapter"
;
private
Context
mContext
;
public
ShortVideoPlayAdapter
(
Context
context
,
List
<
VideoModel
>
list
)
{
super
(
list
);
mContext
=
context
;
}
@Override
public
void
onHolder
(
VideoViewHolder
holder
,
VideoModel
bean
,
int
position
)
{
if
(
bean
!=
null
&&
bean
.
placeholderImage
!=
null
)
{
Glide
.
with
(
mContext
).
load
(
bean
.
placeholderImage
)
.
skipMemoryCache
(
true
)
.
diskCacheStrategy
(
DiskCacheStrategy
.
ALL
).
centerCrop
()
.
into
(
holder
.
mImageViewCover
);
}
}
@Override
public
void
onViewRecycled
(
@NonNull
VideoViewHolder
holder
)
{
super
.
onViewRecycled
(
holder
);
Glide
.
with
(
mContext
).
clear
(
holder
.
mImageViewCover
);
}
@Override
public
VideoViewHolder
onCreateHolder
(
ViewGroup
viewGroup
)
{
return
new
VideoViewHolder
(
getViewByRes
(
R
.
layout
.
player_item_short_video_play
,
viewGroup
));
}
@Override
public
void
onViewDetachedFromWindow
(
@NonNull
VideoViewHolder
holder
)
{
super
.
onViewDetachedFromWindow
(
holder
);
Log
.
i
(
TAG
,
"onViewDetachedFromWindow"
);
TXVideoBaseView
videoView
=
(
TXVideoBaseView
)
holder
.
mRootView
.
findViewById
(
R
.
id
.
baseItemView
);
videoView
.
stopForPlaying
();
}
public
class
VideoViewHolder
extends
AbsViewHolder
{
public
View
mRootView
;
public
TextView
mEpisodeTv
;
public
ImageView
mImageViewCover
;
public
TXCloudVideoView
mVideoView
;
public
VideoViewHolder
(
View
rootView
)
{
super
(
rootView
);
this
.
mRootView
=
rootView
;
this
.
mImageViewCover
=
rootView
.
findViewById
(
R
.
id
.
iv_cover
);
this
.
mVideoView
=
rootView
.
findViewById
(
R
.
id
.
tcv_video_view
);
}
}
}
video/app/src/main/java/com/mints/helivideo/video/tx/adapter/TxRecommendVideo2Adapter.kt
0 → 100755
View file @
dfb91e38
package
com.mints.helivideo.video.tx.adapter
import
android.view.View
import
android.widget.FrameLayout
import
com.airbnb.lottie.LottieAnimationView
import
com.airbnb.lottie.LottieComposition
import
com.airbnb.lottie.LottieCompositionFactory
import
com.airbnb.lottie.LottieDrawable
import
com.bumptech.glide.Glide
import
com.bumptech.glide.load.engine.DiskCacheStrategy
import
com.chad.library.adapter.base.BaseMultiItemQuickAdapter
import
com.chad.library.adapter.base.viewholder.BaseViewHolder
import
com.mints.helivideo.R
import
com.mints.helivideo.ad.draw.DrawExpressManager
import
com.mints.helivideo.ad.express.ExpressAdCallback
import
com.mints.helivideo.mvp.model.*
import
com.mints.helivideo.utils.UIUtils
import
com.mints.helivideo.video.tx.TXVideoBaseView
class
TxRecommendVideo2Adapter
:
BaseMultiItemQuickAdapter
<
VideoMultiItemEntity2
,
BaseViewHolder
>()
{
private
var
mCurrentPosition
=
0
init
{
addItemType
(
MULTI_ITEM_1
,
R
.
layout
.
item_tx_video
)
addItemType
(
MULTI_ITEM_3
,
R
.
layout
.
item_draw_ad
)
}
override
fun
convert
(
holder
:
BaseViewHolder
,
item
:
VideoMultiItemEntity2
)
{
if
(
holder
.
itemViewType
==
MULTI_ITEM_1
)
{
initVideoHolder
(
holder
,
item
.
video
)
}
else
{
initAdHolder
(
holder
)
}
}
private
fun
initVideoHolder
(
holder
:
BaseViewHolder
,
item
:
VedioBean
?)
{
if
(
item
?.
completeStatus
==
0
)
{
holder
.
setText
(
R
.
id
.
episode_tv
,
"共"
+
item
.
vedioTotal
+
"集 已完结"
)
}
else
{
holder
.
setText
(
R
.
id
.
episode_tv
,
"共"
+
item
?.
vedioTotal
+
"集 更新中"
)
}
//用户名
holder
.
setText
(
R
.
id
.
username_tv
,
item
?.
title
)
//标题
holder
.
setText
(
R
.
id
.
usertitle_tv
,
"第"
+
item
?.
recommendIndex
+
"集"
)
//缩略图
Glide
.
with
(
context
).
load
(
item
?.
coverImage
)
.
skipMemoryCache
(
true
)
.
diskCacheStrategy
(
DiskCacheStrategy
.
ALL
).
centerCrop
()
.
into
(
holder
.
getView
<
TXVideoBaseView
>(
R
.
id
.
baseItemView
).
findViewById
(
R
.
id
.
iv_cover
))
if
(
item
?.
collect
==
0
)
{
// 未收藏
setCollectImage
(
holder
.
getView
(
R
.
id
.
iv_collect
))
}
else
{
// 已收藏
setCancelCollectImage
(
holder
.
getView
(
R
.
id
.
iv_collect
))
}
// 热度
holder
.
setText
(
R
.
id
.
tv_collect_num
,
item
?.
hot
)
holder
.
getView
<
View
>(
R
.
id
.
ll_collect
).
setOnClickListener
{
if
(
item
?.
collect
==
0
)
{
playCollectAnim
(
holder
.
getView
(
R
.
id
.
iv_collect
))
}
else
{
playCancelCollectAnim
(
holder
.
getView
(
R
.
id
.
iv_collect
))
}
mOnCustomChildClickListener
?.
onCustomChildClick
(
it
,
holder
.
adapterPosition
)
}
holder
.
getView
<
View
>(
R
.
id
.
ll_bottom
).
setOnClickListener
{
mOnCustomChildClickListener
?.
onCustomChildClick
(
it
,
holder
.
adapterPosition
)
}
holder
.
getView
<
TXVideoBaseView
>(
R
.
id
.
baseItemView
)
.
setOnVideoEndListener
(
mOnVideoEndListener
)
}
private
fun
initAdHolder
(
holder
:
BaseViewHolder
)
{
DrawExpressManager
.
instance
.
getAdView
(
object
:
ExpressAdCallback
{
override
fun
loadSuccess
(
adView
:
FrameLayout
?)
{
adView
?.
let
{
UIUtils
.
removeFromParent
(
it
)
val
fmAd
=
holder
.
getView
<
FrameLayout
>(
R
.
id
.
fl_ad
)
fmAd
.
removeAllViews
()
fmAd
.
addView
(
it
)
}
DrawExpressManager
.
instance
.
preLoadAd
()
}
override
fun
renderSuccess
(
adView
:
FrameLayout
?):
Boolean
{
return
false
}
override
fun
loadFail
()
{
}
})
}
override
fun
onViewDetachedFromWindow
(
holder
:
BaseViewHolder
)
{
super
.
onViewDetachedFromWindow
(
holder
)
if
(
holder
.
itemViewType
==
MULTI_ITEM_1
)
{
val
tXVideoBaseView
=
holder
.
getView
<
TXVideoBaseView
>(
R
.
id
.
baseItemView
)
if
(
data
[
mCurrentPosition
].
itemType
==
MULTI_ITEM_1
)
{
if
(
tXVideoBaseView
.
player
.
url
!=
data
[
mCurrentPosition
].
video
!!
.
recommendUrl
)
{
tXVideoBaseView
.
stopForPlaying
()
}
}
else
{
tXVideoBaseView
.
stopForPlaying
()
}
}
}
override
fun
onViewRecycled
(
holder
:
BaseViewHolder
)
{
super
.
onViewRecycled
(
holder
)
if
(
holder
.
itemViewType
==
MULTI_ITEM_1
)
{
Glide
.
with
(
context
).
clear
(
holder
.
getView
<
View
>(
R
.
id
.
iv_cover
))
}
}
private
fun
setCollectImage
(
view
:
LottieAnimationView
)
{
val
lottieDrawable
=
LottieDrawable
()
LottieCompositionFactory
.
fromAsset
(
context
,
"home_collect.json"
)
.
addListener
{
result
:
LottieComposition
?
->
lottieDrawable
.
setImagesAssetsFolder
(
"images/"
)
lottieDrawable
.
composition
=
result
}
view
.
setImageDrawable
(
lottieDrawable
)
}
private
fun
setCancelCollectImage
(
view
:
LottieAnimationView
)
{
val
lottieDrawable
=
LottieDrawable
()
LottieCompositionFactory
.
fromAsset
(
context
,
"home_cancel_collect.json"
)
.
addListener
{
result
:
LottieComposition
?
->
lottieDrawable
.
setImagesAssetsFolder
(
"images/"
)
lottieDrawable
.
composition
=
result
}
view
.
setImageDrawable
(
lottieDrawable
)
}
private
fun
playCollectAnim
(
view
:
LottieAnimationView
)
{
view
.
setImageDrawable
(
null
)
val
lottieDrawable
=
LottieDrawable
()
LottieCompositionFactory
.
fromAsset
(
context
,
"home_collect.json"
)
.
addListener
{
result
:
LottieComposition
?
->
lottieDrawable
.
setImagesAssetsFolder
(
"images/"
)
lottieDrawable
.
composition
=
result
lottieDrawable
.
loop
(
false
)
lottieDrawable
.
playAnimation
()
}
view
.
setImageDrawable
(
lottieDrawable
)
}
private
fun
playCancelCollectAnim
(
view
:
LottieAnimationView
)
{
view
.
setImageDrawable
(
null
)
val
lottieDrawable
=
LottieDrawable
()
LottieCompositionFactory
.
fromAsset
(
context
,
"home_cancel_collect.json"
)
.
addListener
{
result
:
LottieComposition
?
->
lottieDrawable
.
setImagesAssetsFolder
(
"images/"
)
lottieDrawable
.
composition
=
result
lottieDrawable
.
loop
(
false
)
lottieDrawable
.
playAnimation
()
}
view
.
setImageDrawable
(
lottieDrawable
)
}
fun
setCurrentPosition
(
currentPosition
:
Int
)
{
this
.
mCurrentPosition
=
currentPosition
}
private
var
mOnVideoEndListener
:
TXVideoBaseView
.
OnVideoEndListener
?
=
null
fun
setOnVideoEndListener
(
onVideoEndListener
:
TXVideoBaseView
.
OnVideoEndListener
)
{
this
.
mOnVideoEndListener
=
onVideoEndListener
}
private
var
mOnCustomChildClickListener
:
OnCustomChildClickListener
?
=
null
fun
setOnCustomChildClickListener
(
onCustomChildClickListener
:
OnCustomChildClickListener
)
{
this
.
mOnCustomChildClickListener
=
onCustomChildClickListener
}
interface
OnCustomChildClickListener
{
fun
onCustomChildClick
(
view
:
View
,
position
:
Int
)
}
}
\ No newline at end of file
video/app/src/main/java/com/mints/helivideo/video/tx/adapter/TxRecommendVideoAdapter.kt
View file @
dfb91e38
...
@@ -10,10 +10,7 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy
...
@@ -10,10 +10,7 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy
import
com.chad.library.adapter.base.BaseQuickAdapter
import
com.chad.library.adapter.base.BaseQuickAdapter
import
com.chad.library.adapter.base.viewholder.BaseViewHolder
import
com.chad.library.adapter.base.viewholder.BaseViewHolder
import
com.mints.helivideo.R
import
com.mints.helivideo.R
import
com.mints.helivideo.common.Constant
import
com.mints.helivideo.manager.UserManager
import
com.mints.helivideo.mvp.model.VedioBean
import
com.mints.helivideo.mvp.model.VedioBean
import
com.mints.helivideo.utils.AppPreferencesManager
import
com.mints.helivideo.video.tx.TXVideoBaseView
import
com.mints.helivideo.video.tx.TXVideoBaseView
class
TxRecommendVideoAdapter
:
class
TxRecommendVideoAdapter
:
...
...
video/app/src/main/java/com/mints/helivideo/video/tx/adapter/TxVideoAdapter.kt
View file @
dfb91e38
package
com.mints.helivideo.video.tx.adapter
package
com.mints.helivideo.video.tx.adapter
import
android.view.View
import
android.view.View
import
android.widget.FrameLayout
import
android.widget.LinearLayout
import
android.widget.LinearLayout
import
android.widget.TextView
import
android.widget.TextView
import
android.widget.Toast
import
com.airbnb.lottie.LottieAnimationView
import
com.airbnb.lottie.LottieAnimationView
import
com.airbnb.lottie.LottieComposition
import
com.airbnb.lottie.LottieComposition
import
com.airbnb.lottie.LottieCompositionFactory
import
com.airbnb.lottie.LottieCompositionFactory
...
@@ -13,11 +13,13 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy
...
@@ -13,11 +13,13 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy
import
com.chad.library.adapter.base.BaseMultiItemQuickAdapter
import
com.chad.library.adapter.base.BaseMultiItemQuickAdapter
import
com.chad.library.adapter.base.viewholder.BaseViewHolder
import
com.chad.library.adapter.base.viewholder.BaseViewHolder
import
com.mints.helivideo.R
import
com.mints.helivideo.R
import
com.mints.helivideo.common.Constant
import
com.mints.helivideo.ad.draw.DrawExpressManager
import
com.mints.helivideo.ad.express.ExpressAdCallback
import
com.mints.helivideo.ad.express.ExpressManager
import
com.mints.helivideo.manager.UserManager
import
com.mints.helivideo.manager.UserManager
import
com.mints.helivideo.mvp.model.
VedioBean
import
com.mints.helivideo.mvp.model.
*
import
com.mints.helivideo.
mvp.model.VideoMultiItemEntity
import
com.mints.helivideo.
utils.LogUtil
import
com.mints.helivideo.utils.
AppPreferencesManager
import
com.mints.helivideo.utils.
UIUtils
import
com.mints.helivideo.video.tx.TXVideoBaseView
import
com.mints.helivideo.video.tx.TXVideoBaseView
class
TxVideoAdapter
:
BaseMultiItemQuickAdapter
<
VideoMultiItemEntity
,
BaseViewHolder
>()
{
class
TxVideoAdapter
:
BaseMultiItemQuickAdapter
<
VideoMultiItemEntity
,
BaseViewHolder
>()
{
...
@@ -25,21 +27,50 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
...
@@ -25,21 +27,50 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
private
var
vedioBean
:
VedioBean
?
=
null
private
var
vedioBean
:
VedioBean
?
=
null
init
{
init
{
addItemType
(
VideoMultiItemEntity
.
MULTI_ITEM_1
,
R
.
layout
.
player_item_short_video_play
)
addItemType
(
MULTI_ITEM_1
,
R
.
layout
.
player_item_short_video_play
)
addItemType
(
VideoMultiItemEntity
.
MULTI_ITEM_2
,
R
.
layout
.
item_block_view
)
addItemType
(
MULTI_ITEM_2
,
R
.
layout
.
item_block_view
)
addItemType
(
MULTI_ITEM_3
,
R
.
layout
.
item_draw_ad
)
}
}
override
fun
convert
(
holder
:
BaseViewHolder
,
item
:
VideoMultiItemEntity
)
{
override
fun
convert
(
holder
:
BaseViewHolder
,
item
:
VideoMultiItemEntity
)
{
if
(
holder
.
itemViewType
==
VideoMultiItemEntity
.
MULTI_ITEM_1
)
{
when
(
holder
.
itemViewType
)
{
initVideoHolder
(
holder
,
item
)
MULTI_ITEM_1
->
{
}
else
{
initVideoHolder
(
holder
,
item
.
video
)
initLockHolder
(
holder
)
}
MULTI_ITEM_2
->
{
initLockHolder
(
holder
)
}
else
->
{
initAdHolder
(
holder
)
}
}
}
}
}
private
fun
initAdHolder
(
holder
:
BaseViewHolder
)
{
DrawExpressManager
.
instance
.
getAdView
(
object
:
ExpressAdCallback
{
override
fun
loadSuccess
(
adView
:
FrameLayout
?)
{
adView
?.
let
{
UIUtils
.
removeFromParent
(
it
)
val
fmAd
=
holder
.
getView
<
FrameLayout
>(
R
.
id
.
fl_ad
)
fmAd
.
removeAllViews
()
fmAd
.
addView
(
it
)
}
DrawExpressManager
.
instance
.
preLoadAd
()
}
override
fun
renderSuccess
(
adView
:
FrameLayout
?):
Boolean
{
return
false
}
override
fun
loadFail
()
{
}
})
}
private
fun
initLockHolder
(
holder
:
BaseViewHolder
)
{
private
fun
initLockHolder
(
holder
:
BaseViewHolder
)
{
Glide
.
with
(
context
).
load
(
vedioBean
?.
coverImage
)
Glide
.
with
(
context
).
load
(
vedioBean
?.
coverImage
)
.
into
(
holder
.
getView
(
R
.
id
.
iv_bg
))
.
into
(
holder
.
getView
(
R
.
id
.
iv_bg
))
val
vipBtn
=
holder
.
getView
<
View
>(
R
.
id
.
vip
)
val
vipBtn
=
holder
.
getView
<
View
>(
R
.
id
.
vip
)
if
(
UserManager
.
getInstance
().
newFlag
)
{
if
(
UserManager
.
getInstance
().
newFlag
)
{
// 匹配
// 匹配
...
@@ -56,20 +87,40 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
...
@@ -56,20 +87,40 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
holder
.
getView
<
View
>(
R
.
id
.
unlock
).
setOnClickListener
{
holder
.
getView
<
View
>(
R
.
id
.
unlock
).
setOnClickListener
{
mOnCustomChildClickListener
?.
onCustomChildClick
(
it
,
holder
.
adapterPosition
)
mOnCustomChildClickListener
?.
onCustomChildClick
(
it
,
holder
.
adapterPosition
)
}
}
ExpressManager
.
instance
.
getAdView
(
object
:
ExpressAdCallback
{
override
fun
loadSuccess
(
adView
:
FrameLayout
?)
{
adView
?.
let
{
UIUtils
.
removeFromParent
(
it
)
val
fmAd
=
holder
.
getView
<
FrameLayout
>(
R
.
id
.
fl_ad
)
fmAd
.
removeAllViews
()
fmAd
.
addView
(
it
)
}
ExpressManager
.
instance
.
preLoadAd
()
}
override
fun
renderSuccess
(
adView
:
FrameLayout
?):
Boolean
{
return
false
}
override
fun
loadFail
()
{
}
})
}
}
private
fun
initVideoHolder
(
holder
:
BaseViewHolder
,
item
:
VideoMultiItemEntity
)
{
private
fun
initVideoHolder
(
holder
:
BaseViewHolder
,
item
:
IndexList
.
VedioEpisodeBean
?
)
{
//标题
//标题
holder
.
setText
(
R
.
id
.
title_tv
,
vedioBean
?.
title
)
holder
.
setText
(
R
.
id
.
title_tv
,
vedioBean
?.
title
)
//集数
//集数
holder
.
setText
(
R
.
id
.
info_tv
,
"第"
+
item
.
video
.
vedioIndex
+
"集"
)
holder
.
setText
(
R
.
id
.
info_tv
,
"第"
+
item
?
.
vedioIndex
+
"集"
)
//收藏数量
//收藏数量
holder
.
setText
(
R
.
id
.
zan_num_tv
,
""
+
vedioBean
?.
hot
)
holder
.
setText
(
R
.
id
.
zan_num_tv
,
""
+
vedioBean
?.
hot
)
//缩略图
//缩略图
Glide
.
with
(
context
).
load
(
vedioBean
?.
coverImage
)
Glide
.
with
(
context
).
load
(
vedioBean
?.
coverImage
)
.
skipMemoryCache
(
true
)
.
skipMemoryCache
(
true
)
.
diskCacheStrategy
(
DiskCacheStrategy
.
ALL
).
centerCrop
()
.
diskCacheStrategy
(
DiskCacheStrategy
.
ALL
).
centerCrop
()
.
into
(
holder
.
getView
<
TXVideoBaseView
>(
R
.
id
.
baseItemView
).
findViewById
(
R
.
id
.
iv_cover
))
.
into
(
holder
.
getView
<
TXVideoBaseView
>(
R
.
id
.
baseItemView
).
findViewById
(
R
.
id
.
iv_cover
))
holder
.
getView
<
LinearLayout
>(
R
.
id
.
ll_collect
).
setOnClickListener
{
holder
.
getView
<
LinearLayout
>(
R
.
id
.
ll_collect
).
setOnClickListener
{
mOnCustomChildClickListener
?.
onCustomChildClick
(
it
,
holder
.
adapterPosition
)
mOnCustomChildClickListener
?.
onCustomChildClick
(
it
,
holder
.
adapterPosition
)
...
@@ -89,15 +140,15 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
...
@@ -89,15 +140,15 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
}
}
holder
.
getView
<
TXVideoBaseView
>(
R
.
id
.
baseItemView
)
holder
.
getView
<
TXVideoBaseView
>(
R
.
id
.
baseItemView
)
.
setOnVideoEndListener
(
mOnVideoEndListener
)
.
setOnVideoEndListener
(
mOnVideoEndListener
)
}
}
override
fun
onViewDetachedFromWindow
(
holder
:
BaseViewHolder
)
{
override
fun
onViewDetachedFromWindow
(
holder
:
BaseViewHolder
)
{
super
.
onViewDetachedFromWindow
(
holder
)
super
.
onViewDetachedFromWindow
(
holder
)
if
(
holder
.
itemViewType
==
VideoMultiItemEntity
.
MULTI_ITEM_1
)
{
if
(
holder
.
itemViewType
==
MULTI_ITEM_1
)
{
vedioBean
?.
let
{
vedioBean
?.
let
{
if
(
it
.
seeIndex
!=
holder
.
layoutPosition
+
1
)
{
if
(
it
.
seeIndex
==
data
[
holder
.
layoutPosition
].
video
!!
.
vedioIndex
)
{
holder
.
getView
<
TXVideoBaseView
>(
R
.
id
.
baseItemView
).
pausePlayer
()
holder
.
getView
<
TXVideoBaseView
>(
R
.
id
.
baseItemView
).
pausePlayer
()
holder
.
getView
<
TXVideoBaseView
>(
R
.
id
.
baseItemView
).
stopForPlaying
()
holder
.
getView
<
TXVideoBaseView
>(
R
.
id
.
baseItemView
).
stopForPlaying
()
}
}
...
@@ -107,7 +158,7 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
...
@@ -107,7 +158,7 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
override
fun
onViewRecycled
(
holder
:
BaseViewHolder
)
{
override
fun
onViewRecycled
(
holder
:
BaseViewHolder
)
{
super
.
onViewRecycled
(
holder
)
super
.
onViewRecycled
(
holder
)
if
(
holder
.
itemViewType
==
VideoMultiItemEntity
.
MULTI_ITEM_1
)
{
if
(
holder
.
itemViewType
==
MULTI_ITEM_1
)
{
Glide
.
with
(
context
).
clear
(
holder
.
getView
<
View
>(
R
.
id
.
iv_cover
))
Glide
.
with
(
context
).
clear
(
holder
.
getView
<
View
>(
R
.
id
.
iv_cover
))
}
}
}
}
...
@@ -115,44 +166,44 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
...
@@ -115,44 +166,44 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
private
fun
setCollectImage
(
view
:
LottieAnimationView
)
{
private
fun
setCollectImage
(
view
:
LottieAnimationView
)
{
val
lottieDrawable
=
LottieDrawable
()
val
lottieDrawable
=
LottieDrawable
()
LottieCompositionFactory
.
fromAsset
(
context
,
"home_collect.json"
)
LottieCompositionFactory
.
fromAsset
(
context
,
"home_collect.json"
)
.
addListener
{
result
:
LottieComposition
?
->
.
addListener
{
result
:
LottieComposition
?
->
lottieDrawable
.
setImagesAssetsFolder
(
"images/"
)
lottieDrawable
.
setImagesAssetsFolder
(
"images/"
)
lottieDrawable
.
composition
=
result
lottieDrawable
.
composition
=
result
}
}
view
.
setImageDrawable
(
lottieDrawable
)
view
.
setImageDrawable
(
lottieDrawable
)
}
}
private
fun
setCancelCollectImage
(
view
:
LottieAnimationView
)
{
private
fun
setCancelCollectImage
(
view
:
LottieAnimationView
)
{
val
lottieDrawable
=
LottieDrawable
()
val
lottieDrawable
=
LottieDrawable
()
LottieCompositionFactory
.
fromAsset
(
context
,
"home_cancel_collect.json"
)
LottieCompositionFactory
.
fromAsset
(
context
,
"home_cancel_collect.json"
)
.
addListener
{
result
:
LottieComposition
?
->
.
addListener
{
result
:
LottieComposition
?
->
lottieDrawable
.
setImagesAssetsFolder
(
"images/"
)
lottieDrawable
.
setImagesAssetsFolder
(
"images/"
)
lottieDrawable
.
composition
=
result
lottieDrawable
.
composition
=
result
}
}
view
.
setImageDrawable
(
lottieDrawable
)
view
.
setImageDrawable
(
lottieDrawable
)
}
}
private
fun
playCollectAnim
(
view
:
LottieAnimationView
)
{
private
fun
playCollectAnim
(
view
:
LottieAnimationView
)
{
val
lottieDrawable
=
LottieDrawable
()
val
lottieDrawable
=
LottieDrawable
()
LottieCompositionFactory
.
fromAsset
(
context
,
"home_collect.json"
)
LottieCompositionFactory
.
fromAsset
(
context
,
"home_collect.json"
)
.
addListener
{
result
:
LottieComposition
?
->
.
addListener
{
result
:
LottieComposition
?
->
lottieDrawable
.
setImagesAssetsFolder
(
"images/"
)
lottieDrawable
.
setImagesAssetsFolder
(
"images/"
)
lottieDrawable
.
composition
=
result
lottieDrawable
.
composition
=
result
lottieDrawable
.
loop
(
false
)
lottieDrawable
.
loop
(
false
)
lottieDrawable
.
playAnimation
()
lottieDrawable
.
playAnimation
()
}
}
view
.
setImageDrawable
(
lottieDrawable
)
view
.
setImageDrawable
(
lottieDrawable
)
}
}
private
fun
playCancelCollectAnim
(
view
:
LottieAnimationView
)
{
private
fun
playCancelCollectAnim
(
view
:
LottieAnimationView
)
{
val
lottieDrawable
=
LottieDrawable
()
val
lottieDrawable
=
LottieDrawable
()
LottieCompositionFactory
.
fromAsset
(
context
,
"home_cancel_collect.json"
)
LottieCompositionFactory
.
fromAsset
(
context
,
"home_cancel_collect.json"
)
.
addListener
{
result
:
LottieComposition
?
->
.
addListener
{
result
:
LottieComposition
?
->
lottieDrawable
.
setImagesAssetsFolder
(
"images/"
)
lottieDrawable
.
setImagesAssetsFolder
(
"images/"
)
lottieDrawable
.
composition
=
result
lottieDrawable
.
composition
=
result
lottieDrawable
.
loop
(
false
)
lottieDrawable
.
loop
(
false
)
lottieDrawable
.
playAnimation
()
lottieDrawable
.
playAnimation
()
}
}
view
.
setImageDrawable
(
lottieDrawable
)
view
.
setImageDrawable
(
lottieDrawable
)
}
}
...
...
video/app/src/main/res/drawable-xhdpi/dislike_icon.png
0 → 100644
View file @
dfb91e38
1.48 KB
video/app/src/main/res/drawable-xhdpi/tt_mute.png
0 → 100644
View file @
dfb91e38
600 Bytes
video/app/src/main/res/drawable/btn_bg_blue.xml
0 → 100644
View file @
dfb91e38
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<corners
android:radius=
"60dp"
/>
<stroke
android:color=
"#ff6666"
android:width=
"1dp"
/>
</shape>
\ No newline at end of file
video/app/src/main/res/drawable/btn_bg_red.xml
0 → 100644
View file @
dfb91e38
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<corners
android:radius=
"6dp"
/>
<stroke
android:color=
"#f85959"
android:width=
"1dp"
/>
</shape>
\ No newline at end of file
video/app/src/main/res/drawable/mediation_btn_bg_creative.xml
0 → 100644
View file @
dfb91e38
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<corners
android:radius=
"6dp"
/>
<stroke
android:color=
"#3C93CD"
android:width=
"1dp"
/>
</shape>
\ No newline at end of file
video/app/src/main/res/drawable/tt_ad_cover_btn_begin_bg.xml
0 → 100644
View file @
dfb91e38
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:state_pressed=
"true"
>
<shape
>
<stroke
android:color=
"#7f2a90d7"
/>
<solid
android:color=
"#2a90d7"
/>
<corners
android:radius=
"6dp"
/>
</shape>
</item>
<item
>
<shape
>
<stroke
android:color=
"#2a90d7"
/>
<solid
android:color=
"#2a90d7"
/>
<corners
android:radius=
"6dp"
/>
</shape>
</item>
</selector>
video/app/src/main/res/layout/drama_activity_api_detail.xml
View file @
dfb91e38
...
@@ -206,6 +206,15 @@
...
@@ -206,6 +206,15 @@
android:textColor=
"@color/white"
android:textColor=
"@color/white"
android:visibility=
"gone"
/>
android:visibility=
"gone"
/>
<com.mints.helivideo.ui.widgets.RoundRectLayout
android:id=
"@+id/fl_ad"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_margin=
"15dp"
android:background=
"@drawable/shape_bg_write"
android:elevation=
"2dp"
/>
</LinearLayout>
</LinearLayout>
</FrameLayout>
</FrameLayout>
...
...
video/app/src/main/res/layout/item_block_view.xml
View file @
dfb91e38
...
@@ -8,8 +8,8 @@
...
@@ -8,8 +8,8 @@
<ImageView
<ImageView
android:id=
"@+id/iv_bg"
android:id=
"@+id/iv_bg"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:
scaleType=
"center
"
android:
layout_height=
"match_parent
"
android:
layout_height=
"match_parent
"
/>
android:
scaleType=
"center
"
/>
<FrameLayout
<FrameLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
@@ -17,10 +17,10 @@
...
@@ -17,10 +17,10 @@
android:background=
"#99000000"
>
android:background=
"#99000000"
>
<LinearLayout
<LinearLayout
android:layout_width=
"
wrap_cont
ent"
android:layout_width=
"
match_par
ent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:layout_gravity=
"center"
android:layout_gravity=
"center"
android:gravity=
"center"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
<TextView
<TextView
...
@@ -41,14 +41,25 @@
...
@@ -41,14 +41,25 @@
android:textColor=
"@color/white"
/>
android:textColor=
"@color/white"
/>
<Button
<Button
android:visibility=
"gone"
android:id=
"@+id/vip"
android:id=
"@+id/vip"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:background=
"@mipmap/bg_detail_bottom"
android:background=
"@mipmap/bg_detail_bottom"
android:textColor=
"@color/white"
/>
android:textColor=
"@color/white"
android:visibility=
"gone"
/>
<com.mints.helivideo.ui.widgets.RoundRectLayout
android:id=
"@+id/fl_ad"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"15dp"
android:layout_marginTop=
"20dp"
android:layout_marginEnd=
"15dp"
android:background=
"@drawable/shape_bg_write"
/>
</LinearLayout>
</LinearLayout>
</FrameLayout>
</FrameLayout>
</FrameLayout>
</FrameLayout>
video/app/src/main/res/layout/item_draw_ad.xml
0 → 100644
View file @
dfb91e38
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/draw_view"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"#99000000"
>
<FrameLayout
android:id=
"@+id/fl_ad"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"#99000000"
/>
</FrameLayout>
video/app/src/main/res/layout/mediation_listitem_ad_download_btn_layout.xml
0 → 100644
View file @
dfb91e38
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/ad_title_creative_btn_layout"
android:layout_marginBottom=
"10dp"
android:layout_marginTop=
"10dp"
android:gravity=
"center"
android:visibility=
"gone"
android:orientation=
"horizontal"
>
<Button
android:id=
"@+id/btn_listitem_stop"
android:layout_width=
"wrap_content"
android:layout_height=
"30dp"
android:layout_marginEnd=
"20dp"
android:layout_marginRight=
"20dp"
android:background=
"@drawable/btn_bg_blue"
android:textColor=
"#3C93CD"
android:text=
"暂停下载"
android:visibility=
"gone"
/>
<Button
android:id=
"@+id/btn_listitem_remove"
android:layout_width=
"wrap_content"
android:layout_height=
"30dp"
android:background=
"@drawable/btn_bg_red"
android:textColor=
"#f85959"
android:text=
"删除下载"
android:visibility=
"gone"
/>
</LinearLayout>
\ No newline at end of file
video/app/src/main/res/layout/mediation_listitem_ad_group_pic.xml
0 → 100644
View file @
dfb91e38
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
tools:ignore=
"HardcodedText"
>
<!-- icon+广告源+关闭按钮 layout -->
<include
android:id=
"@+id/icon_source_layout"
layout=
"@layout/mediation_listitem_ad_icon_source_layout"
android:layout_width=
"match_parent"
android:layout_height=
"30dp"
android:layout_marginLeft=
"10dp"
android:layout_marginTop=
"5dp"
android:layout_marginRight=
"10dp"
android:paddingEnd=
"10dp"
android:paddingRight=
"10dp"
/>
<TextView
android:id=
"@+id/tv_listitem_ad_desc"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/icon_source_layout"
android:layout_marginLeft=
"10dp"
android:layout_marginTop=
"5dp"
android:layout_marginRight=
"10dp"
android:ellipsize=
"end"
android:lineSpacingMultiplier=
"1"
android:maxLines=
"2"
android:singleLine=
"false"
android:text=
"劳力士服务中心,清洗保养,更换配件,9秒费用查询"
android:textColor=
"@android:color/black"
android:textSize=
"18sp"
/>
<!-- -->
<LinearLayout
android:id=
"@+id/layout_image_group"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/tv_listitem_ad_desc"
android:layout_centerHorizontal=
"true"
android:layout_marginLeft=
"10dp"
android:layout_marginRight=
"10dp"
android:orientation=
"horizontal"
>
<ImageView
android:id=
"@+id/iv_listitem_image1"
android:layout_width=
"0dp"
android:layout_height=
"100dp"
android:layout_marginEnd=
"5dp"
android:layout_marginRight=
"5dp"
android:layout_weight=
"1"
android:scaleType=
"centerCrop"
/>
<ImageView
android:id=
"@+id/iv_listitem_image2"
android:layout_width=
"0dp"
android:layout_height=
"100dp"
android:layout_marginEnd=
"5dp"
android:layout_marginRight=
"5dp"
android:layout_weight=
"1"
android:scaleType=
"centerCrop"
/>
<ImageView
android:id=
"@+id/iv_listitem_image3"
android:layout_width=
"0dp"
android:layout_height=
"100dp"
android:layout_weight=
"1"
android:scaleType=
"centerCrop"
/>
</LinearLayout>
<!-- title+creativeBtn layout -->
<include
android:id=
"@+id/ad_title_creative_btn_layout"
layout=
"@layout/mediation_listitem_ad_title_creative_btn_layout"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/layout_image_group"
android:layout_marginLeft=
"10dp"
android:layout_marginTop=
"4dp"
android:layout_marginRight=
"10dp"
/>
<!--==== 测试下载状态控制功能 begin ========-->
<include
layout=
"@layout/mediation_listitem_ad_download_btn_layout"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/ad_title_creative_btn_layout"
android:layout_marginTop=
"10dp"
android:layout_marginBottom=
"10dp"
android:gravity=
"center"
android:orientation=
"horizontal"
/>
<!--==== 测试下载状态控制功能 end ========-->
</RelativeLayout>
</FrameLayout>
\ No newline at end of file
video/app/src/main/res/layout/mediation_listitem_ad_icon_source_layout.xml
0 → 100644
View file @
dfb91e38
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/icon_source_layout"
android:layout_width=
"match_parent"
android:layout_height=
"30dp"
android:layout_marginLeft=
"10dp"
android:layout_marginRight=
"10dp"
android:layout_marginTop=
"5dp"
android:paddingEnd=
"10dp"
android:paddingRight=
"10dp"
>
<ImageView
android:id=
"@+id/iv_listitem_icon"
android:layout_width=
"30dp"
android:layout_height=
"match_parent"
android:layout_alignParentLeft=
"true"
android:layout_alignParentStart=
"true"
android:layout_centerVertical=
"true"
android:layout_marginEnd=
"10dp"
android:layout_marginRight=
"10dp"
/>
<TextView
android:id=
"@+id/tv_listitem_ad_source"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_centerVertical=
"true"
android:layout_toEndOf=
"@+id/iv_listitem_icon"
android:layout_toLeftOf=
"@+id/iv_listitem_dislike_layout"
android:layout_toRightOf=
"@+id/iv_listitem_icon"
android:layout_toStartOf=
"@+id/iv_listitem_dislike_layout"
android:ellipsize=
"end"
android:gravity=
"center_vertical"
android:singleLine=
"true"
android:text=
"着陆无双"
android:textColor=
"#70000000"
android:textSize=
"16sp"
/>
<FrameLayout
android:id=
"@+id/iv_listitem_dislike_layout"
android:layout_alignParentEnd=
"true"
android:layout_alignParentRight=
"true"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
>
<ImageView
android:id=
"@+id/iv_listitem_dislike"
android:layout_width=
"20dp"
android:layout_height=
"match_parent"
android:layout_gravity=
"center_vertical"
android:layout_marginLeft=
"10dp"
android:layout_marginStart=
"10dp"
android:visibility=
"gone"
android:clickable=
"true"
android:focusable=
"true"
android:src=
"@drawable/dislike_icon"
/>
</FrameLayout>
</RelativeLayout>
\ No newline at end of file
video/app/src/main/res/layout/mediation_listitem_ad_large_pic.xml
0 → 100644
View file @
dfb91e38
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
tools:ignore=
"HardcodedText"
>
<include
android:id=
"@+id/icon_source_layout"
layout=
"@layout/mediation_listitem_ad_icon_source_layout"
/>
<TextView
android:id=
"@+id/tv_listitem_ad_desc"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/icon_source_layout"
android:layout_marginLeft=
"10dp"
android:layout_marginTop=
"3dp"
android:layout_marginRight=
"10dp"
android:layout_marginBottom=
"3dp"
android:ellipsize=
"end"
android:lineSpacingMultiplier=
"1"
android:maxLines=
"2"
android:singleLine=
"false"
android:text=
"劳力士服务中心,清洗保养,更换配件,9秒费用查询"
android:textColor=
"@android:color/black"
android:textSize=
"18sp"
/>
<ImageView
android:id=
"@+id/iv_listitem_image"
android:layout_width=
"match_parent"
android:layout_height=
"200dp"
android:layout_below=
"@id/tv_listitem_ad_desc"
android:layout_marginLeft=
"10dp"
android:layout_marginRight=
"10dp"
android:background=
"@drawable/tt_ad_cover_btn_begin_bg"
android:scaleType=
"centerCrop"
/>
<!-- title+creativeBtn layout -->
<include
android:id=
"@+id/ad_title_creative_btn_layout"
layout=
"@layout/mediation_listitem_ad_title_creative_btn_layout"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/iv_listitem_image"
android:layout_marginLeft=
"10dp"
android:layout_marginRight=
"10dp"
/>
</RelativeLayout>
</FrameLayout>
\ No newline at end of file
video/app/src/main/res/layout/mediation_listitem_ad_large_video.xml
0 → 100644
View file @
dfb91e38
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
tools:ignore=
"HardcodedText"
>
<include
android:id=
"@+id/icon_source_layout"
layout=
"@layout/mediation_listitem_ad_icon_source_layout"
/>
<TextView
android:id=
"@+id/tv_listitem_ad_desc"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/icon_source_layout"
android:layout_marginLeft=
"10dp"
android:layout_marginTop=
"3dp"
android:layout_marginRight=
"10dp"
android:layout_marginBottom=
"3dp"
android:ellipsize=
"end"
android:lineSpacingMultiplier=
"1"
android:maxLines=
"2"
android:singleLine=
"false"
android:text=
"劳力士服务中心,清洗保养,更换配件,9秒费用查询"
android:textColor=
"@android:color/black"
android:textSize=
"18sp"
/>
<FrameLayout
android:id=
"@+id/iv_listitem_video"
android:layout_width=
"match_parent"
android:layout_height=
"200dp"
android:layout_below=
"@id/tv_listitem_ad_desc"
android:layout_marginLeft=
"10dp"
android:layout_marginRight=
"10dp"
android:background=
"@android:color/background_dark"
android:scaleType=
"centerCrop"
/>
<!-- title+creativeBtn layout -->
<include
android:id=
"@+id/ad_title_creative_btn_layout"
layout=
"@layout/mediation_listitem_ad_title_creative_btn_layout"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/iv_listitem_video"
android:layout_marginLeft=
"10dp"
android:layout_marginRight=
"10dp"
/>
</RelativeLayout>
</FrameLayout>
\ No newline at end of file
video/app/src/main/res/layout/mediation_listitem_ad_small_pic.xml
0 → 100644
View file @
dfb91e38
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
tools:ignore=
"HardcodedText"
>
<RelativeLayout
android:id=
"@+id/ad_contentPanel"
android:layout_width=
"match_parent"
android:layout_height=
"85dp"
android:layout_marginLeft=
"10dp"
android:layout_marginTop=
"10dp"
android:layout_marginRight=
"10dp"
>
<ImageView
android:id=
"@+id/iv_listitem_image"
android:layout_width=
"100dp"
android:layout_height=
"match_parent"
android:layout_alignParentEnd=
"true"
android:layout_alignParentRight=
"true"
android:background=
"@drawable/tt_ad_cover_btn_begin_bg"
android:scaleType=
"centerCrop"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_centerVertical=
"true"
android:layout_toStartOf=
"@+id/iv_listitem_image"
android:layout_toLeftOf=
"@+id/iv_listitem_image"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/tv_listitem_ad_desc"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:ellipsize=
"end"
android:lineSpacingMultiplier=
"1.1"
android:maxLines=
"2"
android:text=
"80后的回忆!经典三国完美复刻,安卓用户的福利"
android:textColor=
"@android:color/black"
android:textSize=
"18sp"
/>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"30dp"
android:layout_marginTop=
"3dp"
android:paddingEnd=
"10dp"
android:paddingRight=
"10dp"
>
<ImageView
android:id=
"@+id/iv_listitem_icon"
android:layout_width=
"30dp"
android:layout_height=
"match_parent"
android:layout_alignParentStart=
"true"
android:layout_alignParentLeft=
"true"
android:layout_centerVertical=
"true"
android:layout_marginEnd=
"10dp"
android:layout_marginRight=
"10dp"
android:src=
"@drawable/tt_mute"
/>
<TextView
android:id=
"@+id/tv_listitem_ad_source"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_centerVertical=
"true"
android:layout_toStartOf=
"@+id/iv_listitem_dislike"
android:layout_toLeftOf=
"@+id/iv_listitem_dislike"
android:layout_toEndOf=
"@+id/iv_listitem_icon"
android:layout_toRightOf=
"@+id/iv_listitem_icon"
android:ellipsize=
"end"
android:gravity=
"center_vertical"
android:singleLine=
"true"
android:text=
"着陆无双"
android:textColor=
"#70000000"
android:textSize=
"16sp"
/>
<ImageView
android:id=
"@+id/iv_listitem_dislike"
android:layout_width=
"20dp"
android:layout_height=
"match_parent"
android:layout_alignParentEnd=
"true"
android:layout_alignParentRight=
"true"
android:layout_gravity=
"center_vertical"
android:layout_marginStart=
"10dp"
android:layout_marginLeft=
"10dp"
android:src=
"@drawable/dislike_icon"
android:clickable=
"true"
android:focusable=
"true"
/>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
<!-- title+creativeBtn layout -->
<include
android:id=
"@+id/ad_title_creative_btn_layout"
layout=
"@layout/mediation_listitem_ad_title_creative_btn_layout"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/ad_contentPanel"
android:layout_marginLeft=
"10dp"
android:layout_marginRight=
"10dp"
/>
</RelativeLayout>
</FrameLayout>
\ No newline at end of file
video/app/src/main/res/layout/mediation_listitem_ad_title_creative_btn_layout.xml
0 → 100644
View file @
dfb91e38
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/ad_title_creative_btn_layout"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"10dp"
android:layout_marginRight=
"10dp"
android:layout_marginBottom=
"2dp"
android:background=
"#F4F5F7"
android:paddingTop=
"5dp"
>
<RelativeLayout
android:id=
"@+id/tt_ad_logo"
android:layout_width=
"15dp"
android:layout_height=
"15dp"
android:layout_centerVertical=
"true"
android:gravity=
"center_vertical"
android:visibility=
"gone"
/>
<TextView
android:id=
"@+id/tv_listitem_ad_title"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"5dp"
android:layout_toLeftOf=
"@+id/btn_listitem_creative"
android:layout_toRightOf=
"@+id/tt_ad_logo"
android:ellipsize=
"end"
android:gravity=
"center_vertical"
android:maxLength=
"14"
android:singleLine=
"true"
android:text=
"计策略,才真三国!计策略,才真三国!"
android:textSize=
"18sp"
/>
<Button
android:id=
"@+id/btn_listitem_creative"
android:layout_width=
"wrap_content"
android:layout_height=
"28dp"
android:layout_alignParentEnd=
"true"
android:layout_alignParentRight=
"true"
android:layout_marginStart=
"3dp"
android:layout_marginLeft=
"3dp"
android:layout_marginEnd=
"8dp"
android:layout_marginRight=
"8dp"
android:background=
"@drawable/mediation_btn_bg_creative"
android:gravity=
"center"
android:padding=
"3dp"
android:text=
"立即下载"
android:textColor=
"#3399cc"
android:textSize=
"14sp"
/>
<LinearLayout
android:id=
"@+id/app_info"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/tv_listitem_ad_title"
android:layout_marginTop=
"10dp"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/app_name"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:textColor=
"#000"
android:textSize=
"14sp"
tools:text=
"Nidddddddddd"
/>
<TextView
android:id=
"@+id/author_name"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:textColor=
"#000"
android:textSize=
"14sp"
tools:text=
"Nidddddddddd"
/>
<TextView
android:id=
"@+id/package_size"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:textColor=
"#000"
android:textSize=
"14sp"
tools:text=
"Nidddddddddd"
/>
<TextView
android:id=
"@+id/permissions_url"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:ellipsize=
"end"
android:maxLines=
"1"
android:textColor=
"#000"
android:textSize=
"14sp"
tools:text=
"Nidddddddddd"
/>
<TextView
android:id=
"@+id/privacy_agreement"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:ellipsize=
"end"
android:maxLines=
"1"
android:textColor=
"#000"
android:textSize=
"14sp"
tools:text=
"Nidddddddddd"
/>
<TextView
android:id=
"@+id/version_name"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:textColor=
"#000"
android:textSize=
"14sp"
tools:text=
"Nidddddddddd"
/>
<TextView
android:id=
"@+id/permissions_content"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:textColor=
"#000"
android:textSize=
"14sp"
tools:text=
"Nidddddddddd"
/>
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
video/app/src/main/res/layout/mediation_listitem_ad_vertical_pic.xml
0 → 100644
View file @
dfb91e38
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
tools:ignore=
"HardcodedText"
>
<ImageView
android:id=
"@+id/iv_listitem_image"
android:layout_width=
"135dp"
android:layout_height=
"240dp"
android:layout_centerHorizontal=
"true"
android:layout_marginEnd=
"10dp"
android:layout_marginRight=
"10dp"
android:scaleType=
"centerCrop"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/iv_listitem_image"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/tv_listitem_ad_title"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_margin=
"10dp"
android:gravity=
"center"
android:singleLine=
"false"
android:textSize=
"14sp"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center_horizontal"
>
<ImageView
android:id=
"@+id/iv_listitem_icon"
android:layout_width=
"30dp"
android:layout_height=
"40dp"
android:layout_centerVertical=
"true"
android:layout_marginStart=
"10dp"
android:layout_marginLeft=
"10dp"
/>
<LinearLayout
android:id=
"@+id/tv_source_desc_layout"
android:layout_width=
"100dp"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/layout_image_group"
android:layout_centerVertical=
"true"
android:layout_marginStart=
"5dp"
android:layout_marginLeft=
"5dp"
android:layout_toEndOf=
"@id/iv_listitem_icon"
android:layout_toRightOf=
"@id/iv_listitem_icon"
android:orientation=
"vertical"
tools:ignore=
"NotSibling"
>
<TextView
android:id=
"@+id/tv_listitem_ad_desc"
android:layout_width=
"80dp"
android:layout_height=
"20dp"
android:ellipsize=
"end"
android:singleLine=
"true"
android:textSize=
"10sp"
/>
<TextView
android:id=
"@+id/tv_listitem_ad_source"
android:layout_width=
"100dp"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"10dp"
android:layout_marginLeft=
"10dp"
android:layout_marginBottom=
"10dp"
android:ellipsize=
"end"
android:singleLine=
"true"
android:textSize=
"8sp"
/>
</LinearLayout>
</RelativeLayout>
<Button
android:id=
"@+id/btn_listitem_creative"
android:layout_width=
"135dp"
android:layout_height=
"40dp"
android:textSize=
"9sp"
/>
<LinearLayout
android:id=
"@+id/app_info"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"10dp"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/app_name"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:textColor=
"#000"
android:textSize=
"14sp"
tools:text=
"Nidddddddddd"
/>
<TextView
android:id=
"@+id/author_name"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:textColor=
"#000"
android:textSize=
"14sp"
tools:text=
"Nidddddddddd"
/>
<TextView
android:id=
"@+id/package_size"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:textColor=
"#000"
android:textSize=
"14sp"
tools:text=
"Nidddddddddd"
/>
<TextView
android:id=
"@+id/permissions_url"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:textColor=
"#000"
android:textSize=
"14sp"
tools:text=
"Nidddddddddd"
/>
<TextView
android:id=
"@+id/privacy_agreement"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:textColor=
"#000"
android:textSize=
"14sp"
tools:text=
"Nidddddddddd"
/>
<TextView
android:id=
"@+id/version_name"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:textColor=
"#000"
android:textSize=
"14sp"
tools:text=
"Nidddddddddd"
/>
<TextView
android:id=
"@+id/permissions_content"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:textColor=
"#000"
android:textSize=
"14sp"
tools:text=
"Nidddddddddd"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<ImageView
android:id=
"@+id/iv_listitem_dislike"
android:layout_width=
"20dp"
android:layout_height=
"20dp"
android:layout_alignParentTop=
"true"
android:layout_alignParentRight=
"true"
android:layout_marginTop=
"10dp"
android:layout_marginRight=
"10dp"
android:clickable=
"true"
android:src=
"@drawable/dislike_icon"
/>
</RelativeLayout>
</FrameLayout>
\ No newline at end of file
video/gradle.properties
View file @
dfb91e38
...
@@ -46,4 +46,5 @@ RELEASE_UMENG_KEY=64b8de13a1a164591b5133df
...
@@ -46,4 +46,5 @@ RELEASE_UMENG_KEY=64b8de13a1a164591b5133df
GROMORE_APP_ID
=
"5412556"
GROMORE_APP_ID
=
"5412556"
GROMORE_SPLASH_CODE="102398740"
GROMORE_SPLASH_CODE="102398740"
GROMORE_VIDEO_CODE
=
"102398300"
GROMORE_VIDEO_CODE
=
"102398300"
GROMORE_EXPRESS_CODE="102398300"
GROMORE_EXPRESS_CODE="102405261"
GROMORE_DRAW_CODE
=
"102405069"
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