Commit 6a8580b3 authored by jyx's avatar jyx

GroMore信息流代码优化

parent badca490
......@@ -101,7 +101,7 @@ class GroMoreExpressManager : TTSettingConfigCallback {
.setTTVideoOption(videoOption) //视频声音相关的配置
.setAdmobNativeAdOptions(admobNativeAdOptions)
.setAdStyleType(mAdStyle) //必传,表示请求的模板广告还是原生广告,AdSlot.TYPE_EXPRESS_AD:模板广告 ; AdSlot.TYPE_NATIVE_AD:原生广告
.setImageAdSize(UIUtils.getScreenWidthDp(MintsApplication.getContext()).toInt(), 320) // 必选参数 单位dp ,详情见上面备注解释
.setImageAdSize(340, 0) // 必选参数 单位dp ,详情见上面备注解释
.setAdCount(1) //请求广告数量为1到3条
.setGdtNativeAdLogoParams(gdtNativeAdLogUtiloParams) // 设置gdt logo布局参数。
.build()
......@@ -129,7 +129,9 @@ class GroMoreExpressManager : TTSettingConfigCallback {
}
if (ads.size > 0) {
mADLoadSuccessListener?.onGMAdLoadSuc(ads[0])
mADLoadSuccessListener?.onGMAdLoadSuc(createAdView(ads[0]))
val ttNativeAd = ads[0]
val vo = HashMap<String, Any>()
vo["adcode"] = ttNativeAd.getAdNetworkRitId()
......@@ -252,7 +254,7 @@ class GroMoreExpressManager : TTSettingConfigCallback {
sWidth = FrameLayout.LayoutParams.MATCH_PARENT
sHeight = FrameLayout.LayoutParams.WRAP_CONTENT
} else {
sWidth = UIUtils.getScreenWidthDp(MintsApplication.getContext()).toInt()
sWidth = UIUtils.getScreenWidth(MintsApplication.getContext()).toInt()
sHeight = (sWidth * height / width).toInt()
}
if (video != null) {
......
......@@ -152,11 +152,11 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
mAdFrameLayout?.addView(view)
}
override fun onGMAdLoadSuc(ttNativeAd: TTNativeAd?) {
override fun onGMAdLoadSuc(ttNativeAd: View?) {
// if (currentIndex == 3) {
// mAdFrameLayout?.addView(view)
// }
mAdFrameLayout?.addView(ttNativeAd?.expressView)
mAdFrameLayout?.addView(ttNativeAd)
}
}
......@@ -174,5 +174,5 @@ interface KSADLoadSuccessListener {
}
interface GMADLoadSuccessListener {
fun onGMAdLoadSuc(ttNativeAd: TTNativeAd?)
fun onGMAdLoadSuc(ttNativeAd: View?)
}
\ No newline at end of file
......@@ -322,7 +322,7 @@ class TaskCpdFragment : BaseFragment(), TaskView,
// cpdLoadCountTime = cpdMax
RxjavaUtil.executeRxTask<MutableList<TzTaskBean>>(object : CommonRxTask<MutableList<TzTaskBean>>() {
RxjavaUtil.executeRxTask(object : CommonRxTask<MutableList<TzTaskBean>>() {
override fun doInIOThread() {
val newPkgData = mutableListOf<TzTaskBean>()
......
......@@ -29,6 +29,11 @@ public class UIUtils {
return width / (scale <= 0 ? 1 : scale) + 0.5f;
}
public static int getScreenWidth(Context context) {
DisplayMetrics dm = context.getResources().getDisplayMetrics();
return dm.widthPixels;
}
//全面屏、刘海屏适配
public static float getHeight(Activity activity) {
hideBottomUIMenu(activity);
......
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