Commit 503e89c6 authored by jyx's avatar jyx

Merge branch 'dev_gro_more_haotu' into dev_ad

# Conflicts:
#	GoodMoney/app/src/main/java/com/mints/goodmoney/ad/express/GroMoreCarrierExpressManager.kt
#	GoodMoney/app/src/main/java/com/mints/goodmoney/ad/express/GroMoreExpressManager.kt
#	GoodMoney/app/src/main/java/com/mints/goodmoney/ad/express/PreLoadExpressManager.kt
#	GoodMoney/app/src/main/java/com/mints/goodmoney/ad/video/CsjGroMoreVideoAdManager.java
#	GoodMoney/app/src/main/java/com/mints/goodmoney/manager/CsjAppLogManager.kt
#	GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/FoodSubsidyActivity.kt
#	GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/MorningClockActivity.kt
#	GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/SplashGroMoreActivity.java
#	GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/WalkActivity.kt
#	GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/WaterActivity.kt
#	GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/MainFragment.kt
#	GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/MyFragment.kt
#	GoodMoney/app/src/main/java/com/mints/goodmoney/utils/ForegroundOrBackground.java
#	GoodMoney/build.gradle
parents 729994a5 6bdad092
......@@ -5,8 +5,6 @@ apply plugin: 'kotlin-kapt'
apply plugin: 'dagger.hilt.android.plugin'
apply plugin: 'androidx.navigation.safeargs.kotlin'
apply plugin: 'android-aspectjx'
apply plugin: 'com.sensorsdata.analytics.android'
apply plugin: 'com.bytedance.std.tracker'
android {
compileSdkVersion rootProject.ext.androidCompileSdkVersion
......@@ -225,21 +223,6 @@ dependencies {
implementation(name: 'umeng-asms-armeabi-v1.2.2', ext: 'aar')
implementation(name: 'umeng-apm-armeabi-v1.2.0', ext: 'aar')
// TalkingDada(已集成)
// 一览视频
implementation("com.yilan.sdk:ui:3.3.3.0") {
exclude group: 'com.yilan.sdk', module: 'yb_extra'
exclude group: 'com.yilan.sdk', module: 'gdt'
exclude group: 'com.yilan.sdk', module: 'ks'
}
implementation('com.aliyun.ams:alicloud-android-httpdns:1.2.3@aar') {
transitive true
}
implementation 'tv.danmaku.ijk.media:ijkplayer-java:0.8.8'
implementation 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.8'
implementation 'tv.danmaku.ijk.media:ijkplayer-armv5:0.8.8'
implementation 'tv.danmaku.ijk.media:ijkplayer-arm64:0.8.8'
implementation 'tv.danmaku.ijk.media:ijkplayer-x86:0.8.8'
implementation 'tv.danmaku.ijk.media:ijkplayer-x86_64:0.8.8'
// 数美
implementation files('libs/smantifraud.aar')
// 猎豹游戏
......@@ -360,18 +343,10 @@ dependencies {
// androidTestImplementation 'androidx.test.ext:junit:1.1.2'
// 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-all--3.3.16-publishRelease-9ffe2b94e', ext: 'aar')
// applog
implementation 'com.bytedance.applog:RangersAppLog-All-cn:5.2.6'
implementation(name: 'kssdk-all--3.3.16-publishRelease-9ffe2b94e', ext: 'aar')
}
......@@ -131,17 +131,6 @@
<!-- </intent-filter>-->
<!-- </activity>-->
<activity
android:name=".ui.activitys.SplashGroMoreActivity"
android:screenOrientation="portrait"
android:theme="@style/NormalSplash">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ui.activitys.MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
......@@ -210,7 +199,13 @@
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.SplashCsjADActivity"
android:screenOrientation="portrait" />
android:screenOrientation="portrait"
android:theme="@style/NormalSplash">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ui.activitys.MorningClockActivity"
android:screenOrientation="portrait" />
......@@ -258,9 +253,6 @@
<activity
android:name=".ui.activitys.ShaiziActivity"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.SplashGroMoreBackgroundActivity"
android:screenOrientation="portrait" />
<service
android:name=".service.UpdateService"
......@@ -319,8 +311,10 @@
android:noHistory="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="tencent1111016251" />
</intent-filter>
</activity>
......
......@@ -12,8 +12,6 @@ import androidx.multidex.MultiDexApplication;
import com.hjq.toast.ToastUtils;
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.LiebaoManager;
import com.mints.goodmoney.manager.MhManager;
......@@ -24,7 +22,6 @@ import com.mints.goodmoney.manager.TtCsjAdManager;
import com.mints.goodmoney.manager.TzManager;
import com.mints.goodmoney.manager.WnManager;
import com.mints.goodmoney.manager.XmManager;
import com.mints.goodmoney.manager.YlVideoManager;
import com.mints.goodmoney.manager.YlhAdManager;
import com.mints.goodmoney.net.LoanService;
import com.mints.goodmoney.utils.ForegroundOrBackground;
......@@ -129,12 +126,6 @@ public class MintsApplication extends MultiDexApplication {
// 穿山甲
TtCsjAdManager.init(this);
// GroMore
CsjGroMoreManager.INSTANCE.init(this);
// AppLog
CsjAppLogManager.INSTANCE.init(this);
// 快手
KsManager.INSTANCE.initKs(this);
......@@ -153,9 +144,6 @@ public class MintsApplication extends MultiDexApplication {
//小满
XmManager.INSTANCE.initXm(this);
// 一览视频
YlVideoManager.INSTANCE.init(this);
// 猎豹游戏初始化
LiebaoManager.getInstance().initCmGameSdk();
......
......@@ -10,18 +10,11 @@ import com.mints.goodmoney.manager.TtCsjAdManager
object ExpressManager {
fun loadExpress() {
if (AppConfig.groMoreVideoAdCount > 0) {
GroMoreCarrierExpressManager.instance.loadADFrameLayout()
} else {
TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_WATER)
}
TTPreLoadCarrierExpressManager.getInstance()
.loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_WATER)
}
fun getExpressFrameLayout(): FrameLayout? {
if (AppConfig.groMoreVideoAdCount > 0) {
return GroMoreCarrierExpressManager.instance.getADFrameLayout()
} else {
return TTPreLoadCarrierExpressManager.getInstance().ttFrameLayout
}
}
}
\ No newline at end of file
package com.mints.goodmoney.ad.express
import android.os.Handler
import android.os.HandlerThread
import android.text.TextUtils
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.*
import com.bumptech.glide.Glide
import com.bytedance.msdk.api.*
import com.bytedance.msdk.api.nativeAd.*
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.R
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.CsjGroMoreManager
import com.mints.goodmoney.manager.TrackManager
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
import java.util.ArrayList
import java.util.HashMap
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 var 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 = FrameLayout(MintsApplication.getContext())
if (TTMediationAdSdk.configLoadSuccess()) {
loadAd()
} else {
TTMediationAdSdk.registerConfigCallback(this)
}
}
/**
* config成功,加载信息流
*/
override fun configLoad() {
loadAd()
}
private fun loadAd() {
mTTAdNative = TTUnifiedNativeAd(MintsApplication.getContext(), CsjGroMoreManager.AD_UNIT_EXPRESS_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(340, 0) // 必选参数 单位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(createAdView(ads[0]))
val ttNativeAd = ads[0]
val vo = HashMap<String, Any>()
vo["adcode"] = ttNativeAd.adNetworkRitId
vo["ecpm"] = ttNativeAd.preEcpm
vo["adSource"] = ttNativeAd.adNetworkPlatformId
vo["adType"] = Constant.GRO_MORE_ADTYPE1
vo["adid"] =CsjGroMoreManager.AD_UNIT_EXPRESS_ID
TrackManager.getInstance().cmtGroMoreInfo(vo)
}
}
})
}
fun getADFrameLayout(): FrameLayout? {
return frameLayout
}
/**
* 销毁
*/
private fun destroy() {
mHandlerThread?.quit()
mHandlerThread = null
mWorkHandler?.removeCallbacksAndMessages(null)
mWorkHandler = null
TTMediationAdSdk.unregisterConfigCallback(this)
}
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 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.MATCH_PARENT
} else {
sWidth = UIUtils.getScreenWidth(MintsApplication.getContext())
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() {}
//
// /**
// * 拒绝再次提交
// */
// /**
// * 拒绝再次提交
// */
// 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")
}
}
//渲染模板广告
// 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
package com.mints.goodmoney.ad.express
import android.text.TextUtils
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.*
import com.bumptech.glide.Glide
import com.bytedance.msdk.api.*
import com.bytedance.msdk.api.nativeAd.*
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.R
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.CsjGroMoreManager
import com.mints.goodmoney.manager.TrackManager
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
import java.util.*
private val TAG = GroMoreExpressManager::class.java.simpleName
class GroMoreExpressManager : TTSettingConfigCallback {
companion object {
val instance: GroMoreExpressManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
GroMoreExpressManager()
}
}
private var mADLoadSuccessListener: GMADLoadSuccessListener? = null
fun setListener(adLoadSuccessListener: GMADLoadSuccessListener?) {
mADLoadSuccessListener = adLoadSuccessListener
}
@Volatile
private var sAdFrameLayout: FrameLayout = FrameLayout(MintsApplication.getContext())
private var mTTAdNative: TTUnifiedNativeAd? = null
private var mAdStyle = 0
private var mExpressType = 0
init {
mAdStyle = AdSlot.TYPE_EXPRESS_AD
}
fun loadADFrameLayout() {
// 销毁及移除事件
destroy()
sAdFrameLayout.removeAllViews()
if (TTMediationAdSdk.configLoadSuccess()) {
loadAd()
} else {
TTMediationAdSdk.registerConfigCallback(this)
}
}
private fun loadAd() {
mTTAdNative = TTUnifiedNativeAd(MintsApplication.getContext(), CsjGroMoreManager.AD_UNIT_EXPRESS_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(340, 0) // 必选参数 单位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(createAdView(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
vo["adid"] =CsjGroMoreManager.AD_UNIT_EXPRESS_ID
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 点击了取消")
// }
//
// /**
// * 拒绝再次提交
// */
// 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.getScreenWidth(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() {}
//
// /**
// * 拒绝再次提交
// */
// /**
// * 拒绝再次提交
// */
// 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
......@@ -12,7 +12,6 @@ import android.widget.ImageView
import android.widget.TextView
import com.bumptech.glide.Glide
import com.kwad.sdk.api.*
import com.kwad.sdk.api.KsNativeAd.VideoPlayListener
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.R
import com.mints.goodmoney.manager.KsManager
......@@ -88,7 +87,7 @@ object KsPreLoadExpressManager {
// 设置广告数据
bindCommonData(convertView as ViewGroup, videoViewHolder, ksNativeAd)
ksNativeAd.setVideoPlayListener(object : VideoPlayListener {
ksNativeAd.setVideoPlayListener(object : KsNativeAd.VideoPlayListener {
override fun onVideoPlayStart() {
}
......
package com.mints.goodmoney.ad.express
import android.annotation.SuppressLint
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import com.bytedance.msdk.api.nativeAd.TTNativeAd
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.mvp.model.WeightBean
......@@ -11,11 +11,12 @@ import com.mints.goodmoney.utils.LogUtil
import com.qq.e.ads.nativ.NativeExpressADView
import java.util.*
/**
* 预加载信息流管理类
*/
object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener, KSADLoadSuccessListener, GMADLoadSuccessListener {
@SuppressLint("StaticFieldLeak")
object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener,
KSADLoadSuccessListener {
private val TAG = PreLoadExpressManager::class.java.simpleName
......@@ -36,7 +37,7 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
YlhPreLoadExpressManager.setListener(this)
TTPreLoadExpressManager.getInstance().setListener(this)
KsPreLoadExpressManager.setListener(this)
GroMoreExpressManager.instance.setListener(this)
// GroMoreExpressManager.instance.setListener(this)
}
fun init(csjWeight: Int, ylhWeight: Int, ksWeight: Int, gmWeight: Int) {
......@@ -62,10 +63,11 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
// }
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.KS_EXPRESS_AD -> KsPreLoadExpressManager.loadKsFrameLayout(mAdFrameLayout as ViewGroup)
Constant.GM_EXPRESS_AD -> GroMoreExpressManager.instance.loadADFrameLayout()
// Constant.GM_EXPRESS_AD -> GroMoreExpressManager.instance.loadADFrameLayout()
else -> {
TTPreLoadExpressManager.getInstance().loadTtFrameLayout(mAdFrameLayout)
}
......@@ -152,13 +154,6 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
mAdFrameLayout?.addView(view)
}
override fun onGMAdLoadSuc(ttNativeAd: View?) {
// if (currentIndex == 3) {
// mAdFrameLayout?.addView(view)
// }
mAdFrameLayout?.addView(ttNativeAd)
}
}
interface TTADLoadSuccessListener {
......@@ -172,7 +167,3 @@ interface YLHADLoadSuccessListener {
interface KSADLoadSuccessListener {
fun onKSAdLoadSuc(ksNativeAd: View?)
}
\ No newline at end of file
interface GMADLoadSuccessListener {
fun onGMAdLoadSuc(ttNativeAd: View?)
}
\ No newline at end of file
......@@ -141,6 +141,10 @@ public class CsjFullVideoAdManager extends BaseVideoAd {
}
}
}
@Override
public void onFullScreenVideoCached(TTFullScreenVideoAd ttFullScreenVideoAd) {
}
});
}
......
package com.mints.goodmoney.ad.video;
import android.app.Activity;
import android.util.Log;
import com.bytedance.msdk.adapter.util.Logger;
import com.bytedance.msdk.api.AdError;
import com.bytedance.msdk.api.AdSlot;
import com.bytedance.msdk.api.TTAdConstant;
import com.bytedance.msdk.api.TTMediationAdSdk;
import com.bytedance.msdk.api.TTSettingConfigCallback;
import com.bytedance.msdk.api.TTVideoOption;
import com.bytedance.msdk.api.reward.RewardItem;
import com.bytedance.msdk.api.reward.TTRewardAd;
import com.bytedance.msdk.api.reward.TTRewardedAdListener;
import com.bytedance.msdk.api.reward.TTRewardedAdLoadCallback;
import com.bytedance.sdk.openadsdk.TTAdNative;
import com.bytedance.sdk.openadsdk.TTAppDownloadListener;
import com.bytedance.sdk.openadsdk.TTRewardVideoAd;
import com.mints.goodmoney.BuildConfig;
import com.mints.goodmoney.ad.video.base.BaseVideoAd;
import com.mints.goodmoney.ad.video.base.VideoAdStatusListener;
import com.mints.goodmoney.common.AppConfig;
import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.manager.CsjGroMoreManager;
import com.mints.goodmoney.manager.TTNativeExpressManager;
import com.mints.goodmoney.manager.TrackManager;
import com.mints.goodmoney.manager.TtCsjAdManager;
import com.mints.goodmoney.manager.UserManager;
import com.mints.goodmoney.utils.LogUtil;
import com.mints.goodmoney.utils.MD5;
import com.mints.library.utils.json.JsonUtil;
import net.grandcentrix.tray.AppPreferences;
import java.util.HashMap;
import java.util.Map;
/**
* GroMore激励视频广告
*/
public class CsjGroMoreVideoAdManager extends BaseVideoAd {
private static final String TAG = CsjGroMoreVideoAdManager.class.getSimpleName();
private static CsjGroMoreVideoAdManager _inst;
private int curCoin;
private String extraId;
private String carrierType;
private String appSetId;
private VideoAdStatusListener videoAdStatusListener;
private TTRewardAd mttRewardAd;
private Activity activity;
private boolean isClickScreen = true; // 是否点击屏幕跳转广告
public static CsjGroMoreVideoAdManager getInstance(Activity activity) {
if (_inst == null) {
_inst = new CsjGroMoreVideoAdManager(activity);
}
return _inst;
}
private CsjGroMoreVideoAdManager(Activity activity) {
init(activity);
}
private void init(Activity activity) {
this.activity = activity;
}
@Override
public void onDestroy() {
TTMediationAdSdk.unregisterConfigCallback(mSettingConfigCallback);
if (mttRewardAd != null) {
mttRewardAd.destroy();
}
activity = null;
}
/**
* 激励视频
*
* @param carrierType
*/
@Override
public void loadAd(Activity activity, int curCoin, String carrierType, String extraId) {
this.activity = activity;
isClickScreen = true;
this.curCoin = curCoin;
this.extraId = extraId;
this.carrierType = carrierType;
appSetId = MD5.GetMD5Code(System.currentTimeMillis() + UserManager.getInstance().getUserID());
/**
* 判断当前是否存在config 配置 ,如果存在直接加载广告 ,如果不存在则注册config加载回调
*/
if (TTMediationAdSdk.configLoadSuccess()) {
loadAd(CsjGroMoreManager.INSTANCE.getAD_UNIT_VIDEO_ID(), TTAdConstant.VERTICAL);
} else {
TTMediationAdSdk.registerConfigCallback(mSettingConfigCallback); //不用使用内部类,否则在ondestory中无法移除该回调
}
}
/**
* config回调
*/
private TTSettingConfigCallback mSettingConfigCallback = new TTSettingConfigCallback() {
@Override
public void configLoad() {
loadAd(CsjGroMoreManager.INSTANCE.getAD_UNIT_VIDEO_ID(), TTAdConstant.VERTICAL);
}
};
private void loadAd(final String adUnitId, int orientation) {
/**
* 注:每次加载激励视频广告的时候需要新建一个TTRewardAd,否则可能会出现广告填充问题
* ( 例如:mttRewardAd = new TTRewardAd(this, adUnitId);)
*/
mttRewardAd = new TTRewardAd(activity, adUnitId);
TTVideoOption videoOption = new TTVideoOption.Builder()
.setMuted(true)//对所有SDK的激励广告生效,除需要在平台配置的SDK,如穿山甲SDK
.setAdmobAppVolume(0f)//配合Admob的声音大小设置[0-1]
.build();
// 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_GDT, "gdt custom data");
// customData.put(com.bytedance.msdk.api.AdSlot.CUSTOM_DATA_KEY_KS, "ks custom data");
// 其他需要透传给adn的数据。
//创建广告请求参数AdSlot,具体参数含义参考文档
com.bytedance.msdk.api.AdSlot.Builder adSlotBuilder = new com.bytedance.msdk.api.AdSlot.Builder()
.setTTVideoOption(videoOption)
.setUserID(UserManager.getInstance().getUserID())//用户id,必传参数
.setAdStyleType(AdSlot.TYPE_EXPRESS_AD) // 确保该聚合广告位下所有gdt代码位都是同一种类型(模版或非模版)。
.setOrientation(orientation);//必填参数,期望视频的播放方向:TTAdConstant.HORIZONTAL 或 TTAdConstant.VERTICAL
//请求广告
mttRewardAd.loadRewardAd(adSlotBuilder.build(), new TTRewardedAdLoadCallback() {
@Override
public void onRewardVideoLoadFail(AdError adError) {
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);
if (videoAdStatusListener != null) {
videoAdStatusListener.adFail();
}
}
@Override
public void onRewardVideoAdLoad() {
}
@Override
public void onRewardVideoCached() {
if (mttRewardAd != null) {
//在获取到广告后展示,强烈建议在onRewardVideoCached回调后,展示广告,提升播放体验
//该方法直接展示广告
//展示广告,并传入广告展示的场景
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");
HashMap<String, Object> vo = new HashMap<>();
vo.put("appSetId", appSetId);
TrackManager.getInstance().reportGromoreAdClick(vo);
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, "", "");
HashMap<String, Object> voTemp = getAdMapVO(carrierType, Constant.AD_SOURCE_GROMORE, extraId, curCoin);
if (mttRewardAd != null) {
String groAdsouce = String.valueOf(mttRewardAd.getAdNetworkPlatformId());
switch (mttRewardAd.getAdNetworkPlatformId()) {
case 1:
groAdsouce = "CSJ";
break;
case 3:
groAdsouce = "YLH";
break;
case 7:
groAdsouce = "KS";
break;
}
voTemp.put("gromoreAdsource", groAdsouce);
}
TrackManager.getInstance().reportAddCoinMsg(activity, voTemp);
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价格
/**
* SDK_NAME_NO_PERMISSION = -3; //无权限
* * SDK_NAME_NO_DATA = -2; //暂无数据
* * SDK_NAME_PANGLE = 1;
* * SDK_NAME_ADMOB = 2;
* * SDK_NAME_GDT = 3;
* * SDK_NAME_MT = 4;
* * SDK_NAME_UNITY = 5;
* * SDK_NAME_BAIDU = 6;
* * SDK_NAME_KS = 7;
* * SDK_NAME_SIGMOB = 8;
*/
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);
vo.put("adid", CsjGroMoreManager.INSTANCE.getAD_UNIT_VIDEO_ID());
vo.put("appSetId", appSetId);
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;
}
}
......@@ -151,7 +151,6 @@ public class CsjVideoAdManager extends BaseVideoAd {
public void onError(int code, String message) {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJ, Constant.EVENT_TYPE_ONE, String.valueOf(code), message);
LogUtil.d(TAG, "onError " + code + message);
if (videoAdStatusListener != null) {
videoAdStatusListener.adFail();
......@@ -174,6 +173,10 @@ public class CsjVideoAdManager extends BaseVideoAd {
}
}
@Override
public void onRewardVideoCached(TTRewardVideoAd ttRewardVideoAd) {
}
//视频广告的素材加载完毕,比如视频url等,在此回调后,可以播放在线视频,网络不好可能出现加载缓冲,影响体验。
@Override
public void onRewardVideoAdLoad(TTRewardVideoAd ad) {
......
......@@ -41,7 +41,6 @@ public class VideoAdingManager {
private ShVideoAdManager shVideoAdManager;
private CsjFullVideoAdManager csjFullVideoAdManager;
private KsVideoAdManager ksVideoAdManager;
private CsjGroMoreVideoAdManager csjGroMoreVideoAdManager;
private OwVideoAdManager owVideoAdManager;
private int wnWeight;
......@@ -91,7 +90,6 @@ public class VideoAdingManager {
shVideoAdManager = ShVideoAdManager.Companion.getInstance(activity);
csjFullVideoAdManager = CsjFullVideoAdManager.getInstance(activity);
ksVideoAdManager = KsVideoAdManager.Companion.getInstance(activity);
csjGroMoreVideoAdManager = CsjGroMoreVideoAdManager.getInstance(activity);
owVideoAdManager = OwVideoAdManager.Companion.getInstance();
weightList = new ArrayList<>();
}
......@@ -460,11 +458,11 @@ public class VideoAdingManager {
owVideoAdManager.onDestroy();
owVideoAdManager = null;
}
if (csjGroMoreVideoAdManager != null) {
csjGroMoreVideoAdManager.setVideoAdStatusListener(null);
csjGroMoreVideoAdManager.onDestroy();
csjGroMoreVideoAdManager = null;
}
// if (csjGroMoreVideoAdManager != null) {
// csjGroMoreVideoAdManager.setVideoAdStatusListener(null);
// csjGroMoreVideoAdManager.onDestroy();
// csjGroMoreVideoAdManager = null;
// }
if (mReceiverBroadcastReceiver != null) {
activity.stopService(new Intent(activity, AppInstallService.class));
......@@ -566,7 +564,6 @@ public class VideoAdingManager {
return;
}
csjVideoAdManager = CsjVideoAdManager.getInstance(activity);
// csjVideoAdManager = CsjVideoAdManager.getInstance();
}
......@@ -815,43 +812,6 @@ public class VideoAdingManager {
}
});
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());
}
} catch (Exception e) {
e.printStackTrace();
......
......@@ -59,6 +59,10 @@ public class BxmPlayVideo {
public void onRewardVideoCached() {
}
@Override
public void onRewardVideoCached(TTRewardVideoAd ttRewardVideoAd) {
}
});
} catch (Throwable e) {
appNative.onError(0);
......
package com.mints.goodmoney.manager
import android.app.Application
import com.bytedance.applog.AppLog
import com.bytedance.applog.InitConfig
import com.bytedance.applog.util.UriConstants
import com.bytedance.hume.readapk.HumeSDK
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.utils.LogUtil
import com.mints.library.utils.CommonUtils
private val TAG = CsjAppLogManager::class.java.simpleName
object CsjAppLogManager {
fun init(application: Application) {
/* 初始化开始 */
val config = InitConfig("229031", CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME") + HumeSDK.getChannel(MintsApplication.getContext())) // appid和渠道,appid如不清楚请联系对接同学
//上报域名只支持中国
config.setUriConfig(UriConstants.DEFAULT)
// 是否在控制台输出日志,可用于观察用户行为日志上报情况
// config.setLogger { msg, t -> LogUtil.d(TAG, "$msg -> $t") }
config.setAutoStart(true)
AppLog.init(application, config)
/* 初始化结束 */
/* 自定义 “用户公共属性”(可选,初始化后调用, key相同会覆盖)
关于自定义 “用户公共属性” 请注意:1. 上报机制是随着每一次日志发送进行提交,默认的日志发送频率是1分钟,所以如果在一分钟内连续修改自定义用户公共属性,,按照日志发送前的最后一次修改为准, 2. 不推荐高频次修改,如每秒修改一次 */
//Map<String,Object> headerMap = new HashMap<String, Object>();
//headerMap.put("your_custom_key","your_custom_value");
//AppLog.setHeaderInfo((HashMap<String, Object>)headerMap);
//移除公共属性
//AppLog.removeHeaderInfo("your_custom_key");
}
}
\ No newline at end of file
......@@ -16,7 +16,7 @@ object CsjGroMoreManager {
var AD_UNIT_VIDEO_ID = "946018378" // 激励视频
fun init(application: MintsApplication) {
TTGroMoreAdManagerHolder.init(application)
// TTGroMoreAdManagerHolder.init(application)
}
/**
......
......@@ -12,6 +12,8 @@ import com.mints.goodmoney.R
*/
object KsManager {
const val KS_CONTENT = 5746000049L
private const val KS_APP_ID = "574600005"
/* splash-postid */
......
......@@ -3,9 +3,6 @@ package com.mints.goodmoney.manager;
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.gamedata.CmGameAppInfo;
import com.mints.goodmoney.BuildConfig;
......@@ -55,20 +52,30 @@ public class LiebaoManager {
* 游戏SDK初始化
*/
public void initCmGameSdk() {
final String adAppId = TtCsjAdManager.TT_AD_APPID; // 穿山甲appid
TTAdSdk.init(context,
new TTAdConfig.Builder()
.appId(adAppId)
.useTextureView(false) //使用TextureView控件播放视频,默认为SurfaceView,当有SurfaceView冲突的场景,可以使用TextureView
.appName(TtCsjAdManager.TT_AD_NAME)
.titleBarTheme(TTAdConstant.TITLE_BAR_THEME_DARK)
.allowShowNotify(true) //是否允许sdk展示通知栏提示
.allowShowPageWhenScreenLock(true) //是否在锁屏场景支持展示广告落地页
.debug(BuildConfig.DEBUG) //测试阶段打开,可以通过日志排查问题,上线时去除该调用
.directDownloadNetworkType(TTAdConstant.NETWORK_STATE_WIFI, TTAdConstant.NETWORK_STATE_3G) //允许直接下载的网络状态集合
.supportMultiProcess(false) //是否支持多进程,true支持
.build());
// final String adAppId = TtCsjAdManager.TT_AD_APPID; // 穿山甲appid
// TTAdSdk.init(context,
// new TTAdConfig.Builder()
// .appId(adAppId)
// .useTextureView(false) //使用TextureView控件播放视频,默认为SurfaceView,当有SurfaceView冲突的场景,可以使用TextureView
// .appName(TtCsjAdManager.TT_AD_NAME)
// .titleBarTheme(TTAdConstant.TITLE_BAR_THEME_DARK)
// .allowShowNotify(true) //是否允许sdk展示通知栏提示
// .allowShowPageWhenScreenLock(true) //是否在锁屏场景支持展示广告落地页
// .debug(BuildConfig.DEBUG) //测试阶段打开,可以通过日志排查问题,上线时去除该调用
// .directDownloadNetworkType(TTAdConstant.NETWORK_STATE_WIFI, TTAdConstant.NETWORK_STATE_3G) //允许直接下载的网络状态集合
// .supportMultiProcess(false) //是否支持多进程,true支持
// .build(), new TTAdSdk.InitCallback() {
// @Override
// public void success() {
//
// }
//
// @Override
// public void fail(int i, String s) {
//
// }
// });
CmGameAppInfo cmGameAppInfo = new CmGameAppInfo();
......
......@@ -196,6 +196,11 @@ public class ReadToutiaoAD {
LogUtils.i("ToutiaoAd", "rewardVideoAd video cached");
}
@Override
public void onRewardVideoCached(TTRewardVideoAd ttRewardVideoAd) {
}
//视频广告素材加载到,如title,视频url等,不包括视频文件
@Override
public void onRewardVideoAdLoad(TTRewardVideoAd ad) {
......
package com.mints.goodmoney.manager;
import android.app.Activity;
import android.content.Context;
import android.provider.Settings;
import com.bytedance.hume.readapk.HumeSDK;
import com.bytedance.msdk.api.TTAdConfig;
import com.bytedance.msdk.api.TTAdConstant;
import com.bytedance.msdk.api.TTMediationAdSdk;
import com.bytedance.msdk.api.UserInfoForSegment;
import com.mints.goodmoney.BuildConfig;
import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.common.Constant;
import com.mints.library.utils.CommonUtils;
import java.util.HashMap;
import java.util.Map;
/**
* 可以用一个单例来保存TTAdManager实例,在需要初始化sdk的时候调用
*/
public class TTGroMoreAdManagerHolder {
public static final String TT_AD_APPID = "5113521";
public static final String TT_AD_NAME = Constant.MINTS_APP_NAME;
private static boolean sInit;
public static void init(Context context) {
doInit(context);
}
public static void initUnitySdkBanner(Activity activity) {
TTMediationAdSdk.initUnityForBanner(activity);
}
//step1:接入网盟广告sdk的初始化操作,详情见接入文档和穿山甲平台说明
private static void doInit(Context context) {
if (!sInit) {
TTMediationAdSdk.initialize(context, buildConfig(context));
sInit = true;
}
}
private static TTAdConfig buildConfig(Context context) {
UserInfoForSegment userInfo = new UserInfoForSegment();
userInfo.setUserId(UserManager.getInstance().getUserID());
userInfo.setGender(UserInfoForSegment.GENDER_UNKNOWN);
userInfo.setChannel(CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME"));
userInfo.setSubChannel(HumeSDK.getChannel(MintsApplication.getContext()));
userInfo.setAge(999);
userInfo.setUserValueGroup("msdk demo user value group");
Map<String, String> customInfos = new HashMap<>();
// customInfos.put("aaaa", "test111");
// customInfos.put("bbbb", "test222");
userInfo.setCustomInfos(customInfos);
return new TTAdConfig.Builder()
.appId(TT_AD_APPID) //必填 ,不能为空
.appName(TT_AD_NAME) //必填,不能为空
.openAdnTest(false)//开启第三方ADN测试时需要设置为true,会每次重新拉去最新配置,release 包情况下必须关闭.默认false
.isPanglePaid(false)//是否为费用户
.setPublisherDid(getAndroidId(context)) //用户自定义device_id
.openDebugLog(BuildConfig.DEBUG) //测试阶段打开,可以通过日志排查问题,上线时去除该调用
.usePangleTextureView(true) //使用TextureView控件播放视频,默认为SurfaceView,当有SurfaceView冲突的场景,可以使用TextureView
.setPangleTitleBarTheme(TTAdConstant.TITLE_BAR_THEME_DARK)
.allowPangleShowNotify(true) //是否允许sdk展示通知栏提示
.allowPangleShowPageWhenScreenLock(true) //是否在锁屏场景支持展示广告落地页
.setPangleDirectDownloadNetworkType(TTAdConstant.NETWORK_STATE_WIFI, TTAdConstant.NETWORK_STATE_3G) //允许直接下载的网络状态集合
.needPangleClearTaskReset()//特殊机型过滤,部分机型出现包解析失败问题(大部分是三星)。参数取android.os.Build.MODEL
.setUserInfoForSegment(userInfo) // 设置流量分组的信息
.build();
}
public static String getAndroidId(Context context) {
String androidId = null;
try {
androidId = Settings.System.getString(context.getContentResolver(), Settings.System.ANDROID_ID);
} catch (Exception e) {
e.printStackTrace();
}
return androidId;
}
}
......@@ -6,10 +6,9 @@ import com.bytedance.sdk.openadsdk.TTAdConfig;
import com.bytedance.sdk.openadsdk.TTAdConstant;
import com.bytedance.sdk.openadsdk.TTAdSdk;
import com.mints.goodmoney.BuildConfig;
import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.mvp.model.AdcodeBean;
import com.mints.library.utils.CommonUtils;
import com.mints.goodmoney.utils.LogUtil;
/**
* 穿山甲广告
......@@ -82,7 +81,17 @@ public class TtCsjAdManager {
//step1:接入网盟广告sdk的初始化操作,详情见接入文档和穿山甲平台说明
private static void doInit(Context context) {
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;
}
}
......@@ -107,7 +116,7 @@ public class TtCsjAdManager {
.allowShowNotify(true) //是否允许sdk展示通知栏提示
.allowShowPageWhenScreenLock(false) //是否在锁屏场景支持展示广告落地页
.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)//是否支持多进程
//.httpStack(new MyOkStack3())//自定义网络库,demo中给出了okhttp3版本的样例,其余请自行开发或者咨询工作人员。
.build();
......
package com.mints.goodmoney.manager
import android.app.Application
import com.yilan.sdk.ui.YLUIInit
import com.yilan.sdk.ui.configs.CommentConfig
import com.yilan.sdk.ui.configs.FeedConfig
import com.yilan.sdk.ui.configs.YLUIConfig
/**
* 描述:一览视频(好兔)
* 作者:孟崔广
*/
object YlVideoManager {
private const val ACCESSKEY = "ylxgszgwjrr8"
private const val ACCESSTOKEN = "lmnzhm9yjdlc86xiy74cjgixnqpxe4o2"
fun init(application: Application) {
YLUIInit.getInstance()
.setCrashOpen(false)
.setApplication(application)
.setAccessKey(ACCESSKEY)
.setAccessToken(ACCESSTOKEN)
.build()
//页面个性化配置
YLUIConfig.getInstance() //抖音样式小视频配置
.littleLikeShow(true) //是否显示点赞
.littleShareShow(false) //是否显示分享
.littleShowGuide(true) //是否显示新手引导滑动浮层(第一次安装进入显示)
.littleComment(CommentConfig.CommentType.DISMISS_COMMENT) //评论,参数详见文档;
//feed流短视频样式配置
.videoComment(CommentConfig.CommentType.DISMISS_COMMENT) //评论,参数详见文档;
.videoLikeShow(false) //是否显示点赞
.videoShareShow(false) //是否显示分享
.followAvailable(false) //关注功能是否可用
.feedAvatarClickable(true) //头像是否支持点击跳转到作者页面
.feedPlayAuto(true) //feed自动播放
.feedSwipeRefreshEnable(true) //feed是否可以下拉刷新
FeedConfig.getInstance().playerStyle = FeedConfig.STYLE_FEED_PLAY //FeedConfig.STYLE_FEED_PLAY当前页面播放
}
}
\ No newline at end of file
......@@ -3,23 +3,16 @@ package com.mints.goodmoney.ui.activitys
import android.annotation.SuppressLint
import android.os.Bundle
import android.view.View
import android.widget.FrameLayout
import android.widget.ImageView
import com.bytedance.hume.readapk.HumeSDK
import com.mints.goodmoney.MintsApplication
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.Constant
import com.mints.goodmoney.manager.TtCsjAdManager
import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.ui.adapter.AdBannerAdapter
import com.mints.goodmoney.utils.ToastUtil
import com.mints.library.utils.CommonUtils
import com.mints.library.utils.ConstantUtil
import kotlinx.android.synthetic.main.activity_aboutus.*
import kotlinx.android.synthetic.main.fragment_main_my.*
import kotlinx.android.synthetic.main.header_layout.*
/**
......@@ -44,7 +37,6 @@ class AboutusActivity : BaseActivity(), View.OnClickListener {
ToastUtil.showLong(MintsApplication.getContext(), "自有渠道:" + CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME") +
"\n 广告代码位:" + AppConfig.user_channel_ad +
"\n 头条渠道:" + HumeSDK.getChannel(context))
// CsjGroMoreVideoAdManager.getInstance(AboutusActivity@this).loadAd(AboutusActivity@this,0,"","")
true
}
......
......@@ -11,7 +11,6 @@ import android.view.KeyEvent
import android.view.View
import androidx.core.content.ContextCompat
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.express.GroMoreExpressManager
import com.mints.goodmoney.ad.express.PreLoadExpressManager
import com.mints.goodmoney.ad.video.VideoAdingManager
import com.mints.goodmoney.common.AppConfig
......
......@@ -3,8 +3,9 @@ package com.mints.goodmoney.ui.activitys
import android.os.Bundle
import android.view.View
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.express.ExpressManager
import com.mints.goodmoney.ad.express.TTPreLoadCarrierExpressManager
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.TtCsjAdManager
import com.mints.goodmoney.mvp.model.MealBean
import com.mints.goodmoney.mvp.presenters.FoodSubsidyPresenter
import com.mints.goodmoney.mvp.views.FoodSubsidyView
......@@ -18,7 +19,8 @@ import kotlinx.android.synthetic.main.activity_food_subsidy.*
* 作者:孟崔广
* 时间:2020/10/13 11:55
*/
class FoodSubsidyActivity : BaseActivity(), View.OnClickListener, FoodSubsidyView, StepView.StepViewListener, MealView.MealViewListener {
class FoodSubsidyActivity : BaseActivity(), View.OnClickListener, FoodSubsidyView,
StepView.StepViewListener, MealView.MealViewListener {
private val foodSubsidyPresenter by lazy { FoodSubsidyPresenter() }
......@@ -87,8 +89,8 @@ class FoodSubsidyActivity : BaseActivity(), View.OnClickListener, FoodSubsidyVie
}
// 预加载信息流
// TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_EAT)
ExpressManager.loadExpress()
TTPreLoadCarrierExpressManager.getInstance()
.loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_EAT)
}
......@@ -99,7 +101,7 @@ class FoodSubsidyActivity : BaseActivity(), View.OnClickListener, FoodSubsidyVie
try {
if (flSubsidykAd != null) {
flSubsidykAd.removeAllViews()
flSubsidykAd.addView(ExpressManager.getExpressFrameLayout())
flSubsidykAd.addView(TTPreLoadCarrierExpressManager.getInstance().ttFrameLayout)
}
} catch (e: Exception) {
e.printStackTrace()
......
......@@ -23,7 +23,7 @@ class MokuGuideActivity : BaseActivity(), View.OnClickListener {
override fun finish() {
super.finish()
//关闭窗体动画显示
overridePendingTransition(0, R.anim.bottom_out)
overridePendingTransition(0, R.anim.push_bottom_out)
}
override fun initViewsAndEvents() {
......
......@@ -5,11 +5,11 @@ import android.view.View
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.GridLayoutManager
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.express.ExpressManager
import com.mints.goodmoney.ad.express.TTPreLoadCarrierExpressManager
import com.mints.goodmoney.ad.video.VideoAdingManager
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.ad.express.TTPreLoadCarrierExpressManager
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.manager.TtCsjAdManager
import com.mints.goodmoney.mvp.model.MorningClockBean
import com.mints.goodmoney.mvp.model.VideoAdingBean
......@@ -66,7 +66,8 @@ class MorningClockActivity : BaseActivity(), View.OnClickListener, MorningClockV
awardVideo()
// 预加载信息流
TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_MORNINGCLOCK)
TTPreLoadCarrierExpressManager.getInstance()
.loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_MORNINGCLOCK)
}
}
}
......@@ -76,16 +77,19 @@ class MorningClockActivity : BaseActivity(), View.OnClickListener, MorningClockV
morningClockList = data.targetList
if (data.isCanClick) {
tvMorningClockClick.background = ContextCompat.getDrawable(mContext, R.drawable.shape_water_btn)
tvMorningClockClick.background =
ContextCompat.getDrawable(mContext, R.drawable.shape_water_btn)
tvMorningClockClick.isEnabled = true
} else {
tvMorningClockClick.background = ContextCompat.getDrawable(mContext, R.drawable.shape_tv_gold_none)
tvMorningClockClick.background =
ContextCompat.getDrawable(mContext, R.drawable.shape_tv_gold_none)
tvMorningClockClick.isEnabled = false
}
tvMorningClockClick.text = data.buttonMsg
tvMorningClockDay.text = SpanUtils()
.append("打卡领金币 已连续打卡")
.append("${data.continuityDays}").setForegroundColor(ContextCompat.getColor(mContext, R.color.color_FF9837))
.append("${data.continuityDays}")
.setForegroundColor(ContextCompat.getColor(mContext, R.color.color_FF9837))
.append("天")
.create()
......@@ -128,7 +132,11 @@ class MorningClockActivity : BaseActivity(), View.OnClickListener, MorningClockV
/**
* 加载激励视频
*/
private fun loadVideo(videoAdingManager: VideoAdingManager, bean: VideoAdingBean, isFirstLoad: Boolean) {
private fun loadVideo(
videoAdingManager: VideoAdingManager,
bean: VideoAdingBean,
isFirstLoad: Boolean
) {
videoAdingManager.setVideoAdingListener(object : VideoAdingManager.VideoAdingListener {
override fun videoAdingListenerError(adType: String) {
showToast("加载超时,请休息一下")
......@@ -186,7 +194,7 @@ class MorningClockActivity : BaseActivity(), View.OnClickListener, MorningClockV
try {
if (flMorningClockAd != null) {
flMorningClockAd.removeAllViews()
flMorningClockAd.addView(ExpressManager.getExpressFrameLayout())
flMorningClockAd.addView(TTPreLoadCarrierExpressManager.getInstance().ttFrameLayout)
}
} catch (e: Exception) {
e.printStackTrace()
......
......@@ -8,7 +8,6 @@ import com.mints.goodmoney.R
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.common.DeviceInfo
import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.yilan.sdk.ui.little.YLLittleVideoFragment
import kotlinx.android.synthetic.main.activity_splash.*
import net.grandcentrix.tray.AppPreferences
......@@ -63,9 +62,6 @@ class SplashActivity : BaseActivity() {
if (!deviceInfo.signInfo) {
finish()
} else {
// 预加载好兔视频
YLLittleVideoFragment.preloadVideo()
setAnimation()
}
}
......
package com.mints.goodmoney.ui.activitys
import android.text.TextUtils
import android.view.KeyEvent
import android.view.View
import android.view.ViewGroup
import com.bytedance.sdk.openadsdk.AdSlot
import com.bytedance.sdk.openadsdk.TTAdNative
import com.bytedance.sdk.openadsdk.TTSplashAd
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.R
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.TTNativeExpressManager
import com.mints.goodmoney.manager.TtCsjAdManager
import com.mints.goodmoney.manager.UserManager
import com.mints.goodmoney.ui.activitys.base.BaseActivity
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
......@@ -18,6 +24,9 @@ private val TAG = SplashCsjADActivity::class.java.simpleName
* 后台返回时每次都展示 快手广告
*/
class SplashCsjADActivity : BaseActivity() {
private val ps by lazy { AppPreferences(context) }
private var container: ViewGroup? = null
private var mIsPaused = false
var canJump = false
......@@ -143,7 +152,18 @@ class SplashCsjADActivity : BaseActivity() {
}
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
package com.mints.goodmoney.ui.activitys;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.widget.FrameLayout;
import com.bytedance.msdk.adapter.gdt.GdtNetworkRequestInfo;
import com.bytedance.msdk.adapter.pangle.PangleNetworkRequestInfo;
import com.bytedance.msdk.api.AdError;
import com.bytedance.msdk.api.AdSlot;
import com.bytedance.msdk.api.NetworkPlatformConst;
import com.bytedance.msdk.api.TTNetworkRequestInfo;
import com.bytedance.msdk.api.splash.TTSplashAd;
import com.bytedance.msdk.api.splash.TTSplashAdListener;
import com.bytedance.msdk.api.splash.TTSplashAdLoadCallback;
import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.R;
import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.common.DeviceInfo;
import com.mints.goodmoney.manager.CsjGroMoreManager;
import com.mints.goodmoney.manager.TrackManager;
import com.mints.goodmoney.manager.TtCsjAdManager;
import com.mints.goodmoney.manager.UserManager;
import com.mints.goodmoney.manager.YlhAdManager;
import com.mints.goodmoney.ui.activitys.base.BaseActivity;
import com.mints.goodmoney.utils.LogUtil;
import com.mints.library.utils.CommonUtils;
import com.yilan.sdk.ui.little.YLLittleVideoFragment;
import net.grandcentrix.tray.AppPreferences;
import java.util.HashMap;
/**
* GroMore开屏广告Activity示例
*/
public class SplashGroMoreActivity extends BaseActivity {
private static final String TAG = "SplashGroMoreActivity";
private TTSplashAd mTTSplashAd;
private FrameLayout mSplashContainer;
//是否强制跳转到主页面
private boolean mForceGoMain;
//开屏广告加载超时时间,建议大于1000,这里为了冷启动第一次加载到广告并且展示,示例设置了2000ms
private static final int AD_TIME_OUT = 4000;
private static final int MSG_GO_MAIN = 1;
//开屏广告是否已经加载
private boolean mHasLoaded;
// 百度开屏广告点击跳转落地页后倒计时不暂停,即使在看落地页,倒计时结束后仍然会强制跳转,需要特殊处理:
// 检测到广告被点击,且走了activity的onPaused证明跳转到了落地页,这时候onAdDismiss回调中不进行跳转,而是在activity的onResume中跳转。
private boolean isBaiduSplashAd = false;
private boolean baiduSplashAdClicked = false;
private boolean onPaused = false;
private AppPreferences ps;
@Override
protected int getContentViewLayoutID() {
return R.layout.activity_splash_gromore;
}
@Override
protected void initViewsAndEvents() {
if (!isTaskRoot()) {
//点击Home键后再点击App图标,会回到原来的界面。今天重新打包后,但是在Debug模式下,一切正常,
// 但是把打完包的apk(Release)安装在其他手机上时,回到桌面后点击图标会重新打开启动页
finish();
return;
}
TrackManager.getInstance().getCommonHallBaseMsg();
TrackManager.getInstance().firstApiWithUid();
// 校验APP签名
checkAppSign();
}
/**
* 加载开屏广告
*/
private void loadSplashAd() {
/**
* 注:每次加载开屏广告的时候需要新建一个TTSplashAd,否则可能会出现广告填充问题
* ( 例如:mTTSplashAd = new TTSplashAd(this, mAdUnitId);)
*/
mTTSplashAd = new TTSplashAd(this, CsjGroMoreManager.INSTANCE.getAD_UNIT_SPLASH_ID());
mTTSplashAd.setTTAdSplashListener(mSplashAdListener);
//step3:创建开屏广告请求参数AdSlot,具体参数含义参考文档
AdSlot adSlot = new AdSlot.Builder()
.setImageAdSize(1080, 1920) // 既适用于原生类型,也适用于模版类型。
.build();
//自定义兜底方案 选择使用
TTNetworkRequestInfo ttNetworkRequestInfo;
//穿山甲兜底
ttNetworkRequestInfo = new PangleNetworkRequestInfo(TtCsjAdManager.TT_AD_APPID, TtCsjAdManager.TT_AD_GRO_SPLASH);
//gdt兜底
// ttNetworkRequestInfo = new GdtNetworkRequestInfo(YlhAdManager.YLH_AD_APPID, "2001697222975737");
//ks兜底
// ttNetworkRequestInfo = new KsNetworkRequestInfo("90009", "4000000042");
//百度兜底
// ttNetworkRequestInfo = new BaiduNetworkRequestInfo("e866cfb0", "2058622");
//step4:请求广告,调用开屏广告异步请求接口,对请求回调的广告作渲染处理
mTTSplashAd.loadAd(adSlot, ttNetworkRequestInfo, new TTSplashAdLoadCallback() {
// mTTSplashAd.loadAd(adSlot, new TTSplashAdLoadCallback() {
@Override
public void onSplashAdLoadFail(AdError adError) {
LogUtil.d(TAG, adError.message);
mHasLoaded = true;
Log.e(TAG, "load splash ad error : " + adError.code + ", " + adError.message);
// 获取本次waterfall加载中,加载失败的adn错误信息。
if (mTTSplashAd != null)
LogUtil.d(TAG, "ad load infos: " + mTTSplashAd.getAdLoadInfoList());
goToMainActivity();
}
@Override
public void onSplashAdLoadSuccess() {
if (mTTSplashAd != null) {
mTTSplashAd.showAd(mSplashContainer);
isBaiduSplashAd = mTTSplashAd.getAdNetworkPlatformId() == NetworkPlatformConst.SDK_NAME_BAIDU;
// 获取本次waterfall加载中,加载失败的adn错误信息。
HashMap<String, Object> vo = new HashMap<>();
vo.put("adcode", mTTSplashAd.getAdNetworkRitId());
vo.put("ecpm", mTTSplashAd.getPreEcpm());
vo.put("adSource", mTTSplashAd.getAdNetworkPlatformId());
vo.put("adType", Constant.GRO_MORE_ADTYPE0);
vo.put("adid", CsjGroMoreManager.INSTANCE.getAD_UNIT_SPLASH_ID());
TrackManager.getInstance().cmtGroMoreInfo(vo);
}
Log.e(TAG, "load splash ad success ");
}
@Override
public void onAdLoadTimeout() {
mHasLoaded = true;
Log.i(TAG, "开屏广告加载超时.......");
// 获取本次waterfall加载中,加载失败的adn错误信息。
if (mTTSplashAd != null)
LogUtil.d(TAG, "ad load infos: " + mTTSplashAd.getAdLoadInfoList());
goToMainActivity();
}
}, AD_TIME_OUT);
}
TTSplashAdListener mSplashAdListener = new TTSplashAdListener() {
@Override
public void onAdClicked() {
baiduSplashAdClicked = true;
LogUtil.d(TAG, "onAdClicked");
}
@Override
public void onAdShow() {
LogUtil.d(TAG, "onAdShow");
}
@Override
public void onAdSkip() {
LogUtil.d(TAG, "onAdSkip");
goToMainActivity();
}
@Override
public void onAdDismiss() {
LogUtil.d(TAG, "onAdDismiss");
if (isBaiduSplashAd && onPaused && baiduSplashAdClicked) {
// 这种情况下,百度开屏广告不能在onAdDismiss中跳转,需要在onResume中跳转主页。
return;
}
goToMainActivity();
}
};
@Override
protected void onResume() {
//判断是否该跳转到主页面
if (mForceGoMain) {
goToMainActivity();
}
if (isBaiduSplashAd && onPaused && baiduSplashAdClicked) {
// 这种情况下,百度开屏广告不能在onAdDismiss中跳转,需要自己在onResume中跳转主页。
goToMainActivity();
}
super.onResume();
}
@Override
protected void onPause() {
super.onPause();
onPaused = true;
}
@Override
protected void onStop() {
super.onStop();
mForceGoMain = true;
}
@Override
protected void onDestroy() {
super.onDestroy();
if (mTTSplashAd != null) {
mTTSplashAd.destroy();
}
}
/**
* 校验App签名
*/
private void checkAppSign() {
DeviceInfo deviceInfo = DeviceInfo.Companion.getInstance();
if (!deviceInfo.getSignInfo()) {
getBaseApplication().exitApp();
} else {
YLLittleVideoFragment.preloadVideo();
try {
mSplashContainer = findViewById(R.id.splash_container);
ps = new AppPreferences(this);
//加载开屏广告
loadSplashAd();
} catch (Exception e) {
goToMainActivity();
}
}
}
@Override
protected boolean isApplyKitKatTranslucency() {
return false;
}
/**
* 跳转到主页面
*/
private void goToMainActivity() {
int customVersion = ps.getInt(Constant.CUSTOM_VERSION, 0);
boolean isFirstEnter = ps.getBoolean(Constant.ISFIRSTENTER + customVersion, true);
if (isFirstEnter) {
readyGoThenKill(GuideActivity.class);
} else {
String channel = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME");
if (TextUtils.equals(channel, Constant.CHANNEL_SHARE) && !UserManager.getInstance().userIsLogin()) {
readyGo(WxLoginActivity.class);
} else {
readyGoThenKill(MainActivity.class);
}
}
// mSplashContainer.removeAllViews();
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
return true;
}
return super.onKeyDown(keyCode, event);
}
}
package com.mints.goodmoney.ui.activitys;
import android.util.Log;
import android.view.KeyEvent;
import android.widget.FrameLayout;
import com.bytedance.msdk.adapter.pangle.PangleNetworkRequestInfo;
import com.bytedance.msdk.api.AdError;
import com.bytedance.msdk.api.AdSlot;
import com.bytedance.msdk.api.NetworkPlatformConst;
import com.bytedance.msdk.api.TTNetworkRequestInfo;
import com.bytedance.msdk.api.splash.TTSplashAd;
import com.bytedance.msdk.api.splash.TTSplashAdListener;
import com.bytedance.msdk.api.splash.TTSplashAdLoadCallback;
import com.mints.goodmoney.R;
import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.manager.CsjGroMoreManager;
import com.mints.goodmoney.manager.TrackManager;
import com.mints.goodmoney.manager.TtCsjAdManager;
import com.mints.goodmoney.ui.activitys.base.BaseActivity;
import com.mints.goodmoney.utils.LogUtil;
import java.util.HashMap;
/**
* GroMore开屏广告Activity示例
*/
public class SplashGroMoreBackgroundActivity extends BaseActivity {
private static final String TAG = "SplashGroMoreActivity";
private TTSplashAd mTTSplashAd;
private FrameLayout mSplashContainer;
//是否强制跳转到主页面
private boolean mForceGoMain;
//开屏广告加载超时时间,建议大于1000,这里为了冷启动第一次加载到广告并且展示,示例设置了2000ms
private static final int AD_TIME_OUT = 4000;
private static final int MSG_GO_MAIN = 1;
//开屏广告是否已经加载
private boolean mHasLoaded;
// 百度开屏广告点击跳转落地页后倒计时不暂停,即使在看落地页,倒计时结束后仍然会强制跳转,需要特殊处理:
// 检测到广告被点击,且走了activity的onPaused证明跳转到了落地页,这时候onAdDismiss回调中不进行跳转,而是在activity的onResume中跳转。
private boolean isBaiduSplashAd = false;
private boolean baiduSplashAdClicked = false;
private boolean onPaused = false;
@Override
protected int getContentViewLayoutID() {
return R.layout.activity_splash_gromore_back;
}
@Override
protected void initViewsAndEvents() {
try {
mSplashContainer = findViewById(R.id.splash_container);
//加载开屏广告
loadSplashAd();
} catch (Exception e) {
goToMainActivity();
}
}
/**
* 加载开屏广告
*/
private void loadSplashAd() {
/**
* 注:每次加载开屏广告的时候需要新建一个TTSplashAd,否则可能会出现广告填充问题
* ( 例如:mTTSplashAd = new TTSplashAd(this, mAdUnitId);)
*/
mTTSplashAd = new TTSplashAd(this, CsjGroMoreManager.INSTANCE.getAD_UNIT_SPLASH_ID());
mTTSplashAd.setTTAdSplashListener(mSplashAdListener);
//step3:创建开屏广告请求参数AdSlot,具体参数含义参考文档
AdSlot adSlot = new AdSlot.Builder()
.setImageAdSize(1080, 1920) // 既适用于原生类型,也适用于模版类型。
.build();
//自定义兜底方案 选择使用
TTNetworkRequestInfo ttNetworkRequestInfo;
//穿山甲兜底
ttNetworkRequestInfo = new PangleNetworkRequestInfo(TtCsjAdManager.TT_AD_APPID, TtCsjAdManager.TT_AD_GRO_SPLASH);
//gdt兜底
// ttNetworkRequestInfo = new GdtNetworkRequestInfo(YlhAdManager.YLH_AD_APPID, "2001697222975737");
//ks兜底
// ttNetworkRequestInfo = new KsNetworkRequestInfo("90009", "4000000042");
//百度兜底
// ttNetworkRequestInfo = new BaiduNetworkRequestInfo("e866cfb0", "2058622");
//step4:请求广告,调用开屏广告异步请求接口,对请求回调的广告作渲染处理
mTTSplashAd.loadAd(adSlot, ttNetworkRequestInfo, new TTSplashAdLoadCallback() {
// mTTSplashAd.loadAd(adSlot, new TTSplashAdLoadCallback() {
@Override
public void onSplashAdLoadFail(AdError adError) {
LogUtil.d(TAG, adError.message);
mHasLoaded = true;
Log.e(TAG, "load splash ad error : " + adError.code + ", " + adError.message);
// 获取本次waterfall加载中,加载失败的adn错误信息。
if (mTTSplashAd != null)
LogUtil.d(TAG, "ad load infos: " + mTTSplashAd.getAdLoadInfoList());
goToMainActivity();
}
@Override
public void onSplashAdLoadSuccess() {
if (mTTSplashAd != null) {
mTTSplashAd.showAd(mSplashContainer);
isBaiduSplashAd = mTTSplashAd.getAdNetworkPlatformId() == NetworkPlatformConst.SDK_NAME_BAIDU;
// 获取本次waterfall加载中,加载失败的adn错误信息。
HashMap<String, Object> vo = new HashMap<>();
vo.put("adcode", mTTSplashAd.getAdNetworkRitId());
vo.put("ecpm", mTTSplashAd.getPreEcpm());
vo.put("adSource", mTTSplashAd.getAdNetworkPlatformId());
vo.put("adType", Constant.GRO_MORE_ADTYPE0);
vo.put("adid", CsjGroMoreManager.INSTANCE.getAD_UNIT_SPLASH_ID());
TrackManager.getInstance().cmtGroMoreInfo(vo);
}
Log.e(TAG, "load splash ad success ");
}
@Override
public void onAdLoadTimeout() {
mHasLoaded = true;
Log.i(TAG, "开屏广告加载超时.......");
// 获取本次waterfall加载中,加载失败的adn错误信息。
if (mTTSplashAd != null)
LogUtil.d(TAG, "ad load infos: " + mTTSplashAd.getAdLoadInfoList());
goToMainActivity();
}
}, AD_TIME_OUT);
}
TTSplashAdListener mSplashAdListener = new TTSplashAdListener() {
@Override
public void onAdClicked() {
baiduSplashAdClicked = true;
LogUtil.d(TAG, "onAdClicked");
}
@Override
public void onAdShow() {
LogUtil.d(TAG, "onAdShow");
}
@Override
public void onAdSkip() {
LogUtil.d(TAG, "onAdSkip");
goToMainActivity();
}
@Override
public void onAdDismiss() {
LogUtil.d(TAG, "onAdDismiss");
if (isBaiduSplashAd && onPaused && baiduSplashAdClicked) {
// 这种情况下,百度开屏广告不能在onAdDismiss中跳转,需要在onResume中跳转主页。
return;
}
goToMainActivity();
}
};
@Override
protected void onResume() {
//判断是否该跳转到主页面
if (mForceGoMain) {
goToMainActivity();
}
if (isBaiduSplashAd && onPaused && baiduSplashAdClicked) {
// 这种情况下,百度开屏广告不能在onAdDismiss中跳转,需要自己在onResume中跳转主页。
goToMainActivity();
}
super.onResume();
}
@Override
protected void onPause() {
super.onPause();
onPaused = true;
}
@Override
protected void onStop() {
super.onStop();
mForceGoMain = true;
}
@Override
protected void onDestroy() {
super.onDestroy();
if (mTTSplashAd != null) {
mTTSplashAd.destroy();
}
}
@Override
protected boolean isApplyKitKatTranslucency() {
return false;
}
/**
* 跳转到主页面
*/
private void goToMainActivity() {
finish();
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
return true;
}
return super.onKeyDown(keyCode, event);
}
}
......@@ -21,7 +21,6 @@ import com.mints.library.utils.CommonUtils
import com.qq.e.ads.splash.SplashAD
import com.qq.e.ads.splash.SplashADListener
import com.qq.e.comm.util.AdError
import com.yilan.sdk.ui.little.YLLittleVideoFragment
import net.grandcentrix.tray.AppPreferences
/**
......@@ -101,7 +100,6 @@ class SplashYlhActivity : BaseActivity(), SplashADListener {
if (!deviceInfo.signInfo) {
baseApplication.exitApp()
} else {
YLLittleVideoFragment.preloadVideo()
try {
container = findViewById<View>(R.id.splash_container) as ViewGroup
fetchSplashAD(this, container, skipView, YlhAdManager.YLH_AD_SPLASH_POSTID, this, 0)
......
......@@ -3,8 +3,9 @@ package com.mints.goodmoney.ui.activitys
import android.os.Bundle
import android.view.View
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.express.ExpressManager
import com.mints.goodmoney.ad.express.TTPreLoadCarrierExpressManager
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.TtCsjAdManager
import com.mints.goodmoney.mvp.model.WalkBean
import com.mints.goodmoney.mvp.presenters.WalkPresenter
import com.mints.goodmoney.mvp.views.WalkView
......@@ -98,8 +99,7 @@ class WalkActivity : BaseActivity(), View.OnClickListener, WalkView, StepView.St
}
// 预加载信息流
// TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_WALK)
ExpressManager.loadExpress()
TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_WALK)
}
/**
......@@ -109,7 +109,7 @@ class WalkActivity : BaseActivity(), View.OnClickListener, WalkView, StepView.St
try {
if (flWalkAd != null) {
flWalkAd.removeAllViews()
flWalkAd.addView(ExpressManager.getExpressFrameLayout())
flWalkAd.addView(TTPreLoadCarrierExpressManager.getInstance().ttFrameLayout)
}
} catch (e: Exception) {
e.printStackTrace()
......
......@@ -3,8 +3,9 @@ package com.mints.goodmoney.ui.activitys
import android.os.Bundle
import android.view.View
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.express.ExpressManager
import com.mints.goodmoney.ad.express.TTPreLoadCarrierExpressManager
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.TtCsjAdManager
import com.mints.goodmoney.mvp.model.WaterBean
import com.mints.goodmoney.mvp.presenters.WaterPresenter
import com.mints.goodmoney.ui.activitys.base.BaseActivity
......@@ -16,7 +17,8 @@ import kotlinx.android.synthetic.main.activity_water.*
* 作者:孟崔广
* 时间:2020/10/13 11:55
*/
class WaterActivity : BaseActivity(), View.OnClickListener, WaterView.WaterViewListener, com.mints.goodmoney.mvp.views.WaterView {
class WaterActivity : BaseActivity(), View.OnClickListener, WaterView.WaterViewListener,
com.mints.goodmoney.mvp.views.WaterView {
private val waterPresenter by lazy { WaterPresenter() }
......@@ -68,7 +70,8 @@ class WaterActivity : BaseActivity(), View.OnClickListener, WaterView.WaterViewL
}
// 预加载信息流
ExpressManager.loadExpress()
TTPreLoadCarrierExpressManager.getInstance()
.loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_WATER)
}
override fun clickForWaterSuc(waterCoin: Int) {
......@@ -112,7 +115,7 @@ class WaterActivity : BaseActivity(), View.OnClickListener, WaterView.WaterViewL
try {
if (flWaterAd != null) {
flWaterAd.removeAllViews()
flWaterAd.addView(ExpressManager.getExpressFrameLayout())
flWaterAd.addView(TTPreLoadCarrierExpressManager.getInstance().ttFrameLayout)
}
} catch (e: Exception) {
e.printStackTrace()
......
......@@ -349,6 +349,7 @@ class XiaomanActivity : BaseActivity(), View.OnClickListener {
//视频广告加载后的视频文件资源缓存到本地的回调
override fun onRewardVideoCached() {}
override fun onRewardVideoCached(p0: TTRewardVideoAd?) {}
//视频广告素材加载到,如title,视频url等,不包括视频文件
override fun onRewardVideoAdLoad(ad: TTRewardVideoAd) {
......
......@@ -42,8 +42,7 @@ public abstract class BaseActivity extends BaseAppCompatActivity implements Base
}
try {
if (TextUtils.equals(getClass().getSimpleName(), "SplashGroMoreActivity") ||
TextUtils.equals(getClass().getSimpleName(), "GuideActivity")) {
if (TextUtils.equals(getClass().getSimpleName(), "GuideActivity")) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
} else {
......
......@@ -8,6 +8,7 @@ import android.view.Gravity
import android.view.View
import android.widget.FrameLayout
import android.widget.LinearLayout
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentTransaction
import com.daimajia.androidanimations.library.Techniques
import com.daimajia.androidanimations.library.YoYo
......@@ -23,9 +24,6 @@ import com.mints.goodmoney.ui.widgets.countdowntimer.CountDownTimerSupport
import com.mints.goodmoney.ui.widgets.countdowntimer.OnCountDownTimerListener
import com.mints.goodmoney.ui.widgets.seekbar.BubbleUtils
import com.mints.goodmoney.utils.TimeRender
import com.yilan.sdk.player.ylplayer.YLPlayerConfig
import com.yilan.sdk.player.ylplayer.callback.OnPlayerCallBack
import com.yilan.sdk.ui.category.ChannelFragment
import kotlinx.android.synthetic.main.layout_red_bag.*
import kotlinx.android.synthetic.main.layout_red_box.*
import net.grandcentrix.tray.AppPreferences
......@@ -43,7 +41,7 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis
private val ps by lazy { AppPreferences(context) }
private var channelFragment: ChannelFragment? = null
private var channelFragment: Fragment? = null
// 是否是第一次观看完视频
private var isFirstWatchVideo = true
......@@ -105,9 +103,6 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis
override fun onPause() {
super.onPause()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_TWO) {
YLPlayerConfig.config().unRegisterPlayerCallback()
}
// 福袋动画停止
stopRedbox()
// 倒计时红包暂停
......@@ -138,7 +133,6 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis
override fun onDestroy() {
super.onDestroy()
YLPlayerConfig.config().unRegisterPlayerCallback()
horizChannelPresenter.detachView()
}
......@@ -234,11 +228,17 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis
}
private fun initListener() {
val params = LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)
val params = LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT
)
params.setMargins(0, 0, 0, BubbleUtils.dp2px(30))
cdvvYilanTime.layoutParams = params
val paramsRedBox = FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT)
val paramsRedBox = FrameLayout.LayoutParams(
FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT
)
paramsRedBox.setMargins(0, BubbleUtils.dp2px(120), 0, 0)
paramsRedBox.gravity = Gravity.END
rl_fragment_main_redbox.layoutParams = paramsRedBox
......@@ -252,8 +252,12 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis
val transaction: FragmentTransaction = childFragmentManager.beginTransaction()
if (channelFragment == null) {
channelFragment = ChannelFragment()
transaction.add(R.id.yilan_fragment_frame_container, channelFragment!!, ChannelFragment::class.java.simpleName)
channelFragment = MyFragment()
transaction.add(
R.id.yilan_fragment_frame_container,
channelFragment!!,
MyFragment::class.java.simpleName
)
} else {
transaction.show(channelFragment!!)
}
......@@ -345,49 +349,6 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis
}
private fun registerPlayerCallBack() {
// 设置点击的item播放状态,callback返回true标识用户已经处理了event,返回false,标识使用播放器内部逻辑处理event。
YLPlayerConfig.config().registerPlayerCallBack(object : OnPlayerCallBack {
override fun onStart(p0: String?, videoid: String, p2: String?) {
// 防止网络异常时, 第一次加载倒计时红包
if (isFirstLoadVideo) {
isFirstLoadVideo = false
initTimeView()
} else {
resumeDownloadTime(videoid)
}
}
override fun onPause(p0: String?, p1: String?, p2: String?) {
pauseDownloadTime()
}
override fun onResume(p0: String?, videoid: String, p2: String?) {
resumeDownloadTime(videoid)
}
override fun onComplete(p0: String?, videoid: String, p2: String?) {
}
override fun onLoopComplete(pager: String?, videoID: String, taskID: String?, num: Int) {
pauseDownloadTime()
}
override fun onStuckStart(p0: String?, p1: String?, p2: String?) {
}
override fun onStuckEnd(p0: String?, p1: String?, p2: String?) {
}
override fun onError(p0: String?, p1: String?, p2: String?) {
pauseDownloadTime()
}
override fun onStop(p0: String?, p1: String?, p2: String?) {
// pauseDownloadTime()
}
})
}
private fun destoryTimerRedbox() {
......
......@@ -11,15 +11,17 @@ import android.view.Gravity
import android.view.View
import android.widget.FrameLayout
import android.widget.LinearLayout
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentTransaction
import com.daimajia.androidanimations.library.Techniques
import com.daimajia.androidanimations.library.YoYo
import com.daimajia.androidanimations.library.YoYo.YoYoString
import com.fly.scenemodule.SceneUtil
import com.kwad.sdk.api.KsAdSDK
import com.kwad.sdk.api.KsContentPage
import com.kwad.sdk.api.KsScene
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.express.ExpressManager
import com.mints.goodmoney.ad.express.GroMoreExpressManager
import com.mints.goodmoney.ad.express.PreLoadExpressManager
import com.mints.goodmoney.ad.express.TTPreLoadExpressXmlyManager
import com.mints.goodmoney.ad.video.VideoAdingManager
......@@ -30,7 +32,6 @@ import com.mints.goodmoney.mvp.model.*
import com.mints.goodmoney.mvp.presenters.HomePresenter
import com.mints.goodmoney.mvp.views.HomeView
import com.mints.goodmoney.ui.activitys.*
import com.mints.goodmoney.ui.adapter.MainMyAdapter
import com.mints.goodmoney.ui.fragment.base.BaseFragment
import com.mints.goodmoney.ui.widgets.countdowntimer.CountDownTimerSupport
import com.mints.goodmoney.ui.widgets.countdowntimer.OnCountDownTimerListener
......@@ -42,12 +43,6 @@ import com.mints.goodmoney.utils.LogUtil
import com.mints.goodmoney.utils.TimeRender
import com.mints.library.utils.CommonUtils
import com.tbruyelle.rxpermissions.RxPermissions
import com.yilan.sdk.player.ylplayer.YLPlayerConfig
import com.yilan.sdk.player.ylplayer.callback.OnPlayerCallBack
import com.yilan.sdk.ui.configs.YLUIConfig
import com.yilan.sdk.ui.little.YLLittleVideoFragment
import com.yilan.sdk.ylad.YLAdListener
import kotlinx.android.synthetic.main.item_fragment_main_my_promotions.*
import kotlinx.android.synthetic.main.layout_red_bag.*
import kotlinx.android.synthetic.main.layout_red_box.*
import net.grandcentrix.tray.AppPreferences
......@@ -67,12 +62,10 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
private var bindWxDialog: BindWxDialog? = null
private var userMsgBean: UserTaskMsgBean? = null
// private lateinit var baseResponse: BaseResponse<UserTaskMsgBean>
// 视频相关
private var rewardDoubleCoin = 0 // 大金币
private var rewardCoin = 0 // 小金币
private var littleVideoFragment: YLLittleVideoFragment? = null
private val videoMaxCount = 12 // 当前缓存视频id最大数
private val videoIdList by lazy { ArrayList<String>() }//记录播放的视频id
......@@ -81,6 +74,10 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
private var isAward = false // 是否可以领金币 本地判断
private var isFirstWatchVideo = true// 是否是第一次观看完视频
// 快手视频相关
private var ksFragment: Fragment? = null
private var mKsContentPage: KsContentPage? = null
// 广告权重相关
private var videoAdingManager: VideoAdingManager? = null
......@@ -97,7 +94,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
private var flDialogFlag = true
// 任务数据
private val dataList: MutableList<MyInfo.AutoListBean> = mutableListOf()
// private val dataList: MutableList<MyInfo.AutoListBean> = mutableListOf()
// 当天签到金币
private var carrierType = ""
......@@ -155,7 +152,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
}
override fun onHiddenChanged(hidden: Boolean) {
littleVideoFragment?.onHiddenChanged(hidden)
ksFragment?.onHiddenChanged(hidden)
if (hidden) {
onPause()
......@@ -184,7 +181,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
}
registerPlayerCallBack()
littleVideoFragment?.onResume()
ksFragment?.onResume()
}
}
......@@ -200,16 +197,13 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
override fun onPause() {
super.onPause()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_ONE) {
YLPlayerConfig.config().unRegisterPlayerCallback()
}
// 福袋动画停止
stopRedbox()
// 倒计时红包暂停
pauseDownloadTime()
destroyTimerRedbox()
littleVideoFragment?.onPause()
ksFragment?.onPause()
if (isToCreateReward) {
// 防止界面切换 重置红包动画
......@@ -222,7 +216,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
override fun setUserVisibleHint(isVisibleToUser: Boolean) {
super.setUserVisibleHint(isVisibleToUser)
littleVideoFragment?.userVisibleHint = isVisibleToUser
ksFragment?.userVisibleHint = isVisibleToUser
}
override fun onDestroyView() {
......@@ -238,9 +232,6 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
override fun onDestroy() {
super.onDestroy()
// 广告回调解绑
YLUIConfig.getInstance().unRegisterAdListener()
YLPlayerConfig.config().unRegisterPlayerCallback()
homePresenter.detachView()
}
......@@ -403,7 +394,8 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
private fun FlDialogShow(flList: MutableList<FlActivityBean.ActiveTipsConfigDTO>?) {
//活动是否存在(存在弹框,不存在不弹框),有活动 判断打开应用后是否已经弹框过 , 是否是在权限弹框弹出后 再弹出
if (flList != null && flList.size > 0 &&
!ps.getBoolean(Constant.LOAN_PERMISSION_FLAG, true) && flDialogFlag) {
!ps.getBoolean(Constant.LOAN_PERMISSION_FLAG, true) && flDialogFlag
) {
//服务器交互,做回调 //弹窗打开传入1
homePresenter.activeGuidanceTips(Constant.STATUS_CODE_ONE, flList[0].activeKey)
flDialog(flList)
......@@ -431,29 +423,42 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
}
Constant.HOT_ACTIVITY_WATER -> {
ExpressManager.loadExpress()
// TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_WATER)
readyGo(WaterActivity::class.java)
homePresenter.activeGuidanceTips(Constant.STATUS_CODE_TWO,flhost.activeKey)
homePresenter.activeGuidanceTips(
Constant.STATUS_CODE_TWO,
flhost.activeKey
)
}
Constant.HOT_ACTIVITY_WALK -> {
ExpressManager.loadExpress()
// TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_WALK)
readyGo(WalkActivity::class.java)
homePresenter.activeGuidanceTips(Constant.STATUS_CODE_TWO, flhost.activeKey)
homePresenter.activeGuidanceTips(
Constant.STATUS_CODE_TWO,
flhost.activeKey
)
}
Constant.HOT_ACTIVITY_CARD -> {
readyGo(EraseActivity::class.java)
homePresenter.activeGuidanceTips(Constant.STATUS_CODE_TWO, flhost.activeKey)
homePresenter.activeGuidanceTips(
Constant.STATUS_CODE_TWO,
flhost.activeKey
)
}
Constant.HOT_ACTIVITY_LIEBAO -> {
readyGo(LiebaoGameActivity::class.java)
homePresenter.activeGuidanceTips(Constant.STATUS_CODE_TWO, flhost.activeKey)
homePresenter.activeGuidanceTips(
Constant.STATUS_CODE_TWO,
flhost.activeKey
)
}
Constant.HOT_ACTIVITY_MORNINGCLOCK -> {
ExpressManager.loadExpress()
// TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_MORNINGCLOCK)
readyGo(MorningClockActivity::class.java)
homePresenter.activeGuidanceTips(Constant.STATUS_CODE_TWO, flhost.activeKey)
homePresenter.activeGuidanceTips(
Constant.STATUS_CODE_TWO,
flhost.activeKey
)
}
Constant.HOT_ACTIVITY_YYZ -> {
......@@ -464,13 +469,19 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
return
}
YyzManager.openYyzTask(requireActivity())
homePresenter.activeGuidanceTips(Constant.STATUS_CODE_TWO, flhost.activeKey)
homePresenter.activeGuidanceTips(
Constant.STATUS_CODE_TWO,
flhost.activeKey
)
}
Constant.HOT_ACTIVITY_EAT -> {
ExpressManager.loadExpress()
// TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_EAT)
readyGo(FoodSubsidyActivity::class.java)
homePresenter.activeGuidanceTips(Constant.STATUS_CODE_TWO, flhost.activeKey)
homePresenter.activeGuidanceTips(
Constant.STATUS_CODE_TWO,
flhost.activeKey
)
}
Constant.HOT_ACTIVITY_SHARE_NEWS -> {
......@@ -480,7 +491,10 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
return
}
shareArticle(300)
homePresenter.activeGuidanceTips(Constant.STATUS_CODE_TWO, flhost.activeKey)
homePresenter.activeGuidanceTips(
Constant.STATUS_CODE_TWO,
flhost.activeKey
)
}
Constant.HOT_ACTIVITY_CPD -> {
if (!UserManager.getInstance().userIsLogin()) {
......@@ -490,14 +504,23 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
}
carrierType = ""
readyGo(TaskCpdActivity::class.java)
homePresenter.activeGuidanceTips(Constant.STATUS_CODE_TWO, flhost.activeKey)
homePresenter.activeGuidanceTips(
Constant.STATUS_CODE_TWO,
flhost.activeKey
)
}
Constant.HOT_ACTIVITY_MOKU -> {//截图任务
gotoMoku()
homePresenter.activeGuidanceTips(Constant.STATUS_CODE_TWO,flhost.activeKey)
homePresenter.activeGuidanceTips(
Constant.STATUS_CODE_TWO,
flhost.activeKey
)
}
else -> {
if (!TextUtils.isEmpty(flhost.key) && !TextUtils.isEmpty(flhost.title)) {
if (!TextUtils.isEmpty(flhost.key) && !TextUtils.isEmpty(
flhost.title
)
) {
val bundle = Bundle()
bundle.putString(WebActivity.WEB_TITLE, flhost.title)
bundle.putString(WebActivity.WEB_URL, flhost.key)
......@@ -521,9 +544,11 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
private fun gotoMoku() {
RxPermissions(requireActivity())
.request(Manifest.permission.READ_PHONE_STATE,
.request(
Manifest.permission.READ_PHONE_STATE,
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE)
Manifest.permission.WRITE_EXTERNAL_STORAGE
)
.subscribe { granted: Boolean ->
if (granted) {
MokuManager.gotoMoku(requireContext())
......@@ -548,70 +573,101 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
* 一览视频初始化
*/
private fun showLittle() {
val transaction: FragmentTransaction = supportFragmentManager.beginTransaction()
if (littleVideoFragment == null) {
littleVideoFragment = YLLittleVideoFragment.newInstance()
transaction.add(R.id.yilan_fragment_frame_container, littleVideoFragment!!, YLLittleVideoFragment::class.java.simpleName)
val adScene = KsScene.Builder(KsManager.KS_CONTENT).build()
mKsContentPage = KsAdSDK.getLoadManager().loadContentPage(adScene)
registerPlayerCallBack()
val transaction: FragmentTransaction = childFragmentManager.beginTransaction()
if (ksFragment == null) {
ksFragment = mKsContentPage?.fragment
transaction.add(R.id.yilan_fragment_frame_container, ksFragment!!, "ks_fragment")
} else {
transaction.show(littleVideoFragment!!)
transaction.show(ksFragment!!)
}
transaction.commitAllowingStateLoss()
}
private fun registerPlayerCallBack() {
YLPlayerConfig.config().registerPlayerCallBack(object : OnPlayerCallBack {
override fun onStart(pager: String, videoid: String, p2: String?) {
// 防止网络异常时, 第一次加载倒计时红包
if (isFirstLoadVideo) {
isFirstLoadVideo = false
initTimeview()
} else {
resumeDownloadTime(videoid)
}
}
mKsContentPage?.let {
override fun onPause(pager: String, p1: String?, p2: String?) {
pauseDownloadTime()
it.setPageListener(object : KsContentPage.PageListener {
override fun onPagePause(p0: KsContentPage.ContentItem?) {
LogUtil.d("onPagePause")
}
override fun onResume(pager: String, videoid: String, p2: String?) {
resumeDownloadTime(videoid)
override fun onPageResume(p0: KsContentPage.ContentItem?) {
LogUtil.d("onPageResume")
}
override fun onComplete(pager: String, videoid: String, p2: String?) {
override fun onPageEnter(p0: KsContentPage.ContentItem?) {
LogUtil.d("onPageEnter")
}
override fun onPageLeave(p0: KsContentPage.ContentItem?) {
LogUtil.d("onPageLeave")
}
})
override fun onLoopComplete(pager: String?, videoID: String, taskID: String?, num: Int) {
// LogUtil.d(TAG, "registerPlayerCallBack onLoopComplete")
addVideoIdList(videoID)
// 视频播放回调
it.setVideoListener(object : KsContentPage.VideoListener {
override fun onVideoPlayCompleted(p0: KsContentPage.ContentItem?) {
LogUtil.d("onVideoPlayCompleted")
addVideoIdList(p0!!.id)
pauseDownloadTime()
}
override fun onStuckStart(pager: String, p1: String?, p2: String?) {
override fun onVideoPlayPaused(p0: KsContentPage.ContentItem?) {
LogUtil.d("onVideoPlayPaused")
pauseDownloadTime()
}
override fun onStuckEnd(pager: String, p1: String?, p2: String?) {
}
override fun onVideoPlayStart(p0: KsContentPage.ContentItem?) {
LogUtil.d("onVideoPlayStart")
override fun onError(pager: String, p1: String?, p2: String?) {
// 防止网络异常时, 第一次加载倒计时红包
if (isFirstLoadVideo) {
isFirstLoadVideo = false
initTimeview()
} else {
resumeDownloadTime(p0!!.id)
}
}
override fun onVideoPlayError(p0: KsContentPage.ContentItem?, p1: Int, p2: Int) {
LogUtil.d("onVideoPlayError")
pauseDownloadTime()
}
override fun onStop(pager: String, p1: String?, p2: String?) {
// LogUtil.d(TAG, "registerPlayerCallBack onStop")
// pauseDownloadTime()
override fun onVideoPlayResume(p0: KsContentPage.ContentItem?) {
LogUtil.d("onVideoPlayResume")
// 防止网络异常时, 第一次加载倒计时红包
if (isFirstLoadVideo) {
isFirstLoadVideo = false
initTimeview()
} else {
resumeDownloadTime(p0!!.id)
}
}
})
}
}
private fun initListener() {
val params = LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)
val params = LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT
)
params.setMargins(0, 0, 0, BubbleUtils.dp2px(270))
cdvvYilanTime.layoutParams = params
val paramsRedBox = FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT)
val paramsRedBox = FrameLayout.LayoutParams(
FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT
)
paramsRedBox.setMargins(0, BubbleUtils.dp2px(40), 0, 0)
paramsRedBox.gravity = Gravity.END
rl_fragment_main_redbox.layoutParams = paramsRedBox
......@@ -620,48 +676,6 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
rl_fragment_main_redbox.isClickable = false
// 广告回调
YLUIConfig.getInstance().registerAdListener(object : YLAdListener() {
override fun onSuccess(p0: String?, p1: Int, p2: String?, p3: String?) {
}
override fun onError(p0: String?, p1: Int, p2: String?, p3: Int, p4: String?, p5: String?) {
}
override fun onRenderError(p0: String?, p1: Int, p2: String?, p3: Int, p4: String?, p5: String?) {
}
override fun onShow(p0: String?, p1: Int, p2: String?, p3: String) {
resumeAdTime()
}
override fun onClick(p0: String?, p1: Int, p2: String?, p3: String?) {}
override fun onSkip(p0: String?, p1: Int, p2: String?, p3: String?) {}
override fun onTimeOver(p0: String?, p1: Int, p2: String?, p3: String?) {}
override fun onClose(p0: String?, p1: Int, p2: String?, p3: String?) {}
override fun onAdEmpty(p0: String?, p1: Int, p2: String?, p3: String?) {}
override fun onVideoStart(p0: String?, p1: Int, p2: String?, p3: String) {
}
override fun onVideoPause(p0: String?, p1: Int, p2: String?, p3: String?) {
pauseDownloadTime()
}
override fun onVideoResume(p0: String?, p1: Int, p2: String?, p3: String?) {
resumeAdTime()
}
override fun onVideoComplete(p0: String?, p1: Int, p2: String?, p3: String?) {
pauseDownloadTime()
}
override fun onVideoError(p0: String?, p1: Int, p2: String?, p3: String?) {}
})
}
private fun resumeAdTime() {
......@@ -746,7 +760,8 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
when (v?.id) {
R.id.tv_focus -> {//马上关注
// //将“淘金空间”复制到粘贴板上
val clipboardManager = baseApplication.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
val clipboardManager =
baseApplication.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
val clipData = ClipData.newPlainText("Label", "淘金空间")
clipboardManager.setPrimaryClip(clipData)
showToast("已复制内容到剪贴板")
......@@ -823,12 +838,25 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
ShumeiManager.getInstance().initShumei()
// 游客首次提示1500新人奖励 且 不是分享包
val channel = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME")
if (!TextUtils.equals(channel, Constant.CHANNEL_SHARE) && ps.getBoolean(Constant.FIRST_VISITOR_FLAG, true)) {
val channel = CommonUtils.getAppMetaData(
MintsApplication.getContext(),
"CHANNEL_NAME"
)
if (!TextUtils.equals(channel, Constant.CHANNEL_SHARE) && ps.getBoolean(
Constant.FIRST_VISITOR_FLAG,
true
)
) {
ps.put(Constant.FIRST_VISITOR_FLAG, false)
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, if (userMsgBean != null && userMsgBean!!.userMsg.showCoin > 0) userMsgBean?.userMsg?.showCoin!! else 1500)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_NEW_VISITOR)
bundle.putInt(
Constant.MAIN_CUR_COIN,
if (userMsgBean != null && userMsgBean!!.userMsg.showCoin > 0) userMsgBean?.userMsg?.showCoin!! else 1500
)
bundle.putString(
Constant.MAIN_CARRIER_TYPE,
Constant.CARRIER_NEW_VISITOR
)
readyGo(AwardActivity::class.java, bundle)
}
}
......@@ -840,7 +868,12 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
}
private fun initExpress(flowAdRules: FlowAdRulesBean) {
PreLoadExpressManager.init(flowAdRules.csj, flowAdRules.ylh, flowAdRules.ks, flowAdRules.gromore)
PreLoadExpressManager.init(
flowAdRules.csj,
flowAdRules.ylh,
flowAdRules.ks,
flowAdRules.gromore
)
}
/**
......
......@@ -21,6 +21,9 @@ import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.banner.BannerManager
import com.mints.goodmoney.ad.express.*
import com.mints.goodmoney.ad.express.PreLoadExpressManager
import com.mints.goodmoney.ad.express.TTPreLoadCarrierExpressManager
import com.mints.goodmoney.ad.express.TTPreLoadExpressXmlyManager
import com.mints.goodmoney.ad.video.VideoAdingManager
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
......@@ -266,8 +269,10 @@ class MyFragment : BaseFragment(),
for (i in 0 until pageCount) {
val gridView = inflater.inflate(R.layout.item_fragment_main_my_promotions_gv,
vp_grid, false) as GridView
val gridView = inflater.inflate(
R.layout.item_fragment_main_my_promotions_gv,
vp_grid, false
) as GridView
gridView.adapter = GvMyAdapter(requireActivity(), data, i, HOT_PAGE_SIZE)
pagerList.add(gridView)
......@@ -512,8 +517,10 @@ class MyFragment : BaseFragment(),
nowDate
}
item_clock_signday.text = SpanUtils()
.append(" 已连续签到").setForegroundColor(ContextCompat.getColor(mContext, R.color.color_172B54))
.append(" $alwaysSignDay ").setForegroundColor(ContextCompat.getColor(mContext, R.color.color_F18542))
.append(" 已连续签到")
.setForegroundColor(ContextCompat.getColor(mContext, R.color.color_172B54))
.append(" $alwaysSignDay ")
.setForegroundColor(ContextCompat.getColor(mContext, R.color.color_F18542))
.append("天").setForegroundColor(ContextCompat.getColor(mContext, R.color.color_172B54))
.create()
val finalSignStatus = signStatus
......@@ -532,11 +539,20 @@ class MyFragment : BaseFragment(),
LogUtil.d("lixianshouyi", "setUserLoginStatus。。。。。。。。。。。。。。。。。。。。。。。。。。")
// 已登录
if (userManager.wxOpenid.isNotEmpty()) {
GlideUtils.loadImageViewLoding(context, userManager.wxHeader, item_title_avatar, R.mipmap.ic_my, R.mipmap.ic_my)
GlideUtils.loadImageViewLoding(
context,
userManager.wxHeader,
item_title_avatar,
R.mipmap.ic_my,
R.mipmap.ic_my
)
if (userManager.wxName.isEmpty()) {
var mobile = userManager.mobile
if (mobile.isNotEmpty()) {
mobile = mobile.substring(0, 3) + "****" + mobile.substring(mobile.length - 4, mobile.length)
mobile = mobile.substring(0, 3) + "****" + mobile.substring(
mobile.length - 4,
mobile.length
)
}
item_title_id.text = "手机:$mobile"
} else {
......@@ -545,7 +561,10 @@ class MyFragment : BaseFragment(),
} else {
var mobile = userManager.mobile
if (mobile.isNotEmpty()) {
mobile = mobile.substring(0, 3) + "****" + mobile.substring(mobile.length - 4, mobile.length)
mobile = mobile.substring(0, 3) + "****" + mobile.substring(
mobile.length - 4,
mobile.length
)
}
item_title_id.text = "手机:$mobile"
item_title_avatar.setImageResource(R.mipmap.ic_my)
......@@ -571,7 +590,8 @@ class MyFragment : BaseFragment(),
val allcoinBig = BigDecimal(userConfig!!.userMsg.coin.toString())
val rateBig = BigDecimal("10000")
val cashStr: String = allcoinBig.divide(rateBig).setScale(2, BigDecimal.ROUND_DOWN).toString()
val cashStr: String =
allcoinBig.divide(rateBig).setScale(2, BigDecimal.ROUND_DOWN).toString()
item_title_gold_about.text = "约" + cashStr + "元"
userGold = CommonUtils.formatString(userConfig!!.userMsg.coin.toString())
......@@ -585,7 +605,8 @@ class MyFragment : BaseFragment(),
*/
private fun handleRecyData() {
userConfig?.let {
item_bottom_qqGroupNum.text = userConfig?.qqMsg?.useqq?.name + ":" + userConfig?.qqMsg?.useqq?.qq
item_bottom_qqGroupNum.text =
userConfig?.qqMsg?.useqq?.name + ":" + userConfig?.qqMsg?.useqq?.qq
}
dataList.clear()
......@@ -608,18 +629,22 @@ class MyFragment : BaseFragment(),
when (taskBean.baseConfig.taskId) {
// 积分任务
MainMyAdapter.TO_OTHERAPP -> {
if (!TextUtils.isEmpty(taskBean.otherConfig.pkg) && !AppUtil.checkPackInfo(requireActivity(),taskBean.otherConfig.pkg)) {
showToast("请先安装"+taskBean.otherConfig.pkgName)
if (!TextUtils.isEmpty(taskBean.otherConfig.pkg) && !AppUtil.checkPackInfo(
requireActivity(),
taskBean.otherConfig.pkg
)
) {
showToast("请先安装" + taskBean.otherConfig.pkgName)
return
}
if(!TextUtils.isEmpty(taskBean.otherConfig.tourl)){
if (!TextUtils.isEmpty(taskBean.otherConfig.tourl)) {
try {
val uri = Uri.parse(taskBean.otherConfig.tourl)
val intent = Intent(Intent.ACTION_VIEW, uri)
startActivity(intent)
}catch (e:Exception){
AppUtil.openBrowser(requireContext(),taskBean.otherConfig.tourl)
} catch (e: Exception) {
AppUtil.openBrowser(requireContext(), taskBean.otherConfig.tourl)
}
}
......@@ -660,7 +685,10 @@ class MyFragment : BaseFragment(),
1 -> {
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, taskBean.otherConfig.coin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_HIGH_ACTIVITY)
bundle.putString(
Constant.MAIN_CARRIER_TYPE,
Constant.CARRIER_HIGH_ACTIVITY
)
readyGo(AwardActivity::class.java, bundle)
AppConfig.isHighTask = false
......@@ -675,7 +703,10 @@ class MyFragment : BaseFragment(),
// if (TextUtils.isEmpty(mCurrentPkg)) {
if (mCurrentPkg == null) {
showToast("任务异常,请重试~")
myPresenter.setHighTaskType(Constant.CARRIER_HIGH_ACTIVITY, "0")
myPresenter.setHighTaskType(
Constant.CARRIER_HIGH_ACTIVITY,
"0"
)
AppConfig.isHighTask = false
} else {
......@@ -685,7 +716,10 @@ class MyFragment : BaseFragment(),
AppConfig.isHighTask = true
} else {
showToast("未找到当前APP、可能被卸载,请重试~")
myPresenter.setHighTaskType(Constant.CARRIER_HIGH_ACTIVITY, "0")
myPresenter.setHighTaskType(
Constant.CARRIER_HIGH_ACTIVITY,
"0"
)
AppConfig.isHighTask = false
}
......@@ -709,7 +743,10 @@ class MyFragment : BaseFragment(),
1 -> {
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, taskBean.otherConfig.coin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_SHARE_NEWS)
bundle.putString(
Constant.MAIN_CARRIER_TYPE,
Constant.CARRIER_SHARE_NEWS
)
readyGo(AwardActivity::class.java, bundle)
}
}
......@@ -728,7 +765,10 @@ class MyFragment : BaseFragment(),
1 -> {
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, taskBean.otherConfig.coin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_HOMEVEDIO_CHALLENGE)
bundle.putString(
Constant.MAIN_CARRIER_TYPE,
Constant.CARRIER_HOMEVEDIO_CHALLENGE
)
readyGo(AwardActivity::class.java, bundle)
}
}
......@@ -745,7 +785,10 @@ class MyFragment : BaseFragment(),
1 -> {
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, taskBean.otherConfig.coin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_MINIVEDIO_CHALLENGE)
bundle.putString(
Constant.MAIN_CARRIER_TYPE,
Constant.CARRIER_MINIVEDIO_CHALLENGE
)
readyGo(AwardActivity::class.java, bundle)
}
}
......@@ -772,8 +815,14 @@ class MyFragment : BaseFragment(),
1 -> {
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, taskBean.otherConfig.coin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CHALLENGE_SHAREFRIEND)
bundle.putString(Constant.MAIN_EXTRA_ID, taskBean.otherConfig.doubleCoin.toString())
bundle.putString(
Constant.MAIN_CARRIER_TYPE,
Constant.CHALLENGE_SHAREFRIEND
)
bundle.putString(
Constant.MAIN_EXTRA_ID,
taskBean.otherConfig.doubleCoin.toString()
)
readyGo(AwardActivity::class.java, bundle)
}
}
......@@ -801,7 +850,10 @@ class MyFragment : BaseFragment(),
1 -> {
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, taskBean.otherConfig.coin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_GAME_ONLINE)
bundle.putString(
Constant.MAIN_CARRIER_TYPE,
Constant.CARRIER_GAME_ONLINE
)
readyGo(AwardActivity::class.java, bundle)
}
}
......@@ -819,7 +871,10 @@ class MyFragment : BaseFragment(),
1 -> {
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, taskBean.otherConfig.coin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_RUISHINEWS_CHALLANGE)
bundle.putString(
Constant.MAIN_CARRIER_TYPE,
Constant.CARRIER_RUISHINEWS_CHALLANGE
)
readyGo(AwardActivity::class.java, bundle)
}
}
......@@ -868,7 +923,10 @@ class MyFragment : BaseFragment(),
1 -> {
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, taskBean.otherConfig.coin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_XMLY_CHALLENGE)
bundle.putString(
Constant.MAIN_CARRIER_TYPE,
Constant.CARRIER_XMLY_CHALLENGE
)
readyGo(AwardActivity::class.java, bundle)
}
}
......@@ -884,7 +942,11 @@ class MyFragment : BaseFragment(),
pkgMCRSName = taskBean.otherConfig.pkg
// 下载牧场人生
DownloadApkManager.downloadApk(requireActivity(), taskBean.otherConfig.downloadUrl, pkgMCRSName)
DownloadApkManager.downloadApk(
requireActivity(),
taskBean.otherConfig.downloadUrl,
pkgMCRSName
)
// 开启广播监听安装事件
registerBroad()
......@@ -893,7 +955,10 @@ class MyFragment : BaseFragment(),
// 牧场人生APP,直接弹奖励框
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, taskBean.otherConfig.coin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_MC_FIRSTDOWNLOAD)
bundle.putString(
Constant.MAIN_CARRIER_TYPE,
Constant.CARRIER_MC_FIRSTDOWNLOAD
)
readyGo(AwardActivity::class.java, bundle)
onDestroyBroadcastReceiver()
......@@ -910,15 +975,25 @@ class MyFragment : BaseFragment(),
pkgMCRSCarrier = Constant.CARRIER_FIRSTDOWNLOADS
pkgMCRSKey = taskBean.otherConfig.key
pkgMCRSName = taskBean.otherConfig.pkg
DownloadApkManager.downloadApk(requireActivity(), taskBean.otherConfig.downloadUrl, pkgMCRSName)
DownloadApkManager.downloadApk(
requireActivity(),
taskBean.otherConfig.downloadUrl,
pkgMCRSName
)
// 开启广播监听安装事件
registerBroad()
}
1 -> {
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, taskBean.otherConfig.coin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_FIRSTDOWNLOADS)
bundle.putString(Constant.MAIN_EXTRA_ID, taskBean.otherConfig.key)
bundle.putString(
Constant.MAIN_CARRIER_TYPE,
Constant.CARRIER_FIRSTDOWNLOADS
)
bundle.putString(
Constant.MAIN_EXTRA_ID,
taskBean.otherConfig.key
)
readyGo(AwardActivity::class.java, bundle)
onDestroyBroadcastReceiver()
......@@ -995,7 +1070,10 @@ class MyFragment : BaseFragment(),
myPresenter.getAutoUserHallBaseMsg()
return
}
LogUtil.e("jinbitixian","*****************************************+++++++++++++++++++========================****&&&&&&&&%%^&$^$&%$&")
LogUtil.e(
"jinbitixian",
"*****************************************+++++++++++++++++++========================****&&&&&&&&%%^&$^$&%$&"
)
readyGo(DrawcashActivity::class.java)
}
R.id.btn_coinRecord -> {
......@@ -1032,12 +1110,15 @@ class MyFragment : BaseFragment(),
}
Constant.HOT_ACTIVITY_WATER -> {
ExpressManager.loadExpress()
// TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_WATER)
readyGo(WaterActivity::class.java)
}
Constant.HOT_ACTIVITY_WALK -> {
ExpressManager.loadExpress()
// TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_WALK)
readyGo(WaterActivity::class.java)
}
Constant.HOT_ACTIVITY_WALK -> {
TTPreLoadCarrierExpressManager.getInstance()
.loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_WALK)
readyGo(WalkActivity::class.java)
}
Constant.HOT_ACTIVITY_CARD -> {
......@@ -1048,7 +1129,8 @@ class MyFragment : BaseFragment(),
}
Constant.HOT_ACTIVITY_MORNINGCLOCK -> {
ExpressManager.loadExpress()
// TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_MORNINGCLOCK)
TTPreLoadCarrierExpressManager.getInstance()
.loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_MORNINGCLOCK)
readyGo(MorningClockActivity::class.java)
}
Constant.HOT_ACTIVITY_BXM -> {
......@@ -1129,7 +1211,8 @@ class MyFragment : BaseFragment(),
}
Constant.HOT_ACTIVITY_EAT -> {
ExpressManager.loadExpress()
// TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_EAT)
TTPreLoadCarrierExpressManager.getInstance()
.loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_EAT)
readyGo(FoodSubsidyActivity::class.java)
}
Constant.HOT_ACTIVITY_SHARE_NEWS -> {
......@@ -1211,7 +1294,11 @@ class MyFragment : BaseFragment(),
/**
* 加载激励视频
*/
private fun loadVideo(videoAdingManager: VideoAdingManager, bean: VideoAdingBean, isFirstLoad: Boolean) {
private fun loadVideo(
videoAdingManager: VideoAdingManager,
bean: VideoAdingBean,
isFirstLoad: Boolean
) {
videoAdingManager.setVideoAdingListener(object : VideoAdingManager.VideoAdingListener {
override fun videoAdingListenerError(adType: String) {
showToast("加载超时,请休息一下")
......@@ -1268,7 +1355,10 @@ class MyFragment : BaseFragment(),
if (autoListBean.baseConfig.taskId == MainMyAdapter.APP_VEDIO) {
if (autoListBean.otherConfig != null) {
bundle.putInt(Constant.MAIN_CUR_COIN, autoListBean.otherConfig.coin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_VERSUS_VIDEO)
bundle.putString(
Constant.MAIN_CARRIER_TYPE,
Constant.CARRIER_VERSUS_VIDEO
)
readyGo(AwardActivity::class.java, bundle)
return
}
......@@ -1327,7 +1417,11 @@ class MyFragment : BaseFragment(),
override fun onPageScrollStateChanged(state: Int) {
}
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
override fun onPageScrolled(
position: Int,
positionOffset: Float,
positionOffsetPixels: Int
) {
}
override fun onPageSelected(position: Int) {
......@@ -1351,7 +1445,12 @@ class MyFragment : BaseFragment(),
}
private fun initExpress(flowAdRules: FlowAdRulesBean) {
PreLoadExpressManager.init(flowAdRules.csj, flowAdRules.ylh, flowAdRules.ks, flowAdRules.gromore)
PreLoadExpressManager.init(
flowAdRules.csj,
flowAdRules.ylh,
flowAdRules.ks,
flowAdRules.gromore
)
}
/**
......@@ -1377,7 +1476,13 @@ class MyFragment : BaseFragment(),
* 第一次微信分享弹框
*/
private fun firstWeChatInvite() {
DialogUtils.showDialog(mContext, "提示", "被邀请人成功提现0.5元后发放贡献", "取消", "打开微信", object : DialogListener() {
DialogUtils.showDialog(
mContext,
"提示",
"被邀请人成功提现0.5元后发放贡献",
"取消",
"打开微信",
object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
dialog?.dismiss()
......@@ -1406,7 +1511,10 @@ class MyFragment : BaseFragment(),
if (userManager.wxName.isEmpty()) {
var mobile = userManager.mobile
if (mobile.isNotEmpty()) {
mobile = mobile.substring(0, 3) + "****" + mobile.substring(mobile.length - 4, mobile.length)
mobile = mobile.substring(0, 3) + "****" + mobile.substring(
mobile.length - 4,
mobile.length
)
}
title = "Hi,我是$mobile"
} else {
......@@ -1433,10 +1541,12 @@ class MyFragment : BaseFragment(),
*/
private fun highVideoTint(taskBean: MyInfo.AutoListBean) {
val ssb = SpanUtils()
.append("1.点击开始任务,观看广告时,点击广告中的下载APP区域\r\n" +
.append(
"1.点击开始任务,观看广告时,点击广告中的下载APP区域\r\n" +
"2.等待APP下载完成后,安装该APP\r\n" +
"3.通过好赚钱APP打开该APP并试玩至少30秒" +
"\n\n")
"\n\n"
)
.append("说明:有些可能不是下载APP类型的广告,请关闭广告后重试").setFontSize(BubbleUtils.dp2px(12))
.create()
......@@ -1463,7 +1573,13 @@ class MyFragment : BaseFragment(),
* 打开应用使用记录授权弹框
*/
private fun openAppUsageStats() {
DialogUtils.showDialog(mContext, "任务步骤", "该任务需要【应用使用记录】权限", "取消", "打开授权", object : DialogListener() {
DialogUtils.showDialog(
mContext,
"任务步骤",
"该任务需要【应用使用记录】权限",
"取消",
"打开授权",
object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
dialog?.dismiss()
......@@ -1519,7 +1635,8 @@ class MyFragment : BaseFragment(),
*/
fun turnDayTask() {
if (signCardBean != null) {
scrollviewMy.scrollTo(0, llMyRoot.height -
scrollviewMy.scrollTo(
0, llMyRoot.height -
recy_my.height -
item_customer_service.height -
item_bottom_qqGroupNum.height -
......@@ -1533,7 +1650,8 @@ class MyFragment : BaseFragment(),
Timer().schedule(800) {
activity?.runOnUiThread {
// scrollviewMy.scrollTo(0, llMyRoot.height - viewTitleDayTask.height)
scrollviewMy.scrollTo(0, llMyRoot.height -
scrollviewMy.scrollTo(
0, llMyRoot.height -
recy_my.height -
item_customer_service.height -
item_bottom_qqGroupNum.height -
......@@ -1558,9 +1676,11 @@ class MyFragment : BaseFragment(),
private fun gotoMoku() {
RxPermissions(requireActivity())
.request(Manifest.permission.READ_PHONE_STATE,
.request(
Manifest.permission.READ_PHONE_STATE,
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE)
Manifest.permission.WRITE_EXTERNAL_STORAGE
)
.subscribe { granted: Boolean ->
if (granted) {
MokuManager.gotoMoku(requireContext())
......
......@@ -6,13 +6,9 @@ import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import com.mints.goodmoney.common.AppConfig;
import com.mints.goodmoney.manager.TrackManager;
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.SplashGroMoreActivity;
import com.mints.goodmoney.ui.activitys.SplashGroMoreBackgroundActivity;
import java.lang.ref.WeakReference;
......@@ -96,8 +92,7 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
// 每次返回应用时 都展示开屏广告
String simpleName = activity.getClass().getSimpleName();
if (TextUtils.equals(simpleName, "SplashYlhActivity") ||
TextUtils.equals(simpleName, "GuideActivity") ||
if (TextUtils.equals(simpleName, "GuideActivity") ||
TextUtils.equals(simpleName, "AwardActivity") ||
TextUtils.equals(simpleName, "DrawcashActivity")) {
count++;
......@@ -111,7 +106,7 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
// if (AppConfig.groMoreVideoAdCount > 0) {
if (groIntent == null) {
groIntent = new Intent(activity, SplashGroMoreBackgroundActivity.class);
groIntent = new Intent(activity, SplashCsjADActivity.class);
}
activity.startActivity(groIntent);
// } else {
......
package com.mints.goodmoney.utils;
import android.Manifest;
import android.annotation.SuppressLint;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
......@@ -12,7 +11,7 @@ import android.util.Log;
import androidx.annotation.RequiresApi;
import com.yilan.sdk.common.util.PermissionUtil;
import com.tz.sdk.core.utils.PermissionUtil;
import java.lang.reflect.Method;
......
package com.mints.goodmoney.utils;
import com.bytedance.msdk.api.BaiduExtraOptions;
import com.bytedance.msdk.api.GDTExtraOption;
import com.bytedance.msdk.api.TTVideoOption;
public class VideoOptionUtil {
public static TTVideoOption getTTVideoOption() {
//广点通(GDT)单独使用配置
GDTExtraOption gdtExtraOption = new GDTExtraOption.Builder()
.setGDTAutoPlayMuted(true)//自动播放是否静音,默认true
.setGDTDetailPageMuted(false)//详情页是否静音,默认值为false,即有声播放;
.setGDTEnableDetailPage(true)//是否能跳转详情页,默认true
.setGDTEnableUserControl(false)//是否能控制是否暂停与播放,默认false
.setGDTMaxVideoDuration(0)//视频最大长度,单位:秒 此设置会影响广告填充,请谨慎设置
.setGDTMinVideoDuration(0)//视频最小长度,单位:秒 此设置会影响广告填充,请谨慎设置
// VideoOption.AutoPlayPolicy.WIFI表示只在WiFi下自动播放;
// VideoOption.AutoPlayPolicy.ALWAYS表示始终自动播放,不区分当前网络;
// VideoOption.AutoPlayPolicy.NEVER表示始终都不自动播放,不区分当前网络,但在WiFi时会预下载视频资源;
// 默认为始终自动播放;模板渲染视频、插屏2.0视频、自渲染2.0视频都可使用
.setAutoPlayPolicy(GDTExtraOption.AutoPlayPolicy.WIFI)//自动播放策略--
.setDownAPPConfirmPolicy(GDTExtraOption.DownAPPConfirmPolicy.TYPE_DEFAULT)//指定点击 APP 广告后是否展示二次确认,可选项包括 Default(wifi 不展示,非wifi 展示),NoConfirm(所有情况不展示)
.setBrowserType(GDTExtraOption.BrowserType.TYPE_DEFAULT)//指定普链广告点击后用于展示落地页的浏览器类型,可选项包括:InnerBrowser(APP 内置浏览器),Sys(系统浏览器),Default(默认),SDK 按照默认逻辑选择
.build();
//针对百度SDK信息流设置
BaiduExtraOptions baiduExtraOptions = new BaiduExtraOptions.Builder()
.setGDTExtraOption(BaiduExtraOptions.DOWNLOAD_APP_CONFIRM_ALWAYS)
.setCacheVideoOnlyWifi(true).build();
//视频声音控制
TTVideoOption videoOption = new TTVideoOption.Builder()
.setMuted(false) //所有类型生效,GDT除外
.setAdmobAppVolume(1f)//admob 声音配置,与setMuted配合使用
.setGDTExtraOption(gdtExtraOption)//GDT 单独
.setBaiduExtraOption(baiduExtraOptions)//百度SDK配置
.build();
return videoOption;
}
public static TTVideoOption getTTVideoOption2() {
//广点通(GDT)单独使用配置
GDTExtraOption gdtExtraOption = new GDTExtraOption.Builder()
.setGDTAutoPlayMuted(true)//自动播放是否静音,默认true
.setGDTDetailPageMuted(false)//详情页是否静音,默认值为false,即有声播放;
.setGDTEnableDetailPage(true)//是否能跳转详情页,默认true
.setGDTEnableUserControl(false)//是否能控制是否暂停与播放,默认false
.setGDTMaxVideoDuration(0)//视频最大长度,单位:秒 此设置会影响广告填充,请谨慎设置
.setGDTMinVideoDuration(0)//视频最小长度,单位:秒 此设置会影响广告填充,请谨慎设置
.setFeedExpressType(GDTExtraOption.FeedExpressType.FEED_EXPRESS_TYPE_2)//确定使用GDT FEED 模板渲染2.0功能;需要向广点通商务申请2.0权限
// VideoOption.AutoPlayPolicy.WIFI表示只在WiFi下自动播放;
// VideoOption.AutoPlayPolicy.ALWAYS表示始终自动播放,不区分当前网络;
// VideoOption.AutoPlayPolicy.NEVER表示始终都不自动播放,不区分当前网络,但在WiFi时会预下载视频资源;
// 默认为始终自动播放;模板渲染视频、插屏2.0视频、自渲染2.0视频都可使用
.setAutoPlayPolicy(GDTExtraOption.AutoPlayPolicy.WIFI)//自动播放策略--
.setDownAPPConfirmPolicy(GDTExtraOption.DownAPPConfirmPolicy.TYPE_DEFAULT)//指定点击 APP 广告后是否展示二次确认,可选项包括 Default(wifi 不展示,非wifi 展示),NoConfirm(所有情况不展示)
.setBrowserType(GDTExtraOption.BrowserType.TYPE_DEFAULT).build();//指定普链广告点击后用于展示落地页的浏览器类型,可选项包括:InnerBrowser(APP 内置浏览器),Sys(系统浏览器),Default(默认),SDK 按照默认逻辑选择
//针对百度SDK信息流设置
BaiduExtraOptions baiduExtraOptions = new BaiduExtraOptions.Builder()
.setGDTExtraOption(BaiduExtraOptions.DOWNLOAD_APP_CONFIRM_ALWAYS)
.setCacheVideoOnlyWifi(true).build();
//视频声音控制
TTVideoOption videoOption = new TTVideoOption.Builder()
.setMuted(false) //所有类型生效,GDT除外
.setAdmobAppVolume(1f)//admob 声音配置,与setMuted配合使用
.setGDTExtraOption(gdtExtraOption)//GDT 单独
.setBaiduExtraOption(baiduExtraOptions)//百度SDK配置
.build();
return videoOption;
}
}
//package com.mints.goodmoney.utils;
//
//import com.bytedance.msdk.api.BaiduExtraOptions;
//import com.bytedance.msdk.api.GDTExtraOption;
//import com.bytedance.msdk.api.TTVideoOption;
//
//public class VideoOptionUtil {
//
//
// public static TTVideoOption getTTVideoOption() {
// //广点通(GDT)单独使用配置
// GDTExtraOption gdtExtraOption = new GDTExtraOption.Builder()
// .setGDTAutoPlayMuted(true)//自动播放是否静音,默认true
// .setGDTDetailPageMuted(false)//详情页是否静音,默认值为false,即有声播放;
// .setGDTEnableDetailPage(true)//是否能跳转详情页,默认true
// .setGDTEnableUserControl(false)//是否能控制是否暂停与播放,默认false
// .setGDTMaxVideoDuration(0)//视频最大长度,单位:秒 此设置会影响广告填充,请谨慎设置
// .setGDTMinVideoDuration(0)//视频最小长度,单位:秒 此设置会影响广告填充,请谨慎设置
// // VideoOption.AutoPlayPolicy.WIFI表示只在WiFi下自动播放;
// // VideoOption.AutoPlayPolicy.ALWAYS表示始终自动播放,不区分当前网络;
// // VideoOption.AutoPlayPolicy.NEVER表示始终都不自动播放,不区分当前网络,但在WiFi时会预下载视频资源;
// // 默认为始终自动播放;模板渲染视频、插屏2.0视频、自渲染2.0视频都可使用
// .setAutoPlayPolicy(GDTExtraOption.AutoPlayPolicy.WIFI)//自动播放策略--
// .setDownAPPConfirmPolicy(GDTExtraOption.DownAPPConfirmPolicy.TYPE_DEFAULT)//指定点击 APP 广告后是否展示二次确认,可选项包括 Default(wifi 不展示,非wifi 展示),NoConfirm(所有情况不展示)
// .setBrowserType(GDTExtraOption.BrowserType.TYPE_DEFAULT)//指定普链广告点击后用于展示落地页的浏览器类型,可选项包括:InnerBrowser(APP 内置浏览器),Sys(系统浏览器),Default(默认),SDK 按照默认逻辑选择
// .build();
//
// //针对百度SDK信息流设置
// BaiduExtraOptions baiduExtraOptions = new BaiduExtraOptions.Builder()
// .setGDTExtraOption(BaiduExtraOptions.DOWNLOAD_APP_CONFIRM_ALWAYS)
// .setCacheVideoOnlyWifi(true).build();
//
// //视频声音控制
// TTVideoOption videoOption = new TTVideoOption.Builder()
// .setMuted(false) //所有类型生效,GDT除外
// .setAdmobAppVolume(1f)//admob 声音配置,与setMuted配合使用
// .setGDTExtraOption(gdtExtraOption)//GDT 单独
// .setBaiduExtraOption(baiduExtraOptions)//百度SDK配置
// .build();
//
// return videoOption;
// }
//
// public static TTVideoOption getTTVideoOption2() {
// //广点通(GDT)单独使用配置
// GDTExtraOption gdtExtraOption = new GDTExtraOption.Builder()
// .setGDTAutoPlayMuted(true)//自动播放是否静音,默认true
// .setGDTDetailPageMuted(false)//详情页是否静音,默认值为false,即有声播放;
// .setGDTEnableDetailPage(true)//是否能跳转详情页,默认true
// .setGDTEnableUserControl(false)//是否能控制是否暂停与播放,默认false
// .setGDTMaxVideoDuration(0)//视频最大长度,单位:秒 此设置会影响广告填充,请谨慎设置
// .setGDTMinVideoDuration(0)//视频最小长度,单位:秒 此设置会影响广告填充,请谨慎设置
// .setFeedExpressType(GDTExtraOption.FeedExpressType.FEED_EXPRESS_TYPE_2)//确定使用GDT FEED 模板渲染2.0功能;需要向广点通商务申请2.0权限
// // VideoOption.AutoPlayPolicy.WIFI表示只在WiFi下自动播放;
// // VideoOption.AutoPlayPolicy.ALWAYS表示始终自动播放,不区分当前网络;
// // VideoOption.AutoPlayPolicy.NEVER表示始终都不自动播放,不区分当前网络,但在WiFi时会预下载视频资源;
// // 默认为始终自动播放;模板渲染视频、插屏2.0视频、自渲染2.0视频都可使用
// .setAutoPlayPolicy(GDTExtraOption.AutoPlayPolicy.WIFI)//自动播放策略--
// .setDownAPPConfirmPolicy(GDTExtraOption.DownAPPConfirmPolicy.TYPE_DEFAULT)//指定点击 APP 广告后是否展示二次确认,可选项包括 Default(wifi 不展示,非wifi 展示),NoConfirm(所有情况不展示)
// .setBrowserType(GDTExtraOption.BrowserType.TYPE_DEFAULT).build();//指定普链广告点击后用于展示落地页的浏览器类型,可选项包括:InnerBrowser(APP 内置浏览器),Sys(系统浏览器),Default(默认),SDK 按照默认逻辑选择
//
//
// //针对百度SDK信息流设置
// BaiduExtraOptions baiduExtraOptions = new BaiduExtraOptions.Builder()
// .setGDTExtraOption(BaiduExtraOptions.DOWNLOAD_APP_CONFIRM_ALWAYS)
// .setCacheVideoOnlyWifi(true).build();
//
// //视频声音控制
// TTVideoOption videoOption = new TTVideoOption.Builder()
// .setMuted(false) //所有类型生效,GDT除外
// .setAdmobAppVolume(1f)//admob 声音配置,与setMuted配合使用
// .setGDTExtraOption(gdtExtraOption)//GDT 单独
// .setBaiduExtraOption(baiduExtraOptions)//百度SDK配置
// .build();
//
// return videoOption;
// }
//}
......@@ -23,7 +23,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:padding="15dp"
android:src="@drawable/yl_mp_ic_back_left" />
android:src="@mipmap/ic_arrow_back_white" />
<ImageView
android:layout_width="wrap_content"
......
......@@ -22,7 +22,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:padding="15dp"
android:src="@drawable/yl_mp_ic_back_left" />
android:src="@mipmap/ic_arrow_back_white" />
<ImageView
android:layout_width="wrap_content"
......
......@@ -22,7 +22,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:padding="15dp"
android:src="@drawable/yl_mp_ic_back_left" />
android:src="@mipmap/ic_arrow_back_white" />
<ImageView
android:layout_width="wrap_content"
......
......@@ -22,7 +22,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:padding="15dp"
android:src="@drawable/yl_mp_ic_back_left" />
android:src="@mipmap/ic_arrow_back_white" />
<ImageView
android:layout_width="wrap_content"
......
<?xml version="1.0" encoding="utf-8"?>
<com.bytedance.msdk.api.format.TTNativeAdView xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
......@@ -108,4 +108,4 @@
android:layout_marginRight="10dp" />
</RelativeLayout>
</com.bytedance.msdk.api.format.TTNativeAdView>
\ No newline at end of file
</FrameLayout>
\ No newline at end of file
......@@ -71,6 +71,9 @@ allprojects {
repositories {
google()
jcenter()
// maven { url 'https://dl.bintray.com/umsdk/release' }
// umeng仓库
maven { url 'https://repo1.maven.org/maven2/' }
maven { url "https://jitpack.io" }
//添加一览 maven地址
......
......@@ -16,8 +16,9 @@ android.injected.testOnly=false
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
DEBUG_URL="http://39.97.65.143:9082/api-gm/"
#DEBUG_URL="http://39.97.65.143:9082/api-gm/"
#DEBUG_URL="http://192.168.31.194:8101/"
DEBUG_URL="https://api.mints-id.com/api-gm/"
RELEASE_URL="https://api.mints-id.com/api-gm/"
RELEASE_KEY_PASSWORD=mints.goodmoney
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment