Commit dacc956c authored by jyx's avatar jyx

应用内信息流添加关闭按钮

parent 3198ee14
package com.mints.flowbox.ad package com.mints.flowbox.ad
import android.os.Handler
import android.os.Looper
import android.text.TextUtils import android.text.TextUtils
import android.view.Gravity import android.view.Gravity
import android.view.LayoutInflater import android.view.LayoutInflater
...@@ -182,9 +180,6 @@ class AppOutScreenGroMoreCarrierExpressManager : TTSettingConfigCallback { ...@@ -182,9 +180,6 @@ class AppOutScreenGroMoreCarrierExpressManager : TTSettingConfigCallback {
val isOversped = TimeRender.isOversped45Min(adLoadTime, 45) val isOversped = TimeRender.isOversped45Min(adLoadTime, 45)
// 若上一个广告还在加载中则返回 // 若上一个广告还在加载中则返回
if (isLoadSuccess == 1) { if (isLoadSuccess == 1) {
Handler(Looper.getMainLooper()).postDelayed({
getAdView(callback)
}, 1000)
return return
} }
......
...@@ -182,9 +182,6 @@ class AppOutSimpleGroMoreCarrierExpressManager : TTSettingConfigCallback { ...@@ -182,9 +182,6 @@ class AppOutSimpleGroMoreCarrierExpressManager : TTSettingConfigCallback {
val isOversped = TimeRender.isOversped45Min(adLoadTime, 45) val isOversped = TimeRender.isOversped45Min(adLoadTime, 45)
// 若上一个广告还在加载中则返回 // 若上一个广告还在加载中则返回
if (isLoadSuccess == 1) { if (isLoadSuccess == 1) {
Handler(Looper.getMainLooper()).postDelayed({
getAdView(callback)
}, 1000)
return return
} }
......
package com.mints.flowbox.ad.banner package com.mints.flowbox.ad.banner
import android.app.Activity
import android.view.View import android.view.View
import android.widget.FrameLayout import android.widget.FrameLayout
import com.bytedance.sdk.openadsdk.AdSlot import com.bytedance.sdk.openadsdk.*
import com.bytedance.sdk.openadsdk.TTAdNative
import com.bytedance.sdk.openadsdk.TTAdSdk
import com.bytedance.sdk.openadsdk.TTNativeExpressAd
import com.mints.flowbox.MintsApplication import com.mints.flowbox.MintsApplication
import com.mints.flowbox.manager.TtCsjAdManager import com.mints.flowbox.manager.TtCsjAdManager
import com.mints.flowbox.ui.activitys.MainActivity
import com.mints.flowbox.utils.LogUtil import com.mints.flowbox.utils.LogUtil
/** /**
...@@ -47,7 +46,7 @@ class BannerManager { ...@@ -47,7 +46,7 @@ class BannerManager {
/** /**
* 获取穿山甲banner * 获取穿山甲banner
*/ */
fun getTtBanner(codeId: String, frameLayout: FrameLayout?) { fun getTtBanner(codeId: String, frameLayout: FrameLayout?, activity: Activity) {
this.frameLayout = frameLayout this.frameLayout = frameLayout
var expressViewAcceptedSizeWidth = getViewWidth() var expressViewAcceptedSizeWidth = getViewWidth()
var expressViewAcceptedSizeHeight = 0f var expressViewAcceptedSizeHeight = 0f
...@@ -78,7 +77,7 @@ class BannerManager { ...@@ -78,7 +77,7 @@ class BannerManager {
frameLayout?.let { frameLayout?.let {
mTTAd = ads[0] mTTAd = ads[0]
bindAdListener() bindAdListener(activity)
mTTAd?.render() mTTAd?.render()
} }
} }
...@@ -90,8 +89,20 @@ class BannerManager { ...@@ -90,8 +89,20 @@ class BannerManager {
} }
} }
private fun bindAdListener() { private fun bindAdListener(activity: Activity) {
mTTAd?.let { mTTAd?.let {
it.setDislikeCallback(activity, object : TTAdDislike.DislikeInteractionCallback {
override fun onShow() {
}
override fun onSelected(p0: Int, p1: String?, p2: Boolean) {
frameLayout?.removeAllViews()
}
override fun onCancel() {
}
})
it.setExpressInteractionListener(object : it.setExpressInteractionListener(object :
TTNativeExpressAd.ExpressAdInteractionListener { TTNativeExpressAd.ExpressAdInteractionListener {
override fun onAdClicked(p0: View?, p1: Int) { override fun onAdClicked(p0: View?, p1: Int) {
......
...@@ -19,6 +19,7 @@ import com.mints.flowbox.common.Constant ...@@ -19,6 +19,7 @@ import com.mints.flowbox.common.Constant
import com.mints.flowbox.manager.CsjGroMoreManager import com.mints.flowbox.manager.CsjGroMoreManager
import com.mints.flowbox.manager.TrackManager import com.mints.flowbox.manager.TrackManager
import com.mints.flowbox.ui.widgets.seekbar.BubbleUtils import com.mints.flowbox.ui.widgets.seekbar.BubbleUtils
import com.mints.flowbox.utils.ForegroundOrBackground
import com.mints.flowbox.utils.LogUtil import com.mints.flowbox.utils.LogUtil
import com.mints.flowbox.utils.VideoOptionUtil import com.mints.flowbox.utils.VideoOptionUtil
import java.util.* import java.util.*
...@@ -247,23 +248,26 @@ class GroMoreCarrierExpressManager : TTSettingConfigCallback { ...@@ -247,23 +248,26 @@ class GroMoreCarrierExpressManager : TTSettingConfigCallback {
convertView.tag = adViewHolder convertView.tag = adViewHolder
//判断是否存在dislike按钮 //判断是否存在dislike按钮
// if (ad.hasDislike()) { if (ad.hasDislike() && ForegroundOrBackground.getApp_activity() != null) {
// ad.setDislikeCallback(MintsApplication.getContext() as Activity?, object : TTDislikeCallback { ad.setDislikeCallback(
// override fun onSelected(position: Int, value: String) { ForegroundOrBackground.getApp_activity(),
// //用户选择不喜欢原因后,移除广告展示 object : TTDislikeCallback {
// } override fun onSelected(position: Int, value: String) {
// //用户选择不喜欢原因后,移除广告展示
// override fun onCancel() { frameLayout?.removeAllViews()
// LogUtil.d(TAG, "dislike 点击了取消") }
// }
// override fun onCancel() {
// /** LogUtil.d(TAG, "dislike 点击了取消")
// * 拒绝再次提交 }
// */
// override fun onRefuse() {} /**
// override fun onShow() {} * 拒绝再次提交
// }) */
// } override fun onRefuse() {}
override fun onShow() {}
})
}
//设置点击展示回调监听 //设置点击展示回调监听
ad.setTTNativeAdListener(object : TTNativeExpressAdListener { ad.setTTNativeAdListener(object : TTNativeExpressAdListener {
......
...@@ -263,7 +263,10 @@ class ScreenLockerObserver(private val context: Context) { ...@@ -263,7 +263,10 @@ class ScreenLockerObserver(private val context: Context) {
} }
private fun onHandleScreenOff(context: Context, isPowerDisconnected: Boolean = false) { private fun onHandleScreenOff(context: Context, isPowerDisconnected: Boolean = false) {
if (IntentUtils.isRunningForeground(context) && ForegroundOrBackground.getApp_activity() != null && ForegroundOrBackground.getApp_activity() !is ScreenActivity) { if (IntentUtils.isRunningForeground(context) &&
ForegroundOrBackground.getApp_activity() != null &&
ForegroundOrBackground.getApp_activity() !is ScreenActivity
) {
ForegroundOrBackground.getApp_activity().moveTaskToBack(true) ForegroundOrBackground.getApp_activity().moveTaskToBack(true)
} }
......
...@@ -48,6 +48,12 @@ class SpeedFastActivity : BaseActivity(), View.OnClickListener { ...@@ -48,6 +48,12 @@ class SpeedFastActivity : BaseActivity(), View.OnClickListener {
override fun adClose() {} override fun adClose() {}
}) })
WifiAdManager.instance.loadWifiAd(this) WifiAdManager.instance.loadWifiAd(this)
GlideUtils.loadImageViewGif(this, R.drawable.wifi_speed, iv_gif)
tv_tab.text = topStr[1]
btn.visibility = View.INVISIBLE
tv_progress.visibility = View.VISIBLE
startTimer()
} }
fun startTimer() { fun startTimer() {
...@@ -117,15 +123,6 @@ class SpeedFastActivity : BaseActivity(), View.OnClickListener { ...@@ -117,15 +123,6 @@ class SpeedFastActivity : BaseActivity(), View.OnClickListener {
} }
R.id.btn -> { R.id.btn -> {
when { when {
mStep == 0 -> {
startTimer()
btn.visibility = View.INVISIBLE
tv_progress.visibility = View.VISIBLE
GlideUtils.loadImageViewGif(this, R.drawable.wifi_speed, iv_gif)
tv_tab.text = topStr[1]
}
mStep >= 4 -> { mStep >= 4 -> {
finish() finish()
} }
......
...@@ -36,9 +36,7 @@ class ScreenActivity : OutAppActivity(), View.OnClickListener { ...@@ -36,9 +36,7 @@ class ScreenActivity : OutAppActivity(), View.OnClickListener {
// thread.start() // thread.start()
initExpress() initExpress()
ForegroundOrBackground.getMain_activity().moveTaskToBack(true)
tvBoost.setOnClickListener(this) tvBoost.setOnClickListener(this)
tvClean.setOnClickListener(this) tvClean.setOnClickListener(this)
tvSaveBattery.setOnClickListener(this) tvSaveBattery.setOnClickListener(this)
......
...@@ -120,7 +120,11 @@ class MyFragment : BaseFragment(), ...@@ -120,7 +120,11 @@ class MyFragment : BaseFragment(),
// 防止banner刷新太快 // 防止banner刷新太快
if (AntiShake.check(fl_my_banner?.id)) return if (AntiShake.check(fl_my_banner?.id)) return
BannerManager.instance.getTtBanner(TtCsjAdManager.TT_AD_BANNER_MY, fl_my_banner) BannerManager.instance.getTtBanner(
TtCsjAdManager.TT_AD_BANNER_MY,
fl_my_banner,
requireActivity()
)
// 刷新喜马拉雅信息流 // 刷新喜马拉雅信息流
TTPreLoadExpressXmlyManager.getInstance().loadTtFrameLayout() TTPreLoadExpressXmlyManager.getInstance().loadTtFrameLayout()
......
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