Commit c504eb99 authored by jyx's avatar jyx

优化信息流广告加载

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