Commit c504eb99 authored by jyx's avatar jyx

优化信息流广告加载

parent 1b1cf3da
......@@ -28,6 +28,7 @@ import com.mints.flowbox.keepalive.ServiceUtil;
import com.mints.flowbox.keepalive.WifiStateWatch;
import com.mints.flowbox.manager.CsjGroMoreManager;
import com.mints.flowbox.manager.MiitHelper;
import com.mints.flowbox.manager.TrackManager;
import com.mints.flowbox.manager.ad.OwManager;
import com.mints.flowbox.manager.ad.TzManager;
import com.mints.flowbox.manager.ad.WnManager;
......@@ -179,6 +180,9 @@ public class MintsApplication extends BaseApp {
// TODO 这里可以初始化广告SDK
thirdConfig();
TrackManager.getInstance().getOuterAdConfig();
TrackManager.getInstance().getAdWeight();
new ScreenLockerObserver(this).start(this);
CoreAdContext.Companion.setLockerResumeCallback(new Function1<Activity, Boolean>() {
......
......@@ -60,6 +60,18 @@ class AppOutGroMoreCarrierExpressManager : TTSettingConfigCallback {
}
}
fun loadADFrameLayout(_framelayout: FrameLayout) {
// 销毁及移除事件
destroy()
this.frameLayout = _framelayout
if (TTMediationAdSdk.configLoadSuccess()) {
loadAd()
} else {
TTMediationAdSdk.registerConfigCallback(this)
}
}
/**
* config成功,加载信息流
*/
......
......@@ -32,6 +32,18 @@ object ExpressManager {
// }
}
/** 加载应用外信息流 */
fun loadNoAppOutExpress(framelayout: FrameLayout) {
if (AppConfig.groMoreVideoAdCount > 0) {
AppOutGroMoreCarrierExpressManager.instance.loadADFrameLayout(framelayout)
}
// else {
// TTPreLoadCarrierExpressManager.getInstance()
// .loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_WATER)
// }
}
/** 获取应用内信息流 */
fun getExpressFrameLayout(): FrameLayout? {
if (AppConfig.groMoreVideoAdCount > 0) {
......
......@@ -96,8 +96,7 @@ class BonusPresenter : BasePresenter<BonusView>() {
if (isLinkView) return
val vo2 = HashMap<String, Any>()
vo["carrierType"] = Constant.CHALLENGE_SHAREFRIEND
TrackManager.getInstance()
.reportAddCoinMsg(activity, vo)
TrackManager.getInstance().reportAddCoinMsg(activity, vo2)
}
})
}
......
......@@ -400,8 +400,8 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
RxPermissions(this)
.request(
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_BACKGROUND_LOCATION,
Manifest.permission.WRITE_EXTERNAL_STORAGE
Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.ACCESS_BACKGROUND_LOCATION
)
} else {
RxPermissions(this)
......@@ -411,7 +411,7 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
)
}
request.subscribe { granted: Boolean ->
if (granted) {
// 预加载信息流
ExpressManager.loadExpress(false)
......@@ -421,9 +421,11 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
IncreasespeedActivity.INCREASE_BOOST
)
readyGo(IncreasespeedActivity::class.java)
} else {
}
}
}
/**
* 游客登录
......
......@@ -19,6 +19,7 @@ import kotlinx.android.synthetic.main.activity_apk.btnClean
import kotlinx.android.synthetic.main.activity_apk.fl_ad
import kotlinx.android.synthetic.main.activity_apk.iv_close
import kotlinx.android.synthetic.main.activity_apk.tvInfo
import kotlinx.android.synthetic.main.activity_screen.*
import kotlin.random.Random
/**
......@@ -117,9 +118,11 @@ class ApkActivity : BaseActivity() {
*/
private fun initExpress() {
try {
if (fl_ad != null) {
if (fl_ad != null && ExpressManager.getAppOutExpressFrameLayout() != null) {
fl_ad.removeAllViews()
fl_ad.addView(ExpressManager.getAppOutExpressFrameLayout())
} else {
ExpressManager.loadNoAppOutExpress(fl_ad)
}
} catch (e: Exception) {
e.printStackTrace()
......
......@@ -15,7 +15,10 @@ import com.mints.flowbox.ad.wifi.WifiAdManager
import com.mints.flowbox.ad.wifi.WifiAdStatusListener
import com.mints.flowbox.ui.activitys.base.BaseActivity
import kotlinx.android.synthetic.main.activity_boost_fast.*
import kotlinx.android.synthetic.main.activity_boost_fast.container
import kotlinx.android.synthetic.main.activity_boost_fast.fl_ad
import kotlinx.android.synthetic.main.activity_boost_fast.iv_close
import kotlinx.android.synthetic.main.activity_screen.*
import java.util.*
import kotlin.random.Random
......@@ -148,16 +151,17 @@ class BoostFastActivity : BaseActivity() {
*/
private fun initExpress() {
try {
if (fl_ad != null) {
if (fl_ad != null && ExpressManager.getAppOutExpressFrameLayout() != null) {
fl_ad.removeAllViews()
fl_ad.addView(ExpressManager.getAppOutExpressFrameLayout())
} else {
ExpressManager.loadNoAppOutExpress(fl_ad)
}
} catch (e: Exception) {
e.printStackTrace()
}
}
override fun onBackPressed() {
// super.onBackPressed()
}
......
......@@ -40,10 +40,14 @@ class ScreenActivity : OutAppActivity(), View.OnClickListener {
override fun onResume() {
super.onResume()
resetTime()
initExpress()
}
override fun onPause() {
super.onPause()
ExpressManager.loadAppOutExpress()
}
private fun resetTime() {
val date = Date()
val monthDay = TimeRender.formatDate(date, TimeRender.DEFAULT_FORMAT_MONTH_DAY)
......@@ -91,9 +95,11 @@ class ScreenActivity : OutAppActivity(), View.OnClickListener {
*/
private fun initExpress() {
try {
if (fl_ad != null) {
if (fl_ad != null && ExpressManager.getAppOutExpressFrameLayout() != null) {
fl_ad.removeAllViews()
fl_ad.addView(ExpressManager.getAppOutExpressFrameLayout())
} else {
ExpressManager.loadNoAppOutExpress(fl_ad)
}
} catch (e: Exception) {
e.printStackTrace()
......
......@@ -18,6 +18,7 @@ import com.mints.flowbox.ui.activitys.base.BaseActivity
import com.mints.flowbox.utils.SpanUtils
import com.mints.flowbox.utils.SystemUtils
import com.mints.library.utils.GlideUtils
import kotlinx.android.synthetic.main.activity_screen.*
import kotlinx.android.synthetic.main.activity_timing.*
import kotlinx.android.synthetic.main.activity_timing.fl_ad
import kotlinx.android.synthetic.main.activity_timing.iv_close
......@@ -230,9 +231,11 @@ class TriggerActivity : BaseActivity() {
*/
private fun initExpress() {
try {
if (fl_ad != null) {
if (fl_ad != null && ExpressManager.getAppOutExpressFrameLayout() != null) {
fl_ad.removeAllViews()
fl_ad.addView(ExpressManager.getAppOutExpressFrameLayout())
} else {
ExpressManager.loadNoAppOutExpress(fl_ad)
}
} catch (e: Exception) {
e.printStackTrace()
......
......@@ -14,6 +14,7 @@ import com.mints.flowbox.ad.video.VideoAdingManager
import com.mints.flowbox.ad.video.base.VideoAdStatusListener
import com.mints.flowbox.common.AppConfig
import com.mints.flowbox.common.Constant
import com.mints.flowbox.manager.TrackManager
import com.mints.flowbox.manager.UserManager
import com.mints.flowbox.mvp.model.SignRedbagsBean
import com.mints.flowbox.mvp.model.VideoAdingBean
......@@ -171,14 +172,14 @@ class BonusFragment : BaseFragment(), OnItemChildClickListener, BonusView, View.
shareImgDialog()
}
1 -> {
// val vo = HashMap<String, Any>()
// vo["carrierType"] = Constant.CHALLENGE_SHAREFRIEND
// TrackManager.getInstance()
// .reportAddCoinMsg(requireActivity(), vo)
//
// Handler(Looper.getMainLooper()).postDelayed({
// refreshData()
// }, 500)
val vo = HashMap<String, Any>()
vo["carrierType"] = Constant.CHALLENGE_SHAREFRIEND
TrackManager.getInstance()
.reportAddCoinMsg(requireActivity(), vo)
Handler(Looper.getMainLooper()).postDelayed({
refreshData()
}, 500)
}
}
}
......@@ -276,6 +277,8 @@ class BonusFragment : BaseFragment(), OnItemChildClickListener, BonusView, View.
.setCash("" + todayMoney)
.setBtnStr("好的")
.show()
refreshData()
}
override fun onDestroy() {
......@@ -292,10 +295,14 @@ class BonusFragment : BaseFragment(), OnItemChildClickListener, BonusView, View.
if (isButtonCanClick) {
// 签到
bonusPresenter.sign()
} else {
if (btn_sign.text.contains("已")) {
ToastUtils.show("请明天再来吧!")
} else {
ToastUtils.show("请先完成今日任务!")
}
}
}
else -> {
}
}
......
......@@ -543,7 +543,6 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
.request(
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_BACKGROUND_LOCATION,
Manifest.permission.WRITE_EXTERNAL_STORAGE
)
} else {
RxPermissions(activity!!)
......@@ -558,7 +557,7 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
loadWifiData()
}, 1000)
} else {
showMissingPermissionDialog("位置,存储")
showMissingPermissionDialog("位置,存储 ")
}
}
}
......
......@@ -62,7 +62,7 @@ class BonusTintDialog(context: Context, listener: DialogListener) :
tv_dialogper_title =
findViewById<View>(R.id.tv_title) as TextView
tv_dialogper_cash =
findViewById<View>(R.id.tv_cash) as TextView
findViewById<View>(R.id.tvCash) as TextView
btn_dialogper_submit =
findViewById<View>(R.id.btn_submit) as Button
......
......@@ -57,9 +57,7 @@ public class IntentUtils {
}
@Override
public void onResult(boolean b) {
LogUtil.d("AAAAAAA -> " + b);
}
public void onResult(boolean b) { }
}, null);
} catch (Exception e) {
e.printStackTrace();
......
......@@ -2,7 +2,8 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal">
<ImageView
android:id="@+id/imageView"
......
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