Commit f3daa0e9 authored by mengcuiguang's avatar mengcuiguang

添加gromore sdk

parent d8da792a
......@@ -196,10 +196,6 @@ dependencies {
implementation 'cn.jiguang.sdk:jcore:2.3.8'
// 移动安全联盟
implementation(name: 'oaid_sdk_1.0.23', ext: 'aar')
// 穿山甲广告
implementation(name: 'open_ad_sdk', ext: 'aar')
// 广点通广告 腾讯
implementation(name: 'GDTSDK.unionNoPlugin.4.294.1164', ext: 'aar')
// shareSdk
implementation project(':shareSdkLib')
// 应用管理中心分包
......@@ -234,8 +230,19 @@ dependencies {
implementation(name: 'tzsdk_coral-2.0.0-20200807131516-release', ext: 'aar')
implementation(name: 'tzsdk_core-3.0.0-20200807131516-release', ext: 'aar')
implementation(name: 'tzsdk_reporter-3.0.0-20200807131516-release', ext: 'aar')
// 穿山甲 GroMore
// mediation_ad_sdk
implementation(name: 'mediation_ad_sdk_2.8.0.2', ext: 'aar')
implementation(name: 'gdt_adapter_4.351.1221.3', ext: 'aar')
implementation(name: 'ks_adapter_3.3.9.2', ext: 'aar')
// 穿山甲广告
implementation(name: 'open_ad_sdk_3.6.1.3', ext: 'aar')
// 广点通广告 腾讯
implementation(name: 'GDTSDK.unionNormal.4.351.1221', ext: 'aar')
// 快手
implementation(name: 'kssdk-all--3.3.16-publishRelease-9ffe2b94e', ext: 'aar')
implementation(name: 'kssdk-ad-3.3.9', ext: 'aar')
// OneWay
implementation(name: 'oneway-common-core-1.0.10', ext: 'aar')
......
......@@ -12,6 +12,7 @@ import androidx.multidex.MultiDexApplication;
import com.hjq.toast.ToastUtils;
import com.mints.goodnews.common.Constant;
import com.mints.goodnews.manager.CsjGroMoreManager;
import com.mints.goodnews.manager.KsManager;
import com.mints.goodnews.manager.LiebaoManager;
import com.mints.goodnews.manager.MhManager;
......@@ -115,6 +116,9 @@ public class MintsApplication extends MultiDexApplication {
// 移动安全联盟 oaid
initMiitHelper();
// GroMore
CsjGroMoreManager.INSTANCE.init(this);
// 优量汇
YlhAdManager.INSTANCE.initYlhAd(this);
......
package com.mints.goodnews.ad.express
import android.widget.FrameLayout
import com.mingshu.goldcow.ad.express.GroMoreCarrierExpressManager
import com.mints.goodnews.common.AppConfig
import com.mints.goodnews.manager.TtCsjAdManager
/**
* 能用信息流加载
*/
object ExpressManager {
fun loadExpress() {
if (AppConfig.groMoreVideoAdCount > 0) {
GroMoreCarrierExpressManager.instance.loadADFrameLayout()
} else {
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
......@@ -13,8 +13,10 @@ import android.widget.TextView
import com.bumptech.glide.Glide
import com.kwad.sdk.api.*
import com.kwad.sdk.api.KsNativeAd.VideoPlayListener
import com.mingshu.goldcow.ad.express.KSADLoadSuccessListener
import com.mints.goodnews.MintsApplication
import com.mints.goodnews.R
import com.mints.goodnews.common.AppConfig
import com.mints.goodnews.manager.KsManager
import com.mints.goodnews.utils.LogUtil
import java.util.*
......@@ -42,6 +44,7 @@ object KsPreLoadExpressManager {
KsAdSDK.getLoadManager().loadNativeAd(scene, object : KsLoadManager.NativeAdListener {
override fun onError(p0: Int, p1: String?) {
LogUtil.d("$p0 -> $p1")
AppConfig.isPreExpressAwardActivity=false
}
override fun onNativeAdLoad(p0: MutableList<KsNativeAd>?) {
......@@ -51,6 +54,7 @@ object KsPreLoadExpressManager {
})
} catch (e: Exception) {
AppConfig.isPreExpressAwardActivity=false
e.printStackTrace()
}
}
......@@ -184,7 +188,7 @@ object KsPreLoadExpressManager {
object : KsNativeAd.AdInteractionListener {
override fun onAdClicked(view: View, ad: KsNativeAd) {
if (ad != null) {
// Toast.makeText(MintsApplication.getContext(), "广告" + ad.appName + "被点击", Toast.LENGTH_SHORT).show()
// Toast.makeText(WenshuApplication.getContext(), "广告" + ad.appName + "被点击", Toast.LENGTH_SHORT).show()
}
}
......
package com.mints.goodnews.ad.express
import android.annotation.SuppressLint
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import com.mingshu.goldcow.ad.express.GroMoreExpressManager
import com.mingshu.goldcow.ad.express.YlhPreLoadExpressManager
import com.mints.goodnews.MintsApplication
import com.mints.goodnews.common.AppConfig
import com.mints.goodnews.common.Constant
import com.mints.goodnews.mvp.model.WeightBean
import com.mints.goodnews.utils.LogUtil
import com.qq.e.ads.nativ.NativeExpressADView
import java.util.*
/**
* 预加载信息流管理类
*/
object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener, KSADLoadSuccessListener {
object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener, KSADLoadSuccessListener, GMADLoadSuccessListener {
private val TAG = PreLoadExpressManager::class.java.simpleName
......@@ -28,18 +31,21 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
private var csjWeight = 0
private var ylhWeight = 0
private var ksWeight = 0
private var gmWeight = 0
init {
mAdFrameLayout = FrameLayout(MintsApplication.getContext())
YlhPreLoadExpressManager.setListener(this)
TTPreLoadExpressManager.getInstance().setListener(this)
KsPreLoadExpressManager.setListener(this)
GroMoreExpressManager.instance.setListener(this)
}
fun init(csjWeight: Int, ylhWeight: Int, ksWeight: Int) {
PreLoadExpressManager.csjWeight = csjWeight
PreLoadExpressManager.ylhWeight = ylhWeight
PreLoadExpressManager.ksWeight = ksWeight
fun init(csjWeight: Int, ylhWeight: Int, ksWeight: Int, gmWeight: Int) {
this.csjWeight = csjWeight
this.ylhWeight = ylhWeight
this.ksWeight = ksWeight
this.gmWeight = gmWeight
}
fun loadADFrameLayout() {
......@@ -61,6 +67,7 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
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()
else -> {
TTPreLoadExpressManager.getInstance().loadTtFrameLayout(mAdFrameLayout)
}
......@@ -89,6 +96,11 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
weight += ksWeight
LogUtil.d(TAG, "EXPRESS权重值:ksWeight:$ksWeight")
}
if (gmWeight > 0) {
weightList.add(WeightBean(gmWeight, Constant.GM_EXPRESS_AD))
weight += gmWeight
LogUtil.d(TAG, "EXPRESS权重值:gmWeight:$gmWeight")
}
// 权重随机
if (weightList.size > 0 && weight > 0) {
......@@ -121,17 +133,23 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
KsPreLoadExpressManager.onDestroy()
}
override fun onTTAdLoadSuc(adFrameLayout: FrameLayout?) {
override fun onTTAdLoadSuc(view: FrameLayout?) {
// if (currentIndex == 1) {
// mAdFrameLayout = adFrameLayout
// }
mAdFrameLayout = adFrameLayout
if(view!=null){
AppConfig.isPreExpressAwardActivity=true
}
mAdFrameLayout = view
}
override fun onYlhAdLoadSuc(view: NativeExpressADView?) {
// if (currentIndex == 2) {
// mAdFrameLayout?.addView(view)
// }
if(view!=null){
AppConfig.isPreExpressAwardActivity=true
}
mAdFrameLayout?.addView(view)
}
......@@ -139,6 +157,19 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
// if (currentIndex == 3) {
// mAdFrameLayout?.addView(view)
// }
if(view!=null){
AppConfig.isPreExpressAwardActivity=true
}
mAdFrameLayout?.addView(view)
}
override fun onGMAdLoadSuc(view: View?) {
// if (currentIndex == 3) {
// mAdFrameLayout?.addView(view)
// }
if(view!=null){
AppConfig.isPreExpressAwardActivity=true
}
mAdFrameLayout?.addView(view)
}
......@@ -154,4 +185,8 @@ interface YLHADLoadSuccessListener {
interface KSADLoadSuccessListener {
fun onKSAdLoadSuc(ksNativeAd: View?)
}
interface GMADLoadSuccessListener {
fun onGMAdLoadSuc(ttNativeAd: View?)
}
\ No newline at end of file
......@@ -104,9 +104,9 @@ public class TTPreLoadCarrierExpressManager {
* 预加载 信息流
*/
public void loadTtFrameLayout(String codeId) {
// init();
init();
// ToastUtil.showLong(MintsApplication.getContext(), "通用信息流:" + codeId);
// ToastUtil.showLong(WenshuApplication.getContext(), "通用信息流:" + codeId);
if (mWorkHandler != null) {
Message msg = Message.obtain();
......
......@@ -4,6 +4,7 @@ import android.util.DisplayMetrics;
import android.widget.FrameLayout;
import com.mints.goodnews.MintsApplication;
import com.mints.goodnews.ad.express.TTADLoadSuccessListener;import com.mints.goodnews.common.AppConfig;
import com.mints.goodnews.manager.TTNativeExpressManager;
import com.mints.goodnews.manager.TtCsjAdManager;
......@@ -42,8 +43,7 @@ public class TTPreLoadExpressManager {
DisplayMetrics displayMetrics = MintsApplication.getContext().getResources().getDisplayMetrics();
float density = displayMetrics.density;
float pxWidth = displayMetrics.widthPixels - (50 * density + 0.5f);
float dpWidth = pxWidth / density + 0.5f;
return dpWidth;
return pxWidth / density + 0.5f;
}
/**
......@@ -53,8 +53,6 @@ public class TTPreLoadExpressManager {
init();
try {
ttNativeExpressManager.getNativeExpressInit(TtCsjAdManager.TT_AD_NATIVEEXPRESS_AWARD, adFrameLayout, getViewWidth(), 0);
ttNativeExpressManager.setTTNativeExpressManagerListener(view -> {
try {
......@@ -64,6 +62,7 @@ public class TTPreLoadExpressManager {
}
}
} catch (Exception e) {
AppConfig.isPreExpressAwardActivity=false;
e.printStackTrace();
}
});
......
......@@ -7,6 +7,7 @@ import com.mints.goodnews.MintsApplication;
import com.mints.goodnews.common.AppConfig;
import com.mints.goodnews.manager.TTNativeExpressManager;
import com.mints.goodnews.manager.TtCsjAdManager;
import com.mints.goodnews.utils.LogUtil;
/**
......@@ -27,7 +28,7 @@ public class TTPreLoadExpressXmlyManager {
}
private TTPreLoadExpressXmlyManager() {
// init();
init();
}
private void init() {
......@@ -64,18 +65,18 @@ public class TTPreLoadExpressXmlyManager {
if (view == null) {
ttFrameLayout = null;
AppConfig.xmlyAdFlag = false;
// LogUtil.d("TTPreLoadExpressXmlyManager",AppConfig.xmlyAdFlag+"");
LogUtil.d("TTPreLoadExpressXmlyManager",AppConfig.xmlyAdFlag+"");
} else {
try {
ttFrameLayout = view;
AppConfig.xmlyAdFlag = true;
// LogUtil.d("TTPreLoadExpressXmlyManager",AppConfig.xmlyAdFlag+"");
LogUtil.d("TTPreLoadExpressXmlyManager",AppConfig.xmlyAdFlag+"");
} catch (Exception e) {
e.printStackTrace();
ttFrameLayout = null;
AppConfig.xmlyAdFlag = false;
// LogUtil.d("TTPreLoadExpressXmlyManager",AppConfig.xmlyAdFlag+"");
LogUtil.d("TTPreLoadExpressXmlyManager",AppConfig.xmlyAdFlag+"");
}
}
});
......
package com.mints.goodnews.ad.express
import com.mints.goodnews.BuildConfig
import com.qq.e.ads.nativ.express2.*
import com.qq.e.comm.util.AdError
import com.mints.goodnews.MintsApplication
import com.mints.goodnews.common.AppConfig
import com.mints.goodnews.manager.YlhAdManager
import com.mints.goodnews.utils.LogUtil
import com.qq.e.ads.nativ.ADSize
import com.qq.e.ads.nativ.NativeExpressAD
import com.qq.e.ads.nativ.NativeExpressADView
import com.qq.e.comm.util.AdError
/**
* 优量汇预加载信息流
......@@ -27,10 +29,7 @@ object YlhPreLoadExpressManager {
try {
nativeExpressAD = NativeExpressAD(MintsApplication.getContext(), ADSize(ADSize.FULL_WIDTH, ADSize.AUTO_HEIGHT), YlhAdManager.YLH_AD_NATIVEEXPRESS_AWARD, object : NativeExpressAD.NativeExpressADListener {
override fun onNoAD(p0: AdError?) {
if (BuildConfig.DEBUG) {
LogUtil.d("通用奖励 ylh:TTNativeExpressManager", "onError ${p0?.errorCode} ${p0?.errorMsg}")
}
AppConfig.isPreExpressAwardActivity=false
}
override fun onADClicked(p0: NativeExpressADView?) {
......@@ -64,6 +63,7 @@ object YlhPreLoadExpressManager {
}
override fun onRenderFail(p0: NativeExpressADView?) {
AppConfig.isPreExpressAwardActivity=false
}
override fun onRenderSuccess(p0: NativeExpressADView?) {
......@@ -74,6 +74,7 @@ object YlhPreLoadExpressManager {
} catch (e: Exception) {
e.printStackTrace()
AppConfig.isPreExpressAwardActivity=false
}
}
......
......@@ -97,6 +97,11 @@ public class AppConfig {
*/
public static int owVideoAdCount = 0;
/**
* gromore 剩余广告播放数
*/
public static int groMoreVideoAdCount = 0;
/**
* 高额任务和超级翻倍 csjVideo 剩余广告播放数
*/
......@@ -112,6 +117,11 @@ public class AppConfig {
*/
public static int ksHighVideoAdCount = 0;
/**
* 高额任务和超级翻倍 groVideo 剩余广告播放数
*/
public static int groHighVideoAdCount = 0;
/**
* 高额试玩任务标识
*/
......@@ -151,4 +161,22 @@ public class AppConfig {
* 激励视频是否休眠 false-不休眠 提示:加载失败,请稍后重试。
*/
public static boolean isVideoSleep = false;
// 奖励弹窗信息流是否加载成功
public static volatile boolean isPreExpressAwardActivity = false;
// 插屏是否展示
public static boolean isShowInsertScreen = false;
// 大转盘领取奖励后 是否弹出插屏
public static boolean isPopInsertForTurn = false;
// 是否显示蒙层
public static boolean showTurnTableMantle = false;
// 是否展示300元界面
public static boolean isShowRedBoxPage = true;
public static int visitCoin = 1500;
// gromoreId
public static String gromoreId = "";
public static int awardCoin = 0;
}
......@@ -150,6 +150,7 @@ object Constant {
const val AD_SOURCE_SH = "CORAL" //珊瑚天卓
const val AD_SOURCE_KS = "KS" //快手
const val AD_SOURCE_OW = "OW" //OneWay
const val AD_SOURCE_GROMORE = "GROMORE"
// 调用事件 0 成功 1失败 2点击 3-有效展示 4-去重
const val EVENT_TYPE_ZERO = "0"
......@@ -172,11 +173,13 @@ object Constant {
const val SH_VEDIO_AD = "SH_VEDIO_AD"
const val KS_VEDIO_AD = "KS_VEDIO_AD"
const val OW_VEDIO_AD = "OW_VEDIO_AD"
const val GROMORE_VEDIO_AD = "GROMORE_VEDIO_AD"
// 信息流广告类型
const val CSJ_EXPRESS_AD = "CSJ_EXPRESS_AD"
const val YLH_EXPRESS_AD = "YLH_EXPRESS_AD"
const val KS_EXPRESS_AD = "KS_EXPRESS_AD"
const val GM_EXPRESS_AD = "GM_EXPRESS_AD"
// 游戏类型
const val EVENT_TYPE_CLICK = "CLICK"
......@@ -239,4 +242,10 @@ object Constant {
// 外网IP地址
const val OUT_NET_IP = "out_net_ip"
//0-开屏,1-信息流,2-激励视频,3-插屏
const val GRO_MORE_ADTYPE0 = "0"
const val GRO_MORE_ADTYPE1 = "1"
const val GRO_MORE_ADTYPE2 = "2"
const val GRO_MORE_ADTYPE3 = "3"
}
package com.mints.goodnews.manager
import android.text.TextUtils
import com.mints.goodnews.MintsApplication
import com.mints.goodnews.mvp.model.GroAdcodeBean
/**
* 穿山甲GroMore
*/
object CsjGroMoreManager {
var AD_UNIT_EXPRESS_ID = "" // 信息流
var AD_UNIT_SPLASH_ID = "" // 开屏
var AD_UNIT_VIDEO_ID = "" // 激励视频
var AD_UNIT_INTERSTITIAL_ID = "" // 插屏
fun init(application: MintsApplication) {
TTGroMoreAdManagerHolder.init(application)
}
/**
* 更新代码位
*/
fun updataIdByChannel(idBean: GroAdcodeBean?) {
// 渠道对象不为空
if (idBean != null) {
if (!TextUtils.isEmpty(idBean.groExpress)) {
AD_UNIT_EXPRESS_ID = idBean.groExpress
}
if (!TextUtils.isEmpty(idBean.groSplash)) {
AD_UNIT_SPLASH_ID = idBean.groSplash
}
if (!TextUtils.isEmpty(idBean.groVideo)) {
AD_UNIT_VIDEO_ID = idBean.groVideo
}
if (!TextUtils.isEmpty(idBean.groInterstitial)) {
AD_UNIT_INTERSTITIAL_ID = idBean.groInterstitial
}
}
}
}
\ No newline at end of file
package com.mints.goodnews.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.goodnews.MintsApplication;
import com.mints.goodnews.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 = "5171145";
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;
}
}
......@@ -139,5 +139,21 @@ public class TrackManager {
}
}
public void cmtGroMoreInfo(HashMap<String, Object> vo) {
if (trackPresenter != null && !TextUtils.isEmpty(UserManager.getInstance().getUserID())) {
trackPresenter.cmtGroMoreInfo(vo);
}
}
public void reporGromeEcpm(HashMap<String, Object> vo) {
if (trackPresenter != null && !TextUtils.isEmpty(UserManager.getInstance().getUserID())) {
trackPresenter.reporGromeEcpm(vo);
}
}
public void reportGromoreAdClick(HashMap<String, Object> vo) {
if (trackPresenter != null && !TextUtils.isEmpty(UserManager.getInstance().getUserID())) {
trackPresenter.reportGromoreAdClick(vo);
}
}
}
......@@ -17,7 +17,14 @@ object UserWeight {
private val videoAdingManager by lazy { VideoAdingManager.getInstance(ForegroundOrBackground.getApp_activity()) }
fun initAdWeight(data: UserTaskMsgBean) {
AppConfig.isVideoSleep=data.vedioRules.isVedioSleep
AppConfig.isVideoSleep = data.vedioRules.isVedioSleep
var groMoreRate = 0
var groMoreCount = 0
if (data.vedioRules.gromorE_VEDIO != null) {
groMoreRate = data.vedioRules.gromorE_VEDIO.rate
groMoreCount = data.vedioRules.gromorE_VEDIO.surplus
}
videoAdingManager.initAdWeight(data.vedioRules.csJ_VEDIO.rate,
data.vedioRules.ylH_VEDIO.rate,
......@@ -26,31 +33,39 @@ object UserWeight {
data.vedioRules.corAl_VIDEO.rate,
data.vedioRules.csjfulL_VEDIO.rate,
data.vedioRules.kS_VEDIO.rate,
data.vedioRules.oW_VEDIO.rate)
groMoreRate,
0
)
LogUtil.d(TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} " +
"ylhWeight:${data.vedioRules.ylH_VEDIO.rate} " +
"sdhzWeight:${data.vedioRules.sdhZ_VEDIO.rate} " +
"csjFullWeight:${data.vedioRules.csjfulL_VEDIO.rate} " +
"shWeight:${data.vedioRules.corAl_VIDEO.rate} " +
"flWeight:${data.vedioRules.fL_VEDIO.rate} " +
"ksWeight:${data.vedioRules.kS_VEDIO.rate} "+
"owWeight:${data.vedioRules.oW_VEDIO.rate} ")
"flWeight:${data.vedioRules.fL_VEDIO.rate} " +
"groMoreWeight:${groMoreRate} " +
"owWeight:${data.vedioRules.oW_VEDIO.rate} " +
"ksWeight:${data.vedioRules.kS_VEDIO.rate}"
)
// 广告视频数
AppConfig.csjVideoAdCount = data.vedioRules.csJ_VEDIO.surplus
AppConfig.ylhAdCount = data.vedioRules.ylH_VEDIO.surplus
AppConfig.wnVideoAdCount = data.vedioRules.sdhZ_VEDIO.surplus
AppConfig.flVideoAdCount = data.vedioRules.fL_VEDIO.surplus
AppConfig.csjFullVedioAdCount = data.vedioRules.csjfulL_VEDIO.surplus
AppConfig.shVideoAdCount = data.vedioRules.corAl_VIDEO.surplus
AppConfig.ksVideoAdCount = data.vedioRules.kS_VEDIO.surplus
AppConfig.owVideoAdCount = data.vedioRules.oW_VEDIO.surplus
AppConfig.csjFullVedioAdCount = data.vedioRules.csjfulL_VEDIO.surplus
AppConfig.groMoreVideoAdCount = groMoreCount
LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVideoAdCount} " +
"ylhCount:${AppConfig.ylhAdCount} " +
"sdhzCount:${AppConfig.wnVideoAdCount} " +
"csjFullCount:${AppConfig.csjFullVedioAdCount} " +
"shCount:${AppConfig.shVideoAdCount} " +
"flCount:${AppConfig.flVideoAdCount} " +
"ksCount:${AppConfig.ksVideoAdCount} "+
"owCount:${AppConfig.owVideoAdCount} ")
"groMoreCount:${AppConfig.groMoreVideoAdCount} " +
"owCount:${AppConfig.owVideoAdCount} " +
"ksCount:${AppConfig.ksVideoAdCount}"
)
}
}
\ No newline at end of file
......@@ -19,6 +19,7 @@ public class DrawcashBean implements Serializable {
private boolean openJDCash = true;
private String JDUrl = null;
public String getJDUrl() {
return JDUrl;
}
......@@ -86,21 +87,23 @@ public class DrawcashBean implements Serializable {
private int YLH_VEDIO;
private int FL_VEDIO;
private int CORAL_VEDIO;
private int KS_VEDIO;
private int RTA_VEDIO;
private int GROMORE_VEDIO;
private int OW_VEDIO;
public int getKS_VEDIO() {
return KS_VEDIO;
public int getRTA_VEDIO() {
return RTA_VEDIO;
}
public void setKS_VEDIO(int KS_VEDIO) {
this.KS_VEDIO = KS_VEDIO;
public void setRTA_VEDIO(int RTA_VEDIO) {
this.RTA_VEDIO = RTA_VEDIO;
}
private int KS_VEDIO;
public int getCORAL_VEDIO() {
return CORAL_VEDIO;
}
public int getSDHZ_VEDIO() {
return SDHZ_VEDIO;
}
......@@ -121,6 +124,13 @@ public class DrawcashBean implements Serializable {
return FL_VEDIO;
}
public int getKS_VEDIO() {
return KS_VEDIO;
}
public int getGROMORE_VEDIO() {
return GROMORE_VEDIO;
}
public int getOW_VEDIO() {
return OW_VEDIO;
}
......
package com.mints.goodnews.mvp.model;
import java.io.Serializable;
/**
* 用户渠道对应代码位
*/
public class GroAdcodeBean implements Serializable {
private String groExpress;
private String groSplash;
private String groVideo;
private String groInterstitial;
public String getGroExpress() {
return groExpress;
}
public String getGroSplash() {
return groSplash;
}
public String getGroVideo() {
return groVideo;
}
public String getGroInterstitial() {
return groInterstitial;
}
}
......@@ -12,6 +12,7 @@ public class UserTaskMsgBean implements Serializable {
private UserRiskAppsBean userRiskApps;
private AdcodeBean adcode_v1 = null;
private FlowAdRulesBean flowAdRules;
private GroAdcodeBean gromoreAdcodes = null;
private HighRatePlanBean highRatePlan;
private String ip;
......@@ -19,6 +20,16 @@ public class UserTaskMsgBean implements Serializable {
private boolean needReportClickAdEvent;
public boolean isShowWechatTips() {
return showWechatTips;
}
public void setShowWechatTips(boolean showWechatTips) {
this.showWechatTips = showWechatTips;
}
private boolean showWechatTips;
public boolean isNeedReportClickAdEvent() {
return needReportClickAdEvent;
}
......@@ -138,6 +149,7 @@ public class UserTaskMsgBean implements Serializable {
private int YLH;
private int KS;
private int CSJ;
private int GROMORE;
public int getYLH() {
return YLH;
......@@ -150,5 +162,13 @@ public class UserTaskMsgBean implements Serializable {
public int getCSJ() {
return CSJ;
}
public int getGROMORE() {
return GROMORE;
}
}
public GroAdcodeBean getGromoreAdcodes() {
return gromoreAdcodes;
}
}
......@@ -10,20 +10,14 @@ public class VedioRulesBean implements Serializable {
private FLVedioBean FL_VEDIO;
private CsjfullVedioBean CSJFULL_VEDIO;
private CORALVedioBean CORAL_VEDIO;
private KSVedioBean KS_VEDIO;
private RTAVedioBean RTA_VEDIO;
private GROMOREVedioBean GROMORE_VEDIO;
private OWVedioBean OW_VEDIO;
public KsVedioBean getKS_VEDIO() {
return KS_VEDIO;
}
public void setKS_VEDIO(KsVedioBean KS_VEDIO) {
this.KS_VEDIO = KS_VEDIO;
}
private KsVedioBean KS_VEDIO;
private boolean flVideoFlag;
private boolean vedioSleep;
public class CsjVedioBean implements Serializable {
private int surplus;//剩余可看视频数
private int rate;//权重
......@@ -89,7 +83,20 @@ public class VedioRulesBean implements Serializable {
}
}
public class OWVedioBean implements Serializable {
public class KSVedioBean implements Serializable {
private int surplus;
private int rate;
public int getSurplus() {
return surplus;
}
public int getRate() {
return rate;
}
}
public class RTAVedioBean implements Serializable {
private int surplus;
private int rate;
......@@ -116,7 +123,7 @@ public class VedioRulesBean implements Serializable {
}
public class KsVedioBean implements Serializable {
public class GROMOREVedioBean implements Serializable {
private int surplus;
private int rate;
......@@ -150,14 +157,42 @@ public class VedioRulesBean implements Serializable {
return CORAL_VEDIO;
}
public CsjfullVedioBean getCSJFULL_VEDIO() {
return CSJFULL_VEDIO;
public RTAVedioBean getRTA_VEDIO() {
return RTA_VEDIO;
}
public GROMOREVedioBean getGROMORE_VEDIO() {
return GROMORE_VEDIO;
}
public OWVedioBean getOW_VEDIO() {
return OW_VEDIO;
}
public class OWVedioBean implements Serializable {
private int surplus;
private int rate;
public int getSurplus() {
return surplus;
}
public int getRate() {
return rate;
}
}
public void setRTA_VEDIO(RTAVedioBean RTA_VEDIO) {
this.RTA_VEDIO = RTA_VEDIO;
}
public KSVedioBean getKS_VEDIO() {
return KS_VEDIO;
}
public CsjfullVedioBean getCSJFULL_VEDIO() {
return CSJFULL_VEDIO;
}
public boolean isFlVideoFlag() {
return flVideoFlag;
}
......
......@@ -377,4 +377,71 @@ public class TrackPresenter extends BaseTrackPresenter {
}
});
}
public void cmtGroMoreInfo(HashMap<String, Object> vo) {
AppHttpManager.getInstance(loanApplication)
.call(loanService.reportAdIncome(vo),
new BaseSubscriber<BaseResponse<Object>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(BaseResponse<Object> baseResponse) {
}
});
}
public void reportGromoreAdClick(HashMap<String, Object> vo) {
AppHttpManager.getInstance(loanApplication)
.call(loanService.reportGromoreAdClick(vo),
new BaseSubscriber<BaseResponse<Object>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(BaseResponse<Object> baseResponse) {
}
});
}
public void reporGromeEcpm(HashMap<String, Object> vo) {
AppHttpManager.getInstance(loanApplication)
.call(loanService.reporGromeEcpm(vo),
new BaseSubscriber<BaseResponse<JsonObject>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(BaseResponse<JsonObject> baseResponse) {
try {
if (baseResponse.getStatus() == 200) {
JsonObject data = baseResponse.getData();
if (data != null) {
AppConfig.gromoreId = data.get("ecpmId").getAsString();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}
......@@ -647,6 +647,30 @@ public interface LoanService {
@POST("api/vedioPlans")
Observable<BaseResponse<UserTaskMsgBean>> vedioPlans();
/**
* groMore数据提交
*
* @return
*/
@POST("api/reportAdIncome")
Observable<BaseResponse<Object>> reportAdIncome(@Body Map<String, Object> vo);
/**
* groMore点击广告
*
* @return
*/
@POST("api/reporGromeClick")
Observable<BaseResponse<Object>> reportGromoreAdClick(@Body Map<String, Object> vo);
/**
* groMore激励视频展示广告提交数据
*
* @return
*/
@POST("api/reporGromeEcpm")
Observable<BaseResponse<JsonObject>> reporGromeEcpm(@Body Map<String, Object> vo);
/**
* 默认http工厂
*/
......
......@@ -298,26 +298,22 @@ class DrawcashActivity : BaseActivity(),
* 设置视频权重
*/
private fun initAdWeight(data: DrawcashBean.VedioRules) {
vedioAdingManager.initAdWeight(data.csJ_VEDIO,
data.ylH_VEDIO,
data.sdhZ_VEDIO,
data.fL_VEDIO,
data.coraL_VEDIO,
data.csjfulL_VEDIO,
data.kS_VEDIO,
data.oW_VEDIO
vedioAdingManager.initAdWeight(data.csJ_VEDIO,data.ylH_VEDIO,data.sdhZ_VEDIO,
data.fL_VEDIO,data.coraL_VEDIO,data.csjfulL_VEDIO,data.kS_VEDIO,data.gromorE_VEDIO,data.oW_VEDIO
)
LogUtil.d(TAG, "提现权重值:csjWeight:${data.csJ_VEDIO} " +
"ylhWeight:${data.ylH_VEDIO} " +
"sdhzWeight:${data.sdhZ_VEDIO} " +
"csjFullWeight:${data.csjfulL_VEDIO} " +
"shWeight:${data.coraL_VEDIO} " +
"flWeight:${data.fL_VEDIO} " +
"ksWeight:${data.kS_VEDIO} " +
"owWeight:${data.oW_VEDIO} ")
"flWeight:${data.fL_VEDIO} " +
"groMoreWeight:${data.gromorE_VEDIO} " +
"owWeight:${data.oW_VEDIO} " +
"ksWeight:${data.kS_VEDIO}"
)
// 广告视频数
AppConfig.csjVideoAdCount = 10
AppConfig.ylhAdCount = 10
AppConfig.csjVideoAdCount = 5
AppConfig.ylhAdCount = 5
}
/**
......
......@@ -3,6 +3,7 @@ package com.mints.goodnews.ui.activitys
import android.os.Bundle
import android.view.View
import com.mints.goodnews.R
import com.mints.goodnews.ad.express.ExpressManager
import com.mints.goodnews.common.Constant
import com.mints.goodnews.ad.express.TTPreLoadCarrierExpressManager
import com.mints.goodnews.manager.TtCsjAdManager
......@@ -88,7 +89,8 @@ class FoodSubsidyActivity : BaseActivity(), View.OnClickListener, FoodSubsidyVie
}
// 预加载信息流
TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_EAT)
// TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_EAT)
ExpressManager.loadExpress()
}
......@@ -97,11 +99,9 @@ class FoodSubsidyActivity : BaseActivity(), View.OnClickListener, FoodSubsidyVie
*/
private fun initExpress() {
try {
if (TTPreLoadCarrierExpressManager.getInstance().ttFrameLayout != null) {
if (flSubsidykAd != null) {
flSubsidykAd.removeAllViews()
flSubsidykAd.addView(TTPreLoadCarrierExpressManager.getInstance().ttFrameLayout)
}
if (flSubsidykAd != null) {
flSubsidykAd.removeAllViews()
flSubsidykAd.addView(ExpressManager.getExpressFrameLayout())
}
} catch (e: Exception) {
e.printStackTrace()
......
......@@ -3,6 +3,7 @@ package com.mints.goodnews.ui.activitys
import android.os.Bundle
import android.view.View
import com.mints.goodnews.R
import com.mints.goodnews.ad.express.ExpressManager
import com.mints.goodnews.common.Constant
import com.mints.goodnews.ad.express.TTPreLoadCarrierExpressManager
import com.mints.goodnews.manager.TtCsjAdManager
......@@ -99,7 +100,8 @@ class WalkActivity : BaseActivity(), View.OnClickListener, WalkView, StepView.St
}
// 预加载信息流
TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_WALK)
// TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_WALK)
ExpressManager.loadExpress()
}
/**
......@@ -107,11 +109,9 @@ class WalkActivity : BaseActivity(), View.OnClickListener, WalkView, StepView.St
*/
private fun initExpress() {
try {
if (TTPreLoadCarrierExpressManager.getInstance().ttFrameLayout != null) {
if (flWalkAd != null) {
flWalkAd.removeAllViews()
flWalkAd.addView(TTPreLoadCarrierExpressManager.getInstance().ttFrameLayout)
}
if (flWalkAd != null) {
flWalkAd.removeAllViews()
flWalkAd.addView(ExpressManager.getExpressFrameLayout())
}
} catch (e: Exception) {
e.printStackTrace()
......
......@@ -3,6 +3,7 @@ package com.mints.goodnews.ui.activitys
import android.os.Bundle
import android.view.View
import com.mints.goodnews.R
import com.mints.goodnews.ad.express.ExpressManager
import com.mints.goodnews.common.Constant
import com.mints.goodnews.ad.express.TTPreLoadCarrierExpressManager
import com.mints.goodnews.manager.TtCsjAdManager
......@@ -69,7 +70,8 @@ class WaterActivity : BaseActivity(), View.OnClickListener, WaterView.WaterViewL
}
// 预加载信息流
TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_WATER)
// TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_WATER)
ExpressManager.loadExpress()
}
override fun clickForWaterSuc(waterCoin: Int) {
......@@ -111,11 +113,9 @@ class WaterActivity : BaseActivity(), View.OnClickListener, WaterView.WaterViewL
*/
private fun initExpress() {
try {
if (TTPreLoadCarrierExpressManager.getInstance().ttFrameLayout != null) {
if (flWaterAd != null) {
flWaterAd.removeAllViews()
flWaterAd.addView(TTPreLoadCarrierExpressManager.getInstance().ttFrameLayout)
}
if (flWaterAd != null) {
flWaterAd.removeAllViews()
flWaterAd.addView(ExpressManager.getExpressFrameLayout())
}
} catch (e: Exception) {
e.printStackTrace()
......
......@@ -163,6 +163,8 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener {
// 设置视频权重
UserWeight.initAdWeight(data)
CsjGroMoreManager.updataIdByChannel(data.gromoreAdcodes)
initExpress(data.flowAdRules)
......
......@@ -16,6 +16,7 @@ import com.component.dly.xzzq_ywsdk.YwSDK_WebActivity.Companion.open
import com.mints.goodnews.BuildConfig
import com.mints.goodnews.R
import com.mints.goodnews.ad.banner.BannerManager
import com.mints.goodnews.ad.express.ExpressManager
import com.mints.goodnews.ad.express.PreLoadExpressManager
import com.mints.goodnews.ad.express.TTPreLoadCarrierExpressManager
import com.mints.goodnews.ad.express.TTPreLoadExpressXmlyManager
......@@ -323,6 +324,9 @@ class MyFragment : BaseFragment(),
AppConfig.user_channel_ad = data.adcode.key
}
CsjGroMoreManager.updataIdByChannel(data.gromoreAdcodes)
// 是否上报点击广告
AppConfig.needReportClickAdEvent = data.isNeedReportClickAdEvent
......@@ -909,23 +913,23 @@ class MyFragment : BaseFragment(),
// 自有界面
when (hotBean.toUrl) {
Constant.HOT_ACTIVITY_WATER -> {
TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_WATER)
ExpressManager.loadExpress()
readyGo(WaterActivity::class.java)
}
Constant.HOT_ACTIVITY_WALK -> {
TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_WALK)
ExpressManager.loadExpress()
readyGo(WalkActivity::class.java)
}
Constant.HOT_ACTIVITY_CARD -> {
readyGo(EraseActivity::class.java)
}
Constant.HOT_ACTIVITY_LIEBAO -> {
readyGo(LiebaoGameActivity::class.java)
}
Constant.HOT_ACTIVITY_MORNINGCLOCK -> {
TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_MORNINGCLOCK)
ExpressManager.loadExpress()
readyGo(MorningClockActivity::class.java)
}
Constant.HOT_ACTIVITY_LIEBAO -> {
readyGo(LiebaoGameActivity::class.java)
}
Constant.HOT_ACTIVITY_BXM -> {
// 消费变现猫事件
if (!userManager.userIsLogin()) {
......
......@@ -15,6 +15,7 @@ import com.daimajia.androidanimations.library.YoYo
import com.mints.goodnews.R
import com.mints.goodnews.common.AppConfig
import com.mints.goodnews.common.Constant
import com.mints.goodnews.manager.CsjGroMoreManager
import com.mints.goodnews.manager.TrackManager
import com.mints.goodnews.manager.UserManager
import com.mints.goodnews.mvp.model.ClickTurnBean
......
This diff is collapsed.
package com.mints.goodnews.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;
}
}
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
>
<corners android:radius="6dp" />
<stroke android:color="#3C93CD" android:width="1dp"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
>
<corners android:radius="6dp" />
<stroke android:color="#f85959" android:width="1dp"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/ad_title_creative_btn_layout"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:gravity="center"
android:visibility="gone"
android:orientation="horizontal">
<Button
android:id="@+id/btn_listitem_stop"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_marginEnd="20dp"
android:layout_marginRight="20dp"
android:background="@drawable/btn_bg_blue"
android:textColor="#3C93CD"
android:text="暂停下载"
android:visibility="gone" />
<Button
android:id="@+id/btn_listitem_remove"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:background="@drawable/btn_bg_red"
android:textColor="#f85959"
android:text="删除下载"
android:visibility="gone" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<com.bytedance.msdk.api.format.TTNativeAdView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="HardcodedText">
<!-- icon+广告源+关闭按钮 layout -->
<include
android:id="@+id/icon_source_layout"
layout="@layout/listitem_ad_icon_source_layout"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_marginRight="10dp"
android:paddingEnd="10dp"
android:paddingRight="10dp" />
<TextView
android:id="@+id/tv_listitem_ad_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/icon_source_layout"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_marginRight="10dp"
android:ellipsize="end"
android:lineSpacingMultiplier="1"
android:maxLines="2"
android:singleLine="false"
android:text="劳力士服务中心,清洗保养,更换配件,9秒费用查询"
android:textColor="@android:color/black"
android:textSize="18sp" />
<!-- -->
<LinearLayout
android:id="@+id/layout_image_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/tv_listitem_ad_desc"
android:layout_centerHorizontal="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_listitem_image1"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:scaleType="centerCrop" />
<ImageView
android:id="@+id/iv_listitem_image2"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:scaleType="centerCrop" />
<ImageView
android:id="@+id/iv_listitem_image3"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_weight="1"
android:scaleType="centerCrop" />
</LinearLayout>
<!-- title+creativeBtn layout -->
<include
android:id="@+id/ad_title_creative_btn_layout"
layout="@layout/listitem_ad_title_creative_btn_layout"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_below="@+id/layout_image_group"
android:layout_marginLeft="10dp"
android:layout_marginTop="4dp"
android:layout_marginRight="10dp" />
<!--==== 测试下载状态控制功能 begin ========-->
<include
layout="@layout/listitem_ad_download_btn_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/ad_title_creative_btn_layout"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:gravity="center"
android:orientation="horizontal" />
<!--==== 测试下载状态控制功能 end ========-->
</RelativeLayout>
</com.bytedance.msdk.api.format.TTNativeAdView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<com.bytedance.msdk.api.format.TTNativeAdView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="HardcodedText">
<include
android:id="@+id/icon_source_layout"
layout="@layout/listitem_ad_icon_source_layout" />
<TextView
android:id="@+id/tv_listitem_ad_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/icon_source_layout"
android:layout_marginLeft="10dp"
android:layout_marginTop="3dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="3dp"
android:ellipsize="end"
android:lineSpacingMultiplier="1"
android:maxLines="2"
android:singleLine="false"
android:text="劳力士服务中心,清洗保养,更换配件,9秒费用查询"
android:textColor="@android:color/black"
android:textSize="18sp" />
<ImageView
android:id="@+id/iv_listitem_image"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_below="@id/tv_listitem_ad_desc"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@drawable/tt_ad_cover_btn_begin_bg"
android:scaleType="centerCrop" />
<!-- title+creativeBtn layout -->
<include
android:id="@+id/ad_title_creative_btn_layout"
layout="@layout/listitem_ad_title_creative_btn_layout"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_below="@+id/iv_listitem_image"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" />
</RelativeLayout>
</com.bytedance.msdk.api.format.TTNativeAdView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<com.bytedance.msdk.api.format.TTNativeAdView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="HardcodedText">
<include
android:id="@+id/icon_source_layout"
layout="@layout/listitem_ad_icon_source_layout" />
<TextView
android:id="@+id/tv_listitem_ad_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/icon_source_layout"
android:layout_marginLeft="10dp"
android:layout_marginTop="3dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="3dp"
android:ellipsize="end"
android:lineSpacingMultiplier="1"
android:maxLines="2"
android:singleLine="false"
android:text="劳力士服务中心,清洗保养,更换配件,9秒费用查询"
android:textColor="@android:color/black"
android:textSize="18sp" />
<com.bytedance.msdk.api.format.TTMediaView
android:id="@+id/iv_listitem_video"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_below="@id/tv_listitem_ad_desc"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@android:color/background_dark"
android:scaleType="centerCrop" />
<!-- title+creativeBtn layout -->
<include
android:id="@+id/ad_title_creative_btn_layout"
layout="@layout/listitem_ad_title_creative_btn_layout"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_below="@+id/iv_listitem_video"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" />
</RelativeLayout>
</com.bytedance.msdk.api.format.TTNativeAdView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<com.bytedance.msdk.api.format.TTNativeAdView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<FrameLayout
android:id="@+id/iv_listitem_express"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center" />
</com.bytedance.msdk.api.format.TTNativeAdView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<com.bytedance.msdk.api.format.TTNativeAdView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="HardcodedText">
<RelativeLayout
android:id="@+id/ad_contentPanel"
android:layout_width="match_parent"
android:layout_height="85dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp">
<ImageView
android:id="@+id/iv_listitem_image"
android:layout_width="100dp"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:background="@drawable/tt_ad_cover_btn_begin_bg"
android:scaleType="centerCrop" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_toStartOf="@+id/iv_listitem_image"
android:layout_toLeftOf="@+id/iv_listitem_image"
android:orientation="vertical">
<TextView
android:id="@+id/tv_listitem_ad_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:lineSpacingMultiplier="1.1"
android:maxLines="2"
android:text="80后的回忆!经典三国完美复刻,安卓用户的福利"
android:textColor="@android:color/black"
android:textSize="18sp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginTop="3dp"
android:paddingEnd="10dp"
android:paddingRight="10dp">
<ImageView
android:id="@+id/iv_listitem_icon"
android:layout_width="30dp"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:src="@drawable/tt_mute" />
<TextView
android:id="@+id/tv_listitem_ad_source"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_toStartOf="@+id/iv_listitem_dislike"
android:layout_toLeftOf="@+id/iv_listitem_dislike"
android:layout_toEndOf="@+id/iv_listitem_icon"
android:layout_toRightOf="@+id/iv_listitem_icon"
android:ellipsize="end"
android:gravity="center_vertical"
android:singleLine="true"
android:text="着陆无双"
android:textColor="#70000000"
android:textSize="16sp" />
<ImageView
android:id="@+id/iv_listitem_dislike"
android:layout_width="20dp"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_gravity="center_vertical"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:clickable="true"
android:focusable="true" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
<!-- title+creativeBtn layout -->
<include
android:id="@+id/ad_title_creative_btn_layout"
layout="@layout/listitem_ad_title_creative_btn_layout"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_below="@+id/ad_contentPanel"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" />
</RelativeLayout>
</com.bytedance.msdk.api.format.TTNativeAdView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<com.bytedance.msdk.api.format.TTNativeAdView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="HardcodedText">
<ImageView
android:id="@+id/iv_listitem_image"
android:layout_width="135dp"
android:layout_height="240dp"
android:layout_centerHorizontal="true"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:scaleType="centerCrop" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/iv_listitem_image"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:id="@+id/tv_listitem_ad_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:gravity="center"
android:singleLine="false"
android:textSize="14sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal">
<ImageView
android:id="@+id/iv_listitem_icon"
android:layout_width="30dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp" />
<LinearLayout
android:id="@+id/tv_source_desc_layout"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_below="@id/layout_image_group"
android:layout_centerVertical="true"
android:layout_marginStart="5dp"
android:layout_marginLeft="5dp"
android:layout_toEndOf="@id/iv_listitem_icon"
android:layout_toRightOf="@id/iv_listitem_icon"
android:orientation="vertical"
tools:ignore="NotSibling">
<TextView
android:id="@+id/tv_listitem_ad_desc"
android:layout_width="80dp"
android:layout_height="20dp"
android:ellipsize="end"
android:singleLine="true"
android:textSize="10sp" />
<TextView
android:id="@+id/tv_listitem_ad_source"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginBottom="10dp"
android:ellipsize="end"
android:singleLine="true"
android:textSize="8sp" />
</LinearLayout>
</RelativeLayout>
<Button
android:id="@+id/btn_listitem_creative"
android:layout_width="135dp"
android:layout_height="40dp"
android:textSize="9sp" />
</LinearLayout>
</LinearLayout>
<ImageView
android:id="@+id/iv_listitem_dislike"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:clickable="true"
android:src="@mipmap/dislike_icon" />
</RelativeLayout>
</com.bytedance.msdk.api.format.TTNativeAdView>
\ No newline at end of file
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