Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_goodmoney
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
android
android_goodmoney
Commits
6bdad092
Commit
6bdad092
authored
Nov 02, 2021
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新穿山甲、广点通及快手SDK版本号
parent
bf8b2fc9
Changes
39
Show whitespace changes
Inline
Side-by-side
Showing
39 changed files
with
1868 additions
and
1804 deletions
+1868
-1804
build.gradle
GoodMoney/app/build.gradle
+4
-12
GDTSDK.unionNormal.4.351.1221.aar
GoodMoney/app/libs/GDTSDK.unionNormal.4.351.1221.aar
+0
-0
GDTSDK.unionNormal.4.420.1290.aar
GoodMoney/app/libs/GDTSDK.unionNormal.4.420.1290.aar
+0
-0
kssdk-ad-3.3.16.aar
GoodMoney/app/libs/kssdk-ad-3.3.16.aar
+0
-0
net_native-v3.1.3.22-release.aar
GoodMoney/app/libs/net_native-v3.1.3.22-release.aar
+0
-0
open_ad_sdk_4.0.1.1.aar
GoodMoney/app/libs/open_ad_sdk_4.0.1.1.aar
+0
-0
AndroidManifest.xml
GoodMoney/app/src/main/AndroidManifest.xml
+20
-13
MintsApplication.java
...p/src/main/java/com/mints/goodmoney/MintsApplication.java
+10
-18
GroMoreCarrierExpressManager.kt
...ints/goodmoney/ad/express/GroMoreCarrierExpressManager.kt
+244
-244
GroMoreExpressManager.kt
...a/com/mints/goodmoney/ad/express/GroMoreExpressManager.kt
+616
-616
KsPreLoadExpressManager.kt
...com/mints/goodmoney/ad/express/KsPreLoadExpressManager.kt
+11
-5
PreLoadExpressManager.kt
...a/com/mints/goodmoney/ad/express/PreLoadExpressManager.kt
+14
-12
CsjFullVideoAdManager.java
...a/com/mints/goodmoney/ad/video/CsjFullVideoAdManager.java
+4
-0
CsjGroMoreVideoAdManager.java
...om/mints/goodmoney/ad/video/CsjGroMoreVideoAdManager.java
+298
-298
CsjVideoAdManager.java
.../java/com/mints/goodmoney/ad/video/CsjVideoAdManager.java
+4
-0
KsVideoAdManager.kt
...ain/java/com/mints/goodmoney/ad/video/KsVideoAdManager.kt
+6
-0
VideoAdingManager.java
.../java/com/mints/goodmoney/ad/video/VideoAdingManager.java
+45
-44
BxmPlayVideo.java
...c/main/java/com/mints/goodmoney/manager/BxmPlayVideo.java
+4
-0
CsjAppLogManager.kt
...main/java/com/mints/goodmoney/manager/CsjAppLogManager.kt
+40
-40
CsjGroMoreManager.kt
...ain/java/com/mints/goodmoney/manager/CsjGroMoreManager.kt
+1
-1
LiebaoManager.java
.../main/java/com/mints/goodmoney/manager/LiebaoManager.java
+24
-17
ReadToutiaoAD.java
.../main/java/com/mints/goodmoney/manager/ReadToutiaoAD.java
+5
-0
TTGroMoreAdManagerHolder.java
...com/mints/goodmoney/manager/TTGroMoreAdManagerHolder.java
+88
-88
TtCsjAdManager.java
...main/java/com/mints/goodmoney/manager/TtCsjAdManager.java
+13
-4
AboutusActivity.kt
.../java/com/mints/goodmoney/ui/activitys/AboutusActivity.kt
+0
-7
AwardActivity.kt
...in/java/com/mints/goodmoney/ui/activitys/AwardActivity.kt
+0
-1
FoodSubsidyActivity.kt
...a/com/mints/goodmoney/ui/activitys/FoodSubsidyActivity.kt
+7
-6
MorningClockActivity.kt
.../com/mints/goodmoney/ui/activitys/MorningClockActivity.kt
+4
-4
SplashCsjADActivity.kt
...a/com/mints/goodmoney/ui/activitys/SplashCsjADActivity.kt
+21
-1
SplashGroMoreActivity.java
...m/mints/goodmoney/ui/activitys/SplashGroMoreActivity.java
+269
-269
SplashKsADActivity.kt
...va/com/mints/goodmoney/ui/activitys/SplashKsADActivity.kt
+9
-0
WalkActivity.kt
...ain/java/com/mints/goodmoney/ui/activitys/WalkActivity.kt
+8
-6
WaterActivity.kt
...in/java/com/mints/goodmoney/ui/activitys/WaterActivity.kt
+8
-6
XiaomanActivity.kt
.../java/com/mints/goodmoney/ui/activitys/XiaomanActivity.kt
+1
-0
MainFragment.kt
...main/java/com/mints/goodmoney/ui/fragment/MainFragment.kt
+0
-1
MyFragment.kt
...c/main/java/com/mints/goodmoney/ui/fragment/MyFragment.kt
+8
-9
ForegroundOrBackground.java
...ava/com/mints/goodmoney/utils/ForegroundOrBackground.java
+1
-3
VideoOptionUtil.java
.../main/java/com/mints/goodmoney/utils/VideoOptionUtil.java
+78
-78
build.gradle
GoodMoney/build.gradle
+3
-1
No files found.
GoodMoney/app/build.gradle
View file @
6bdad092
...
@@ -228,7 +228,7 @@ dependencies {
...
@@ -228,7 +228,7 @@ dependencies {
// TalkingDada(已集成)
// TalkingDada(已集成)
// 一览视频
// 一览视频
implementation
(
"com.yilan.sdk:ui:3.3.3.0"
)
{
implementation
(
"com.yilan.sdk:ui:3.3.3.0"
)
{
exclude
group:
'com.yilan.sdk'
,
module:
'yb_extra'
//
exclude group: 'com.yilan.sdk', module: 'yb_extra'
exclude
group:
'com.yilan.sdk'
,
module:
'gdt'
exclude
group:
'com.yilan.sdk'
,
module:
'gdt'
exclude
group:
'com.yilan.sdk'
,
module:
'ks'
exclude
group:
'com.yilan.sdk'
,
module:
'ks'
}
}
...
@@ -361,18 +361,10 @@ dependencies {
...
@@ -361,18 +361,10 @@ dependencies {
// androidTestImplementation 'androidx.test.ext:junit:1.1.2'
// androidTestImplementation 'androidx.test.ext:junit:1.1.2'
// androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
// androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
// 穿山甲 GroMore
// mediation_ad_sdk
implementation
(
name:
'mediation_ad_sdk_2.7.1.2'
,
ext:
'aar'
)
implementation
(
name:
'gdt_adapter_4.351.1221.1'
,
ext:
'aar'
)
implementation
(
name:
'ks_adapter_3.3.9.0'
,
ext:
'aar'
)
// 穿山甲广告
// 穿山甲广告
implementation
(
name:
'open_ad_sdk_
3.6.1.3
'
,
ext:
'aar'
)
implementation
(
name:
'open_ad_sdk_
4.0.1.1
'
,
ext:
'aar'
)
// 广点通广告 腾讯
// 广点通广告 腾讯
implementation
(
name:
'GDTSDK.unionNormal.4.
351.1221
'
,
ext:
'aar'
)
implementation
(
name:
'GDTSDK.unionNormal.4.
420.1290
'
,
ext:
'aar'
)
// 快手
// 快手
implementation
(
name:
'kssdk-ad-3.3.9'
,
ext:
'aar'
)
implementation
(
name:
'kssdk-ad-3.3.16'
,
ext:
'aar'
)
// implementation(name: 'kssdk-all--3.3.16-publishRelease-9ffe2b94e', ext: 'aar')
// applog
implementation
'com.bytedance.applog:RangersAppLog-All-cn:5.2.6'
}
}
GoodMoney/app/libs/GDTSDK.unionNormal.4.351.1221.aar
deleted
100644 → 0
View file @
bf8b2fc9
File deleted
GoodMoney/app/libs/GDTSDK.unionNormal.4.420.1290.aar
0 → 100644
View file @
6bdad092
File added
GoodMoney/app/libs/kssdk-ad-3.3.16.aar
0 → 100644
View file @
6bdad092
File added
GoodMoney/app/libs/net_native-v3.1.3.22-release.aar
0 → 100644
View file @
6bdad092
File added
GoodMoney/app/libs/open_ad_sdk_
3.6.1.3
.aar
→
GoodMoney/app/libs/open_ad_sdk_
4.0.1.1
.aar
View file @
6bdad092
No preview for this file type
GoodMoney/app/src/main/AndroidManifest.xml
View file @
6bdad092
...
@@ -131,23 +131,21 @@
...
@@ -131,23 +131,21 @@
<!-- </intent-filter>-->
<!-- </intent-filter>-->
<!-- </activity>-->
<!-- </activity>-->
<activity
<!-- <activity-->
android:name=
".ui.activitys.SplashGroMoreActivity"
<!-- android:name=".ui.activitys.SplashGroMoreActivity"-->
android:screenOrientation=
"portrait"
<!-- android:screenOrientation="portrait"-->
android:theme=
"@style/NormalSplash"
>
<!-- android:theme="@style/NormalSplash">-->
<intent-filter>
<!-- -->
<action
android:name=
"android.intent.action.MAIN"
/>
<!-- </activity>-->
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity
<activity
android:name=
".ui.activitys.MainActivity"
android:name=
".ui.activitys.MainActivity"
android:configChanges=
"orientation|keyboardHidden|screenSize"
android:configChanges=
"orientation|keyboardHidden|screenSize"
android:launchMode=
"singleTask"
android:launchMode=
"singleTask"
android:screenOrientation=
"portrait"
android:screenOrientation=
"portrait"
android:theme=
"@style/AppTheme.NoneTranslucent"
/>
android:theme=
"@style/AppTheme.NoneTranslucent"
>
</activity>
<activity
android:name=
".ui.activitys.WebActivity"
/>
<activity
android:name=
".ui.activitys.WebActivity"
/>
<activity
<activity
android:name=
"com.mints.library.base.BaseWebActivity"
android:name=
"com.mints.library.base.BaseWebActivity"
...
@@ -171,7 +169,13 @@
...
@@ -171,7 +169,13 @@
android:theme=
"@style/AppTheme.NoActionBarTranslucent"
/>
android:theme=
"@style/AppTheme.NoActionBarTranslucent"
/>
<activity
<activity
android:name=
".ui.activitys.SettingsActivity"
android:name=
".ui.activitys.SettingsActivity"
android:screenOrientation=
"portrait"
/>
android:screenOrientation=
"portrait"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity
<activity
android:name=
".ui.activitys.AboutusActivity"
android:name=
".ui.activitys.AboutusActivity"
android:screenOrientation=
"portrait"
/>
android:screenOrientation=
"portrait"
/>
...
@@ -210,7 +214,10 @@
...
@@ -210,7 +214,10 @@
android:screenOrientation=
"portrait"
/>
android:screenOrientation=
"portrait"
/>
<activity
<activity
android:name=
".ui.activitys.SplashCsjADActivity"
android:name=
".ui.activitys.SplashCsjADActivity"
android:screenOrientation=
"portrait"
/>
android:screenOrientation=
"portrait"
android:theme=
"@style/NormalSplash"
>
</activity>
<activity
<activity
android:name=
".ui.activitys.MorningClockActivity"
android:name=
".ui.activitys.MorningClockActivity"
android:screenOrientation=
"portrait"
/>
android:screenOrientation=
"portrait"
/>
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/MintsApplication.java
View file @
6bdad092
...
@@ -12,8 +12,6 @@ import androidx.multidex.MultiDexApplication;
...
@@ -12,8 +12,6 @@ import androidx.multidex.MultiDexApplication;
import
com.hjq.toast.ToastUtils
;
import
com.hjq.toast.ToastUtils
;
import
com.mints.goodmoney.common.Constant
;
import
com.mints.goodmoney.common.Constant
;
import
com.mints.goodmoney.manager.CsjAppLogManager
;
import
com.mints.goodmoney.manager.CsjGroMoreManager
;
import
com.mints.goodmoney.manager.KsManager
;
import
com.mints.goodmoney.manager.KsManager
;
import
com.mints.goodmoney.manager.LiebaoManager
;
import
com.mints.goodmoney.manager.LiebaoManager
;
import
com.mints.goodmoney.manager.MhManager
;
import
com.mints.goodmoney.manager.MhManager
;
...
@@ -127,43 +125,37 @@ public class MintsApplication extends MultiDexApplication {
...
@@ -127,43 +125,37 @@ public class MintsApplication extends MultiDexApplication {
YlhAdManager
.
INSTANCE
.
initYlhAd
(
this
);
YlhAdManager
.
INSTANCE
.
initYlhAd
(
this
);
// 穿山甲
// 穿山甲
TtCsjAdManager
.
init
(
this
);
// TtCsjAdManager.init(this);
// GroMore
CsjGroMoreManager
.
INSTANCE
.
init
(
this
);
// AppLog
CsjAppLogManager
.
INSTANCE
.
init
(
this
);
// 快手
// 快手
KsManager
.
INSTANCE
.
initKs
(
this
);
//
KsManager.INSTANCE.initKs(this);
// 闪电盒子
// 闪电盒子
WnManager
.
INSTANCE
.
initWn
(
this
);
//
WnManager.INSTANCE.initWn(this);
// 枫岚广告
// 枫岚广告
MhManager
.
INSTANCE
.
initMn
(
this
);
//
MhManager.INSTANCE.initMn(this);
// OneWay
// OneWay
OwManager
.
INSTANCE
.
init
(
this
);
//
OwManager.INSTANCE.init(this);
// 天卓珊瑚[INSTANCE是设置单例模式]
// 天卓珊瑚[INSTANCE是设置单例模式]
TzManager
.
INSTANCE
.
initTz
(
this
);
//
TzManager.INSTANCE.initTz(this);
//小满
//小满
XmManager
.
INSTANCE
.
initXm
(
this
);
//
XmManager.INSTANCE.initXm(this);
// 一览视频
// 一览视频
YlVideoManager
.
INSTANCE
.
init
(
this
);
YlVideoManager
.
INSTANCE
.
init
(
this
);
// 猎豹游戏初始化
// 猎豹游戏初始化
LiebaoManager
.
getInstance
().
initCmGameSdk
();
//
LiebaoManager.getInstance().initCmGameSdk();
// 瑞狮新闻
// 瑞狮新闻
RsNewsManager
.
INSTANCE
.
init
(
this
);
//
RsNewsManager.INSTANCE.init(this);
// 喜马拉雅
// 喜马拉雅
initXmly
();
//
initXmly();
// 自定义logger
// 自定义logger
bindLogger
();
bindLogger
();
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/express/GroMoreCarrierExpressManager.kt
View file @
6bdad092
package
com.mints.goodmoney.ad.express
//package com.mints.goodmoney.ad.express
import
android.os.Handler
import
android.os.HandlerThread
import
android.view.Gravity
import
android.widget.FrameLayout
import
com.bytedance.msdk.api.*
import
com.bytedance.msdk.api.nativeAd.*
import
com.mints.goodmoney.MintsApplication
import
com.mints.goodmoney.manager.CsjGroMoreManager
import
com.mints.goodmoney.ui.widgets.seekbar.BubbleUtils
import
com.mints.goodmoney.utils.LogUtil
import
com.mints.goodmoney.utils.UIUtils
import
com.mints.goodmoney.utils.VideoOptionUtil
private
val
TAG
=
GroMoreCarrierExpressManager
::
class
.
java
.
simpleName
class
GroMoreCarrierExpressManager
:
TTSettingConfigCallback
{
companion
object
{
val
instance
:
GroMoreCarrierExpressManager
by
lazy
(
mode
=
LazyThreadSafetyMode
.
SYNCHRONIZED
)
{
GroMoreCarrierExpressManager
()
}
}
private
var
mAdStyle
=
0
private
var
mExpressType
=
0
private
val
frameLayout
:
FrameLayout
?
=
null
private
var
mHandlerThread
:
HandlerThread
?
=
null
private
var
mWorkHandler
:
Handler
?
=
null
private
var
mTTAdNative
:
TTUnifiedNativeAd
?
=
null
init
{
mAdStyle
=
AdSlot
.
TYPE_EXPRESS_AD
}
fun
loadADFrameLayout
()
{
// 销毁及移除事件
destroy
()
frameLayout
?.
removeAllViews
()
if
(
TTMediationAdSdk
.
configLoadSuccess
())
{
loadAd
()
}
else
{
TTMediationAdSdk
.
registerConfigCallback
(
this
)
}
}
/**
* config成功,加载信息流
*/
override
fun
configLoad
()
{
loadAd
()
}
private
fun
loadAd
()
{
mTTAdNative
=
TTUnifiedNativeAd
(
MintsApplication
.
getContext
(),
CsjGroMoreManager
.
AD_UNIT_ID
)
//视频声音控制设置
var
videoOption
:
TTVideoOption
=
VideoOptionUtil
.
getTTVideoOption
()
//判断是否需要使用GDT Feed 模板渲染2.0;注意!!!!需要向广点通商务申请模渲染2.0权限
// 注意不设置默认使用 GDT Feed 模板渲染1.0,默认情况下无需执行下方代码
if
(
mAdStyle
==
AdSlot
.
TYPE_EXPRESS_AD
&&
mExpressType
==
GDTExtraOption
.
FeedExpressType
.
FEED_EXPRESS_TYPE_2
)
{
videoOption
=
VideoOptionUtil
.
getTTVideoOption2
()
}
//针对Admob Native的特殊配置项
val
admobNativeAdOptions
=
AdmobNativeAdOptions
()
admobNativeAdOptions
.
setAdChoicesPlacement
(
AdmobNativeAdOptions
.
ADCHOICES_TOP_RIGHT
)
//设置广告小标默认情况下,广告选择叠加层会显示在右上角。
.
setRequestMultipleImages
(
true
).
isReturnUrlsForImageAssets
=
true
//设置为true,SDK会仅提供Uri字段的值,允许自行决定是否下载实际图片,同时不会提供Drawable字段的值
// 针对Gdt Native自渲染广告,可以自定义gdt logo的布局参数。该参数可选,非必须。
val
gdtNativeAdLogUtiloParams
=
FrameLayout
.
LayoutParams
(
BubbleUtils
.
dp2px
(
40
),
BubbleUtils
.
dp2px
(
14
),
Gravity
.
END
or
Gravity
.
TOP
)
// 例如,放在右上角
/**
* 创建feed广告请求类型参数AdSlot,具体参数含义参考文档
* 备注
* 1: 如果是信息流自渲染广告,设置广告图片期望的图片宽高 ,不能为0
* 2:如果是信息流模板广告,宽度设置为希望的宽度,高度设置为0(0为高度选择自适应参数)
*/
/**
* 创建feed广告请求类型参数AdSlot,具体参数含义参考文档
* 备注
* 1: 如果是信息流自渲染广告,设置广告图片期望的图片宽高 ,不能为0
* 2:如果是信息流模板广告,宽度设置为希望的宽度,高度设置为0(0为高度选择自适应参数)
*/
val
adSlot
=
AdSlot
.
Builder
()
.
setTTVideoOption
(
videoOption
)
//视频声音相关的配置
.
setAdmobNativeAdOptions
(
admobNativeAdOptions
)
.
setAdStyleType
(
mAdStyle
)
//必传,表示请求的模板广告还是原生广告,AdSlot.TYPE_EXPRESS_AD:模板广告 ; AdSlot.TYPE_NATIVE_AD:原生广告
.
setImageAdSize
(
UIUtils
.
getScreenWidthDp
(
MintsApplication
.
getContext
()).
toInt
(),
320
)
// 必选参数 单位dp ,详情见上面备注解释
.
setAdCount
(
1
)
//请求广告数量为1到3条
.
setGdtNativeAdLogoParams
(
gdtNativeAdLogUtiloParams
)
// 设置gdt logo布局参数。
.
build
()
//请求广告,调用feed广告异步请求接口,加载到广告后,拿到广告素材自定义渲染
/**
* 注:每次加载信息流广告的时候需要新建一个TTUnifiedNativeAd,否则可能会出现广告填充问题
* (例如:mTTAdNative = new TTUnifiedNativeAd(this, mAdUnitId);)
*/
mTTAdNative
?.
loadAd
(
adSlot
,
object
:
TTNativeAdLoadCallback
{
override
fun
onAdLoadedFial
(
adError
:
AdError
?)
{
LogUtil
.
e
(
TAG
,
"load feed ad error : "
+
adError
?.
code
+
", "
+
adError
?.
message
)
}
override
fun
onAdLoaded
(
ads
:
MutableList
<
TTNativeAd
>?)
{
if
(
ads
==
null
||
ads
.
isEmpty
())
{
LogUtil
.
e
(
TAG
,
"on FeedAdLoaded: ad is null!"
)
return
}
for
(
ttNativeAd
in
ads
)
{
LogUtil
.
e
(
TAG
,
" "
)
LogUtil
.
e
(
TAG
,
"adNetworkPlatformId: "
+
ttNativeAd
.
adNetworkPlatformId
+
" adNetworkRitId:"
+
ttNativeAd
.
adNetworkRitId
+
" preEcpm: "
+
ttNativeAd
.
preEcpm
)
}
if
(
ads
.
size
>
0
)
{
frameLayout
?.
addView
(
ads
[
0
].
expressView
)
}
}
})
}
fun
getADFrameLayout
():
FrameLayout
?
{
return
frameLayout
}
/**
* 销毁
*/
private
fun
destroy
()
{
mHandlerThread
?.
quit
()
mHandlerThread
=
null
mWorkHandler
?.
removeCallbacksAndMessages
(
null
)
mWorkHandler
=
null
}
//渲染模板广告
// private fun getExpressAdView(ad: TTNativeAd): View? {
// val adViewHolder: GroMoreExpressManager.ExpressAdViewHolder
// val convertView = LayoutInflater.from(MintsApplication.getContext()).inflate(R.layout.listitem_ad_native_express, null, false)
// try {
// adViewHolder = GroMoreExpressManager.ExpressAdViewHolder()
// adViewHolder.mAdContainerView = convertView.findViewById(R.id.iv_listitem_express) as FrameLayout
// convertView.tag = adViewHolder
//
//
// //判断是否存在dislike按钮
//import android.os.Handler
//// if (ad.hasDislike()) {
//import android.os.HandlerThread
//// ad.setDislikeCallback(MintsApplication.getContext() as Activity?, object : TTDislikeCallback {
//import android.view.Gravity
//// override fun onSelected(position: Int, value: String) {
//import android.widget.FrameLayout
//// ToastUtil.show(MintsApplication.getContext(), "点击 $value")
//import com.bytedance.msdk.api.*
//// //用户选择不喜欢原因后,移除广告展示
//import com.bytedance.msdk.api.nativeAd.*
//// }
//import com.mints.goodmoney.MintsApplication
////
//import com.mints.goodmoney.manager.CsjGroMoreManager
//// override fun onCancel() {
//import com.mints.goodmoney.ui.widgets.seekbar.BubbleUtils
//// ToastUtil.show(MintsApplication.getContext(), "dislike 点击了取消")
//import com.mints.goodmoney.utils.LogUtil
//// LogUtil.d(TAG, "dislike 点击了取消")
//import com.mints.goodmoney.utils.UIUtils
//// }
//import com.mints.goodmoney.utils.VideoOptionUtil
////
//// /**
//// * 拒绝再次提交
//// */
//// override fun onRefuse() {}
//// override fun onShow() {}
//// })
//// }
//
//
// //设置点击展示回调监听
//private val TAG = GroMoreCarrierExpressManager::class.java.simpleName
// ad.setTTNativeAdListener(object : TTNativeExpressAdListener {
//
// override fun onAdClick() {
//class GroMoreCarrierExpressManager : TTSettingConfigCallback {
// LogUtil.d(TAG, "onAdClick")
// ToastUtil.show(MintsApplication.getContext(), "模板广告被点击")
// }
//
//
//
override fun onAdShow()
{
//
companion object
{
//
LogUtil.d(TAG, "onAdShow")
//
val instance: GroMoreCarrierExpressManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
//
ToastUtil.show(MintsApplication.getContext(), "模板广告show"
)
//
GroMoreCarrierExpressManager(
)
// }
// }
// }
//
// private var mAdStyle = 0
// private var mExpressType = 0
//
// private val frameLayout: FrameLayout? = null
//
// private var mHandlerThread: HandlerThread? = null
// private var mWorkHandler: Handler? = null
//
//
// override fun onRenderFail(view: View, msg: String, code: Int) {
// private var mTTAdNative: TTUnifiedNativeAd? = null
// ToastUtil.show(MintsApplication.getContext(), "模板广告渲染失败code=$code,msg=$msg")
//
// LogUtil.d(TAG, "onRenderFail code=$code,msg=$msg")
// init {
// mAdStyle = AdSlot.TYPE_EXPRESS_AD
// }
// }
//
//
// // ** 注意点 ** 不要在广告加载成功回调里进行广告view展示,要在onRenderSucces进行广告view展示,否则会导致广告无法展示。
// fun loadADFrameLayout() {
// // 另外,不要直接使用参数view,而是通过ad.getExpressView()来获取广告view。
// // 销毁及移除事件
// override fun onRenderSuccess(view: View, width: Float, height: Float) {
// destroy()
// LogUtil.d(TAG, "onRenderSuccess")
// frameLayout?.removeAllViews()
// ToastUtil.show(MintsApplication.getContext(), "模板广告渲染成功:width=$width,height=$height")
//
// //回调渲染成功后将模板布局添加的父View中
// if (TTMediationAdSdk.configLoadSuccess()) {
// if (adViewHolder.mAdContainerView != null) {
// loadAd()
// //获取视频播放view,该view SDK内部渲染,在媒体平台可配置视频是否自动播放等设置。
// val sWidth: Int
// val sHeight: Int
// val video = ad.expressView // 使用该方式获取广告view,而不是直接使用onRenderSuccess的参数view。
// if (width == TTAdSize.FULL_WIDTH.toFloat() && height == TTAdSize.AUTO_HEIGHT.toFloat()) {
// sWidth = FrameLayout.LayoutParams.MATCH_PARENT
// sHeight = FrameLayout.LayoutParams.WRAP_CONTENT
// } else {
// } else {
// sWidth = UIUtils.getScreenWidthDp(MintsApplication.getContext()).toInt()
// TTMediationAdSdk.registerConfigCallback(this)
// sHeight = (sWidth * height / width).toInt()
// }
// if (video != null) {
// if (video.parent == null) {
// val layoutParams = FrameLayout.LayoutParams(sWidth, sHeight)
// adViewHolder.mAdContainerView!!.removeAllViews()
// adViewHolder.mAdContainerView!!.addView(video, layoutParams)
// }
// }
// }
// }
// }
//
// /**
// * config成功,加载信息流
// */
// override fun configLoad() {
// loadAd()
// }
// }
// })
//
//
// private fun loadAd() {
// mTTAdNative = TTUnifiedNativeAd(MintsApplication.getContext(), CsjGroMoreManager.AD_UNIT_ID)
//
// //视频声音控制设置
// var videoOption: TTVideoOption = VideoOptionUtil.getTTVideoOption()
//
//
// //视频广告设置播放状态回调(可选)
// //判断是否需要使用GDT Feed 模板渲染2.0;注意!!!!需要向广点通商务申请模渲染2.0权限
// ad.setTTVideoListener(object : TTVideoListener {
// // 注意不设置默认使用 GDT Feed 模板渲染1.0,默认情况下无需执行下方代码
// override fun onVideoStart() {
// if (mAdStyle == AdSlot.TYPE_EXPRESS_AD && mExpressType == GDTExtraOption.FeedExpressType.FEED_EXPRESS_TYPE_2) {
// ToastUtil.show(MintsApplication.getContext(), "模板广告视频开始播放")
// videoOption = VideoOptionUtil.getTTVideoOption2()
// LogUtil.d(TAG, "onVideoStart")
// }
// }
//
//
// override fun onVideoPause() {
// //针对Admob Native的特殊配置项
// ToastUtil.show(MintsApplication.getContext(), "模板广告视频暂停")
// val admobNativeAdOptions = AdmobNativeAdOptions()
// LogUtil.d(TAG, "onVideoPause")
// admobNativeAdOptions.setAdChoicesPlacement(AdmobNativeAdOptions.ADCHOICES_TOP_RIGHT) //设置广告小标默认情况下,广告选择叠加层会显示在右上角。
// .setRequestMultipleImages(true).isReturnUrlsForImageAssets = true //设置为true,SDK会仅提供Uri字段的值,允许自行决定是否下载实际图片,同时不会提供Drawable字段的值
//
//
// // 针对Gdt Native自渲染广告,可以自定义gdt logo的布局参数。该参数可选,非必须。
// val gdtNativeAdLogUtiloParams = FrameLayout.LayoutParams(
// BubbleUtils.dp2px(40),
// BubbleUtils.dp2px(14),
// Gravity.END or Gravity.TOP) // 例如,放在右上角
//
// /**
// * 创建feed广告请求类型参数AdSlot,具体参数含义参考文档
// * 备注
// * 1: 如果是信息流自渲染广告,设置广告图片期望的图片宽高 ,不能为0
// * 2:如果是信息流模板广告,宽度设置为希望的宽度,高度设置为0(0为高度选择自适应参数)
// */
// /**
// * 创建feed广告请求类型参数AdSlot,具体参数含义参考文档
// * 备注
// * 1: 如果是信息流自渲染广告,设置广告图片期望的图片宽高 ,不能为0
// * 2:如果是信息流模板广告,宽度设置为希望的宽度,高度设置为0(0为高度选择自适应参数)
// */
// val adSlot = AdSlot.Builder()
// .setTTVideoOption(videoOption) //视频声音相关的配置
// .setAdmobNativeAdOptions(admobNativeAdOptions)
// .setAdStyleType(mAdStyle) //必传,表示请求的模板广告还是原生广告,AdSlot.TYPE_EXPRESS_AD:模板广告 ; AdSlot.TYPE_NATIVE_AD:原生广告
// .setImageAdSize(UIUtils.getScreenWidthDp(MintsApplication.getContext()).toInt(), 320) // 必选参数 单位dp ,详情见上面备注解释
// .setAdCount(1) //请求广告数量为1到3条
// .setGdtNativeAdLogoParams(gdtNativeAdLogUtiloParams) // 设置gdt logo布局参数。
// .build()
//
// //请求广告,调用feed广告异步请求接口,加载到广告后,拿到广告素材自定义渲染
// /**
// * 注:每次加载信息流广告的时候需要新建一个TTUnifiedNativeAd,否则可能会出现广告填充问题
// * (例如:mTTAdNative = new TTUnifiedNativeAd(this, mAdUnitId);)
// */
// mTTAdNative?.loadAd(adSlot, object : TTNativeAdLoadCallback {
// override fun onAdLoadedFial(adError: AdError?) {
// LogUtil.e(TAG, "load feed ad error : " + adError?.code + ", " + adError?.message)
//
// }
// }
//
//
// override fun onVideoResume() {
// override fun onAdLoaded(ads: MutableList<TTNativeAd>?) {
// ToastUtil.show(MintsApplication.getContext(), "模板广告视频继续播放")
// if (ads == null || ads.isEmpty()) {
// LogUtil.d(TAG, "onVideoResume")
// LogUtil.e(TAG, "on FeedAdLoaded: ad is null!")
// return
// }
// }
//
//
//
override fun onVideoCompleted(
) {
//
for (ttNativeAd in ads
) {
//
ToastUtil.show(MintsApplication.getContext(), "模板播放完成
")
//
LogUtil.e(TAG, "
")
// LogUtil.
d(TAG, "onVideoCompleted"
)
// LogUtil.
e(TAG, "adNetworkPlatformId: " + ttNativeAd.adNetworkPlatformId + " adNetworkRitId:" + ttNativeAd.adNetworkRitId + " preEcpm: " + ttNativeAd.preEcpm
)
// }
// }
//
//
//
override fun onVideoError(adError: AdError
) {
//
if (ads.size > 0
) {
//
ToastUtil.show(MintsApplication.getContext(), "模板广告视频播放出错"
)
//
frameLayout?.addView(ads[0].expressView
)
//
LogUtil.d(TAG, "onVideoError")
//
}
// }
// }
//
// })
// })
// ad.render()
// } catch (e: Exception) {
// e.printStackTrace()
// }
// }
// return convertView
//
// fun getADFrameLayout(): FrameLayout? {
// return frameLayout
// }
// }
//
}
// /**
\ No newline at end of file
// * 销毁
// */
// private fun destroy() {
// mHandlerThread?.quit()
// mHandlerThread = null
// mWorkHandler?.removeCallbacksAndMessages(null)
// mWorkHandler = null
// }
//
// //渲染模板广告
//// private fun getExpressAdView(ad: TTNativeAd): View? {
//// val adViewHolder: GroMoreExpressManager.ExpressAdViewHolder
//// val convertView = LayoutInflater.from(MintsApplication.getContext()).inflate(R.layout.listitem_ad_native_express, null, false)
//// try {
//// adViewHolder = GroMoreExpressManager.ExpressAdViewHolder()
//// adViewHolder.mAdContainerView = convertView.findViewById(R.id.iv_listitem_express) as FrameLayout
//// convertView.tag = adViewHolder
////
//// //判断是否存在dislike按钮
////// if (ad.hasDislike()) {
////// ad.setDislikeCallback(MintsApplication.getContext() as Activity?, object : TTDislikeCallback {
////// override fun onSelected(position: Int, value: String) {
////// ToastUtil.show(MintsApplication.getContext(), "点击 $value")
////// //用户选择不喜欢原因后,移除广告展示
////// }
//////
////// override fun onCancel() {
////// ToastUtil.show(MintsApplication.getContext(), "dislike 点击了取消")
////// LogUtil.d(TAG, "dislike 点击了取消")
////// }
//////
////// /**
////// * 拒绝再次提交
////// */
////// override fun onRefuse() {}
////// override fun onShow() {}
////// })
////// }
////
//// //设置点击展示回调监听
//// ad.setTTNativeAdListener(object : TTNativeExpressAdListener {
//// override fun onAdClick() {
//// LogUtil.d(TAG, "onAdClick")
//// ToastUtil.show(MintsApplication.getContext(), "模板广告被点击")
//// }
////
//// override fun onAdShow() {
//// LogUtil.d(TAG, "onAdShow")
//// ToastUtil.show(MintsApplication.getContext(), "模板广告show")
//// }
////
//// override fun onRenderFail(view: View, msg: String, code: Int) {
//// ToastUtil.show(MintsApplication.getContext(), "模板广告渲染失败code=$code,msg=$msg")
//// LogUtil.d(TAG, "onRenderFail code=$code,msg=$msg")
//// }
////
//// // ** 注意点 ** 不要在广告加载成功回调里进行广告view展示,要在onRenderSucces进行广告view展示,否则会导致广告无法展示。
//// // 另外,不要直接使用参数view,而是通过ad.getExpressView()来获取广告view。
//// override fun onRenderSuccess(view: View, width: Float, height: Float) {
//// LogUtil.d(TAG, "onRenderSuccess")
//// ToastUtil.show(MintsApplication.getContext(), "模板广告渲染成功:width=$width,height=$height")
//// //回调渲染成功后将模板布局添加的父View中
//// if (adViewHolder.mAdContainerView != null) {
//// //获取视频播放view,该view SDK内部渲染,在媒体平台可配置视频是否自动播放等设置。
//// val sWidth: Int
//// val sHeight: Int
//// val video = ad.expressView // 使用该方式获取广告view,而不是直接使用onRenderSuccess的参数view。
//// if (width == TTAdSize.FULL_WIDTH.toFloat() && height == TTAdSize.AUTO_HEIGHT.toFloat()) {
//// sWidth = FrameLayout.LayoutParams.MATCH_PARENT
//// sHeight = FrameLayout.LayoutParams.WRAP_CONTENT
//// } else {
//// sWidth = UIUtils.getScreenWidthDp(MintsApplication.getContext()).toInt()
//// sHeight = (sWidth * height / width).toInt()
//// }
//// if (video != null) {
//// if (video.parent == null) {
//// val layoutParams = FrameLayout.LayoutParams(sWidth, sHeight)
//// adViewHolder.mAdContainerView!!.removeAllViews()
//// adViewHolder.mAdContainerView!!.addView(video, layoutParams)
//// }
//// }
//// }
//// }
//// })
////
////
//// //视频广告设置播放状态回调(可选)
//// ad.setTTVideoListener(object : TTVideoListener {
//// override fun onVideoStart() {
//// ToastUtil.show(MintsApplication.getContext(), "模板广告视频开始播放")
//// LogUtil.d(TAG, "onVideoStart")
//// }
////
//// override fun onVideoPause() {
//// ToastUtil.show(MintsApplication.getContext(), "模板广告视频暂停")
//// LogUtil.d(TAG, "onVideoPause")
//// }
////
//// override fun onVideoResume() {
//// ToastUtil.show(MintsApplication.getContext(), "模板广告视频继续播放")
//// LogUtil.d(TAG, "onVideoResume")
//// }
////
//// override fun onVideoCompleted() {
//// ToastUtil.show(MintsApplication.getContext(), "模板播放完成")
//// LogUtil.d(TAG, "onVideoCompleted")
//// }
////
//// override fun onVideoError(adError: AdError) {
//// ToastUtil.show(MintsApplication.getContext(), "模板广告视频播放出错")
//// LogUtil.d(TAG, "onVideoError")
//// }
//// })
//// ad.render()
//// } catch (e: Exception) {
//// e.printStackTrace()
//// }
//// return convertView
//// }
//
//}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/express/GroMoreExpressManager.kt
View file @
6bdad092
package
com.mints.goodmoney.ad.express
//package com.mints.goodmoney.ad.express
//
import
android.text.TextUtils
//import android.text.TextUtils
import
android.view.Gravity
//import android.view.Gravity
import
android.view.LayoutInflater
//import android.view.LayoutInflater
import
android.view.View
//import android.view.View
import
android.view.ViewGroup
//import android.view.ViewGroup
import
android.widget.*
//import android.widget.*
import
com.bumptech.glide.Glide
//import com.bumptech.glide.Glide
import
com.bytedance.msdk.api.*
//import com.bytedance.msdk.api.*
import
com.bytedance.msdk.api.nativeAd.*
//import com.bytedance.msdk.api.nativeAd.*
import
com.mints.goodmoney.MintsApplication
//import com.mints.goodmoney.MintsApplication
import
com.mints.goodmoney.R
//import com.mints.goodmoney.R
import
com.mints.goodmoney.common.Constant
//import com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.manager.CsjGroMoreManager
//import com.mints.goodmoney.manager.CsjGroMoreManager
import
com.mints.goodmoney.manager.TrackManager
//import com.mints.goodmoney.manager.TrackManager
import
com.mints.goodmoney.ui.widgets.seekbar.BubbleUtils
//import com.mints.goodmoney.ui.widgets.seekbar.BubbleUtils
import
com.mints.goodmoney.utils.LogUtil
//import com.mints.goodmoney.utils.LogUtil
import
com.mints.goodmoney.utils.UIUtils
//import com.mints.goodmoney.utils.UIUtils
import
com.mints.goodmoney.utils.VideoOptionUtil
//import com.mints.goodmoney.utils.VideoOptionUtil
import
java.util.*
//import java.util.*
//
private
val
TAG
=
GroMoreExpressManager
::
class
.
java
.
simpleName
//private val TAG = GroMoreExpressManager::class.java.simpleName
//
class
GroMoreExpressManager
:
TTSettingConfigCallback
{
//class GroMoreExpressManager : TTSettingConfigCallback {
//
companion
object
{
// companion object {
val
instance
:
GroMoreExpressManager
by
lazy
(
mode
=
LazyThreadSafetyMode
.
SYNCHRONIZED
)
{
// val instance: GroMoreExpressManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
GroMoreExpressManager
()
// GroMoreExpressManager()
}
// }
}
// }
//
private
var
mADLoadSuccessListener
:
GMADLoadSuccessListener
?
=
null
// private var mADLoadSuccessListener: GMADLoadSuccessListener? = null
//
fun
setListener
(
adLoadSuccessListener
:
GMADLoadSuccessListener
?)
{
// fun setListener(adLoadSuccessListener: GMADLoadSuccessListener?) {
mADLoadSuccessListener
=
adLoadSuccessListener
// mADLoadSuccessListener = adLoadSuccessListener
}
// }
//
@Volatile
// @Volatile
private
var
sAdFrameLayout
:
FrameLayout
=
FrameLayout
(
MintsApplication
.
getContext
())
// private var sAdFrameLayout: FrameLayout = FrameLayout(MintsApplication.getContext())
//
private
var
mTTAdNative
:
TTUnifiedNativeAd
?
=
null
// private var mTTAdNative: TTUnifiedNativeAd? = null
//
private
var
mAdStyle
=
0
// private var mAdStyle = 0
private
var
mExpressType
=
0
// private var mExpressType = 0
//
init
{
// init {
mAdStyle
=
AdSlot
.
TYPE_EXPRESS_AD
// mAdStyle = AdSlot.TYPE_EXPRESS_AD
}
// }
//
fun
loadADFrameLayout
()
{
// fun loadADFrameLayout() {
// 销毁及移除事件
// // 销毁及移除事件
destroy
()
// destroy()
sAdFrameLayout
.
removeAllViews
()
// sAdFrameLayout.removeAllViews()
//
if
(
TTMediationAdSdk
.
configLoadSuccess
())
{
// if (TTMediationAdSdk.configLoadSuccess()) {
loadAd
()
// loadAd()
}
else
{
// } else {
TTMediationAdSdk
.
registerConfigCallback
(
this
)
// TTMediationAdSdk.registerConfigCallback(this)
}
}
private
fun
loadAd
()
{
mTTAdNative
=
TTUnifiedNativeAd
(
MintsApplication
.
getContext
(),
CsjGroMoreManager
.
AD_UNIT_ID
)
//视频声音控制设置
var
videoOption
:
TTVideoOption
=
VideoOptionUtil
.
getTTVideoOption
()
//判断是否需要使用GDT Feed 模板渲染2.0;注意!!!!需要向广点通商务申请模渲染2.0权限
// 注意不设置默认使用 GDT Feed 模板渲染1.0,默认情况下无需执行下方代码
if
(
mAdStyle
==
AdSlot
.
TYPE_EXPRESS_AD
&&
mExpressType
==
GDTExtraOption
.
FeedExpressType
.
FEED_EXPRESS_TYPE_2
)
{
videoOption
=
VideoOptionUtil
.
getTTVideoOption2
()
}
//针对Admob Native的特殊配置项
val
admobNativeAdOptions
=
AdmobNativeAdOptions
()
admobNativeAdOptions
.
setAdChoicesPlacement
(
AdmobNativeAdOptions
.
ADCHOICES_TOP_RIGHT
)
//设置广告小标默认情况下,广告选择叠加层会显示在右上角。
.
setRequestMultipleImages
(
true
).
isReturnUrlsForImageAssets
=
true
//设置为true,SDK会仅提供Uri字段的值,允许自行决定是否下载实际图片,同时不会提供Drawable字段的值
// 针对Gdt Native自渲染广告,可以自定义gdt logo的布局参数。该参数可选,非必须。
val
gdtNativeAdLogUtiloParams
=
FrameLayout
.
LayoutParams
(
BubbleUtils
.
dp2px
(
40
),
BubbleUtils
.
dp2px
(
14
),
Gravity
.
END
or
Gravity
.
TOP
)
// 例如,放在右上角
/**
* 创建feed广告请求类型参数AdSlot,具体参数含义参考文档
* 备注
* 1: 如果是信息流自渲染广告,设置广告图片期望的图片宽高 ,不能为0
* 2:如果是信息流模板广告,宽度设置为希望的宽度,高度设置为0(0为高度选择自适应参数)
*/
/**
* 创建feed广告请求类型参数AdSlot,具体参数含义参考文档
* 备注
* 1: 如果是信息流自渲染广告,设置广告图片期望的图片宽高 ,不能为0
* 2:如果是信息流模板广告,宽度设置为希望的宽度,高度设置为0(0为高度选择自适应参数)
*/
val
adSlot
=
AdSlot
.
Builder
()
.
setTTVideoOption
(
videoOption
)
//视频声音相关的配置
.
setAdmobNativeAdOptions
(
admobNativeAdOptions
)
.
setAdStyleType
(
mAdStyle
)
//必传,表示请求的模板广告还是原生广告,AdSlot.TYPE_EXPRESS_AD:模板广告 ; AdSlot.TYPE_NATIVE_AD:原生广告
.
setImageAdSize
(
UIUtils
.
getScreenWidthDp
(
MintsApplication
.
getContext
()).
toInt
(),
320
)
// 必选参数 单位dp ,详情见上面备注解释
.
setAdCount
(
1
)
//请求广告数量为1到3条
.
setGdtNativeAdLogoParams
(
gdtNativeAdLogUtiloParams
)
// 设置gdt logo布局参数。
.
build
()
//请求广告,调用feed广告异步请求接口,加载到广告后,拿到广告素材自定义渲染
/**
* 注:每次加载信息流广告的时候需要新建一个TTUnifiedNativeAd,否则可能会出现广告填充问题
* (例如:mTTAdNative = new TTUnifiedNativeAd(this, mAdUnitId);)
*/
mTTAdNative
?.
loadAd
(
adSlot
,
object
:
TTNativeAdLoadCallback
{
override
fun
onAdLoadedFial
(
adError
:
AdError
?)
{
LogUtil
.
e
(
TAG
,
"load feed ad error : "
+
adError
?.
code
+
", "
+
adError
?.
message
)
}
override
fun
onAdLoaded
(
ads
:
MutableList
<
TTNativeAd
>?)
{
if
(
ads
==
null
||
ads
.
isEmpty
())
{
LogUtil
.
e
(
TAG
,
"on FeedAdLoaded: ad is null!"
)
return
}
for
(
ttNativeAd
in
ads
)
{
LogUtil
.
e
(
TAG
,
" "
)
LogUtil
.
e
(
TAG
,
"adNetworkPlatformId: "
+
ttNativeAd
.
adNetworkPlatformId
+
" adNetworkRitId:"
+
ttNativeAd
.
adNetworkRitId
+
" preEcpm: "
+
ttNativeAd
.
preEcpm
)
}
if
(
ads
.
size
>
0
)
{
mADLoadSuccessListener
?.
onGMAdLoadSuc
(
ads
[
0
])
val
ttNativeAd
=
ads
[
0
]
val
vo
=
HashMap
<
String
,
Any
>()
vo
[
"adcode"
]
=
ttNativeAd
.
getAdNetworkRitId
()
vo
[
"ecpm"
]
=
ttNativeAd
.
getPreEcpm
()
vo
[
"adSource"
]
=
ttNativeAd
.
getAdNetworkPlatformId
()
vo
[
"adType"
]
=
Constant
.
GRO_MORE_ADTYPE1
TrackManager
.
getInstance
().
cmtGroMoreInfo
(
vo
)
// sAdFrameLayout.addView(createAdView(ads[0]))
}
}
})
}
fun
getADFrameLayout
():
FrameLayout
?
{
return
sAdFrameLayout
}
/**
* config成功,加载信息流
*/
override
fun
configLoad
()
{
loadAd
()
}
private
fun
createAdView
(
ad
:
TTNativeAd
?):
View
?
{
if
(
ad
!=
null
&&
ad
.
isExpressAd
)
{
return
getExpressAdView
(
ad
)
}
return
when
{
ad
==
null
->
{
return
null
}
ad
.
adImageMode
==
TTAdConstant
.
IMAGE_MODE_SMALL_IMG
->
{
return
getSmallAdView
(
ad
)
}
ad
.
adImageMode
==
TTAdConstant
.
IMAGE_MODE_LARGE_IMG
->
{
return
getLargeAdView
(
ad
)
}
ad
.
adImageMode
==
TTAdConstant
.
IMAGE_MODE_GROUP_IMG
->
{
return
getGroupAdView
(
ad
)
}
ad
.
adImageMode
==
TTAdConstant
.
IMAGE_MODE_VIDEO
->
{
return
getVideoView
(
ad
)
}
ad
.
adImageMode
==
TTAdConstant
.
IMAGE_MODE_VERTICAL_IMG
->
{
return
getVerticalAdView
(
ad
)
}
ad
.
adImageMode
==
TTAdConstant
.
IMAGE_MODE_VIDEO_VERTICAL
->
{
return
getVideoView
(
ad
)
}
else
->
{
return
null
}
}
}
/**
* 销毁
*/
private
fun
destroy
()
{
TTMediationAdSdk
.
unregisterConfigCallback
(
this
)
}
//渲染模板广告
private
fun
getExpressAdView
(
ad
:
TTNativeAd
):
View
?
{
val
adViewHolder
:
ExpressAdViewHolder
val
convertView
=
LayoutInflater
.
from
(
MintsApplication
.
getContext
()).
inflate
(
R
.
layout
.
listitem_ad_native_express
,
null
,
false
)
try
{
adViewHolder
=
ExpressAdViewHolder
()
adViewHolder
.
mAdContainerView
=
convertView
.
findViewById
(
R
.
id
.
iv_listitem_express
)
as
FrameLayout
convertView
.
tag
=
adViewHolder
//判断是否存在dislike按钮
// if (ad.hasDislike()) {
// ad.setDislikeCallback(MintsApplication.getContext() as Activity?, object : TTDislikeCallback {
// override fun onSelected(position: Int, value: String) {
// //用户选择不喜欢原因后,移除广告展示
// }
//
// override fun onCancel() {
// LogUtil.d(TAG, "dislike 点击了取消")
// }
// }
//
//
// }
//
// private fun loadAd() {
// mTTAdNative = TTUnifiedNativeAd(MintsApplication.getContext(), CsjGroMoreManager.AD_UNIT_ID)
//
// //视频声音控制设置
// var videoOption: TTVideoOption = VideoOptionUtil.getTTVideoOption()
//
// //判断是否需要使用GDT Feed 模板渲染2.0;注意!!!!需要向广点通商务申请模渲染2.0权限
// // 注意不设置默认使用 GDT Feed 模板渲染1.0,默认情况下无需执行下方代码
// if (mAdStyle == AdSlot.TYPE_EXPRESS_AD && mExpressType == GDTExtraOption.FeedExpressType.FEED_EXPRESS_TYPE_2) {
// videoOption = VideoOptionUtil.getTTVideoOption2()
// }
//
// //针对Admob Native的特殊配置项
// val admobNativeAdOptions = AdmobNativeAdOptions()
// admobNativeAdOptions.setAdChoicesPlacement(AdmobNativeAdOptions.ADCHOICES_TOP_RIGHT) //设置广告小标默认情况下,广告选择叠加层会显示在右上角。
// .setRequestMultipleImages(true).isReturnUrlsForImageAssets = true //设置为true,SDK会仅提供Uri字段的值,允许自行决定是否下载实际图片,同时不会提供Drawable字段的值
//
//
// // 针对Gdt Native自渲染广告,可以自定义gdt logo的布局参数。该参数可选,非必须。
// val gdtNativeAdLogUtiloParams = FrameLayout.LayoutParams(
// BubbleUtils.dp2px(40),
// BubbleUtils.dp2px(14),
// Gravity.END or Gravity.TOP) // 例如,放在右上角
//
// /**
// * 创建feed广告请求类型参数AdSlot,具体参数含义参考文档
// * 备注
// * 1: 如果是信息流自渲染广告,设置广告图片期望的图片宽高 ,不能为0
// * 2:如果是信息流模板广告,宽度设置为希望的宽度,高度设置为0(0为高度选择自适应参数)
// */
// /**
// /**
// * 拒绝再次提交
// * 创建feed广告请求类型参数AdSlot,具体参数含义参考文档
// * 备注
// * 1: 如果是信息流自渲染广告,设置广告图片期望的图片宽高 ,不能为0
// * 2:如果是信息流模板广告,宽度设置为希望的宽度,高度设置为0(0为高度选择自适应参数)
// */
// */
// override fun onRefuse() {}
// val adSlot = AdSlot.Builder()
// override fun onShow() {}
// .setTTVideoOption(videoOption) //视频声音相关的配置
// .setAdmobNativeAdOptions(admobNativeAdOptions)
// .setAdStyleType(mAdStyle) //必传,表示请求的模板广告还是原生广告,AdSlot.TYPE_EXPRESS_AD:模板广告 ; AdSlot.TYPE_NATIVE_AD:原生广告
// .setImageAdSize(UIUtils.getScreenWidthDp(MintsApplication.getContext()).toInt(), 320) // 必选参数 单位dp ,详情见上面备注解释
// .setAdCount(1) //请求广告数量为1到3条
// .setGdtNativeAdLogoParams(gdtNativeAdLogUtiloParams) // 设置gdt logo布局参数。
// .build()
//
// //请求广告,调用feed广告异步请求接口,加载到广告后,拿到广告素材自定义渲染
// /**
// * 注:每次加载信息流广告的时候需要新建一个TTUnifiedNativeAd,否则可能会出现广告填充问题
// * (例如:mTTAdNative = new TTUnifiedNativeAd(this, mAdUnitId);)
// */
// mTTAdNative?.loadAd(adSlot, object : TTNativeAdLoadCallback {
// override fun onAdLoadedFial(adError: AdError?) {
// LogUtil.e(TAG, "load feed ad error : " + adError?.code + ", " + adError?.message)
//
// }
//
// override fun onAdLoaded(ads: MutableList<TTNativeAd>?) {
// if (ads == null || ads.isEmpty()) {
// LogUtil.e(TAG, "on FeedAdLoaded: ad is null!")
// return
// }
//
// for (ttNativeAd in ads) {
// LogUtil.e(TAG, " ")
// LogUtil.e(TAG, "adNetworkPlatformId: " + ttNativeAd.adNetworkPlatformId + " adNetworkRitId:" + ttNativeAd.adNetworkRitId + " preEcpm: " + ttNativeAd.preEcpm)
// }
//
// if (ads.size > 0) {
// mADLoadSuccessListener?.onGMAdLoadSuc(ads[0])
// val ttNativeAd = ads[0]
// val vo = HashMap<String, Any>()
// vo["adcode"] = ttNativeAd.getAdNetworkRitId()
// vo["ecpm"] = ttNativeAd.getPreEcpm()
// vo["adSource"] = ttNativeAd.getAdNetworkPlatformId()
// vo["adType"] = Constant.GRO_MORE_ADTYPE1
// TrackManager.getInstance().cmtGroMoreInfo(vo)
//// sAdFrameLayout.addView(createAdView(ads[0]))
// }
// }
//
// })
// })
// }
// }
//
//设置点击展示回调监听
// fun getADFrameLayout(): FrameLayout? {
ad
.
setTTNativeAdListener
(
object
:
TTNativeExpressAdListener
{
// return sAdFrameLayout
override
fun
onAdClick
()
{
// }
LogUtil
.
d
(
TAG
,
"onAdClick"
)
}
override
fun
onAdShow
()
{
LogUtil
.
d
(
TAG
,
"onAdShow"
)
}
override
fun
onRenderFail
(
view
:
View
,
msg
:
String
,
code
:
Int
)
{
LogUtil
.
d
(
TAG
,
"onRenderFail code=$code,msg=$msg"
)
}
// ** 注意点 ** 不要在广告加载成功回调里进行广告view展示,要在onRenderSucces进行广告view展示,否则会导致广告无法展示。
// 另外,不要直接使用参数view,而是通过ad.getExpressView()来获取广告view。
override
fun
onRenderSuccess
(
view
:
View
,
width
:
Float
,
height
:
Float
)
{
LogUtil
.
d
(
TAG
,
"onRenderSuccess"
)
//回调渲染成功后将模板布局添加的父View中
if
(
adViewHolder
.
mAdContainerView
!=
null
)
{
//获取视频播放view,该view SDK内部渲染,在媒体平台可配置视频是否自动播放等设置。
val
sWidth
:
Int
val
sHeight
:
Int
val
video
=
ad
.
expressView
// 使用该方式获取广告view,而不是直接使用onRenderSuccess的参数view。
if
(
width
==
TTAdSize
.
FULL_WIDTH
.
toFloat
()
&&
height
==
TTAdSize
.
AUTO_HEIGHT
.
toFloat
())
{
sWidth
=
FrameLayout
.
LayoutParams
.
MATCH_PARENT
sHeight
=
FrameLayout
.
LayoutParams
.
WRAP_CONTENT
}
else
{
sWidth
=
UIUtils
.
getScreenWidthDp
(
MintsApplication
.
getContext
()).
toInt
()
sHeight
=
(
sWidth
*
height
/
width
).
toInt
()
}
if
(
video
!=
null
)
{
if
(
video
.
parent
==
null
)
{
val
layoutParams
=
FrameLayout
.
LayoutParams
(
sWidth
,
sHeight
)
adViewHolder
.
mAdContainerView
!!
.
removeAllViews
()
adViewHolder
.
mAdContainerView
!!
.
addView
(
video
,
layoutParams
)
}
}
}
}
})
//视频广告设置播放状态回调(可选)
ad
.
setTTVideoListener
(
object
:
TTVideoListener
{
override
fun
onVideoStart
()
{
LogUtil
.
d
(
TAG
,
"onVideoStart"
)
}
override
fun
onVideoPause
()
{
LogUtil
.
d
(
TAG
,
"onVideoPause"
)
}
override
fun
onVideoResume
()
{
LogUtil
.
d
(
TAG
,
"onVideoResume"
)
}
override
fun
onVideoCompleted
()
{
LogUtil
.
d
(
TAG
,
"onVideoCompleted"
)
}
override
fun
onVideoError
(
adError
:
AdError
)
{
LogUtil
.
d
(
TAG
,
"onVideoError"
)
}
})
ad
.
render
()
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
}
return
convertView
}
/**
* @param ad
* @return
*/
private
fun
getVerticalAdView
(
ad
:
TTNativeAd
):
View
?
{
val
convertView
=
LayoutInflater
.
from
(
MintsApplication
.
getContext
()).
inflate
(
R
.
layout
.
listitem_ad_vertical_pic
,
null
,
false
)
val
adViewHolder
=
VerticalAdViewHolder
()
adViewHolder
.
mTitle
=
convertView
!!
.
findViewById
(
R
.
id
.
tv_listitem_ad_title
)
as
TextView
adViewHolder
.
mSource
=
convertView
.
findViewById
(
R
.
id
.
tv_listitem_ad_source
)
as
TextView
adViewHolder
.
mDescription
=
convertView
.
findViewById
<
View
>(
R
.
id
.
tv_listitem_ad_desc
)
as
TextView
adViewHolder
.
mVerticalImage
=
convertView
.
findViewById
(
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
(
R
.
id
.
tt_ad_logo
)
//logoView 建议传入GroupView类型
val
viewBinder
:
TTViewBinder
=
TTViewBinder
.
Builder
(
R
.
layout
.
listitem_ad_vertical_pic
)
.
titleId
(
R
.
id
.
tv_listitem_ad_title
)
.
decriptionTextId
(
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
convertView
.
tag
=
adViewHolder
bindData
(
convertView
,
adViewHolder
,
ad
,
viewBinder
)
if
(
ad
.
imageUrl
!=
null
)
{
adViewHolder
.
mVerticalImage
?.
let
{
Glide
.
with
(
MintsApplication
.
getContext
()).
load
(
ad
.
imageUrl
).
into
(
it
)
}
}
return
convertView
}
//渲染视频广告,以视频广告为例,以下说明
private
fun
getVideoView
(
ad
:
TTNativeAd
):
View
?
{
val
adViewHolder
:
VideoAdViewHolder
val
viewBinder
:
TTViewBinder
val
convertView
=
LayoutInflater
.
from
(
MintsApplication
.
getContext
()).
inflate
(
R
.
layout
.
listitem_ad_large_video
,
null
,
false
)
try
{
adViewHolder
=
VideoAdViewHolder
()
adViewHolder
.
mTitle
=
convertView
!!
.
findViewById
<
View
>(
R
.
id
.
tv_listitem_ad_title
)
as
TextView
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
(
R
.
id
.
tt_ad_logo
)
//logoView 建议传入GroupView类型
//TTViewBinder 是必须类,需要开发者在确定好View之后把Id设置给TTViewBinder类,并在注册事件时传递给SDK
viewBinder
=
TTViewBinder
.
Builder
(
R
.
layout
.
listitem_ad_large_video
)
.
titleId
(
R
.
id
.
tv_listitem_ad_title
)
.
sourceId
(
R
.
id
.
tv_listitem_ad_source
)
.
decriptionTextId
(
R
.
id
.
tv_listitem_ad_desc
)
.
mediaViewIdId
(
R
.
id
.
iv_listitem_video
)
.
callToActionId
(
R
.
id
.
btn_listitem_creative
)
.
logoLayoutId
(
R
.
id
.
tt_ad_logo
)
//logoView 建议传入GroupView类型
.
iconImageId
(
R
.
id
.
iv_listitem_icon
)
.
build
()
adViewHolder
.
viewBinder
=
viewBinder
convertView
.
tag
=
adViewHolder
//视频广告设置播放状态回调(可选)
ad
.
setTTVideoListener
(
object
:
TTVideoListener
{
override
fun
onVideoStart
()
{
LogUtil
.
d
(
TAG
,
"onVideoStart"
)
}
override
fun
onVideoPause
()
{
LogUtil
.
d
(
TAG
,
"onVideoPause"
)
}
override
fun
onVideoResume
()
{
LogUtil
.
d
(
TAG
,
"onVideoResume"
)
}
override
fun
onVideoCompleted
()
{
LogUtil
.
d
(
TAG
,
"onVideoCompleted"
)
}
override
fun
onVideoError
(
adError
:
AdError
)
{
LogUtil
.
d
(
TAG
,
"onVideoError"
)
}
})
//绑定广告数据、设置交互回调
bindData
(
convertView
,
adViewHolder
,
ad
,
viewBinder
)
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
}
return
convertView
}
private
fun
getLargeAdView
(
ad
:
TTNativeAd
):
View
?
{
val
convertView
=
LayoutInflater
.
from
(
MintsApplication
.
getContext
()).
inflate
(
R
.
layout
.
listitem_ad_large_pic
,
null
,
false
)
val
adViewHolder
=
LargeAdViewHolder
()
adViewHolder
.
mTitle
=
convertView
!!
.
findViewById
<
View
>(
R
.
id
.
tv_listitem_ad_title
)
as
TextView
adViewHolder
.
mDescription
=
convertView
.
findViewById
<
View
>(
R
.
id
.
tv_listitem_ad_desc
)
as
TextView
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
(
R
.
id
.
tt_ad_logo
)
//logoView 建议传入GroupView类型
val
viewBinder
:
TTViewBinder
=
TTViewBinder
.
Builder
(
R
.
layout
.
listitem_ad_large_pic
)
.
titleId
(
R
.
id
.
tv_listitem_ad_title
)
.
decriptionTextId
(
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
)
//logoView 建议传入GroupView类型
.
iconImageId
(
R
.
id
.
iv_listitem_icon
)
.
build
()
adViewHolder
.
viewBinder
=
viewBinder
convertView
.
tag
=
adViewHolder
bindData
(
convertView
,
adViewHolder
,
ad
,
viewBinder
)
if
(
ad
.
imageUrl
!=
null
)
{
adViewHolder
.
mLargeImage
?.
let
{
Glide
.
with
(
MintsApplication
.
getContext
()).
load
(
ad
.
imageUrl
).
into
(
it
)
}
}
return
convertView
}
private
fun
getGroupAdView
(
ad
:
TTNativeAd
):
View
?
{
val
convertView
=
LayoutInflater
.
from
(
MintsApplication
.
getContext
()).
inflate
(
R
.
layout
.
listitem_ad_group_pic
,
null
,
false
)
val
adViewHolder
=
GroupAdViewHolder
()
adViewHolder
.
mTitle
=
convertView
!!
.
findViewById
(
R
.
id
.
tv_listitem_ad_title
)
as
TextView
adViewHolder
.
mSource
=
convertView
.
findViewById
(
R
.
id
.
tv_listitem_ad_source
)
as
TextView
adViewHolder
.
mDescription
=
convertView
.
findViewById
(
R
.
id
.
tv_listitem_ad_desc
)
as
TextView
adViewHolder
.
mGroupImage1
=
convertView
.
findViewById
(
R
.
id
.
iv_listitem_image1
)
as
ImageView
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
adViewHolder
.
mDislike
=
convertView
.
findViewById
(
R
.
id
.
iv_listitem_dislike
)
as
ImageView
adViewHolder
.
mCreativeButton
=
convertView
.
findViewById
(
R
.
id
.
btn_listitem_creative
)
as
Button
adViewHolder
.
mLogo
=
convertView
.
findViewById
(
R
.
id
.
tt_ad_logo
)
//logoView 建议传入GroupView类型
val
viewBinder
:
TTViewBinder
=
TTViewBinder
.
Builder
(
R
.
layout
.
listitem_ad_group_pic
)
.
titleId
(
R
.
id
.
tv_listitem_ad_title
)
.
decriptionTextId
(
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
)
//logoView 建议传入GroupView类型
.
callToActionId
(
R
.
id
.
btn_listitem_creative
)
.
iconImageId
(
R
.
id
.
iv_listitem_icon
)
.
build
()
adViewHolder
.
viewBinder
=
viewBinder
convertView
.
tag
=
adViewHolder
bindData
(
convertView
,
adViewHolder
,
ad
,
viewBinder
)
if
(
ad
.
imageList
!=
null
&&
ad
.
imageList
.
size
>=
3
)
{
val
image1
=
ad
.
imageList
[
0
]
val
image2
=
ad
.
imageList
[
1
]
val
image3
=
ad
.
imageList
[
2
]
if
(
image1
!=
null
)
{
adViewHolder
.
mGroupImage1
?.
let
{
Glide
.
with
(
MintsApplication
.
getContext
()).
load
(
image1
).
into
(
it
)
}
}
if
(
image2
!=
null
)
{
adViewHolder
.
mGroupImage2
?.
let
{
Glide
.
with
(
MintsApplication
.
getContext
()).
load
(
image2
).
into
(
it
)
}
}
if
(
image3
!=
null
)
{
adViewHolder
.
mGroupImage3
?.
let
{
Glide
.
with
(
MintsApplication
.
getContext
()).
load
(
image3
).
into
(
it
)
}
}
}
return
convertView
}
private
fun
getSmallAdView
(
ad
:
TTNativeAd
):
View
?
{
val
convertView
=
LayoutInflater
.
from
(
MintsApplication
.
getContext
()).
inflate
(
R
.
layout
.
listitem_ad_small_pic
,
null
,
false
)
val
adViewHolder
=
SmallAdViewHolder
()
adViewHolder
.
mTitle
=
convertView
!!
.
findViewById
<
View
>(
R
.
id
.
tv_listitem_ad_title
)
as
TextView
adViewHolder
.
mSource
=
convertView
.
findViewById
<
View
>(
R
.
id
.
tv_listitem_ad_source
)
as
TextView
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
val
viewBinder
:
TTViewBinder
=
TTViewBinder
.
Builder
(
R
.
layout
.
listitem_ad_small_pic
)
.
titleId
(
R
.
id
.
tv_listitem_ad_title
)
.
sourceId
(
R
.
id
.
tv_listitem_ad_source
)
.
decriptionTextId
(
R
.
id
.
tv_listitem_ad_desc
)
.
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
()
adViewHolder
.
viewBinder
=
viewBinder
convertView
.
tag
=
adViewHolder
bindData
(
convertView
,
adViewHolder
,
ad
,
viewBinder
)
if
(
ad
.
imageUrl
!=
null
)
{
adViewHolder
.
mSmallImage
?.
let
{
Glide
.
with
(
MintsApplication
.
getContext
()).
load
(
ad
.
imageUrl
).
into
(
it
)
}
}
return
convertView
}
private
fun
bindData
(
convertView
:
View
,
adViewHolder
:
AdViewHolder
,
ad
:
TTNativeAd
,
viewBinder
:
TTViewBinder
)
{
//设置dislike弹窗,如果有
// if (ad.hasDislike()) {
// val ttAdDislike = ad.getDislikeDialog( MintsApplication.getContext() as Activity?)
// adViewHolder.mDislike.setVisibility(View.VISIBLE)
// adViewHolder.mDislike.setOnClickListener(View.OnClickListener {
// //使用接口来展示
// ttAdDislike.showDislikeDialog()
// ttAdDislike.setDislikeCallback(object : TTDislikeCallback {
// override fun onSelected(position: Int, value: String) {}
//
// override fun onCancel() {}
//
//
// /**
// /**
//
* 拒绝再次提交
//
* config成功,加载信息流
// */
// */
// override fun configLoad() {
// loadAd()
// }
//
// private fun createAdView(ad: TTNativeAd?): View? {
//
// if (ad != null && ad.isExpressAd) {
// return getExpressAdView(ad)
// }
//
// return when {
// ad == null -> {
// return null
// }
// ad.adImageMode == TTAdConstant.IMAGE_MODE_SMALL_IMG -> {
// return getSmallAdView(ad)
// }
// ad.adImageMode == TTAdConstant.IMAGE_MODE_LARGE_IMG -> {
// return getLargeAdView(ad)
// }
// ad.adImageMode == TTAdConstant.IMAGE_MODE_GROUP_IMG -> {
// return getGroupAdView(ad)
// }
// ad.adImageMode == TTAdConstant.IMAGE_MODE_VIDEO -> {
// return getVideoView(ad)
// }
// ad.adImageMode == TTAdConstant.IMAGE_MODE_VERTICAL_IMG -> {
// return getVerticalAdView(ad)
// }
// ad.adImageMode == TTAdConstant.IMAGE_MODE_VIDEO_VERTICAL -> {
// return getVideoView(ad)
// }
// else -> {
// return null
// }
// }
// }
//
// /**
// /**
//
* 拒绝再次提交
//
* 销毁
// */
// */
// override fun onRefuse() {}
// private fun destroy() {
// override fun onShow() {}
// TTMediationAdSdk.unregisterConfigCallback(this)
// }
//
// //渲染模板广告
// private fun getExpressAdView(ad: TTNativeAd): View? {
// val adViewHolder: ExpressAdViewHolder
// val convertView = LayoutInflater.from(MintsApplication.getContext()).inflate(R.layout.listitem_ad_native_express, null, false)
// try {
// adViewHolder = ExpressAdViewHolder()
// adViewHolder.mAdContainerView = convertView.findViewById(R.id.iv_listitem_express) as FrameLayout
// convertView.tag = adViewHolder
//
// //判断是否存在dislike按钮
//// if (ad.hasDislike()) {
//// ad.setDislikeCallback(MintsApplication.getContext() as Activity?, object : TTDislikeCallback {
//// override fun onSelected(position: Int, value: String) {
//// //用户选择不喜欢原因后,移除广告展示
//// }
////
//// override fun onCancel() {
//// LogUtil.d(TAG, "dislike 点击了取消")
//// }
////
//// /**
//// * 拒绝再次提交
//// */
//// override fun onRefuse() {}
//// override fun onShow() {}
//// })
//// }
//
// //设置点击展示回调监听
// ad.setTTNativeAdListener(object : TTNativeExpressAdListener {
// override fun onAdClick() {
// LogUtil.d(TAG, "onAdClick")
// }
//
// override fun onAdShow() {
// LogUtil.d(TAG, "onAdShow")
// }
//
// override fun onRenderFail(view: View, msg: String, code: Int) {
// LogUtil.d(TAG, "onRenderFail code=$code,msg=$msg")
// }
//
// // ** 注意点 ** 不要在广告加载成功回调里进行广告view展示,要在onRenderSucces进行广告view展示,否则会导致广告无法展示。
// // 另外,不要直接使用参数view,而是通过ad.getExpressView()来获取广告view。
// override fun onRenderSuccess(view: View, width: Float, height: Float) {
// LogUtil.d(TAG, "onRenderSuccess")
// //回调渲染成功后将模板布局添加的父View中
// if (adViewHolder.mAdContainerView != null) {
// //获取视频播放view,该view SDK内部渲染,在媒体平台可配置视频是否自动播放等设置。
// val sWidth: Int
// val sHeight: Int
// val video = ad.expressView // 使用该方式获取广告view,而不是直接使用onRenderSuccess的参数view。
// if (width == TTAdSize.FULL_WIDTH.toFloat() && height == TTAdSize.AUTO_HEIGHT.toFloat()) {
// sWidth = FrameLayout.LayoutParams.MATCH_PARENT
// sHeight = FrameLayout.LayoutParams.WRAP_CONTENT
// } else {
// sWidth = UIUtils.getScreenWidthDp(MintsApplication.getContext()).toInt()
// sHeight = (sWidth * height / width).toInt()
// }
// if (video != null) {
// if (video.parent == null) {
// val layoutParams = FrameLayout.LayoutParams(sWidth, sHeight)
// adViewHolder.mAdContainerView!!.removeAllViews()
// adViewHolder.mAdContainerView!!.addView(video, layoutParams)
// }
// }
// }
// }
// })
// })
//
//
// //视频广告设置播放状态回调(可选)
// ad.setTTVideoListener(object : TTVideoListener {
// override fun onVideoStart() {
// LogUtil.d(TAG, "onVideoStart")
// }
//
// override fun onVideoPause() {
// LogUtil.d(TAG, "onVideoPause")
// }
//
// override fun onVideoResume() {
// LogUtil.d(TAG, "onVideoResume")
// }
//
// override fun onVideoCompleted() {
// LogUtil.d(TAG, "onVideoCompleted")
// }
//
// override fun onVideoError(adError: AdError) {
// LogUtil.d(TAG, "onVideoError")
// }
// })
// })
// } else {
// ad.render()
// if (adViewHolder.mDislike != null) adViewHolder.mDislike.setVisibility(View.GONE)
// } catch (e: Exception) {
// }
// e.printStackTrace()
// }
//设置事件回调
// return convertView
ad
.
setTTNativeAdListener
(
mTTNativeAdListener
)
// }
//可以被点击的view, 也可以把convertView放进来意味item可被点击
//
val
clickViewList
:
MutableList
<
View
>
=
ArrayList
()
// /**
clickViewList
.
add
(
convertView
)
// * @param ad
adViewHolder
.
mSource
?.
let
{
clickViewList
.
add
(
it
)
}
// * @return
adViewHolder
.
mTitle
?.
let
{
clickViewList
.
add
(
it
)
}
// */
adViewHolder
.
mDescription
?.
let
{
clickViewList
.
add
(
it
)
}
// private fun getVerticalAdView(ad: TTNativeAd): View? {
adViewHolder
.
mIcon
?.
let
{
clickViewList
.
add
(
it
)
}
// val convertView = LayoutInflater.from(MintsApplication.getContext()).inflate(R.layout.listitem_ad_vertical_pic, null, false)
//添加点击区域
// val adViewHolder = VerticalAdViewHolder()
if
(
adViewHolder
is
LargeAdViewHolder
)
{
// adViewHolder.mTitle = convertView!!.findViewById(R.id.tv_listitem_ad_title) as TextView
adViewHolder
.
mLargeImage
?.
let
{
clickViewList
.
add
(
it
)
}
// adViewHolder.mSource = convertView.findViewById(R.id.tv_listitem_ad_source) as TextView
}
else
if
(
adViewHolder
is
SmallAdViewHolder
)
{
// adViewHolder.mDescription = convertView.findViewById<View>(R.id.tv_listitem_ad_desc) as TextView
adViewHolder
.
mSmallImage
?.
let
{
clickViewList
.
add
(
it
)
}
// adViewHolder.mVerticalImage = convertView.findViewById(R.id.iv_listitem_image)
}
else
if
(
adViewHolder
is
VerticalAdViewHolder
)
{
// adViewHolder.mIcon = convertView.findViewById<View>(R.id.iv_listitem_icon) as ImageView
adViewHolder
.
mVerticalImage
?.
let
{
clickViewList
.
add
(
it
)
}
// adViewHolder.mDislike = convertView.findViewById<View>(R.id.iv_listitem_dislike) as ImageView
}
else
if
(
adViewHolder
is
VideoAdViewHolder
)
{
// adViewHolder.mCreativeButton = convertView.findViewById<View>(R.id.btn_listitem_creative) as Button
adViewHolder
.
videoView
?.
let
{
clickViewList
.
add
(
it
)
}
// adViewHolder.mLogo = convertView.findViewById(R.id.tt_ad_logo) //logoView 建议传入GroupView类型
}
else
if
(
adViewHolder
is
GroupAdViewHolder
)
{
// val viewBinder: TTViewBinder = TTViewBinder.Builder(R.layout.listitem_ad_vertical_pic)
adViewHolder
.
mGroupImage1
?.
let
{
clickViewList
.
add
(
it
)
}
// .titleId(R.id.tv_listitem_ad_title)
adViewHolder
.
mGroupImage2
?.
let
{
clickViewList
.
add
(
it
)
}
// .decriptionTextId(R.id.tv_listitem_ad_desc)
adViewHolder
.
mGroupImage3
?.
let
{
clickViewList
.
add
(
it
)
}
// .mainImageId(R.id.iv_listitem_image)
}
// .iconImageId(R.id.iv_listitem_icon)
//触发创意广告的view(点击下载或拨打电话)
// .callToActionId(R.id.btn_listitem_creative)
val
creativeViewList
:
MutableList
<
View
>
=
ArrayList
()
// .sourceId(R.id.tv_listitem_ad_source)
adViewHolder
.
mCreativeButton
?.
let
{
creativeViewList
.
add
(
it
)
}
// .logoLayoutId(R.id.tt_ad_logo) //logoView 建议传入GroupView类型
//重要! 这个涉及到广告计费,必须正确调用。convertView必须使用ViewGroup。
// .build()
ad
.
registerView
((
convertView
as
ViewGroup
),
clickViewList
,
creativeViewList
,
viewBinder
)
// adViewHolder.viewBinder = viewBinder
adViewHolder
.
mTitle
?.
text
=
ad
.
title
//title为广告的简单信息提示
// convertView.tag = adViewHolder
adViewHolder
.
mDescription
?.
text
=
ad
.
description
//description为广告的较长的说明
// bindData(convertView, adViewHolder, ad, viewBinder)
adViewHolder
.
mSource
?.
text
=
if
(
TextUtils
.
isEmpty
(
ad
.
source
))
"广告来源"
else
ad
.
source
// if (ad.imageUrl != null) {
val
icon
=
ad
.
iconUrl
// adViewHolder.mVerticalImage?.let { Glide.with(MintsApplication.getContext()).load(ad.imageUrl).into(it) }
if
(
icon
!=
null
)
{
// }
adViewHolder
.
mIcon
?.
let
{
Glide
.
with
(
MintsApplication
.
getContext
()).
load
(
icon
).
into
(
it
)
}
// return convertView
}
// }
val
adCreativeButton
:
Button
?
=
adViewHolder
.
mCreativeButton
//
when
(
ad
.
interactionType
)
{
// //渲染视频广告,以视频广告为例,以下说明
TTAdConstant
.
INTERACTION_TYPE_DOWNLOAD
->
{
// private fun getVideoView(ad: TTNativeAd): View? {
adCreativeButton
?.
visibility
=
View
.
VISIBLE
// val adViewHolder: VideoAdViewHolder
adCreativeButton
?.
text
=
if
(
TextUtils
.
isEmpty
(
ad
.
actionText
))
"立即下载"
else
ad
.
actionText
// val viewBinder: TTViewBinder
}
// val convertView = LayoutInflater.from(MintsApplication.getContext()).inflate(R.layout.listitem_ad_large_video, null, false)
TTAdConstant
.
INTERACTION_TYPE_DIAL
->
{
// try {
adCreativeButton
?.
visibility
=
View
.
VISIBLE
// adViewHolder = VideoAdViewHolder()
adCreativeButton
?.
text
=
"立即拨打"
// 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
TTAdConstant
.
INTERACTION_TYPE_LANDING_PAGE
,
TTAdConstant
.
INTERACTION_TYPE_BROWSER
->
{
// adViewHolder.mSource = convertView.findViewById<View>(R.id.tv_listitem_ad_source) as TextView
adCreativeButton
?.
visibility
=
View
.
VISIBLE
// adViewHolder.videoView = convertView.findViewById<View>(R.id.iv_listitem_video) as FrameLayout
adCreativeButton
?.
text
=
if
(
TextUtils
.
isEmpty
(
ad
.
actionText
))
"查看详情"
else
ad
.
actionText
// adViewHolder.mIcon = convertView.findViewById<View>(R.id.iv_listitem_icon) as ImageView
}
// adViewHolder.mDislike = convertView.findViewById<View>(R.id.iv_listitem_dislike) as ImageView
else
->
{
// adViewHolder.mCreativeButton = convertView.findViewById<View>(R.id.btn_listitem_creative) as Button
adCreativeButton
?.
visibility
=
View
.
GONE
// adViewHolder.mLogo = convertView.findViewById(R.id.tt_ad_logo) //logoView 建议传入GroupView类型
}
//
}
// //TTViewBinder 是必须类,需要开发者在确定好View之后把Id设置给TTViewBinder类,并在注册事件时传递给SDK
}
// viewBinder = TTViewBinder.Builder(R.layout.listitem_ad_large_video)
// .titleId(R.id.tv_listitem_ad_title)
private
class
VideoAdViewHolder
:
AdViewHolder
()
{
// .sourceId(R.id.tv_listitem_ad_source)
var
videoView
:
FrameLayout
?
=
null
// .decriptionTextId(R.id.tv_listitem_ad_desc)
}
// .mediaViewIdId(R.id.iv_listitem_video)
// .callToActionId(R.id.btn_listitem_creative)
private
class
LargeAdViewHolder
:
AdViewHolder
()
{
// .logoLayoutId(R.id.tt_ad_logo)//logoView 建议传入GroupView类型
var
mLargeImage
:
ImageView
?
=
null
// .iconImageId(R.id.iv_listitem_icon)
}
// .build()
// adViewHolder.viewBinder = viewBinder
private
class
SmallAdViewHolder
:
AdViewHolder
()
{
// convertView.tag = adViewHolder
var
mSmallImage
:
ImageView
?
=
null
//
}
// //视频广告设置播放状态回调(可选)
// ad.setTTVideoListener(object : TTVideoListener {
private
class
VerticalAdViewHolder
:
AdViewHolder
()
{
// override fun onVideoStart() {
var
mVerticalImage
:
ImageView
?
=
null
// LogUtil.d(TAG, "onVideoStart")
}
// }
//
private
class
GroupAdViewHolder
:
AdViewHolder
()
{
// override fun onVideoPause() {
var
mGroupImage1
:
ImageView
?
=
null
// LogUtil.d(TAG, "onVideoPause")
var
mGroupImage2
:
ImageView
?
=
null
// }
var
mGroupImage3
:
ImageView
?
=
null
//
}
// override fun onVideoResume() {
// LogUtil.d(TAG, "onVideoResume")
private
class
ExpressAdViewHolder
{
// }
var
mAdContainerView
:
FrameLayout
?
=
null
//
}
// override fun onVideoCompleted() {
// LogUtil.d(TAG, "onVideoCompleted")
private
open
class
AdViewHolder
{
// }
var
viewBinder
:
TTViewBinder
?
=
null
//
var
mIcon
:
ImageView
?
=
null
// override fun onVideoError(adError: AdError) {
var
mDislike
:
ImageView
?
=
null
// LogUtil.d(TAG, "onVideoError")
var
mCreativeButton
:
Button
?
=
null
// }
var
mTitle
:
TextView
?
=
null
// })
var
mDescription
:
TextView
?
=
null
//
var
mSource
:
TextView
?
=
null
// //绑定广告数据、设置交互回调
var
mLogo
:
RelativeLayout
?
=
null
// bindData(convertView, adViewHolder, ad, viewBinder)
}
// } catch (e: Exception) {
// e.printStackTrace()
private
var
mTTNativeAdListener
:
TTNativeAdListener
=
object
:
TTNativeAdListener
{
// }
override
fun
onAdClick
()
{
// return convertView
LogUtil
.
d
(
TAG
,
"onAdClick"
)
// }
}
//
// private fun getLargeAdView(ad: TTNativeAd): View? {
override
fun
onAdShow
()
{
// val convertView = LayoutInflater.from(MintsApplication.getContext()).inflate(R.layout.listitem_ad_large_pic, null, false)
LogUtil
.
d
(
TAG
,
"onAdShow"
)
// val adViewHolder = LargeAdViewHolder()
}
// adViewHolder.mTitle = convertView!!.findViewById<View>(R.id.tv_listitem_ad_title) as TextView
}
// adViewHolder.mDescription = convertView.findViewById<View>(R.id.tv_listitem_ad_desc) as TextView
// 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
\ No newline at end of file
// 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(R.id.tt_ad_logo) //logoView 建议传入GroupView类型
// val viewBinder: TTViewBinder = TTViewBinder.Builder(R.layout.listitem_ad_large_pic)
// .titleId(R.id.tv_listitem_ad_title)
// .decriptionTextId(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)//logoView 建议传入GroupView类型
// .iconImageId(R.id.iv_listitem_icon)
// .build()
// adViewHolder.viewBinder = viewBinder
// convertView.tag = adViewHolder
// bindData(convertView, adViewHolder, ad, viewBinder)
// if (ad.imageUrl != null) {
// adViewHolder.mLargeImage?.let { Glide.with(MintsApplication.getContext()).load(ad.imageUrl).into(it) }
// }
// return convertView
// }
//
// private fun getGroupAdView(ad: TTNativeAd): View? {
// val convertView = LayoutInflater.from(MintsApplication.getContext()).inflate(R.layout.listitem_ad_group_pic, null, false)
// val adViewHolder = GroupAdViewHolder()
// adViewHolder.mTitle = convertView!!.findViewById(R.id.tv_listitem_ad_title) as TextView
// adViewHolder.mSource = convertView.findViewById(R.id.tv_listitem_ad_source) as TextView
// adViewHolder.mDescription = convertView.findViewById(R.id.tv_listitem_ad_desc) as TextView
// adViewHolder.mGroupImage1 = convertView.findViewById(R.id.iv_listitem_image1) as ImageView
// 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
// adViewHolder.mDislike = convertView.findViewById(R.id.iv_listitem_dislike) as ImageView
// adViewHolder.mCreativeButton = convertView.findViewById(R.id.btn_listitem_creative) as Button
// adViewHolder.mLogo = convertView.findViewById(R.id.tt_ad_logo) //logoView 建议传入GroupView类型
// val viewBinder: TTViewBinder = TTViewBinder.Builder(R.layout.listitem_ad_group_pic)
// .titleId(R.id.tv_listitem_ad_title)
// .decriptionTextId(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)//logoView 建议传入GroupView类型
// .callToActionId(R.id.btn_listitem_creative)
// .iconImageId(R.id.iv_listitem_icon)
// .build()
// adViewHolder.viewBinder = viewBinder
// convertView.tag = adViewHolder
// bindData(convertView, adViewHolder, ad, viewBinder)
// if (ad.imageList != null && ad.imageList.size >= 3) {
// val image1 = ad.imageList[0]
// val image2 = ad.imageList[1]
// val image3 = ad.imageList[2]
// if (image1 != null) {
// adViewHolder.mGroupImage1?.let { Glide.with(MintsApplication.getContext()).load(image1).into(it) }
// }
// if (image2 != null) {
// adViewHolder.mGroupImage2?.let { Glide.with(MintsApplication.getContext()).load(image2).into(it) }
// }
// if (image3 != null) {
// adViewHolder.mGroupImage3?.let { Glide.with(MintsApplication.getContext()).load(image3).into(it) }
// }
// }
// return convertView
// }
//
// private fun getSmallAdView(ad: TTNativeAd): View? {
// val convertView = LayoutInflater.from(MintsApplication.getContext()).inflate(R.layout.listitem_ad_small_pic, null, false)
// val adViewHolder = SmallAdViewHolder()
// adViewHolder.mTitle = convertView!!.findViewById<View>(R.id.tv_listitem_ad_title) as TextView
// adViewHolder.mSource = convertView.findViewById<View>(R.id.tv_listitem_ad_source) as TextView
// 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
// val viewBinder: TTViewBinder = TTViewBinder.Builder(R.layout.listitem_ad_small_pic)
// .titleId(R.id.tv_listitem_ad_title)
// .sourceId(R.id.tv_listitem_ad_source)
// .decriptionTextId(R.id.tv_listitem_ad_desc)
// .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()
// adViewHolder.viewBinder = viewBinder
// convertView.tag = adViewHolder
//
// bindData(convertView, adViewHolder, ad, viewBinder)
// if (ad.imageUrl != null) {
// adViewHolder.mSmallImage?.let { Glide.with(MintsApplication.getContext()).load(ad.imageUrl).into(it) }
// }
// return convertView
// }
//
// private fun bindData(convertView: View, adViewHolder: AdViewHolder, ad: TTNativeAd, viewBinder: TTViewBinder) {
// //设置dislike弹窗,如果有
//// if (ad.hasDislike()) {
//// val ttAdDislike = ad.getDislikeDialog( MintsApplication.getContext() as Activity?)
//// adViewHolder.mDislike.setVisibility(View.VISIBLE)
//// adViewHolder.mDislike.setOnClickListener(View.OnClickListener {
//// //使用接口来展示
//// ttAdDislike.showDislikeDialog()
//// ttAdDislike.setDislikeCallback(object : TTDislikeCallback {
//// override fun onSelected(position: Int, value: String) {}
////
//// override fun onCancel() {}
////
//// /**
//// * 拒绝再次提交
//// */
//// /**
//// * 拒绝再次提交
//// */
//// override fun onRefuse() {}
//// override fun onShow() {}
//// })
//// })
//// } else {
//// if (adViewHolder.mDislike != null) adViewHolder.mDislike.setVisibility(View.GONE)
//// }
//
// //设置事件回调
// ad.setTTNativeAdListener(mTTNativeAdListener)
// //可以被点击的view, 也可以把convertView放进来意味item可被点击
// val clickViewList: MutableList<View> = ArrayList()
// clickViewList.add(convertView)
// adViewHolder.mSource?.let { clickViewList.add(it) }
// adViewHolder.mTitle?.let { clickViewList.add(it) }
// adViewHolder.mDescription?.let { clickViewList.add(it) }
// adViewHolder.mIcon?.let { clickViewList.add(it) }
// //添加点击区域
// if (adViewHolder is LargeAdViewHolder) {
// adViewHolder.mLargeImage?.let { clickViewList.add(it) }
// } else if (adViewHolder is SmallAdViewHolder) {
// adViewHolder.mSmallImage?.let { clickViewList.add(it) }
// } else if (adViewHolder is VerticalAdViewHolder) {
// adViewHolder.mVerticalImage?.let { clickViewList.add(it) }
// } else if (adViewHolder is VideoAdViewHolder) {
// adViewHolder.videoView?.let { clickViewList.add(it) }
// } else if (adViewHolder is GroupAdViewHolder) {
// adViewHolder.mGroupImage1?.let { clickViewList.add(it) }
// adViewHolder.mGroupImage2?.let { clickViewList.add(it) }
// adViewHolder.mGroupImage3?.let { clickViewList.add(it) }
// }
// //触发创意广告的view(点击下载或拨打电话)
// val creativeViewList: MutableList<View> = ArrayList()
// adViewHolder.mCreativeButton?.let { creativeViewList.add(it) }
// //重要! 这个涉及到广告计费,必须正确调用。convertView必须使用ViewGroup。
// ad.registerView((convertView as ViewGroup), clickViewList, creativeViewList, viewBinder)
// adViewHolder.mTitle?.text = ad.title //title为广告的简单信息提示
// adViewHolder.mDescription?.text = ad.description //description为广告的较长的说明
// adViewHolder.mSource?.text = if (TextUtils.isEmpty(ad.source)) "广告来源" else ad.source
// val icon = ad.iconUrl
// if (icon != null) {
// adViewHolder.mIcon?.let { Glide.with(MintsApplication.getContext()).load(icon).into(it) }
// }
// val adCreativeButton: Button? = adViewHolder.mCreativeButton
// when (ad.interactionType) {
// TTAdConstant.INTERACTION_TYPE_DOWNLOAD -> {
// adCreativeButton?.visibility = View.VISIBLE
// adCreativeButton?.text = if (TextUtils.isEmpty(ad.actionText)) "立即下载" else ad.actionText
// }
// TTAdConstant.INTERACTION_TYPE_DIAL -> {
// adCreativeButton?.visibility = View.VISIBLE
// adCreativeButton?.text = "立即拨打"
// }
// TTAdConstant.INTERACTION_TYPE_LANDING_PAGE, TTAdConstant.INTERACTION_TYPE_BROWSER -> {
// adCreativeButton?.visibility = View.VISIBLE
// adCreativeButton?.text = if (TextUtils.isEmpty(ad.actionText)) "查看详情" else ad.actionText
// }
// else -> {
// adCreativeButton?.visibility = View.GONE
// }
// }
// }
//
// 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
// }
//
// private open class AdViewHolder {
// var viewBinder: TTViewBinder? = 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
// }
//
// private var mTTNativeAdListener: TTNativeAdListener = object : TTNativeAdListener {
// override fun onAdClick() {
// LogUtil.d(TAG, "onAdClick")
// }
//
// override fun onAdShow() {
// LogUtil.d(TAG, "onAdShow")
// }
// }
//
//}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/express/KsPreLoadExpressManager.kt
View file @
6bdad092
...
@@ -13,6 +13,8 @@ import android.widget.TextView
...
@@ -13,6 +13,8 @@ import android.widget.TextView
import
com.bumptech.glide.Glide
import
com.bumptech.glide.Glide
import
com.kwad.sdk.api.*
import
com.kwad.sdk.api.*
import
com.kwad.sdk.api.KsNativeAd.VideoPlayListener
import
com.kwad.sdk.api.KsNativeAd.VideoPlayListener
import
com.kwad.sdk.api.model.InteractionType
import
com.kwad.sdk.api.model.MaterialType
import
com.mints.goodmoney.MintsApplication
import
com.mints.goodmoney.MintsApplication
import
com.mints.goodmoney.R
import
com.mints.goodmoney.R
import
com.mints.goodmoney.manager.KsManager
import
com.mints.goodmoney.manager.KsManager
...
@@ -59,15 +61,15 @@ object KsPreLoadExpressManager {
...
@@ -59,15 +61,15 @@ object KsPreLoadExpressManager {
val
adView
:
View
val
adView
:
View
// 判断广告素材类型
// 判断广告素材类型
when
(
ksNativeAd
.
materialType
)
{
when
(
ksNativeAd
.
materialType
)
{
KsNativeAd
.
MaterialType
.
VIDEO
->
{
MaterialType
.
VIDEO
->
{
// 视频素材,渲染自定义的视频广告
// 视频素材,渲染自定义的视频广告
adView
=
getVideoItemView
(
parent
,
ksNativeAd
)
!!
adView
=
getVideoItemView
(
parent
,
ksNativeAd
)
!!
}
}
KsNativeAd
.
MaterialType
.
SINGLE_IMG
->
{
MaterialType
.
SINGLE_IMG
->
{
// 单图素材,渲染自定义的单图广告
// 单图素材,渲染自定义的单图广告
adView
=
getSingleImageItemView
(
parent
,
ksNativeAd
)
!!
adView
=
getSingleImageItemView
(
parent
,
ksNativeAd
)
!!
}
}
KsNativeAd
.
MaterialType
.
GROUP_IMG
->
{
MaterialType
.
GROUP_IMG
->
{
// 组图素材,渲染自定义的组图广告
// 组图素材,渲染自定义的组图广告
adView
=
getGroupImageItemView
(
parent
,
ksNativeAd
)
!!
adView
=
getGroupImageItemView
(
parent
,
ksNativeAd
)
!!
}
}
...
@@ -196,6 +198,10 @@ object KsPreLoadExpressManager {
...
@@ -196,6 +198,10 @@ object KsPreLoadExpressManager {
override
fun
handleDownloadDialog
(
p0
:
DialogInterface
.
OnClickListener
?):
Boolean
{
override
fun
handleDownloadDialog
(
p0
:
DialogInterface
.
OnClickListener
?):
Boolean
{
return
false
return
false
}
}
override
fun
onDownloadTipsDialogShow
()
{}
override
fun
onDownloadTipsDialogDismiss
()
{}
})
})
// 广告描述
// 广告描述
...
@@ -215,7 +221,7 @@ object KsPreLoadExpressManager {
...
@@ -215,7 +221,7 @@ object KsPreLoadExpressManager {
// 获取app下载次数文案,例如:800W此下载,自行渲染。
// 获取app下载次数文案,例如:800W此下载,自行渲染。
Log
.
d
(
"AppInfo"
,
"app下载次数文案 = "
+
ad
.
appDownloadCountDes
)
Log
.
d
(
"AppInfo"
,
"app下载次数文案 = "
+
ad
.
appDownloadCountDes
)
when
(
ad
.
interactionType
)
{
when
(
ad
.
interactionType
)
{
KsNativeAd
.
InteractionType
.
H5
->
{
InteractionType
.
H5
->
{
// 广告描述
// 广告描述
adBaseViewHolder
.
mH5Desc
.
text
=
ad
.
adDescription
adBaseViewHolder
.
mH5Desc
.
text
=
ad
.
adDescription
// 广告转化文案
// 广告转化文案
...
@@ -223,7 +229,7 @@ object KsPreLoadExpressManager {
...
@@ -223,7 +229,7 @@ object KsPreLoadExpressManager {
adBaseViewHolder
.
mAppContainer
.
visibility
=
View
.
GONE
adBaseViewHolder
.
mAppContainer
.
visibility
=
View
.
GONE
adBaseViewHolder
.
mH5Container
.
visibility
=
View
.
VISIBLE
adBaseViewHolder
.
mH5Container
.
visibility
=
View
.
VISIBLE
}
}
KsNativeAd
.
InteractionType
.
DOWNLOAD
->
{
InteractionType
.
DOWNLOAD
->
{
// appIcon,非下载类型的没有
// appIcon,非下载类型的没有
if
(
TextUtils
.
isEmpty
(
ad
.
appIconUrl
))
{
if
(
TextUtils
.
isEmpty
(
ad
.
appIconUrl
))
{
adBaseViewHolder
.
mAppIcon
.
visibility
=
View
.
GONE
adBaseViewHolder
.
mAppIcon
.
visibility
=
View
.
GONE
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/express/PreLoadExpressManager.kt
View file @
6bdad092
package
com.mints.goodmoney.ad.express
package
com.mints.goodmoney.ad.express
import
android.annotation.SuppressLint
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewGroup
import
android.widget.FrameLayout
import
android.widget.FrameLayout
import
com.bytedance.msdk.api.nativeAd.TTNativeAd
import
com.mints.goodmoney.MintsApplication
import
com.mints.goodmoney.MintsApplication
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.mvp.model.WeightBean
import
com.mints.goodmoney.mvp.model.WeightBean
...
@@ -11,11 +11,12 @@ import com.mints.goodmoney.utils.LogUtil
...
@@ -11,11 +11,12 @@ import com.mints.goodmoney.utils.LogUtil
import
com.qq.e.ads.nativ.NativeExpressADView
import
com.qq.e.ads.nativ.NativeExpressADView
import
java.util.*
import
java.util.*
/**
/**
* 预加载信息流管理类
* 预加载信息流管理类
*/
*/
object
PreLoadExpressManager
:
TTADLoadSuccessListener
,
YLHADLoadSuccessListener
,
KSADLoadSuccessListener
,
GMADLoadSuccessListener
{
@SuppressLint
(
"StaticFieldLeak"
)
object
PreLoadExpressManager
:
TTADLoadSuccessListener
,
YLHADLoadSuccessListener
,
KSADLoadSuccessListener
{
private
val
TAG
=
PreLoadExpressManager
::
class
.
java
.
simpleName
private
val
TAG
=
PreLoadExpressManager
::
class
.
java
.
simpleName
...
@@ -36,7 +37,7 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
...
@@ -36,7 +37,7 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
YlhPreLoadExpressManager
.
setListener
(
this
)
YlhPreLoadExpressManager
.
setListener
(
this
)
TTPreLoadExpressManager
.
getInstance
().
setListener
(
this
)
TTPreLoadExpressManager
.
getInstance
().
setListener
(
this
)
KsPreLoadExpressManager
.
setListener
(
this
)
KsPreLoadExpressManager
.
setListener
(
this
)
GroMoreExpressManager
.
instance
.
setListener
(
this
)
//
GroMoreExpressManager.instance.setListener(this)
}
}
fun
init
(
csjWeight
:
Int
,
ylhWeight
:
Int
,
ksWeight
:
Int
,
gmWeight
:
Int
)
{
fun
init
(
csjWeight
:
Int
,
ylhWeight
:
Int
,
ksWeight
:
Int
,
gmWeight
:
Int
)
{
...
@@ -62,10 +63,11 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
...
@@ -62,10 +63,11 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
// }
// }
when
(
getRandomWeight
())
{
when
(
getRandomWeight
())
{
Constant
.
CSJ_EXPRESS_AD
->
TTPreLoadExpressManager
.
getInstance
().
loadTtFrameLayout
(
mAdFrameLayout
)
Constant
.
CSJ_EXPRESS_AD
->
TTPreLoadExpressManager
.
getInstance
()
.
loadTtFrameLayout
(
mAdFrameLayout
)
Constant
.
YLH_EXPRESS_AD
->
YlhPreLoadExpressManager
.
loadYlhFrameLayout
()
Constant
.
YLH_EXPRESS_AD
->
YlhPreLoadExpressManager
.
loadYlhFrameLayout
()
Constant
.
KS_EXPRESS_AD
->
KsPreLoadExpressManager
.
loadKsFrameLayout
(
mAdFrameLayout
as
ViewGroup
)
Constant
.
KS_EXPRESS_AD
->
KsPreLoadExpressManager
.
loadKsFrameLayout
(
mAdFrameLayout
as
ViewGroup
)
Constant
.
GM_EXPRESS_AD
->
GroMoreExpressManager
.
instance
.
loadADFrameLayout
()
//
Constant.GM_EXPRESS_AD -> GroMoreExpressManager.instance.loadADFrameLayout()
else
->
{
else
->
{
TTPreLoadExpressManager
.
getInstance
().
loadTtFrameLayout
(
mAdFrameLayout
)
TTPreLoadExpressManager
.
getInstance
().
loadTtFrameLayout
(
mAdFrameLayout
)
}
}
...
@@ -152,12 +154,12 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
...
@@ -152,12 +154,12 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
mAdFrameLayout
?.
addView
(
view
)
mAdFrameLayout
?.
addView
(
view
)
}
}
override
fun
onGMAdLoadSuc
(
ttNativeAd
:
TTNativeAd
?)
{
//
override fun onGMAdLoadSuc(ttNativeAd: TTNativeAd?) {
// if (currentIndex == 3) {
// if (currentIndex == 3) {
// mAdFrameLayout?.addView(view)
// mAdFrameLayout?.addView(view)
// }
// }
mAdFrameLayout
?.
addView
(
ttNativeAd
?.
expressView
)
//
mAdFrameLayout?.addView(ttNativeAd?.expressView)
}
//
}
}
}
...
@@ -173,6 +175,6 @@ interface KSADLoadSuccessListener {
...
@@ -173,6 +175,6 @@ interface KSADLoadSuccessListener {
fun
onKSAdLoadSuc
(
ksNativeAd
:
View
?)
fun
onKSAdLoadSuc
(
ksNativeAd
:
View
?)
}
}
interface
GMADLoadSuccessListener
{
//interface GMADLoadSuccessListener {
fun
onGMAdLoadSuc
(
ttNativeAd
:
TTNativeAd
?)
// fun onGMAdLoadSuc(ttNativeAd: TTNativeAd?)
}
//}
\ No newline at end of file
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/video/CsjFullVideoAdManager.java
View file @
6bdad092
...
@@ -141,6 +141,10 @@ public class CsjFullVideoAdManager extends BaseVideoAd {
...
@@ -141,6 +141,10 @@ public class CsjFullVideoAdManager extends BaseVideoAd {
}
}
}
}
}
}
@Override
public
void
onFullScreenVideoCached
(
TTFullScreenVideoAd
ttFullScreenVideoAd
)
{
}
});
});
}
}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/video/CsjGroMoreVideoAdManager.java
View file @
6bdad092
package
com
.
mints
.
goodmoney
.
ad
.
video
;
//package com.mints.goodmoney.ad.video;
//
import
android.app.Activity
;
//import android.app.Activity;
import
android.util.Log
;
//import android.util.Log;
//
import
com.bytedance.msdk.adapter.util.Logger
;
//import com.bytedance.msdk.adapter.util.Logger;
import
com.bytedance.msdk.api.AdError
;
//import com.bytedance.msdk.api.AdError;
import
com.bytedance.msdk.api.AdSlot
;
//import com.bytedance.msdk.api.AdSlot;
import
com.bytedance.msdk.api.TTAdConstant
;
//import com.bytedance.msdk.api.TTAdConstant;
import
com.bytedance.msdk.api.TTMediationAdSdk
;
//import com.bytedance.msdk.api.TTMediationAdSdk;
import
com.bytedance.msdk.api.TTSettingConfigCallback
;
//import com.bytedance.msdk.api.TTSettingConfigCallback;
import
com.bytedance.msdk.api.TTVideoOption
;
//import com.bytedance.msdk.api.TTVideoOption;
import
com.bytedance.msdk.api.reward.RewardItem
;
//import com.bytedance.msdk.api.reward.RewardItem;
import
com.bytedance.msdk.api.reward.TTRewardAd
;
//import com.bytedance.msdk.api.reward.TTRewardAd;
import
com.bytedance.msdk.api.reward.TTRewardedAdListener
;
//import com.bytedance.msdk.api.reward.TTRewardedAdListener;
import
com.bytedance.msdk.api.reward.TTRewardedAdLoadCallback
;
//import com.bytedance.msdk.api.reward.TTRewardedAdLoadCallback;
import
com.bytedance.sdk.openadsdk.TTAdNative
;
//import com.bytedance.sdk.openadsdk.TTAdNative;
import
com.bytedance.sdk.openadsdk.TTAppDownloadListener
;
//import com.bytedance.sdk.openadsdk.TTAppDownloadListener;
import
com.bytedance.sdk.openadsdk.TTRewardVideoAd
;
//import com.bytedance.sdk.openadsdk.TTRewardVideoAd;
import
com.mints.goodmoney.BuildConfig
;
//import com.mints.goodmoney.BuildConfig;
import
com.mints.goodmoney.ad.video.base.BaseVideoAd
;
//import com.mints.goodmoney.ad.video.base.BaseVideoAd;
import
com.mints.goodmoney.ad.video.base.VideoAdStatusListener
;
//import com.mints.goodmoney.ad.video.base.VideoAdStatusListener;
import
com.mints.goodmoney.common.AppConfig
;
//import com.mints.goodmoney.common.AppConfig;
import
com.mints.goodmoney.common.Constant
;
//import com.mints.goodmoney.common.Constant;
import
com.mints.goodmoney.manager.TTNativeExpressManager
;
//import com.mints.goodmoney.manager.TTNativeExpressManager;
import
com.mints.goodmoney.manager.TrackManager
;
//import com.mints.goodmoney.manager.TrackManager;
import
com.mints.goodmoney.manager.TtCsjAdManager
;
//import com.mints.goodmoney.manager.TtCsjAdManager;
import
com.mints.goodmoney.manager.UserManager
;
//import com.mints.goodmoney.manager.UserManager;
import
com.mints.goodmoney.utils.LogUtil
;
//import com.mints.goodmoney.utils.LogUtil;
import
com.mints.goodmoney.utils.MD5
;
//import com.mints.goodmoney.utils.MD5;
import
com.mints.library.utils.json.JsonUtil
;
//import com.mints.library.utils.json.JsonUtil;
//
import
net.grandcentrix.tray.AppPreferences
;
//import net.grandcentrix.tray.AppPreferences;
//
import
java.util.HashMap
;
//import java.util.HashMap;
import
java.util.Map
;
//import java.util.Map;
//
/**
///**
* GroMore激励视频广告
// * GroMore激励视频广告
*/
// */
public
class
CsjGroMoreVideoAdManager
extends
BaseVideoAd
{
//public class CsjGroMoreVideoAdManager extends BaseVideoAd {
//
private
static
final
String
TAG
=
CsjGroMoreVideoAdManager
.
class
.
getSimpleName
();
// private static final String TAG = CsjGroMoreVideoAdManager.class.getSimpleName();
//
private
static
CsjGroMoreVideoAdManager
_inst
;
// private static CsjGroMoreVideoAdManager _inst;
private
int
curCoin
;
// private int curCoin;
private
String
extraId
;
// private String extraId;
private
String
carrierType
;
// private String carrierType;
private
VideoAdStatusListener
videoAdStatusListener
;
// private VideoAdStatusListener videoAdStatusListener;
//
private
TTRewardAd
mttRewardAd
;
// private TTRewardAd mttRewardAd;
//
private
Activity
activity
;
// private Activity activity;
//
private
String
adUnitId
=
"946018378"
;
//代码位
// private String adUnitId = "946018378"; //代码位
//
private
boolean
isClickScreen
=
true
;
// 是否点击屏幕跳转广告
// private boolean isClickScreen = true; // 是否点击屏幕跳转广告
//
public
static
CsjGroMoreVideoAdManager
getInstance
(
Activity
activity
)
{
// public static CsjGroMoreVideoAdManager getInstance(Activity activity) {
if
(
_inst
==
null
)
{
// if (_inst == null) {
_inst
=
new
CsjGroMoreVideoAdManager
(
activity
);
// _inst = new CsjGroMoreVideoAdManager(activity);
}
// }
return
_inst
;
// return _inst;
}
// }
//
private
CsjGroMoreVideoAdManager
(
Activity
activity
)
{
// private CsjGroMoreVideoAdManager(Activity activity) {
init
(
activity
);
// init(activity);
}
// }
//
private
void
init
(
Activity
activity
)
{
// private void init(Activity activity) {
this
.
activity
=
activity
;
// this.activity = activity;
//
}
// }
//
@Override
// @Override
public
void
onDestroy
()
{
// public void onDestroy() {
TTMediationAdSdk
.
unregisterConfigCallback
(
mSettingConfigCallback
);
// TTMediationAdSdk.unregisterConfigCallback(mSettingConfigCallback);
if
(
mttRewardAd
!=
null
)
{
// if (mttRewardAd != null) {
mttRewardAd
.
destroy
();
// mttRewardAd.destroy();
}
// }
//
activity
=
null
;
// activity = null;
}
// }
//
/**
// /**
* 激励视频
// * 激励视频
*
// *
* @param carrierType
// * @param carrierType
*/
// */
@Override
// @Override
public
void
loadAd
(
Activity
activity
,
int
curCoin
,
String
carrierType
,
String
extraId
)
{
// public void loadAd(Activity activity, int curCoin, String carrierType, String extraId) {
this
.
activity
=
activity
;
// this.activity = activity;
isClickScreen
=
true
;
// isClickScreen = true;
this
.
curCoin
=
curCoin
;
// this.curCoin = curCoin;
this
.
extraId
=
extraId
;
// this.extraId = extraId;
this
.
carrierType
=
carrierType
;
// this.carrierType = carrierType;
/**
// /**
* 判断当前是否存在config 配置 ,如果存在直接加载广告 ,如果不存在则注册config加载回调
// * 判断当前是否存在config 配置 ,如果存在直接加载广告 ,如果不存在则注册config加载回调
*/
// */
if
(
TTMediationAdSdk
.
configLoadSuccess
())
{
// if (TTMediationAdSdk.configLoadSuccess()) {
loadAd
(
adUnitId
,
TTAdConstant
.
VERTICAL
);
// loadAd(adUnitId, TTAdConstant.VERTICAL);
}
else
{
// } else {
TTMediationAdSdk
.
registerConfigCallback
(
mSettingConfigCallback
);
//不用使用内部类,否则在ondestory中无法移除该回调
// TTMediationAdSdk.registerConfigCallback(mSettingConfigCallback); //不用使用内部类,否则在ondestory中无法移除该回调
}
// }
}
// }
//
/**
// /**
* config回调
// * config回调
*/
// */
private
TTSettingConfigCallback
mSettingConfigCallback
=
new
TTSettingConfigCallback
()
{
// private TTSettingConfigCallback mSettingConfigCallback = new TTSettingConfigCallback() {
@Override
// @Override
public
void
configLoad
()
{
// public void configLoad() {
loadAd
(
adUnitId
,
TTAdConstant
.
VERTICAL
);
// loadAd(adUnitId, TTAdConstant.VERTICAL);
}
// }
};
// };
//
private
void
loadAd
(
final
String
adUnitId
,
int
orientation
)
{
// private void loadAd(final String adUnitId, int orientation) {
/**
// /**
* 注:每次加载激励视频广告的时候需要新建一个TTRewardAd,否则可能会出现广告填充问题
// * 注:每次加载激励视频广告的时候需要新建一个TTRewardAd,否则可能会出现广告填充问题
* ( 例如:mttRewardAd = new TTRewardAd(this, adUnitId);)
// * ( 例如:mttRewardAd = new TTRewardAd(this, adUnitId);)
*/
// */
mttRewardAd
=
new
TTRewardAd
(
activity
,
adUnitId
);
// mttRewardAd = new TTRewardAd(activity, adUnitId);
//
TTVideoOption
videoOption
=
new
TTVideoOption
.
Builder
()
// TTVideoOption videoOption = new TTVideoOption.Builder()
.
setMuted
(
true
)
//对所有SDK的激励广告生效,除需要在平台配置的SDK,如穿山甲SDK
// .setMuted(true)//对所有SDK的激励广告生效,除需要在平台配置的SDK,如穿山甲SDK
.
setAdmobAppVolume
(
0
f
)
//配合Admob的声音大小设置[0-1]
// .setAdmobAppVolume(0f)//配合Admob的声音大小设置[0-1]
.
build
();
// .build();
//
// Map<String, String> customData = new HashMap<>();
//// Map<String, String> customData = new HashMap<>();
// customData.put(com.bytedance.msdk.api.AdSlot.CUSTOM_DATA_KEY_PANGLE, "pangle media_extra");
//// customData.put(com.bytedance.msdk.api.AdSlot.CUSTOM_DATA_KEY_PANGLE, "pangle media_extra");
// customData.put(com.bytedance.msdk.api.AdSlot.CUSTOM_DATA_KEY_GDT, "gdt custom data");
//// customData.put(com.bytedance.msdk.api.AdSlot.CUSTOM_DATA_KEY_GDT, "gdt custom data");
// customData.put(com.bytedance.msdk.api.AdSlot.CUSTOM_DATA_KEY_KS, "ks custom data");
//// customData.put(com.bytedance.msdk.api.AdSlot.CUSTOM_DATA_KEY_KS, "ks custom data");
// 其他需要透传给adn的数据。
// // 其他需要透传给adn的数据。
//
//创建广告请求参数AdSlot,具体参数含义参考文档
// //创建广告请求参数AdSlot,具体参数含义参考文档
com
.
bytedance
.
msdk
.
api
.
AdSlot
.
Builder
adSlotBuilder
=
new
com
.
bytedance
.
msdk
.
api
.
AdSlot
.
Builder
()
// com.bytedance.msdk.api.AdSlot.Builder adSlotBuilder = new com.bytedance.msdk.api.AdSlot.Builder()
.
setTTVideoOption
(
videoOption
)
// .setTTVideoOption(videoOption)
.
setUserID
(
UserManager
.
getInstance
().
getUserID
())
//用户id,必传参数
// .setUserID(UserManager.getInstance().getUserID())//用户id,必传参数
.
setAdStyleType
(
AdSlot
.
TYPE_EXPRESS_AD
)
// 确保该聚合广告位下所有gdt代码位都是同一种类型(模版或非模版)。
// .setAdStyleType(AdSlot.TYPE_EXPRESS_AD) // 确保该聚合广告位下所有gdt代码位都是同一种类型(模版或非模版)。
.
setOrientation
(
orientation
);
//必填参数,期望视频的播放方向:TTAdConstant.HORIZONTAL 或 TTAdConstant.VERTICAL
// .setOrientation(orientation);//必填参数,期望视频的播放方向:TTAdConstant.HORIZONTAL 或 TTAdConstant.VERTICAL
//
//请求广告
// //请求广告
mttRewardAd
.
loadRewardAd
(
adSlotBuilder
.
build
(),
new
TTRewardedAdLoadCallback
()
{
// mttRewardAd.loadRewardAd(adSlotBuilder.build(), new TTRewardedAdLoadCallback() {
//
@Override
// @Override
public
void
onRewardVideoLoadFail
(
AdError
adError
)
{
// public void onRewardVideoLoadFail(AdError adError) {
TrackManager
.
getInstance
().
addCallImp
(
Constant
.
AD_SOURCE_GROMORE
,
Constant
.
EVENT_TYPE_ONE
,
String
.
valueOf
(
adError
.
code
),
adError
.
message
);
// TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_GROMORE, Constant.EVENT_TYPE_ONE, String.valueOf(adError.code), adError.message);
//
//
LogUtil
.
d
(
TAG
,
"onError "
+
String
.
valueOf
(
adError
.
code
)
+
adError
.
message
);
// LogUtil.d(TAG, "onError " + String.valueOf(adError.code) + adError.message);
if
(
videoAdStatusListener
!=
null
)
{
// if (videoAdStatusListener != null) {
videoAdStatusListener
.
adFail
();
// videoAdStatusListener.adFail();
}
// }
}
// }
//
@Override
// @Override
public
void
onRewardVideoAdLoad
()
{
// public void onRewardVideoAdLoad() {
}
// }
//
@Override
// @Override
public
void
onRewardVideoCached
()
{
// public void onRewardVideoCached() {
if
(
mttRewardAd
!=
null
)
{
// if (mttRewardAd != null) {
//在获取到广告后展示,强烈建议在onRewardVideoCached回调后,展示广告,提升播放体验
// //在获取到广告后展示,强烈建议在onRewardVideoCached回调后,展示广告,提升播放体验
//该方法直接展示广告
// //该方法直接展示广告
//展示广告,并传入广告展示的场景
// //展示广告,并传入广告展示的场景
mttRewardAd
.
showRewardAd
(
activity
,
mTTRewardedAdListener
);
// mttRewardAd.showRewardAd(activity, mTTRewardedAdListener);
//
LogUtil
.
d
(
TAG
,
"adNetworkPlatformId: "
+
mttRewardAd
.
getAdNetworkPlatformId
());
//获取展示广告对应的adn的值 具体值见NetworkPlatformConst类 -3: 无权限 -2: 暂无数据
LogUtil
.
d
(
TAG
,
"adNetworkRitId:"
+
mttRewardAd
.
getAdNetworkRitId
());
//获取展示广告对应的代码位 具体值见NetworkPlatformConst类 "-3": 无权限 "-2"
LogUtil
.
d
(
TAG
,
"preEcpm: "
+
mttRewardAd
.
getPreEcpm
());
//获取展示广告预估ecpm价格,单位是分 具体值见NetworkPlatformConst类 "-3": 无权限 "-2": 暂无数据 "-1":平台未有填写的预估ecpm价格
}
else
{
TrackManager
.
getInstance
().
addCallImp
(
Constant
.
AD_SOURCE_GROMORE
,
Constant
.
EVENT_TYPE_ONE
,
"999999"
,
"Cached Fail"
);
LogUtil
.
d
(
TAG
,
" onRewardVideoCached onError "
);
if
(
videoAdStatusListener
!=
null
)
{
videoAdStatusListener
.
adFail
();
}
}
}
});
}
/**
* 激励视频交互回调
*/
private
TTRewardedAdListener
mTTRewardedAdListener
=
new
TTRewardedAdListener
()
{
/**
* 广告的展示回调 每个广告仅回调一次
*/
public
void
onRewardedAdShow
()
{
LogUtil
.
d
(
TAG
,
"onRewardedAdShow"
);
TrackManager
.
getInstance
().
addCallImp
(
Constant
.
AD_SOURCE_GROMORE
,
Constant
.
EVENT_TYPE_ZERO
,
""
,
""
);
}
/**
* 注意Admob的激励视频不会回调该方法
*/
@Override
public
void
onRewardClick
()
{
LogUtil
.
d
(
TAG
,
"onRewardClick"
);
if
(
AppConfig
.
needReportClickAdEvent
)
{
TrackManager
.
getInstance
().
reportClickAdEvent
();
}
TrackManager
.
getInstance
().
addCallImp
(
Constant
.
AD_SOURCE_GROMORE
,
Constant
.
EVENT_TYPE_TWO
,
""
,
""
);
if
(
isClickScreen
)
{
// 防止重复
TrackManager
.
getInstance
().
addCallImp
(
Constant
.
AD_SOURCE_GROMORE
,
Constant
.
EVENT_TYPE_FOUR
,
""
,
""
);
isClickScreen
=
false
;
}
if
(
videoAdStatusListener
!=
null
)
{
videoAdStatusListener
.
adDownload
();
}
}
/**
* 广告关闭的回调
*/
public
void
onRewardedAdClosed
()
{
LogUtil
.
d
(
TAG
,
"onRewardedAdClosed"
);
TrackManager
.
getInstance
().
addCallImp
(
Constant
.
AD_SOURCE_GROMORE
,
Constant
.
EVENT_TYPE_THREE
,
""
,
""
);
TrackManager
.
getInstance
().
reportAddCoinMsg
(
activity
,
getAdMapVO
(
carrierType
,
Constant
.
AD_SOURCE_GROMORE
,
extraId
,
curCoin
));
if
(
mttRewardAd
!=
null
)
{
// LogUtil.d(TAG, "adNetworkPlatformId: " + mttRewardAd.getAdNetworkPlatformId()); //获取展示广告对应的adn的值 具体值见NetworkPlatformConst类 -3: 无权限 -2: 暂无数据
// LogUtil.d(TAG, "adNetworkPlatformId: " + mttRewardAd.getAdNetworkPlatformId()); //获取展示广告对应的adn的值 具体值见NetworkPlatformConst类 -3: 无权限 -2: 暂无数据
// LogUtil.d(TAG, "adNetworkRitId:" + mttRewardAd.getAdNetworkRitId()); //获取展示广告对应的代码位 具体值见NetworkPlatformConst类 "-3": 无权限 "-2"
// LogUtil.d(TAG, "adNetworkRitId:" + mttRewardAd.getAdNetworkRitId()); //获取展示广告对应的代码位 具体值见NetworkPlatformConst类 "-3": 无权限 "-2"
// LogUtil.d(TAG, "preEcpm: " + mttRewardAd.getPreEcpm()); //获取展示广告预估ecpm价格,单位是分 具体值见NetworkPlatformConst类 "-3": 无权限 "-2": 暂无数据 "-1":平台未有填写的预估ecpm价格
// LogUtil.d(TAG, "preEcpm: " + mttRewardAd.getPreEcpm()); //获取展示广告预估ecpm价格,单位是分 具体值见NetworkPlatformConst类 "-3": 无权限 "-2": 暂无数据 "-1":平台未有填写的预估ecpm价格
HashMap
<
String
,
Object
>
vo
=
new
HashMap
<>();
//
vo
.
put
(
"adcode"
,
mttRewardAd
.
getAdNetworkRitId
());
// } else {
vo
.
put
(
"ecpm"
,
mttRewardAd
.
getPreEcpm
());
// TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_GROMORE, Constant.EVENT_TYPE_ONE, "999999", "Cached Fail");
vo
.
put
(
"adSource"
,
mttRewardAd
.
getAdNetworkPlatformId
());
// LogUtil.d(TAG, " onRewardVideoCached onError ");
vo
.
put
(
"adType"
,
Constant
.
GRO_MORE_ADTYPE2
);
//
TrackManager
.
getInstance
().
cmtGroMoreInfo
(
vo
);
// if (videoAdStatusListener != null) {
}
// videoAdStatusListener.adFail();
// }
if
(
videoAdStatusListener
!=
null
)
{
// }
videoAdStatusListener
.
adSuccess
();
// }
}
// });
}
// }
//
/**
// /**
* 视频播放完毕的回调 Admob广告不存在该回调
// * 激励视频交互回调
*/
// */
public
void
onVideoComplete
()
{
// private TTRewardedAdListener mTTRewardedAdListener = new TTRewardedAdListener() {
LogUtil
.
d
(
TAG
,
"onVideoComplete"
);
//
// /**
}
// * 广告的展示回调 每个广告仅回调一次
// */
/**
// public void onRewardedAdShow() {
* 视频播放失败的回调 - Mintegral GDT Admob广告不存在该回调
// LogUtil.d(TAG, "onRewardedAdShow");
*/
// TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_GROMORE, Constant.EVENT_TYPE_ZERO, "", "");
public
void
onVideoError
()
{
//
LogUtil
.
d
(
TAG
,
"onVideoError"
);
//
TrackManager
.
getInstance
().
addCallImp
(
Constant
.
AD_SOURCE_GROMORE
,
Constant
.
EVENT_TYPE_ONE
,
"999999"
,
"VideoError"
);
// }
//
if
(
videoAdStatusListener
!=
null
)
{
// /**
videoAdStatusListener
.
adFail
();
// * 注意Admob的激励视频不会回调该方法
}
// */
}
// @Override
// public void onRewardClick() {
/**
// LogUtil.d(TAG, "onRewardClick");
* 激励视频播放完毕,验证是否有效发放奖励的回调
//
*/
// if (AppConfig.needReportClickAdEvent) {
public
void
onRewardVerify
(
RewardItem
rewardItem
)
{
// TrackManager.getInstance().reportClickAdEvent();
Map
<
String
,
Object
>
customData
=
rewardItem
.
getCustomData
();
// }
if
(
customData
!=
null
)
{
//
String
adnName
=
(
String
)
customData
.
get
(
RewardItem
.
KEY_ADN_NAME
);
// TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_GROMORE, Constant.EVENT_TYPE_TWO, "", "");
switch
(
adnName
)
{
//
case
RewardItem
.
KEY_GDT
:
// if (isClickScreen) {
LogUtil
.
d
(
TAG
,
"rewardItem gdt: "
+
customData
.
get
(
RewardItem
.
KEY_GDT_TRANS_ID
));
// // 防止重复
break
;
// TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_GROMORE, Constant.EVENT_TYPE_FOUR, "", "");
}
// isClickScreen = false;
}
// }
}
// if (videoAdStatusListener != null) {
// videoAdStatusListener.adDownload();
/**
// }
* - Mintegral GDT Admob广告不存在该回调
// }
*/
//
@Override
// /**
public
void
onSkippedVideo
()
{
// * 广告关闭的回调
// */
}
// public void onRewardedAdClosed() {
// LogUtil.d(TAG, "onRewardedAdClosed");
};
//
// TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_GROMORE, Constant.EVENT_TYPE_THREE, "", "");
public
void
setVideoAdStatusListener
(
VideoAdStatusListener
videoAdStatusListener
)
{
//
this
.
videoAdStatusListener
=
videoAdStatusListener
;
// TrackManager.getInstance().reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_GROMORE, extraId, curCoin));
}
//
// if (mttRewardAd != null) {
}
//// LogUtil.d(TAG, "adNetworkPlatformId: " + mttRewardAd.getAdNetworkPlatformId()); //获取展示广告对应的adn的值 具体值见NetworkPlatformConst类 -3: 无权限 -2: 暂无数据
//// LogUtil.d(TAG, "adNetworkRitId:" + mttRewardAd.getAdNetworkRitId()); //获取展示广告对应的代码位 具体值见NetworkPlatformConst类 "-3": 无权限 "-2"
//// LogUtil.d(TAG, "preEcpm: " + mttRewardAd.getPreEcpm()); //获取展示广告预估ecpm价格,单位是分 具体值见NetworkPlatformConst类 "-3": 无权限 "-2": 暂无数据 "-1":平台未有填写的预估ecpm价格
// HashMap<String, Object> vo = new HashMap<>();
// vo.put("adcode",mttRewardAd.getAdNetworkRitId());
// vo.put("ecpm",mttRewardAd.getPreEcpm());
// vo.put("adSource",mttRewardAd.getAdNetworkPlatformId());
// vo.put("adType",Constant.GRO_MORE_ADTYPE2);
// TrackManager.getInstance().cmtGroMoreInfo(vo);
// }
//
// if (videoAdStatusListener != null) {
// videoAdStatusListener.adSuccess();
// }
// }
//
// /**
// * 视频播放完毕的回调 Admob广告不存在该回调
// */
// public void onVideoComplete() {
// LogUtil.d(TAG, "onVideoComplete");
//
// }
//
// /**
// * 视频播放失败的回调 - Mintegral GDT Admob广告不存在该回调
// */
// public void onVideoError() {
// LogUtil.d(TAG, "onVideoError");
// TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_GROMORE, Constant.EVENT_TYPE_ONE, "999999", "VideoError");
//
// if (videoAdStatusListener != null) {
// videoAdStatusListener.adFail();
// }
// }
//
// /**
// * 激励视频播放完毕,验证是否有效发放奖励的回调
// */
// public void onRewardVerify(RewardItem rewardItem) {
// Map<String, Object> customData = rewardItem.getCustomData();
// if (customData != null) {
// String adnName = (String) customData.get(RewardItem.KEY_ADN_NAME);
// switch (adnName) {
// case RewardItem.KEY_GDT:
// LogUtil.d(TAG, "rewardItem gdt: " + customData.get(RewardItem.KEY_GDT_TRANS_ID));
// break;
// }
// }
// }
//
// /**
// * - Mintegral GDT Admob广告不存在该回调
// */
// @Override
// public void onSkippedVideo() {
//
// }
//
// };
//
// public void setVideoAdStatusListener(VideoAdStatusListener videoAdStatusListener) {
// this.videoAdStatusListener = videoAdStatusListener;
// }
//
//}
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/video/CsjVideoAdManager.java
View file @
6bdad092
...
@@ -174,6 +174,10 @@ public class CsjVideoAdManager extends BaseVideoAd {
...
@@ -174,6 +174,10 @@ public class CsjVideoAdManager extends BaseVideoAd {
}
}
}
}
@Override
public
void
onRewardVideoCached
(
TTRewardVideoAd
ttRewardVideoAd
)
{
}
//视频广告的素材加载完毕,比如视频url等,在此回调后,可以播放在线视频,网络不好可能出现加载缓冲,影响体验。
//视频广告的素材加载完毕,比如视频url等,在此回调后,可以播放在线视频,网络不好可能出现加载缓冲,影响体验。
@Override
@Override
public
void
onRewardVideoAdLoad
(
TTRewardVideoAd
ad
)
{
public
void
onRewardVideoAdLoad
(
TTRewardVideoAd
ad
)
{
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/video/KsVideoAdManager.kt
View file @
6bdad092
...
@@ -105,6 +105,9 @@ class KsVideoAdManager private constructor(activity: Activity) :
...
@@ -105,6 +105,9 @@ class KsVideoAdManager private constructor(activity: Activity) :
// ToastUtil.show(activity, "快手激励视频⼴告播放完成")
// ToastUtil.show(activity, "快手激励视频⼴告播放完成")
}
}
override
fun
onVideoSkipToEnd
(
p0
:
Long
)
{
}
override
fun
onVideoPlayStart
()
{
override
fun
onVideoPlayStart
()
{
// ToastUtil.show(activity, "快手激励视频⼴告播放开始")
// ToastUtil.show(activity, "快手激励视频⼴告播放开始")
}
}
...
@@ -115,6 +118,9 @@ class KsVideoAdManager private constructor(activity: Activity) :
...
@@ -115,6 +118,9 @@ class KsVideoAdManager private constructor(activity: Activity) :
TrackManager
.
getInstance
().
addCallImp
(
Constant
.
AD_SOURCE_KS
,
Constant
.
EVENT_TYPE_ZERO
,
""
,
""
)
TrackManager
.
getInstance
().
addCallImp
(
Constant
.
AD_SOURCE_KS
,
Constant
.
EVENT_TYPE_ZERO
,
""
,
""
)
}
}
override
fun
onRewardStepVerify
(
p0
:
Int
,
p1
:
Int
)
{
}
})
})
// PlayConfig默认竖屏播放,传null
// PlayConfig默认竖屏播放,传null
mRewardVideoAd
!!
.
showRewardVideoAd
(
activity
,
null
)
mRewardVideoAd
!!
.
showRewardVideoAd
(
activity
,
null
)
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/video/VideoAdingManager.java
View file @
6bdad092
...
@@ -41,7 +41,7 @@ public class VideoAdingManager {
...
@@ -41,7 +41,7 @@ public class VideoAdingManager {
private
ShVideoAdManager
shVideoAdManager
;
private
ShVideoAdManager
shVideoAdManager
;
private
CsjFullVideoAdManager
csjFullVideoAdManager
;
private
CsjFullVideoAdManager
csjFullVideoAdManager
;
private
KsVideoAdManager
ksVideoAdManager
;
private
KsVideoAdManager
ksVideoAdManager
;
private
CsjGroMoreVideoAdManager
csjGroMoreVideoAdManager
;
//
private CsjGroMoreVideoAdManager csjGroMoreVideoAdManager;
private
OwVideoAdManager
owVideoAdManager
;
private
OwVideoAdManager
owVideoAdManager
;
private
int
wnWeight
;
private
int
wnWeight
;
...
@@ -91,7 +91,7 @@ public class VideoAdingManager {
...
@@ -91,7 +91,7 @@ public class VideoAdingManager {
shVideoAdManager
=
ShVideoAdManager
.
Companion
.
getInstance
(
activity
);
shVideoAdManager
=
ShVideoAdManager
.
Companion
.
getInstance
(
activity
);
csjFullVideoAdManager
=
CsjFullVideoAdManager
.
getInstance
(
activity
);
csjFullVideoAdManager
=
CsjFullVideoAdManager
.
getInstance
(
activity
);
ksVideoAdManager
=
KsVideoAdManager
.
Companion
.
getInstance
(
activity
);
ksVideoAdManager
=
KsVideoAdManager
.
Companion
.
getInstance
(
activity
);
csjGroMoreVideoAdManager
=
CsjGroMoreVideoAdManager
.
getInstance
(
activity
);
//
csjGroMoreVideoAdManager = CsjGroMoreVideoAdManager.getInstance(activity);
owVideoAdManager
=
OwVideoAdManager
.
Companion
.
getInstance
();
owVideoAdManager
=
OwVideoAdManager
.
Companion
.
getInstance
();
weightList
=
new
ArrayList
<>();
weightList
=
new
ArrayList
<>();
}
}
...
@@ -453,11 +453,11 @@ public class VideoAdingManager {
...
@@ -453,11 +453,11 @@ public class VideoAdingManager {
owVideoAdManager
.
onDestroy
();
owVideoAdManager
.
onDestroy
();
owVideoAdManager
=
null
;
owVideoAdManager
=
null
;
}
}
if
(
csjGroMoreVideoAdManager
!=
null
)
{
//
if (csjGroMoreVideoAdManager != null) {
csjGroMoreVideoAdManager
.
setVideoAdStatusListener
(
null
);
//
csjGroMoreVideoAdManager.setVideoAdStatusListener(null);
csjGroMoreVideoAdManager
.
onDestroy
();
//
csjGroMoreVideoAdManager.onDestroy();
csjGroMoreVideoAdManager
=
null
;
//
csjGroMoreVideoAdManager = null;
}
//
}
if
(
mReceiverBroadcastReceiver
!=
null
)
{
if
(
mReceiverBroadcastReceiver
!=
null
)
{
activity
.
stopService
(
new
Intent
(
activity
,
AppInstallService
.
class
));
activity
.
stopService
(
new
Intent
(
activity
,
AppInstallService
.
class
));
...
@@ -808,44 +808,45 @@ public class VideoAdingManager {
...
@@ -808,44 +808,45 @@ public class VideoAdingManager {
}
}
});
});
owVideoAdManager
.
loadAd
(
activity
,
bean
.
getCurCoin
(),
bean
.
getCarrierType
(),
bean
.
getExtraId
());
owVideoAdManager
.
loadAd
(
activity
,
bean
.
getCurCoin
(),
bean
.
getCarrierType
(),
bean
.
getExtraId
());
}
else
if
(
TextUtils
.
equals
(
videoAdType
,
Constant
.
GROMORE_VEDIO_AD
))
{
// GROMORE广告激励视频
if
(
csjGroMoreVideoAdManager
==
null
)
{
if
(
activity
==
null
)
{
if
(
videoAdingListener
!=
null
)
{
videoAdingListener
.
videoAdingListenerError
(
Constant
.
GROMORE_VEDIO_AD
);
}
return
;
}
csjGroMoreVideoAdManager
=
CsjGroMoreVideoAdManager
.
getInstance
(
activity
);
}
csjGroMoreVideoAdManager
.
setVideoAdStatusListener
(
new
VideoAdStatusListener
()
{
@Override
public
void
adSuccess
()
{
AppConfig
.
groMoreVideoAdCount
--;
if
(
videoAdingListener
!=
null
)
{
videoAdingListener
.
videoAdingListenerSuccess
(
Constant
.
GROMORE_VEDIO_AD
);
}
}
@Override
public
void
adFail
()
{
if
(
videoAdingListener
!=
null
)
{
videoAdingListener
.
videoAdingListenerFail
(
Constant
.
GROMORE_VEDIO_AD
);
}
}
@Override
public
void
adDownload
()
{
isVideoAdDownload
=
true
;
// 注册下载任务监听
registerBroad
();
}
});
csjGroMoreVideoAdManager
.
loadAd
(
activity
,
bean
.
getCurCoin
(),
bean
.
getCarrierType
(),
bean
.
getExtraId
());
}
}
// else if (TextUtils.equals(videoAdType, Constant.GROMORE_VEDIO_AD)) {
// // GROMORE广告激励视频
// if (csjGroMoreVideoAdManager == null) {
// if (activity == null) {
// if (videoAdingListener != null) {
// videoAdingListener.videoAdingListenerError(Constant.GROMORE_VEDIO_AD);
// }
// return;
// }
// csjGroMoreVideoAdManager = CsjGroMoreVideoAdManager.getInstance(activity);
// }
// csjGroMoreVideoAdManager.setVideoAdStatusListener(new VideoAdStatusListener() {
// @Override
// public void adSuccess() {
// AppConfig.groMoreVideoAdCount--;
// if (videoAdingListener != null) {
// videoAdingListener.videoAdingListenerSuccess(Constant.GROMORE_VEDIO_AD);
// }
// }
//
// @Override
// public void adFail() {
// if (videoAdingListener != null) {
// videoAdingListener.videoAdingListenerFail(Constant.GROMORE_VEDIO_AD);
// }
// }
//
// @Override
// public void adDownload() {
// isVideoAdDownload = true;
//
// // 注册下载任务监听
// registerBroad();
// }
// });
//
// csjGroMoreVideoAdManager.loadAd(activity, bean.getCurCoin(), bean.getCarrierType(), bean.getExtraId());
// }
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
if
(
videoAdingListener
!=
null
)
{
if
(
videoAdingListener
!=
null
)
{
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/manager/BxmPlayVideo.java
View file @
6bdad092
...
@@ -59,6 +59,10 @@ public class BxmPlayVideo {
...
@@ -59,6 +59,10 @@ public class BxmPlayVideo {
public
void
onRewardVideoCached
()
{
public
void
onRewardVideoCached
()
{
}
}
@Override
public
void
onRewardVideoCached
(
TTRewardVideoAd
ttRewardVideoAd
)
{
}
});
});
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
appNative
.
onError
(
0
);
appNative
.
onError
(
0
);
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/manager/CsjAppLogManager.kt
View file @
6bdad092
package
com.mints.goodmoney.manager
//package com.mints.goodmoney.manager
//
import
android.app.Application
//import android.app.Application
import
com.bytedance.applog.AppLog
//import com.bytedance.applog.AppLog
import
com.bytedance.applog.InitConfig
//import com.bytedance.applog.InitConfig
import
com.bytedance.applog.util.UriConstants
//import com.bytedance.applog.util.UriConstants
import
com.bytedance.hume.readapk.HumeSDK
//import com.bytedance.hume.readapk.HumeSDK
import
com.mints.goodmoney.MintsApplication
//import com.mints.goodmoney.MintsApplication
import
com.mints.goodmoney.utils.LogUtil
//import com.mints.goodmoney.utils.LogUtil
import
com.mints.library.utils.CommonUtils
//import com.mints.library.utils.CommonUtils
//
private
val
TAG
=
CsjAppLogManager
::
class
.
java
.
simpleName
//private val TAG = CsjAppLogManager::class.java.simpleName
//
object
CsjAppLogManager
{
//object CsjAppLogManager {
//
fun
init
(
application
:
Application
)
{
// fun init(application: Application) {
/* 初始化开始 */
// /* 初始化开始 */
val
config
=
InitConfig
(
TtCsjAdManager
.
TT_AD_APPID
,
CommonUtils
.
getAppMetaData
(
MintsApplication
.
getContext
(),
"CHANNEL_NAME"
)
+
HumeSDK
.
getChannel
(
MintsApplication
.
getContext
()))
// appid和渠道,appid如不清楚请联系对接同学
// val config = InitConfig(TtCsjAdManager.TT_AD_APPID, CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME") + HumeSDK.getChannel(MintsApplication.getContext())) // appid和渠道,appid如不清楚请联系对接同学
//
//上报域名只支持中国
// //上报域名只支持中国
config
.
setUriConfig
(
UriConstants
.
DEFAULT
)
// config.setUriConfig(UriConstants.DEFAULT)
//
// 是否在控制台输出日志,可用于观察用户行为日志上报情况
// // 是否在控制台输出日志,可用于观察用户行为日志上报情况
config
.
setLogger
{
msg
,
t
->
LogUtil
.
d
(
TAG
,
"$msg -> $t"
)
}
// config.setLogger { msg, t -> LogUtil.d(TAG, "$msg -> $t") }
//
config
.
setAutoStart
(
true
)
// config.setAutoStart(true)
AppLog
.
init
(
application
,
config
)
// AppLog.init(application, config)
/* 初始化结束 */
// /* 初始化结束 */
//
/* 自定义 “用户公共属性”(可选,初始化后调用, key相同会覆盖)
// /* 自定义 “用户公共属性”(可选,初始化后调用, key相同会覆盖)
关于自定义 “用户公共属性” 请注意:1. 上报机制是随着每一次日志发送进行提交,默认的日志发送频率是1分钟,所以如果在一分钟内连续修改自定义用户公共属性,,按照日志发送前的最后一次修改为准, 2. 不推荐高频次修改,如每秒修改一次 */
// 关于自定义 “用户公共属性” 请注意:1. 上报机制是随着每一次日志发送进行提交,默认的日志发送频率是1分钟,所以如果在一分钟内连续修改自定义用户公共属性,,按照日志发送前的最后一次修改为准, 2. 不推荐高频次修改,如每秒修改一次 */
//Map<String,Object> headerMap = new HashMap<String, Object>();
// //Map<String,Object> headerMap = new HashMap<String, Object>();
//headerMap.put("your_custom_key","your_custom_value");
// //headerMap.put("your_custom_key","your_custom_value");
//AppLog.setHeaderInfo((HashMap<String, Object>)headerMap);
// //AppLog.setHeaderInfo((HashMap<String, Object>)headerMap);
//
//移除公共属性
// //移除公共属性
//AppLog.removeHeaderInfo("your_custom_key");
// //AppLog.removeHeaderInfo("your_custom_key");
}
// }
//
}
//}
\ No newline at end of file
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/manager/CsjGroMoreManager.kt
View file @
6bdad092
...
@@ -8,7 +8,7 @@ object CsjGroMoreManager {
...
@@ -8,7 +8,7 @@ object CsjGroMoreManager {
const
val
AD_UNIT_ID
=
"946167770"
const
val
AD_UNIT_ID
=
"946167770"
fun
init
(
application
:
MintsApplication
)
{
fun
init
(
application
:
MintsApplication
)
{
TTGroMoreAdManagerHolder
.
init
(
application
)
//
TTGroMoreAdManagerHolder.init(application)
}
}
}
}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/manager/LiebaoManager.java
View file @
6bdad092
...
@@ -3,9 +3,6 @@ package com.mints.goodmoney.manager;
...
@@ -3,9 +3,6 @@ package com.mints.goodmoney.manager;
import
android.content.Context
;
import
android.content.Context
;
import
com.bytedance.sdk.openadsdk.TTAdConfig
;
import
com.bytedance.sdk.openadsdk.TTAdConstant
;
import
com.bytedance.sdk.openadsdk.TTAdSdk
;
import
com.cmcm.cmgame.CmGameSdk
;
import
com.cmcm.cmgame.CmGameSdk
;
import
com.cmcm.cmgame.gamedata.CmGameAppInfo
;
import
com.cmcm.cmgame.gamedata.CmGameAppInfo
;
import
com.mints.goodmoney.BuildConfig
;
import
com.mints.goodmoney.BuildConfig
;
...
@@ -55,20 +52,30 @@ public class LiebaoManager {
...
@@ -55,20 +52,30 @@ public class LiebaoManager {
* 游戏SDK初始化
* 游戏SDK初始化
*/
*/
public
void
initCmGameSdk
()
{
public
void
initCmGameSdk
()
{
final
String
adAppId
=
TtCsjAdManager
.
TT_AD_APPID
;
// 穿山甲appid
// final String adAppId = TtCsjAdManager.TT_AD_APPID; // 穿山甲appid
TTAdSdk
.
init
(
context
,
// TTAdSdk.init(context,
new
TTAdConfig
.
Builder
()
// new TTAdConfig.Builder()
.
appId
(
adAppId
)
// .appId(adAppId)
.
useTextureView
(
false
)
//使用TextureView控件播放视频,默认为SurfaceView,当有SurfaceView冲突的场景,可以使用TextureView
// .useTextureView(false) //使用TextureView控件播放视频,默认为SurfaceView,当有SurfaceView冲突的场景,可以使用TextureView
.
appName
(
TtCsjAdManager
.
TT_AD_NAME
)
// .appName(TtCsjAdManager.TT_AD_NAME)
.
titleBarTheme
(
TTAdConstant
.
TITLE_BAR_THEME_DARK
)
// .titleBarTheme(TTAdConstant.TITLE_BAR_THEME_DARK)
.
allowShowNotify
(
true
)
//是否允许sdk展示通知栏提示
// .allowShowNotify(true) //是否允许sdk展示通知栏提示
.
allowShowPageWhenScreenLock
(
true
)
//是否在锁屏场景支持展示广告落地页
// .allowShowPageWhenScreenLock(true) //是否在锁屏场景支持展示广告落地页
.
debug
(
BuildConfig
.
DEBUG
)
//测试阶段打开,可以通过日志排查问题,上线时去除该调用
// .debug(BuildConfig.DEBUG) //测试阶段打开,可以通过日志排查问题,上线时去除该调用
.
directDownloadNetworkType
(
TTAdConstant
.
NETWORK_STATE_WIFI
,
TTAdConstant
.
NETWORK_STATE_3G
)
//允许直接下载的网络状态集合
// .directDownloadNetworkType(TTAdConstant.NETWORK_STATE_WIFI, TTAdConstant.NETWORK_STATE_3G) //允许直接下载的网络状态集合
.
supportMultiProcess
(
false
)
//是否支持多进程,true支持
// .supportMultiProcess(false) //是否支持多进程,true支持
.
build
());
// .build(), new TTAdSdk.InitCallback() {
// @Override
// public void success() {
//
// }
//
// @Override
// public void fail(int i, String s) {
//
// }
// });
CmGameAppInfo
cmGameAppInfo
=
new
CmGameAppInfo
();
CmGameAppInfo
cmGameAppInfo
=
new
CmGameAppInfo
();
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/manager/ReadToutiaoAD.java
View file @
6bdad092
...
@@ -196,6 +196,11 @@ public class ReadToutiaoAD {
...
@@ -196,6 +196,11 @@ public class ReadToutiaoAD {
LogUtils
.
i
(
"ToutiaoAd"
,
"rewardVideoAd video cached"
);
LogUtils
.
i
(
"ToutiaoAd"
,
"rewardVideoAd video cached"
);
}
}
@Override
public
void
onRewardVideoCached
(
TTRewardVideoAd
ttRewardVideoAd
)
{
}
//视频广告素材加载到,如title,视频url等,不包括视频文件
//视频广告素材加载到,如title,视频url等,不包括视频文件
@Override
@Override
public
void
onRewardVideoAdLoad
(
TTRewardVideoAd
ad
)
{
public
void
onRewardVideoAdLoad
(
TTRewardVideoAd
ad
)
{
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/manager/TTGroMoreAdManagerHolder.java
View file @
6bdad092
package
com
.
mints
.
goodmoney
.
manager
;
//
package com.mints.goodmoney.manager;
//
import
android.app.Activity
;
//
import android.app.Activity;
import
android.content.Context
;
//
import android.content.Context;
import
android.provider.Settings
;
//
import android.provider.Settings;
//
import
com.bytedance.hume.readapk.HumeSDK
;
//
import com.bytedance.hume.readapk.HumeSDK;
import
com.bytedance.msdk.api.TTAdConfig
;
//
import com.bytedance.msdk.api.TTAdConfig;
import
com.bytedance.msdk.api.TTAdConstant
;
//
import com.bytedance.msdk.api.TTAdConstant;
import
com.bytedance.msdk.api.TTMediationAdSdk
;
//
import com.bytedance.msdk.api.TTMediationAdSdk;
import
com.bytedance.msdk.api.UserInfoForSegment
;
//
import com.bytedance.msdk.api.UserInfoForSegment;
import
com.mints.goodmoney.BuildConfig
;
//
import com.mints.goodmoney.BuildConfig;
import
com.mints.goodmoney.MintsApplication
;
//
import com.mints.goodmoney.MintsApplication;
import
com.mints.goodmoney.common.Constant
;
//
import com.mints.goodmoney.common.Constant;
import
com.mints.library.utils.CommonUtils
;
//
import com.mints.library.utils.CommonUtils;
//
import
java.util.HashMap
;
//
import java.util.HashMap;
import
java.util.Map
;
//
import java.util.Map;
//
//
/**
/
//
**
* 可以用一个单例来保存TTAdManager实例,在需要初始化sdk的时候调用
//
* 可以用一个单例来保存TTAdManager实例,在需要初始化sdk的时候调用
*/
//
*/
public
class
TTGroMoreAdManagerHolder
{
//
public class TTGroMoreAdManagerHolder {
//
public
static
final
String
TT_AD_APPID
=
"5113521"
;
//
public static final String TT_AD_APPID = "5113521";
public
static
final
String
TT_AD_NAME
=
Constant
.
MINTS_APP_NAME
;
//
public static final String TT_AD_NAME = Constant.MINTS_APP_NAME;
//
private
static
boolean
sInit
;
//
private static boolean sInit;
//
public
static
void
init
(
Context
context
)
{
//
public static void init(Context context) {
doInit
(
context
);
//
doInit(context);
}
//
}
//
public
static
void
initUnitySdkBanner
(
Activity
activity
)
{
//
public static void initUnitySdkBanner(Activity activity) {
TTMediationAdSdk
.
initUnityForBanner
(
activity
);
//
TTMediationAdSdk.initUnityForBanner(activity);
}
//
}
//
//
//step1:接入网盟广告sdk的初始化操作,详情见接入文档和穿山甲平台说明
//
//step1:接入网盟广告sdk的初始化操作,详情见接入文档和穿山甲平台说明
private
static
void
doInit
(
Context
context
)
{
//
private static void doInit(Context context) {
if
(!
sInit
)
{
//
if (!sInit) {
TTMediationAdSdk
.
initialize
(
context
,
buildConfig
(
context
));
//
TTMediationAdSdk.initialize(context, buildConfig(context));
sInit
=
true
;
//
sInit = true;
}
//
}
}
//
}
//
private
static
TTAdConfig
buildConfig
(
Context
context
)
{
//
private static TTAdConfig buildConfig(Context context) {
UserInfoForSegment
userInfo
=
new
UserInfoForSegment
();
//
UserInfoForSegment userInfo = new UserInfoForSegment();
userInfo
.
setUserId
(
UserManager
.
getInstance
().
getUserID
());
//
userInfo.setUserId(UserManager.getInstance().getUserID());
userInfo
.
setGender
(
UserInfoForSegment
.
GENDER_UNKNOWN
);
//
userInfo.setGender(UserInfoForSegment.GENDER_UNKNOWN);
userInfo
.
setChannel
(
CommonUtils
.
getAppMetaData
(
MintsApplication
.
getContext
(),
"CHANNEL_NAME"
));
//
userInfo.setChannel(CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME"));
userInfo
.
setSubChannel
(
HumeSDK
.
getChannel
(
MintsApplication
.
getContext
()));
//
userInfo.setSubChannel(HumeSDK.getChannel(MintsApplication.getContext()));
userInfo
.
setAge
(
999
);
//
userInfo.setAge(999);
userInfo
.
setUserValueGroup
(
"msdk demo user value group"
);
//
userInfo.setUserValueGroup("msdk demo user value group");
//
Map
<
String
,
String
>
customInfos
=
new
HashMap
<>();
//
Map<String, String> customInfos = new HashMap<>();
// customInfos.put("aaaa", "test111");
//
//
customInfos.put("aaaa", "test111");
// customInfos.put("bbbb", "test222");
//
//
customInfos.put("bbbb", "test222");
userInfo
.
setCustomInfos
(
customInfos
);
//
userInfo.setCustomInfos(customInfos);
return
new
TTAdConfig
.
Builder
()
//
return new TTAdConfig.Builder()
.
appId
(
TT_AD_APPID
)
//必填 ,不能为空
//
.appId(TT_AD_APPID) //必填 ,不能为空
.
appName
(
TT_AD_NAME
)
//必填,不能为空
//
.appName(TT_AD_NAME) //必填,不能为空
.
openAdnTest
(
false
)
//开启第三方ADN测试时需要设置为true,会每次重新拉去最新配置,release 包情况下必须关闭.默认false
//
.openAdnTest(false)//开启第三方ADN测试时需要设置为true,会每次重新拉去最新配置,release 包情况下必须关闭.默认false
.
isPanglePaid
(
false
)
//是否为费用户
//
.isPanglePaid(false)//是否为费用户
.
setPublisherDid
(
getAndroidId
(
context
))
//用户自定义device_id
//
.setPublisherDid(getAndroidId(context)) //用户自定义device_id
.
openDebugLog
(
BuildConfig
.
DEBUG
)
//测试阶段打开,可以通过日志排查问题,上线时去除该调用
//
.openDebugLog(BuildConfig.DEBUG) //测试阶段打开,可以通过日志排查问题,上线时去除该调用
.
usePangleTextureView
(
true
)
//使用TextureView控件播放视频,默认为SurfaceView,当有SurfaceView冲突的场景,可以使用TextureView
//
.usePangleTextureView(true) //使用TextureView控件播放视频,默认为SurfaceView,当有SurfaceView冲突的场景,可以使用TextureView
.
setPangleTitleBarTheme
(
TTAdConstant
.
TITLE_BAR_THEME_DARK
)
//
.setPangleTitleBarTheme(TTAdConstant.TITLE_BAR_THEME_DARK)
.
allowPangleShowNotify
(
true
)
//是否允许sdk展示通知栏提示
//
.allowPangleShowNotify(true) //是否允许sdk展示通知栏提示
.
allowPangleShowPageWhenScreenLock
(
true
)
//是否在锁屏场景支持展示广告落地页
//
.allowPangleShowPageWhenScreenLock(true) //是否在锁屏场景支持展示广告落地页
.
setPangleDirectDownloadNetworkType
(
TTAdConstant
.
NETWORK_STATE_WIFI
,
TTAdConstant
.
NETWORK_STATE_3G
)
//允许直接下载的网络状态集合
//
.setPangleDirectDownloadNetworkType(TTAdConstant.NETWORK_STATE_WIFI, TTAdConstant.NETWORK_STATE_3G) //允许直接下载的网络状态集合
.
needPangleClearTaskReset
()
//特殊机型过滤,部分机型出现包解析失败问题(大部分是三星)。参数取android.os.Build.MODEL
//
.needPangleClearTaskReset()//特殊机型过滤,部分机型出现包解析失败问题(大部分是三星)。参数取android.os.Build.MODEL
.
setUserInfoForSegment
(
userInfo
)
// 设置流量分组的信息
//
.setUserInfoForSegment(userInfo) // 设置流量分组的信息
.
build
();
//
.build();
}
//
}
//
public
static
String
getAndroidId
(
Context
context
)
{
//
public static String getAndroidId(Context context) {
String
androidId
=
null
;
//
String androidId = null;
try
{
//
try {
androidId
=
Settings
.
System
.
getString
(
context
.
getContentResolver
(),
Settings
.
System
.
ANDROID_ID
);
//
androidId = Settings.System.getString(context.getContentResolver(), Settings.System.ANDROID_ID);
}
catch
(
Exception
e
)
{
//
} catch (Exception e) {
e
.
printStackTrace
();
//
e.printStackTrace();
}
//
}
return
androidId
;
//
return androidId;
}
//
}
//
}
//
}
GoodMoney/app/src/main/java/com/mints/goodmoney/manager/TtCsjAdManager.java
View file @
6bdad092
...
@@ -6,10 +6,9 @@ import com.bytedance.sdk.openadsdk.TTAdConfig;
...
@@ -6,10 +6,9 @@ import com.bytedance.sdk.openadsdk.TTAdConfig;
import
com.bytedance.sdk.openadsdk.TTAdConstant
;
import
com.bytedance.sdk.openadsdk.TTAdConstant
;
import
com.bytedance.sdk.openadsdk.TTAdSdk
;
import
com.bytedance.sdk.openadsdk.TTAdSdk
;
import
com.mints.goodmoney.BuildConfig
;
import
com.mints.goodmoney.BuildConfig
;
import
com.mints.goodmoney.MintsApplication
;
import
com.mints.goodmoney.common.Constant
;
import
com.mints.goodmoney.common.Constant
;
import
com.mints.goodmoney.mvp.model.AdcodeBean
;
import
com.mints.goodmoney.mvp.model.AdcodeBean
;
import
com.mints.
library.utils.CommonUtils
;
import
com.mints.
goodmoney.utils.LogUtil
;
/**
/**
* 穿山甲广告
* 穿山甲广告
...
@@ -81,7 +80,17 @@ public class TtCsjAdManager {
...
@@ -81,7 +80,17 @@ public class TtCsjAdManager {
//step1:接入网盟广告sdk的初始化操作,详情见接入文档和穿山甲平台说明
//step1:接入网盟广告sdk的初始化操作,详情见接入文档和穿山甲平台说明
private
static
void
doInit
(
Context
context
)
{
private
static
void
doInit
(
Context
context
)
{
if
(!
sInit
)
{
if
(!
sInit
)
{
TTAdSdk
.
init
(
context
,
buildConfig
(
context
));
TTAdSdk
.
init
(
context
,
buildConfig
(
context
),
new
TTAdSdk
.
InitCallback
()
{
@Override
public
void
success
()
{
LogUtil
.
d
(
"TTAdSdk init success"
);
}
@Override
public
void
fail
(
int
i
,
String
s
)
{
LogUtil
.
d
(
"TTAdSdk init fail "
+
i
+
" "
+
s
);
}
});
sInit
=
true
;
sInit
=
true
;
}
}
}
}
...
@@ -106,7 +115,7 @@ public class TtCsjAdManager {
...
@@ -106,7 +115,7 @@ public class TtCsjAdManager {
.
allowShowNotify
(
true
)
//是否允许sdk展示通知栏提示
.
allowShowNotify
(
true
)
//是否允许sdk展示通知栏提示
.
allowShowPageWhenScreenLock
(
false
)
//是否在锁屏场景支持展示广告落地页
.
allowShowPageWhenScreenLock
(
false
)
//是否在锁屏场景支持展示广告落地页
.
debug
(
logFlag
)
//测试阶段打开,可以通过日志排查问题,上线时去除该调用
.
debug
(
logFlag
)
//测试阶段打开,可以通过日志排查问题,上线时去除该调用
.
directDownloadNetworkType
(
TTAdConstant
.
NETWORK_STATE_WIFI
,
TTAdConstant
.
NETWORK_STATE_3G
)
//允许直接下载的网络状态集合
.
directDownloadNetworkType
(
TTAdConstant
.
NETWORK_STATE_WIFI
,
TTAdConstant
.
NETWORK_STATE_
4G
,
TTAdConstant
.
NETWORK_STATE_
3G
)
//允许直接下载的网络状态集合
.
supportMultiProcess
(
false
)
//是否支持多进程
.
supportMultiProcess
(
false
)
//是否支持多进程
//.httpStack(new MyOkStack3())//自定义网络库,demo中给出了okhttp3版本的样例,其余请自行开发或者咨询工作人员。
//.httpStack(new MyOkStack3())//自定义网络库,demo中给出了okhttp3版本的样例,其余请自行开发或者咨询工作人员。
.
build
();
.
build
();
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/AboutusActivity.kt
View file @
6bdad092
...
@@ -3,23 +3,16 @@ package com.mints.goodmoney.ui.activitys
...
@@ -3,23 +3,16 @@ package com.mints.goodmoney.ui.activitys
import
android.annotation.SuppressLint
import
android.annotation.SuppressLint
import
android.os.Bundle
import
android.os.Bundle
import
android.view.View
import
android.view.View
import
android.widget.FrameLayout
import
android.widget.ImageView
import
com.bytedance.hume.readapk.HumeSDK
import
com.bytedance.hume.readapk.HumeSDK
import
com.mints.goodmoney.MintsApplication
import
com.mints.goodmoney.MintsApplication
import
com.mints.goodmoney.R
import
com.mints.goodmoney.R
import
com.mints.goodmoney.ad.banner.BannerManager
import
com.mints.goodmoney.ad.video.CsjGroMoreVideoAdManager
import
com.mints.goodmoney.common.AppConfig
import
com.mints.goodmoney.common.AppConfig
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.manager.TtCsjAdManager
import
com.mints.goodmoney.ui.activitys.base.BaseActivity
import
com.mints.goodmoney.ui.activitys.base.BaseActivity
import
com.mints.goodmoney.ui.adapter.AdBannerAdapter
import
com.mints.goodmoney.utils.ToastUtil
import
com.mints.goodmoney.utils.ToastUtil
import
com.mints.library.utils.CommonUtils
import
com.mints.library.utils.CommonUtils
import
com.mints.library.utils.ConstantUtil
import
com.mints.library.utils.ConstantUtil
import
kotlinx.android.synthetic.main.activity_aboutus.*
import
kotlinx.android.synthetic.main.activity_aboutus.*
import
kotlinx.android.synthetic.main.fragment_main_my.*
import
kotlinx.android.synthetic.main.header_layout.*
import
kotlinx.android.synthetic.main.header_layout.*
/**
/**
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/AwardActivity.kt
View file @
6bdad092
...
@@ -11,7 +11,6 @@ import android.view.KeyEvent
...
@@ -11,7 +11,6 @@ import android.view.KeyEvent
import
android.view.View
import
android.view.View
import
androidx.core.content.ContextCompat
import
androidx.core.content.ContextCompat
import
com.mints.goodmoney.R
import
com.mints.goodmoney.R
import
com.mints.goodmoney.ad.express.GroMoreExpressManager
import
com.mints.goodmoney.ad.express.PreLoadExpressManager
import
com.mints.goodmoney.ad.express.PreLoadExpressManager
import
com.mints.goodmoney.ad.video.VideoAdingManager
import
com.mints.goodmoney.ad.video.VideoAdingManager
import
com.mints.goodmoney.common.AppConfig
import
com.mints.goodmoney.common.AppConfig
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/FoodSubsidyActivity.kt
View file @
6bdad092
...
@@ -3,8 +3,9 @@ package com.mints.goodmoney.ui.activitys
...
@@ -3,8 +3,9 @@ package com.mints.goodmoney.ui.activitys
import
android.os.Bundle
import
android.os.Bundle
import
android.view.View
import
android.view.View
import
com.mints.goodmoney.R
import
com.mints.goodmoney.R
import
com.mints.goodmoney.ad.express.
GroMore
CarrierExpressManager
import
com.mints.goodmoney.ad.express.
TTPreLoad
CarrierExpressManager
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.manager.TtCsjAdManager
import
com.mints.goodmoney.mvp.model.MealBean
import
com.mints.goodmoney.mvp.model.MealBean
import
com.mints.goodmoney.mvp.presenters.FoodSubsidyPresenter
import
com.mints.goodmoney.mvp.presenters.FoodSubsidyPresenter
import
com.mints.goodmoney.mvp.views.FoodSubsidyView
import
com.mints.goodmoney.mvp.views.FoodSubsidyView
...
@@ -87,8 +88,8 @@ class FoodSubsidyActivity : BaseActivity(), View.OnClickListener, FoodSubsidyVie
...
@@ -87,8 +88,8 @@ class FoodSubsidyActivity : BaseActivity(), View.OnClickListener, FoodSubsidyVie
}
}
// 预加载信息流
// 预加载信息流
//
TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_EAT)
TTPreLoadCarrierExpressManager
.
getInstance
().
loadTtFrameLayout
(
TtCsjAdManager
.
TT_AD_NATIVEEXPRESS_EAT
)
GroMoreCarrierExpressManager
.
instance
.
loadADFrameLayout
()
//
GroMoreCarrierExpressManager.instance.loadADFrameLayout()
}
}
...
@@ -97,11 +98,11 @@ class FoodSubsidyActivity : BaseActivity(), View.OnClickListener, FoodSubsidyVie
...
@@ -97,11 +98,11 @@ class FoodSubsidyActivity : BaseActivity(), View.OnClickListener, FoodSubsidyVie
*/
*/
private
fun
initExpress
()
{
private
fun
initExpress
()
{
try
{
try
{
if
(
GroMoreCarrierExpressManager
.
instance
.
getADFrameLayout
()
!=
null
)
{
if
(
TTPreLoadCarrierExpressManager
.
getInstance
().
ttFrameLayout
!=
null
)
{
if
(
flSubsidykAd
!=
null
)
{
if
(
flSubsidykAd
!=
null
)
{
flSubsidykAd
.
removeAllViews
()
flSubsidykAd
.
removeAllViews
()
//
flSubsidykAd.addView(TTPreLoadCarrierExpressManager.getInstance().ttFrameLayout)
flSubsidykAd
.
addView
(
TTPreLoadCarrierExpressManager
.
getInstance
().
ttFrameLayout
)
flSubsidykAd
.
addView
(
GroMoreCarrierExpressManager
.
instance
.
getADFrameLayout
())
//
flSubsidykAd.addView(GroMoreCarrierExpressManager.instance.getADFrameLayout())
}
}
}
}
}
catch
(
e
:
Exception
)
{
}
catch
(
e
:
Exception
)
{
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/MorningClockActivity.kt
View file @
6bdad092
...
@@ -5,7 +5,6 @@ import android.view.View
...
@@ -5,7 +5,6 @@ import android.view.View
import
androidx.core.content.ContextCompat
import
androidx.core.content.ContextCompat
import
androidx.recyclerview.widget.GridLayoutManager
import
androidx.recyclerview.widget.GridLayoutManager
import
com.mints.goodmoney.R
import
com.mints.goodmoney.R
import
com.mints.goodmoney.ad.express.GroMoreCarrierExpressManager
import
com.mints.goodmoney.ad.video.VideoAdingManager
import
com.mints.goodmoney.ad.video.VideoAdingManager
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.ad.express.TTPreLoadCarrierExpressManager
import
com.mints.goodmoney.ad.express.TTPreLoadCarrierExpressManager
...
@@ -184,11 +183,12 @@ class MorningClockActivity : BaseActivity(), View.OnClickListener, MorningClockV
...
@@ -184,11 +183,12 @@ class MorningClockActivity : BaseActivity(), View.OnClickListener, MorningClockV
*/
*/
private
fun
initExpress
()
{
private
fun
initExpress
()
{
try
{
try
{
if
(
GroMoreCarrierExpressManager
.
instance
.
getADFrameLayout
()
!=
null
)
{
// if (GroMoreCarrierExpressManager.instance.getADFrameLayout() != null) {
if
(
TTPreLoadCarrierExpressManager
.
getInstance
().
ttFrameLayout
!=
null
)
{
if
(
flMorningClockAd
!=
null
)
{
if
(
flMorningClockAd
!=
null
)
{
flMorningClockAd
.
removeAllViews
()
flMorningClockAd
.
removeAllViews
()
//
flMorningClockAd.addView(TTPreLoadCarrierExpressManager.getInstance().ttFrameLayout)
flMorningClockAd
.
addView
(
TTPreLoadCarrierExpressManager
.
getInstance
().
ttFrameLayout
)
flMorningClockAd
.
addView
(
GroMoreCarrierExpressManager
.
instance
.
getADFrameLayout
())
//
flMorningClockAd.addView(GroMoreCarrierExpressManager.instance.getADFrameLayout())
}
}
}
}
}
catch
(
e
:
Exception
)
{
}
catch
(
e
:
Exception
)
{
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/SplashCsjADActivity.kt
View file @
6bdad092
package
com.mints.goodmoney.ui.activitys
package
com.mints.goodmoney.ui.activitys
import
android.text.TextUtils
import
android.view.KeyEvent
import
android.view.KeyEvent
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewGroup
import
com.bytedance.sdk.openadsdk.AdSlot
import
com.bytedance.sdk.openadsdk.AdSlot
import
com.bytedance.sdk.openadsdk.TTAdNative
import
com.bytedance.sdk.openadsdk.TTAdNative
import
com.bytedance.sdk.openadsdk.TTSplashAd
import
com.bytedance.sdk.openadsdk.TTSplashAd
import
com.mints.goodmoney.MintsApplication
import
com.mints.goodmoney.R
import
com.mints.goodmoney.R
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.manager.TTNativeExpressManager
import
com.mints.goodmoney.manager.TTNativeExpressManager
import
com.mints.goodmoney.manager.TtCsjAdManager
import
com.mints.goodmoney.manager.TtCsjAdManager
import
com.mints.goodmoney.manager.UserManager
import
com.mints.goodmoney.ui.activitys.base.BaseActivity
import
com.mints.goodmoney.ui.activitys.base.BaseActivity
import
com.mints.library.net.netstatus.NetUtils
import
com.mints.library.net.netstatus.NetUtils
import
com.mints.library.utils.CommonUtils
import
net.grandcentrix.tray.AppPreferences
private
val
TAG
=
SplashCsjADActivity
::
class
.
java
.
simpleName
private
val
TAG
=
SplashCsjADActivity
::
class
.
java
.
simpleName
...
@@ -18,6 +24,9 @@ private val TAG = SplashCsjADActivity::class.java.simpleName
...
@@ -18,6 +24,9 @@ private val TAG = SplashCsjADActivity::class.java.simpleName
* 后台返回时每次都展示 快手广告
* 后台返回时每次都展示 快手广告
*/
*/
class
SplashCsjADActivity
:
BaseActivity
()
{
class
SplashCsjADActivity
:
BaseActivity
()
{
private
val
ps
by
lazy
{
AppPreferences
(
context
)
}
private
var
container
:
ViewGroup
?
=
null
private
var
container
:
ViewGroup
?
=
null
private
var
mIsPaused
=
false
private
var
mIsPaused
=
false
var
canJump
=
false
var
canJump
=
false
...
@@ -143,7 +152,18 @@ class SplashCsjADActivity : BaseActivity() {
...
@@ -143,7 +152,18 @@ class SplashCsjADActivity : BaseActivity() {
}
}
private
fun
readyGoOtherActivity
()
{
private
fun
readyGoOtherActivity
()
{
finish
()
val
customVersion
:
Int
=
ps
.
getInt
(
Constant
.
CUSTOM_VERSION
,
0
)
val
isFirstEnter
:
Boolean
=
ps
.
getBoolean
(
Constant
.
ISFIRSTENTER
+
customVersion
,
true
)
if
(
isFirstEnter
)
{
readyGoThenKill
(
GuideActivity
::
class
.
java
)
}
else
{
val
channel
=
CommonUtils
.
getAppMetaData
(
MintsApplication
.
getContext
(),
"CHANNEL_NAME"
)
if
(
TextUtils
.
equals
(
channel
,
Constant
.
CHANNEL_SHARE
)
&&
!
UserManager
.
getInstance
().
userIsLogin
())
{
readyGo
(
WxLoginActivity
::
class
.
java
)
}
else
{
readyGoThenKill
(
MainActivity
::
class
.
java
)
}
}
}
}
}
}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/SplashGroMoreActivity.java
View file @
6bdad092
package
com
.
mints
.
goodmoney
.
ui
.
activitys
;
//
package com.mints.goodmoney.ui.activitys;
//
import
android.text.TextUtils
;
//
import android.text.TextUtils;
import
android.util.Log
;
//
import android.util.Log;
import
android.view.KeyEvent
;
//
import android.view.KeyEvent;
import
android.widget.FrameLayout
;
//
import android.widget.FrameLayout;
//
import
com.bytedance.msdk.adapter.pangle.PangleNetworkRequestInfo
;
//
import com.bytedance.msdk.adapter.pangle.PangleNetworkRequestInfo;
import
com.bytedance.msdk.api.AdError
;
//
import com.bytedance.msdk.api.AdError;
import
com.bytedance.msdk.api.AdSlot
;
//
import com.bytedance.msdk.api.AdSlot;
import
com.bytedance.msdk.api.NetworkPlatformConst
;
//
import com.bytedance.msdk.api.NetworkPlatformConst;
import
com.bytedance.msdk.api.TTNetworkRequestInfo
;
//
import com.bytedance.msdk.api.TTNetworkRequestInfo;
import
com.bytedance.msdk.api.splash.TTSplashAd
;
//
import com.bytedance.msdk.api.splash.TTSplashAd;
import
com.bytedance.msdk.api.splash.TTSplashAdListener
;
//
import com.bytedance.msdk.api.splash.TTSplashAdListener;
import
com.bytedance.msdk.api.splash.TTSplashAdLoadCallback
;
//
import com.bytedance.msdk.api.splash.TTSplashAdLoadCallback;
import
com.mints.goodmoney.MintsApplication
;
//
import com.mints.goodmoney.MintsApplication;
import
com.mints.goodmoney.R
;
//
import com.mints.goodmoney.R;
import
com.mints.goodmoney.common.Constant
;
//
import com.mints.goodmoney.common.Constant;
import
com.mints.goodmoney.common.DeviceInfo
;
//
import com.mints.goodmoney.common.DeviceInfo;
import
com.mints.goodmoney.manager.TrackManager
;
//
import com.mints.goodmoney.manager.TrackManager;
import
com.mints.goodmoney.manager.TtCsjAdManager
;
//
import com.mints.goodmoney.manager.TtCsjAdManager;
import
com.mints.goodmoney.manager.UserManager
;
//
import com.mints.goodmoney.manager.UserManager;
import
com.mints.goodmoney.ui.activitys.base.BaseActivity
;
//
import com.mints.goodmoney.ui.activitys.base.BaseActivity;
import
com.mints.goodmoney.utils.LogUtil
;
//
import com.mints.goodmoney.utils.LogUtil;
import
com.mints.library.utils.CommonUtils
;
//
import com.mints.library.utils.CommonUtils;
import
com.yilan.sdk.ui.little.YLLittleVideoFragment
;
//
import com.yilan.sdk.ui.little.YLLittleVideoFragment;
//
import
net.grandcentrix.tray.AppPreferences
;
//
import net.grandcentrix.tray.AppPreferences;
//
import
java.util.HashMap
;
//
import java.util.HashMap;
//
//
/**
/
//
**
* GroMore开屏广告Activity示例
//
* GroMore开屏广告Activity示例
*/
//
*/
public
class
SplashGroMoreActivity
extends
BaseActivity
{
//
public class SplashGroMoreActivity extends BaseActivity {
private
static
final
String
TAG
=
"SplashGroMoreActivity"
;
//
private static final String TAG = "SplashGroMoreActivity";
private
TTSplashAd
mTTSplashAd
;
////
private TTSplashAd mTTSplashAd;
private
FrameLayout
mSplashContainer
;
//
private FrameLayout mSplashContainer;
//是否强制跳转到主页面
//
//是否强制跳转到主页面
private
boolean
mForceGoMain
;
//
private boolean mForceGoMain;
private
String
mAdUnitId
=
"887459392"
;
//
private String mAdUnitId = "887459392";
//
//开屏广告加载超时时间,建议大于1000,这里为了冷启动第一次加载到广告并且展示,示例设置了2000ms
//
//开屏广告加载超时时间,建议大于1000,这里为了冷启动第一次加载到广告并且展示,示例设置了2000ms
private
static
final
int
AD_TIME_OUT
=
4000
;
//
private static final int AD_TIME_OUT = 4000;
private
static
final
int
MSG_GO_MAIN
=
1
;
//
private static final int MSG_GO_MAIN = 1;
//开屏广告是否已经加载
//
//开屏广告是否已经加载
private
boolean
mHasLoaded
;
//
private boolean mHasLoaded;
//
// 百度开屏广告点击跳转落地页后倒计时不暂停,即使在看落地页,倒计时结束后仍然会强制跳转,需要特殊处理:
//
// 百度开屏广告点击跳转落地页后倒计时不暂停,即使在看落地页,倒计时结束后仍然会强制跳转,需要特殊处理:
// 检测到广告被点击,且走了activity的onPaused证明跳转到了落地页,这时候onAdDismiss回调中不进行跳转,而是在activity的onResume中跳转。
//
// 检测到广告被点击,且走了activity的onPaused证明跳转到了落地页,这时候onAdDismiss回调中不进行跳转,而是在activity的onResume中跳转。
private
boolean
isBaiduSplashAd
=
false
;
//
private boolean isBaiduSplashAd = false;
private
boolean
baiduSplashAdClicked
=
false
;
//
private boolean baiduSplashAdClicked = false;
private
boolean
onPaused
=
false
;
//
private boolean onPaused = false;
private
AppPreferences
ps
;
//
private AppPreferences ps;
//
@Override
//
@Override
protected
int
getContentViewLayoutID
()
{
//
protected int getContentViewLayoutID() {
return
R
.
layout
.
activity_splash_gromore
;
//
return R.layout.activity_splash_gromore;
}
//
}
//
@Override
//
@Override
protected
void
initViewsAndEvents
()
{
//
protected void initViewsAndEvents() {
if
(!
isTaskRoot
())
{
//
if (!isTaskRoot()) {
//点击Home键后再点击App图标,会回到原来的界面。今天重新打包后,但是在Debug模式下,一切正常,
//
//点击Home键后再点击App图标,会回到原来的界面。今天重新打包后,但是在Debug模式下,一切正常,
// 但是把打完包的apk(Release)安装在其他手机上时,回到桌面后点击图标会重新打开启动页
//
// 但是把打完包的apk(Release)安装在其他手机上时,回到桌面后点击图标会重新打开启动页
finish
();
//
finish();
return
;
//
return;
}
//
}
TrackManager
.
getInstance
().
getCommonHallBaseMsg
();
//
TrackManager.getInstance().getCommonHallBaseMsg();
TrackManager
.
getInstance
().
firstApiWithUid
();
//
TrackManager.getInstance().firstApiWithUid();
//
// 校验APP签名
//
// 校验APP签名
checkAppSign
();
//
checkAppSign();
}
//
}
//
/**
//
/**
* 加载开屏广告
//
* 加载开屏广告
*/
//
*/
private
void
loadSplashAd
()
{
//
private void loadSplashAd() {
if
(
mAdUnitId
==
null
)
return
;
//
if (mAdUnitId == null) return;
/**
//
/**
* 注:每次加载开屏广告的时候需要新建一个TTSplashAd,否则可能会出现广告填充问题
//
* 注:每次加载开屏广告的时候需要新建一个TTSplashAd,否则可能会出现广告填充问题
* ( 例如:mTTSplashAd = new TTSplashAd(this, mAdUnitId);)
//
* ( 例如:mTTSplashAd = new TTSplashAd(this, mAdUnitId);)
*/
//
*/
mTTSplashAd
=
new
TTSplashAd
(
this
,
mAdUnitId
);
//
mTTSplashAd = new TTSplashAd(this, mAdUnitId);
mTTSplashAd
.
setTTAdSplashListener
(
mSplashAdListener
);
//
mTTSplashAd.setTTAdSplashListener(mSplashAdListener);
//
//step3:创建开屏广告请求参数AdSlot,具体参数含义参考文档
//
//step3:创建开屏广告请求参数AdSlot,具体参数含义参考文档
AdSlot
adSlot
=
new
AdSlot
.
Builder
()
//
AdSlot adSlot = new AdSlot.Builder()
.
setImageAdSize
(
1080
,
1920
)
// 既适用于原生类型,也适用于模版类型。
//
.setImageAdSize(1080, 1920) // 既适用于原生类型,也适用于模版类型。
.
build
();
//
.build();
//
//自定义兜底方案 选择使用
//
//自定义兜底方案 选择使用
TTNetworkRequestInfo
ttNetworkRequestInfo
;
//
TTNetworkRequestInfo ttNetworkRequestInfo;
//穿山甲兜底
//
//穿山甲兜底
ttNetworkRequestInfo
=
new
PangleNetworkRequestInfo
(
TtCsjAdManager
.
TT_AD_APPID
,
"887483103"
);
//
ttNetworkRequestInfo = new PangleNetworkRequestInfo(TtCsjAdManager.TT_AD_APPID, "887483103");
//gdt兜底
//
//gdt兜底
// ttNetworkRequestInfo = new GdtNetworkRequestInfo("1101152570", "8863364436303842593");
//
//
ttNetworkRequestInfo = new GdtNetworkRequestInfo("1101152570", "8863364436303842593");
//ks兜底
//
//ks兜底
// ttNetworkRequestInfo = new KsNetworkRequestInfo("90009", "4000000042");
//
//
ttNetworkRequestInfo = new KsNetworkRequestInfo("90009", "4000000042");
//百度兜底
//
//百度兜底
// ttNetworkRequestInfo = new BaiduNetworkRequestInfo("e866cfb0", "2058622");
//
//
ttNetworkRequestInfo = new BaiduNetworkRequestInfo("e866cfb0", "2058622");
//
//
//step4:请求广告,调用开屏广告异步请求接口,对请求回调的广告作渲染处理
//
//step4:请求广告,调用开屏广告异步请求接口,对请求回调的广告作渲染处理
mTTSplashAd
.
loadAd
(
adSlot
,
ttNetworkRequestInfo
,
new
TTSplashAdLoadCallback
()
{
//
mTTSplashAd.loadAd(adSlot, ttNetworkRequestInfo, new TTSplashAdLoadCallback() {
@Override
//
@Override
public
void
onSplashAdLoadFail
(
AdError
adError
)
{
//
public void onSplashAdLoadFail(AdError adError) {
LogUtil
.
d
(
TAG
,
adError
.
message
);
//
LogUtil.d(TAG, adError.message);
mHasLoaded
=
true
;
//
mHasLoaded = true;
Log
.
e
(
TAG
,
"load splash ad error : "
+
adError
.
code
+
", "
+
adError
.
message
);
//
Log.e(TAG, "load splash ad error : " + adError.code + ", " + adError.message);
// 获取本次waterfall加载中,加载失败的adn错误信息。
//
// 获取本次waterfall加载中,加载失败的adn错误信息。
if
(
mTTSplashAd
!=
null
)
//
if (mTTSplashAd != null)
LogUtil
.
d
(
TAG
,
"ad load infos: "
+
mTTSplashAd
.
getAdLoadInfoList
());
//
LogUtil.d(TAG, "ad load infos: " + mTTSplashAd.getAdLoadInfoList());
goToMainActivity
();
//
goToMainActivity();
}
//
}
//
@Override
//
@Override
public
void
onSplashAdLoadSuccess
()
{
//
public void onSplashAdLoadSuccess() {
if
(
mTTSplashAd
!=
null
)
{
//
if (mTTSplashAd != null) {
mTTSplashAd
.
showAd
(
mSplashContainer
);
//
mTTSplashAd.showAd(mSplashContainer);
isBaiduSplashAd
=
mTTSplashAd
.
getAdNetworkPlatformId
()
==
NetworkPlatformConst
.
SDK_NAME_BAIDU
;
//
isBaiduSplashAd = mTTSplashAd.getAdNetworkPlatformId() == NetworkPlatformConst.SDK_NAME_BAIDU;
// 获取本次waterfall加载中,加载失败的adn错误信息。
//
// 获取本次waterfall加载中,加载失败的adn错误信息。
//
//
if
(
mTTSplashAd
!=
null
)
{
//
if (mTTSplashAd != null) {
HashMap
<
String
,
Object
>
vo
=
new
HashMap
<>();
//
HashMap<String, Object> vo = new HashMap<>();
vo
.
put
(
"adcode"
,
mTTSplashAd
.
getAdNetworkRitId
());
//
vo.put("adcode",mTTSplashAd.getAdNetworkRitId());
vo
.
put
(
"ecpm"
,
mTTSplashAd
.
getPreEcpm
());
//
vo.put("ecpm",mTTSplashAd.getPreEcpm());
vo
.
put
(
"adSource"
,
mTTSplashAd
.
getAdNetworkPlatformId
());
//
vo.put("adSource",mTTSplashAd.getAdNetworkPlatformId());
vo
.
put
(
"adType"
,
Constant
.
GRO_MORE_ADTYPE0
);
//
vo.put("adType",Constant.GRO_MORE_ADTYPE0);
TrackManager
.
getInstance
().
cmtGroMoreInfo
(
vo
);
//
TrackManager.getInstance().cmtGroMoreInfo(vo);
}
//
}
}
//
}
Log
.
e
(
TAG
,
"load splash ad success "
);
//
Log.e(TAG, "load splash ad success ");
}
//
}
//
@Override
//
@Override
public
void
onAdLoadTimeout
()
{
//
public void onAdLoadTimeout() {
mHasLoaded
=
true
;
//
mHasLoaded = true;
Log
.
i
(
TAG
,
"开屏广告加载超时......."
);
//
Log.i(TAG, "开屏广告加载超时.......");
// 获取本次waterfall加载中,加载失败的adn错误信息。
//
// 获取本次waterfall加载中,加载失败的adn错误信息。
if
(
mTTSplashAd
!=
null
)
//
if (mTTSplashAd != null)
LogUtil
.
d
(
TAG
,
"ad load infos: "
+
mTTSplashAd
.
getAdLoadInfoList
());
//
LogUtil.d(TAG, "ad load infos: " + mTTSplashAd.getAdLoadInfoList());
goToMainActivity
();
//
goToMainActivity();
}
//
}
},
AD_TIME_OUT
);
//
}, AD_TIME_OUT);
//
}
//
}
//
TTSplashAdListener
mSplashAdListener
=
new
TTSplashAdListener
()
{
//
TTSplashAdListener mSplashAdListener = new TTSplashAdListener() {
@Override
//
@Override
public
void
onAdClicked
()
{
//
public void onAdClicked() {
baiduSplashAdClicked
=
true
;
//
baiduSplashAdClicked = true;
LogUtil
.
d
(
TAG
,
"onAdClicked"
);
//
LogUtil.d(TAG, "onAdClicked");
}
//
}
//
@Override
//
@Override
public
void
onAdShow
()
{
//
public void onAdShow() {
LogUtil
.
d
(
TAG
,
"onAdShow"
);
//
LogUtil.d(TAG, "onAdShow");
}
//
}
//
@Override
//
@Override
public
void
onAdSkip
()
{
//
public void onAdSkip() {
LogUtil
.
d
(
TAG
,
"onAdSkip"
);
//
LogUtil.d(TAG, "onAdSkip");
//
goToMainActivity
();
//
goToMainActivity();
}
//
}
//
@Override
//
@Override
public
void
onAdDismiss
()
{
//
public void onAdDismiss() {
LogUtil
.
d
(
TAG
,
"onAdDismiss"
);
//
LogUtil.d(TAG, "onAdDismiss");
if
(
isBaiduSplashAd
&&
onPaused
&&
baiduSplashAdClicked
)
{
//
if (isBaiduSplashAd && onPaused && baiduSplashAdClicked) {
// 这种情况下,百度开屏广告不能在onAdDismiss中跳转,需要在onResume中跳转主页。
//
// 这种情况下,百度开屏广告不能在onAdDismiss中跳转,需要在onResume中跳转主页。
return
;
//
return;
}
//
}
goToMainActivity
();
//
goToMainActivity();
}
//
}
};
//
};
//
@Override
//
@Override
protected
void
onResume
()
{
//
protected void onResume() {
//判断是否该跳转到主页面
//
//判断是否该跳转到主页面
if
(
mForceGoMain
)
{
//
if (mForceGoMain) {
goToMainActivity
();
//
goToMainActivity();
}
//
}
if
(
isBaiduSplashAd
&&
onPaused
&&
baiduSplashAdClicked
)
{
//
if (isBaiduSplashAd && onPaused && baiduSplashAdClicked) {
// 这种情况下,百度开屏广告不能在onAdDismiss中跳转,需要自己在onResume中跳转主页。
//
// 这种情况下,百度开屏广告不能在onAdDismiss中跳转,需要自己在onResume中跳转主页。
goToMainActivity
();
//
goToMainActivity();
}
//
}
super
.
onResume
();
//
super.onResume();
}
//
}
//
@Override
//
@Override
protected
void
onPause
()
{
//
protected void onPause() {
super
.
onPause
();
//
super.onPause();
onPaused
=
true
;
//
onPaused = true;
}
//
}
//
@Override
//
@Override
protected
void
onStop
()
{
//
protected void onStop() {
super
.
onStop
();
//
super.onStop();
mForceGoMain
=
true
;
//
mForceGoMain = true;
}
//
}
//
@Override
//
@Override
protected
void
onDestroy
()
{
//
protected void onDestroy() {
super
.
onDestroy
();
//
super.onDestroy();
if
(
mTTSplashAd
!=
null
)
{
//
if (mTTSplashAd != null) {
mTTSplashAd
.
destroy
();
//
mTTSplashAd.destroy();
}
//
}
}
//
}
//
/**
//
/**
* 校验App签名
//
* 校验App签名
*/
//
*/
private
void
checkAppSign
()
{
//
private void checkAppSign() {
DeviceInfo
deviceInfo
=
DeviceInfo
.
Companion
.
getInstance
();
//
DeviceInfo deviceInfo = DeviceInfo.Companion.getInstance();
if
(!
deviceInfo
.
getSignInfo
())
{
//
if (!deviceInfo.getSignInfo()) {
getBaseApplication
().
exitApp
();
//
getBaseApplication().exitApp();
}
else
{
//
} else {
YLLittleVideoFragment
.
preloadVideo
();
//
YLLittleVideoFragment.preloadVideo();
try
{
//
try {
mSplashContainer
=
findViewById
(
R
.
id
.
splash_container
);
//
mSplashContainer = findViewById(R.id.splash_container);
ps
=
new
AppPreferences
(
this
);
//
ps = new AppPreferences(this);
//加载开屏广告
//
//加载开屏广告
loadSplashAd
();
//
loadSplashAd();
}
catch
(
Exception
e
)
{
//
} catch (Exception e) {
goToMainActivity
();
//
goToMainActivity();
}
//
}
}
//
}
}
//
}
//
@Override
//
@Override
protected
boolean
isApplyKitKatTranslucency
()
{
//
protected boolean isApplyKitKatTranslucency() {
return
false
;
//
return false;
}
//
}
//
/**
//
/**
* 跳转到主页面
//
* 跳转到主页面
*/
//
*/
private
void
goToMainActivity
()
{
//
private void goToMainActivity() {
//
int
customVersion
=
ps
.
getInt
(
Constant
.
CUSTOM_VERSION
,
0
);
//
int customVersion = ps.getInt(Constant.CUSTOM_VERSION, 0);
boolean
isFirstEnter
=
ps
.
getBoolean
(
Constant
.
ISFIRSTENTER
+
customVersion
,
true
);
//
boolean isFirstEnter = ps.getBoolean(Constant.ISFIRSTENTER + customVersion, true);
if
(
isFirstEnter
)
{
//
if (isFirstEnter) {
readyGoThenKill
(
GuideActivity
.
class
);
//
readyGoThenKill(GuideActivity.class);
}
else
{
//
} else {
String
channel
=
CommonUtils
.
getAppMetaData
(
MintsApplication
.
getContext
(),
"CHANNEL_NAME"
);
//
String channel = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME");
if
(
TextUtils
.
equals
(
channel
,
Constant
.
CHANNEL_SHARE
)
&&
!
UserManager
.
getInstance
().
userIsLogin
())
{
//
if (TextUtils.equals(channel, Constant.CHANNEL_SHARE) && !UserManager.getInstance().userIsLogin()) {
readyGo
(
WxLoginActivity
.
class
);
//
readyGo(WxLoginActivity.class);
}
else
{
//
} else {
readyGoThenKill
(
MainActivity
.
class
);
//
readyGoThenKill(MainActivity.class);
}
//
}
}
//
}
//
mSplashContainer
.
removeAllViews
();
//
mSplashContainer.removeAllViews();
}
//
}
//
//
@Override
//
@Override
public
boolean
onKeyDown
(
int
keyCode
,
KeyEvent
event
)
{
//
public boolean onKeyDown(int keyCode, KeyEvent event) {
if
(
keyCode
==
KeyEvent
.
KEYCODE_BACK
)
{
//
if (keyCode == KeyEvent.KEYCODE_BACK) {
return
true
;
//
return true;
}
//
}
return
super
.
onKeyDown
(
keyCode
,
event
);
//
return super.onKeyDown(keyCode, event);
}
//
}
}
//
}
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/SplashKsADActivity.kt
View file @
6bdad092
...
@@ -76,6 +76,15 @@ class SplashKsADActivity : BaseActivity() {
...
@@ -76,6 +76,15 @@ class SplashKsADActivity : BaseActivity() {
next
()
next
()
}
}
override
fun
onDownloadTipsDialogShow
()
{
}
override
fun
onDownloadTipsDialogDismiss
()
{
}
override
fun
onDownloadTipsDialogCancel
()
{
}
})
})
if
(!
isFinishing
)
{
if
(!
isFinishing
)
{
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/WalkActivity.kt
View file @
6bdad092
...
@@ -3,8 +3,9 @@ package com.mints.goodmoney.ui.activitys
...
@@ -3,8 +3,9 @@ package com.mints.goodmoney.ui.activitys
import
android.os.Bundle
import
android.os.Bundle
import
android.view.View
import
android.view.View
import
com.mints.goodmoney.R
import
com.mints.goodmoney.R
import
com.mints.goodmoney.ad.express.
GroMore
CarrierExpressManager
import
com.mints.goodmoney.ad.express.
TTPreLoad
CarrierExpressManager
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.manager.TtCsjAdManager
import
com.mints.goodmoney.mvp.model.WalkBean
import
com.mints.goodmoney.mvp.model.WalkBean
import
com.mints.goodmoney.mvp.presenters.WalkPresenter
import
com.mints.goodmoney.mvp.presenters.WalkPresenter
import
com.mints.goodmoney.mvp.views.WalkView
import
com.mints.goodmoney.mvp.views.WalkView
...
@@ -98,8 +99,8 @@ class WalkActivity : BaseActivity(), View.OnClickListener, WalkView, StepView.St
...
@@ -98,8 +99,8 @@ class WalkActivity : BaseActivity(), View.OnClickListener, WalkView, StepView.St
}
}
// 预加载信息流
// 预加载信息流
//
TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_WALK)
TTPreLoadCarrierExpressManager
.
getInstance
().
loadTtFrameLayout
(
TtCsjAdManager
.
TT_AD_NATIVEEXPRESS_WALK
)
GroMoreCarrierExpressManager
.
instance
.
loadADFrameLayout
()
//
GroMoreCarrierExpressManager.instance.loadADFrameLayout()
}
}
/**
/**
...
@@ -107,11 +108,12 @@ class WalkActivity : BaseActivity(), View.OnClickListener, WalkView, StepView.St
...
@@ -107,11 +108,12 @@ class WalkActivity : BaseActivity(), View.OnClickListener, WalkView, StepView.St
*/
*/
private
fun
initExpress
()
{
private
fun
initExpress
()
{
try
{
try
{
if
(
GroMoreCarrierExpressManager
.
instance
.
getADFrameLayout
()
!=
null
)
{
// if (GroMoreCarrierExpressManager.instance.getADFrameLayout() != null) {
if
(
TTPreLoadCarrierExpressManager
.
getInstance
().
ttFrameLayout
!=
null
)
{
if
(
flWalkAd
!=
null
)
{
if
(
flWalkAd
!=
null
)
{
flWalkAd
.
removeAllViews
()
flWalkAd
.
removeAllViews
()
//
flWalkAd.addView(TTPreLoadCarrierExpressManager.getInstance().ttFrameLayout)
flWalkAd
.
addView
(
TTPreLoadCarrierExpressManager
.
getInstance
().
ttFrameLayout
)
flWalkAd
.
addView
(
GroMoreCarrierExpressManager
.
instance
.
getADFrameLayout
())
//
flWalkAd.addView(GroMoreCarrierExpressManager.instance.getADFrameLayout())
}
}
}
}
}
catch
(
e
:
Exception
)
{
}
catch
(
e
:
Exception
)
{
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/WaterActivity.kt
View file @
6bdad092
...
@@ -3,8 +3,9 @@ package com.mints.goodmoney.ui.activitys
...
@@ -3,8 +3,9 @@ package com.mints.goodmoney.ui.activitys
import
android.os.Bundle
import
android.os.Bundle
import
android.view.View
import
android.view.View
import
com.mints.goodmoney.R
import
com.mints.goodmoney.R
import
com.mints.goodmoney.ad.express.
GroMore
CarrierExpressManager
import
com.mints.goodmoney.ad.express.
TTPreLoad
CarrierExpressManager
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.manager.TtCsjAdManager
import
com.mints.goodmoney.mvp.model.WaterBean
import
com.mints.goodmoney.mvp.model.WaterBean
import
com.mints.goodmoney.mvp.presenters.WaterPresenter
import
com.mints.goodmoney.mvp.presenters.WaterPresenter
import
com.mints.goodmoney.ui.activitys.base.BaseActivity
import
com.mints.goodmoney.ui.activitys.base.BaseActivity
...
@@ -68,8 +69,8 @@ class WaterActivity : BaseActivity(), View.OnClickListener, WaterView.WaterViewL
...
@@ -68,8 +69,8 @@ class WaterActivity : BaseActivity(), View.OnClickListener, WaterView.WaterViewL
}
}
// 预加载信息流
// 预加载信息流
//
TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_WATER)
TTPreLoadCarrierExpressManager
.
getInstance
().
loadTtFrameLayout
(
TtCsjAdManager
.
TT_AD_NATIVEEXPRESS_WATER
)
GroMoreCarrierExpressManager
.
instance
.
loadADFrameLayout
()
//
GroMoreCarrierExpressManager.instance.loadADFrameLayout()
}
}
override
fun
clickForWaterSuc
(
waterCoin
:
Int
)
{
override
fun
clickForWaterSuc
(
waterCoin
:
Int
)
{
...
@@ -111,11 +112,12 @@ class WaterActivity : BaseActivity(), View.OnClickListener, WaterView.WaterViewL
...
@@ -111,11 +112,12 @@ class WaterActivity : BaseActivity(), View.OnClickListener, WaterView.WaterViewL
*/
*/
private
fun
initExpress
()
{
private
fun
initExpress
()
{
try
{
try
{
if
(
GroMoreCarrierExpressManager
.
instance
.
getADFrameLayout
()
!=
null
)
{
// if (GroMoreCarrierExpressManager.instance.getADFrameLayout() != null) {
if
(
TTPreLoadCarrierExpressManager
.
getInstance
().
ttFrameLayout
!=
null
)
{
if
(
flWaterAd
!=
null
)
{
if
(
flWaterAd
!=
null
)
{
flWaterAd
.
removeAllViews
()
flWaterAd
.
removeAllViews
()
//
flWaterAd.addView(TTPreLoadCarrierExpressManager.getInstance().ttFrameLayout)
flWaterAd
.
addView
(
TTPreLoadCarrierExpressManager
.
getInstance
().
ttFrameLayout
)
flWaterAd
.
addView
(
GroMoreCarrierExpressManager
.
instance
.
getADFrameLayout
())
//
flWaterAd.addView(GroMoreCarrierExpressManager.instance.getADFrameLayout())
}
}
}
}
}
catch
(
e
:
Exception
)
{
}
catch
(
e
:
Exception
)
{
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/XiaomanActivity.kt
View file @
6bdad092
...
@@ -349,6 +349,7 @@ class XiaomanActivity : BaseActivity(), View.OnClickListener {
...
@@ -349,6 +349,7 @@ class XiaomanActivity : BaseActivity(), View.OnClickListener {
//视频广告加载后的视频文件资源缓存到本地的回调
//视频广告加载后的视频文件资源缓存到本地的回调
override
fun
onRewardVideoCached
()
{}
override
fun
onRewardVideoCached
()
{}
override
fun
onRewardVideoCached
(
p0
:
TTRewardVideoAd
?)
{}
//视频广告素材加载到,如title,视频url等,不包括视频文件
//视频广告素材加载到,如title,视频url等,不包括视频文件
override
fun
onRewardVideoAdLoad
(
ad
:
TTRewardVideoAd
)
{
override
fun
onRewardVideoAdLoad
(
ad
:
TTRewardVideoAd
)
{
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/MainFragment.kt
View file @
6bdad092
...
@@ -16,7 +16,6 @@ import com.daimajia.androidanimations.library.YoYo
...
@@ -16,7 +16,6 @@ import com.daimajia.androidanimations.library.YoYo
import
com.daimajia.androidanimations.library.YoYo.YoYoString
import
com.daimajia.androidanimations.library.YoYo.YoYoString
import
com.mints.goodmoney.MintsApplication
import
com.mints.goodmoney.MintsApplication
import
com.mints.goodmoney.R
import
com.mints.goodmoney.R
import
com.mints.goodmoney.ad.express.GroMoreExpressManager
import
com.mints.goodmoney.ad.express.PreLoadExpressManager
import
com.mints.goodmoney.ad.express.PreLoadExpressManager
import
com.mints.goodmoney.ad.express.TTPreLoadExpressXmlyManager
import
com.mints.goodmoney.ad.express.TTPreLoadExpressXmlyManager
import
com.mints.goodmoney.ad.video.VideoAdingManager
import
com.mints.goodmoney.ad.video.VideoAdingManager
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/MyFragment.kt
View file @
6bdad092
...
@@ -19,7 +19,6 @@ import com.mints.goodmoney.BuildConfig
...
@@ -19,7 +19,6 @@ import com.mints.goodmoney.BuildConfig
import
com.mints.goodmoney.MintsApplication
import
com.mints.goodmoney.MintsApplication
import
com.mints.goodmoney.R
import
com.mints.goodmoney.R
import
com.mints.goodmoney.ad.banner.BannerManager
import
com.mints.goodmoney.ad.banner.BannerManager
import
com.mints.goodmoney.ad.express.GroMoreCarrierExpressManager
import
com.mints.goodmoney.ad.express.PreLoadExpressManager
import
com.mints.goodmoney.ad.express.PreLoadExpressManager
import
com.mints.goodmoney.ad.express.TTPreLoadCarrierExpressManager
import
com.mints.goodmoney.ad.express.TTPreLoadCarrierExpressManager
import
com.mints.goodmoney.ad.express.TTPreLoadExpressXmlyManager
import
com.mints.goodmoney.ad.express.TTPreLoadExpressXmlyManager
...
@@ -1013,13 +1012,13 @@ class MyFragment : BaseFragment(),
...
@@ -1013,13 +1012,13 @@ class MyFragment : BaseFragment(),
readyGo
(
XiaomanActivity
::
class
.
java
,
bundle
)
readyGo
(
XiaomanActivity
::
class
.
java
,
bundle
)
}
}
Constant
.
HOT_ACTIVITY_WATER
->
{
Constant
.
HOT_ACTIVITY_WATER
->
{
GroMoreCarrierExpressManager
.
instance
.
loadADFrameLayout
()
//
GroMoreCarrierExpressManager.instance.loadADFrameLayout()
//
TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_WATER)
TTPreLoadCarrierExpressManager
.
getInstance
().
loadTtFrameLayout
(
TtCsjAdManager
.
TT_AD_NATIVEEXPRESS_WATER
)
readyGo
(
WaterActivity
::
class
.
java
)
readyGo
(
WaterActivity
::
class
.
java
)
}
}
Constant
.
HOT_ACTIVITY_WALK
->
{
Constant
.
HOT_ACTIVITY_WALK
->
{
GroMoreCarrierExpressManager
.
instance
.
loadADFrameLayout
()
//
GroMoreCarrierExpressManager.instance.loadADFrameLayout()
//
TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_WALK)
TTPreLoadCarrierExpressManager
.
getInstance
().
loadTtFrameLayout
(
TtCsjAdManager
.
TT_AD_NATIVEEXPRESS_WALK
)
readyGo
(
WalkActivity
::
class
.
java
)
readyGo
(
WalkActivity
::
class
.
java
)
}
}
Constant
.
HOT_ACTIVITY_CARD
->
{
Constant
.
HOT_ACTIVITY_CARD
->
{
...
@@ -1029,8 +1028,8 @@ class MyFragment : BaseFragment(),
...
@@ -1029,8 +1028,8 @@ class MyFragment : BaseFragment(),
readyGo
(
LiebaoGameActivity
::
class
.
java
)
readyGo
(
LiebaoGameActivity
::
class
.
java
)
}
}
Constant
.
HOT_ACTIVITY_MORNINGCLOCK
->
{
Constant
.
HOT_ACTIVITY_MORNINGCLOCK
->
{
GroMoreCarrierExpressManager
.
instance
.
loadADFrameLayout
()
//
GroMoreCarrierExpressManager.instance.loadADFrameLayout()
//
TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_MORNINGCLOCK)
TTPreLoadCarrierExpressManager
.
getInstance
().
loadTtFrameLayout
(
TtCsjAdManager
.
TT_AD_NATIVEEXPRESS_MORNINGCLOCK
)
readyGo
(
MorningClockActivity
::
class
.
java
)
readyGo
(
MorningClockActivity
::
class
.
java
)
}
}
Constant
.
HOT_ACTIVITY_BXM
->
{
Constant
.
HOT_ACTIVITY_BXM
->
{
...
@@ -1110,8 +1109,8 @@ class MyFragment : BaseFragment(),
...
@@ -1110,8 +1109,8 @@ class MyFragment : BaseFragment(),
readyGo
(
WrapperActivity
::
class
.
java
,
bundle
)
readyGo
(
WrapperActivity
::
class
.
java
,
bundle
)
}
}
Constant
.
HOT_ACTIVITY_EAT
->
{
Constant
.
HOT_ACTIVITY_EAT
->
{
GroMoreCarrierExpressManager
.
instance
.
loadADFrameLayout
()
//
GroMoreCarrierExpressManager.instance.loadADFrameLayout()
//
TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_EAT)
TTPreLoadCarrierExpressManager
.
getInstance
().
loadTtFrameLayout
(
TtCsjAdManager
.
TT_AD_NATIVEEXPRESS_EAT
)
readyGo
(
FoodSubsidyActivity
::
class
.
java
)
readyGo
(
FoodSubsidyActivity
::
class
.
java
)
}
}
Constant
.
HOT_ACTIVITY_SHARE_NEWS
->
{
Constant
.
HOT_ACTIVITY_SHARE_NEWS
->
{
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/utils/ForegroundOrBackground.java
View file @
6bdad092
...
@@ -8,9 +8,7 @@ import android.text.TextUtils;
...
@@ -8,9 +8,7 @@ import android.text.TextUtils;
import
com.mints.goodmoney.manager.TrackManager
;
import
com.mints.goodmoney.manager.TrackManager
;
import
com.mints.goodmoney.mvp.presenters.VersionUpdatePresenter
;
import
com.mints.goodmoney.mvp.presenters.VersionUpdatePresenter
;
import
com.mints.goodmoney.ui.activitys.SplashADActivity
;
import
com.mints.goodmoney.ui.activitys.SplashCsjADActivity
;
import
com.mints.goodmoney.ui.activitys.SplashCsjADActivity
;
import
com.mints.goodmoney.ui.activitys.SplashGroMoreActivity
;
import
java.lang.ref.WeakReference
;
import
java.lang.ref.WeakReference
;
...
@@ -131,7 +129,7 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
...
@@ -131,7 +129,7 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
//// activity.startActivity(ksIntent);
//// activity.startActivity(ksIntent);
// }
// }
if
(
ksIntent
==
null
)
{
if
(
ksIntent
==
null
)
{
ksIntent
=
new
Intent
(
activity
,
Splash
GroMore
Activity
.
class
);
ksIntent
=
new
Intent
(
activity
,
Splash
CsjAD
Activity
.
class
);
}
}
activity
.
startActivity
(
ksIntent
);
activity
.
startActivity
(
ksIntent
);
}
}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/utils/VideoOptionUtil.java
View file @
6bdad092
package
com
.
mints
.
goodmoney
.
utils
;
//
package com.mints.goodmoney.utils;
//
import
com.bytedance.msdk.api.BaiduExtraOptions
;
//
import com.bytedance.msdk.api.BaiduExtraOptions;
import
com.bytedance.msdk.api.GDTExtraOption
;
//
import com.bytedance.msdk.api.GDTExtraOption;
import
com.bytedance.msdk.api.TTVideoOption
;
//
import com.bytedance.msdk.api.TTVideoOption;
//
public
class
VideoOptionUtil
{
//
public class VideoOptionUtil {
//
//
public
static
TTVideoOption
getTTVideoOption
()
{
//
public static TTVideoOption getTTVideoOption() {
//广点通(GDT)单独使用配置
//
//广点通(GDT)单独使用配置
GDTExtraOption
gdtExtraOption
=
new
GDTExtraOption
.
Builder
()
//
GDTExtraOption gdtExtraOption = new GDTExtraOption.Builder()
.
setGDTAutoPlayMuted
(
true
)
//自动播放是否静音,默认true
//
.setGDTAutoPlayMuted(true)//自动播放是否静音,默认true
.
setGDTDetailPageMuted
(
false
)
//详情页是否静音,默认值为false,即有声播放;
//
.setGDTDetailPageMuted(false)//详情页是否静音,默认值为false,即有声播放;
.
setGDTEnableDetailPage
(
true
)
//是否能跳转详情页,默认true
//
.setGDTEnableDetailPage(true)//是否能跳转详情页,默认true
.
setGDTEnableUserControl
(
false
)
//是否能控制是否暂停与播放,默认false
//
.setGDTEnableUserControl(false)//是否能控制是否暂停与播放,默认false
.
setGDTMaxVideoDuration
(
0
)
//视频最大长度,单位:秒 此设置会影响广告填充,请谨慎设置
//
.setGDTMaxVideoDuration(0)//视频最大长度,单位:秒 此设置会影响广告填充,请谨慎设置
.
setGDTMinVideoDuration
(
0
)
//视频最小长度,单位:秒 此设置会影响广告填充,请谨慎设置
//
.setGDTMinVideoDuration(0)//视频最小长度,单位:秒 此设置会影响广告填充,请谨慎设置
// VideoOption.AutoPlayPolicy.WIFI表示只在WiFi下自动播放;
//
// VideoOption.AutoPlayPolicy.WIFI表示只在WiFi下自动播放;
// VideoOption.AutoPlayPolicy.ALWAYS表示始终自动播放,不区分当前网络;
//
// VideoOption.AutoPlayPolicy.ALWAYS表示始终自动播放,不区分当前网络;
// VideoOption.AutoPlayPolicy.NEVER表示始终都不自动播放,不区分当前网络,但在WiFi时会预下载视频资源;
//
// VideoOption.AutoPlayPolicy.NEVER表示始终都不自动播放,不区分当前网络,但在WiFi时会预下载视频资源;
// 默认为始终自动播放;模板渲染视频、插屏2.0视频、自渲染2.0视频都可使用
//
// 默认为始终自动播放;模板渲染视频、插屏2.0视频、自渲染2.0视频都可使用
.
setAutoPlayPolicy
(
GDTExtraOption
.
AutoPlayPolicy
.
WIFI
)
//自动播放策略--
//
.setAutoPlayPolicy(GDTExtraOption.AutoPlayPolicy.WIFI)//自动播放策略--
.
setDownAPPConfirmPolicy
(
GDTExtraOption
.
DownAPPConfirmPolicy
.
TYPE_DEFAULT
)
//指定点击 APP 广告后是否展示二次确认,可选项包括 Default(wifi 不展示,非wifi 展示),NoConfirm(所有情况不展示)
//
.setDownAPPConfirmPolicy(GDTExtraOption.DownAPPConfirmPolicy.TYPE_DEFAULT)//指定点击 APP 广告后是否展示二次确认,可选项包括 Default(wifi 不展示,非wifi 展示),NoConfirm(所有情况不展示)
.
setBrowserType
(
GDTExtraOption
.
BrowserType
.
TYPE_DEFAULT
)
//指定普链广告点击后用于展示落地页的浏览器类型,可选项包括:InnerBrowser(APP 内置浏览器),Sys(系统浏览器),Default(默认),SDK 按照默认逻辑选择
//
.setBrowserType(GDTExtraOption.BrowserType.TYPE_DEFAULT)//指定普链广告点击后用于展示落地页的浏览器类型,可选项包括:InnerBrowser(APP 内置浏览器),Sys(系统浏览器),Default(默认),SDK 按照默认逻辑选择
.
build
();
//
.build();
//
//针对百度SDK信息流设置
//
//针对百度SDK信息流设置
BaiduExtraOptions
baiduExtraOptions
=
new
BaiduExtraOptions
.
Builder
()
//
BaiduExtraOptions baiduExtraOptions = new BaiduExtraOptions.Builder()
.
setGDTExtraOption
(
BaiduExtraOptions
.
DOWNLOAD_APP_CONFIRM_ALWAYS
)
//
.setGDTExtraOption(BaiduExtraOptions.DOWNLOAD_APP_CONFIRM_ALWAYS)
.
setCacheVideoOnlyWifi
(
true
).
build
();
//
.setCacheVideoOnlyWifi(true).build();
//
//视频声音控制
//
//视频声音控制
TTVideoOption
videoOption
=
new
TTVideoOption
.
Builder
()
//
TTVideoOption videoOption = new TTVideoOption.Builder()
.
setMuted
(
false
)
//所有类型生效,GDT除外
//
.setMuted(false) //所有类型生效,GDT除外
.
setAdmobAppVolume
(
1
f
)
//admob 声音配置,与setMuted配合使用
//
.setAdmobAppVolume(1f)//admob 声音配置,与setMuted配合使用
.
setGDTExtraOption
(
gdtExtraOption
)
//GDT 单独
//
.setGDTExtraOption(gdtExtraOption)//GDT 单独
.
setBaiduExtraOption
(
baiduExtraOptions
)
//百度SDK配置
//
.setBaiduExtraOption(baiduExtraOptions)//百度SDK配置
.
build
();
//
.build();
//
return
videoOption
;
//
return videoOption;
}
//
}
//
public
static
TTVideoOption
getTTVideoOption2
()
{
//
public static TTVideoOption getTTVideoOption2() {
//广点通(GDT)单独使用配置
//
//广点通(GDT)单独使用配置
GDTExtraOption
gdtExtraOption
=
new
GDTExtraOption
.
Builder
()
//
GDTExtraOption gdtExtraOption = new GDTExtraOption.Builder()
.
setGDTAutoPlayMuted
(
true
)
//自动播放是否静音,默认true
//
.setGDTAutoPlayMuted(true)//自动播放是否静音,默认true
.
setGDTDetailPageMuted
(
false
)
//详情页是否静音,默认值为false,即有声播放;
//
.setGDTDetailPageMuted(false)//详情页是否静音,默认值为false,即有声播放;
.
setGDTEnableDetailPage
(
true
)
//是否能跳转详情页,默认true
//
.setGDTEnableDetailPage(true)//是否能跳转详情页,默认true
.
setGDTEnableUserControl
(
false
)
//是否能控制是否暂停与播放,默认false
//
.setGDTEnableUserControl(false)//是否能控制是否暂停与播放,默认false
.
setGDTMaxVideoDuration
(
0
)
//视频最大长度,单位:秒 此设置会影响广告填充,请谨慎设置
//
.setGDTMaxVideoDuration(0)//视频最大长度,单位:秒 此设置会影响广告填充,请谨慎设置
.
setGDTMinVideoDuration
(
0
)
//视频最小长度,单位:秒 此设置会影响广告填充,请谨慎设置
//
.setGDTMinVideoDuration(0)//视频最小长度,单位:秒 此设置会影响广告填充,请谨慎设置
.
setFeedExpressType
(
GDTExtraOption
.
FeedExpressType
.
FEED_EXPRESS_TYPE_2
)
//确定使用GDT FEED 模板渲染2.0功能;需要向广点通商务申请2.0权限
//
.setFeedExpressType(GDTExtraOption.FeedExpressType.FEED_EXPRESS_TYPE_2)//确定使用GDT FEED 模板渲染2.0功能;需要向广点通商务申请2.0权限
// VideoOption.AutoPlayPolicy.WIFI表示只在WiFi下自动播放;
//
// VideoOption.AutoPlayPolicy.WIFI表示只在WiFi下自动播放;
// VideoOption.AutoPlayPolicy.ALWAYS表示始终自动播放,不区分当前网络;
//
// VideoOption.AutoPlayPolicy.ALWAYS表示始终自动播放,不区分当前网络;
// VideoOption.AutoPlayPolicy.NEVER表示始终都不自动播放,不区分当前网络,但在WiFi时会预下载视频资源;
//
// VideoOption.AutoPlayPolicy.NEVER表示始终都不自动播放,不区分当前网络,但在WiFi时会预下载视频资源;
// 默认为始终自动播放;模板渲染视频、插屏2.0视频、自渲染2.0视频都可使用
//
// 默认为始终自动播放;模板渲染视频、插屏2.0视频、自渲染2.0视频都可使用
.
setAutoPlayPolicy
(
GDTExtraOption
.
AutoPlayPolicy
.
WIFI
)
//自动播放策略--
//
.setAutoPlayPolicy(GDTExtraOption.AutoPlayPolicy.WIFI)//自动播放策略--
.
setDownAPPConfirmPolicy
(
GDTExtraOption
.
DownAPPConfirmPolicy
.
TYPE_DEFAULT
)
//指定点击 APP 广告后是否展示二次确认,可选项包括 Default(wifi 不展示,非wifi 展示),NoConfirm(所有情况不展示)
//
.setDownAPPConfirmPolicy(GDTExtraOption.DownAPPConfirmPolicy.TYPE_DEFAULT)//指定点击 APP 广告后是否展示二次确认,可选项包括 Default(wifi 不展示,非wifi 展示),NoConfirm(所有情况不展示)
.
setBrowserType
(
GDTExtraOption
.
BrowserType
.
TYPE_DEFAULT
).
build
();
//指定普链广告点击后用于展示落地页的浏览器类型,可选项包括:InnerBrowser(APP 内置浏览器),Sys(系统浏览器),Default(默认),SDK 按照默认逻辑选择
//
.setBrowserType(GDTExtraOption.BrowserType.TYPE_DEFAULT).build();//指定普链广告点击后用于展示落地页的浏览器类型,可选项包括:InnerBrowser(APP 内置浏览器),Sys(系统浏览器),Default(默认),SDK 按照默认逻辑选择
//
//
//针对百度SDK信息流设置
//
//针对百度SDK信息流设置
BaiduExtraOptions
baiduExtraOptions
=
new
BaiduExtraOptions
.
Builder
()
//
BaiduExtraOptions baiduExtraOptions = new BaiduExtraOptions.Builder()
.
setGDTExtraOption
(
BaiduExtraOptions
.
DOWNLOAD_APP_CONFIRM_ALWAYS
)
//
.setGDTExtraOption(BaiduExtraOptions.DOWNLOAD_APP_CONFIRM_ALWAYS)
.
setCacheVideoOnlyWifi
(
true
).
build
();
//
.setCacheVideoOnlyWifi(true).build();
//
//视频声音控制
//
//视频声音控制
TTVideoOption
videoOption
=
new
TTVideoOption
.
Builder
()
//
TTVideoOption videoOption = new TTVideoOption.Builder()
.
setMuted
(
false
)
//所有类型生效,GDT除外
//
.setMuted(false) //所有类型生效,GDT除外
.
setAdmobAppVolume
(
1
f
)
//admob 声音配置,与setMuted配合使用
//
.setAdmobAppVolume(1f)//admob 声音配置,与setMuted配合使用
.
setGDTExtraOption
(
gdtExtraOption
)
//GDT 单独
//
.setGDTExtraOption(gdtExtraOption)//GDT 单独
.
setBaiduExtraOption
(
baiduExtraOptions
)
//百度SDK配置
//
.setBaiduExtraOption(baiduExtraOptions)//百度SDK配置
.
build
();
//
.build();
//
return
videoOption
;
//
return videoOption;
}
//
}
}
//
}
GoodMoney/build.gradle
View file @
6bdad092
...
@@ -80,7 +80,9 @@ allprojects {
...
@@ -80,7 +80,9 @@ allprojects {
repositories
{
repositories
{
google
()
google
()
jcenter
()
jcenter
()
maven
{
url
'https://dl.bintray.com/umsdk/release'
}
// maven { url 'https://dl.bintray.com/umsdk/release' }
// umeng仓库
maven
{
url
'https://repo1.maven.org/maven2/'
}
maven
{
url
"https://jitpack.io"
}
maven
{
url
"https://jitpack.io"
}
//添加一览 maven地址
//添加一览 maven地址
...
...
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