Commit 9d934027 authored by mengcuiguang's avatar mengcuiguang

小满科技界面退出时添加拦截

parent 252dffef
...@@ -346,12 +346,6 @@ dependencies { ...@@ -346,12 +346,6 @@ dependencies {
implementation "com.alibaba:arouter-api:$arouter_api_version" implementation "com.alibaba:arouter-api:$arouter_api_version"
implementation 'com.sensorsdata.analytics.android:SensorsAnalyticsSDK:4.4.3' implementation 'com.sensorsdata.analytics.android:SensorsAnalyticsSDK:4.4.3'
api 'org.aspectj:aspectjrt:1.9.5' api 'org.aspectj:aspectjrt:1.9.5'
// testImplementation 'junit:junit:4.13'
// androidTestImplementation 'androidx.test.ext:junit:1.1.2'
// androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
//小满 //小满
implementation ("com.bx:adsdk:1.4.2.2"){ implementation ("com.bx:adsdk:1.4.2.2"){
exclude group:"com.miit.sdk" exclude group:"com.miit.sdk"
...@@ -359,16 +353,9 @@ dependencies { ...@@ -359,16 +353,9 @@ dependencies {
changing = true changing = true
} }
// implementation ('com.google.code.gson:gson:2.8.2'){ // testImplementation 'junit:junit:4.13'
// exclude group:"com.miit.sdk" // androidTestImplementation 'androidx.test.ext:junit:1.1.2'
// } // androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
// implementation ('com.qq.e.union:union:4.310.1180'){
// exclude group:"com.miit.sdk"
// } // 普通版本
// compile(name: 'open_ad_sdk', ext: 'aar')
} }
...@@ -7,34 +7,23 @@ import android.util.Log ...@@ -7,34 +7,23 @@ import android.util.Log
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.FrameLayout import android.widget.FrameLayout
import android.widget.Toast
import androidx.fragment.app.FragmentTransaction import androidx.fragment.app.FragmentTransaction
import com.bx.adsdk.CampaignCallback import com.bx.adsdk.CampaignCallback
import com.bx.adsdk.CampaignFragment import com.bx.adsdk.CampaignFragment
import com.bytedance.sdk.openadsdk.AdSlot import com.bytedance.sdk.openadsdk.*
import com.bytedance.sdk.openadsdk.TTAdConstant
import com.bytedance.sdk.openadsdk.TTAdDislike
import com.bytedance.sdk.openadsdk.TTAdNative
import com.bytedance.sdk.openadsdk.TTAdSdk
import com.bytedance.sdk.openadsdk.TTNativeExpressAd
import com.bytedance.sdk.openadsdk.TTRewardVideoAd
import com.google.gson.Gson import com.google.gson.Gson
import com.mints.goodmoney.R import com.mints.goodmoney.R
import com.mints.goodmoney.common.Constant import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.TtCsjAdManager
import com.mints.goodmoney.manager.UserManager import com.mints.goodmoney.manager.UserManager
import com.mints.goodmoney.manager.YlhAdManager import com.mints.goodmoney.manager.YlhAdManager
import com.mints.goodmoney.mvp.model.JsBridgeBean import com.mints.goodmoney.mvp.model.JsBridgeBean
import com.mints.goodmoney.ui.activitys.base.BaseActivity import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.qq.e.ads.banner2.UnifiedBannerADListener
import com.qq.e.ads.banner2.UnifiedBannerView import com.qq.e.ads.banner2.UnifiedBannerView
import com.qq.e.ads.nativ.express2.AdEventListener
import com.qq.e.ads.nativ.express2.NativeExpressAD2 import com.qq.e.ads.nativ.express2.NativeExpressAD2
import com.qq.e.ads.nativ.express2.NativeExpressADData2 import com.qq.e.ads.nativ.express2.NativeExpressADData2
import com.qq.e.ads.rewardvideo.RewardVideoAD import com.qq.e.ads.rewardvideo.RewardVideoAD
import com.qq.e.ads.rewardvideo.RewardVideoADListener import com.qq.e.ads.rewardvideo.RewardVideoADListener
import com.qq.e.comm.util.AdError import com.qq.e.comm.util.AdError
import kotlinx.android.synthetic.main.activity_layout_xiaoman.*
import kotlinx.android.synthetic.main.header_layout.* import kotlinx.android.synthetic.main.header_layout.*
class XiaomanActivity : BaseActivity(), View.OnClickListener { class XiaomanActivity : BaseActivity(), View.OnClickListener {
...@@ -45,7 +34,7 @@ class XiaomanActivity : BaseActivity(), View.OnClickListener { ...@@ -45,7 +34,7 @@ class XiaomanActivity : BaseActivity(), View.OnClickListener {
private var rewardVideoAD: RewardVideoAD? = null private var rewardVideoAD: RewardVideoAD? = null
private var unifiedBannerView: UnifiedBannerView? = null private var unifiedBannerView: UnifiedBannerView? = null
private val TAG = "XiaomanActivity" private val TAG = "XiaomanActivity"
private val campaignFragment: CampaignFragment? = null private val campaignFragment by lazy { CampaignFragment.newInstance(System.currentTimeMillis().toString()) }
private var mttRewardVideoAd: TTRewardVideoAd? = null private var mttRewardVideoAd: TTRewardVideoAd? = null
...@@ -64,9 +53,10 @@ class XiaomanActivity : BaseActivity(), View.OnClickListener { ...@@ -64,9 +53,10 @@ class XiaomanActivity : BaseActivity(), View.OnClickListener {
super.getBundleExtras(extras) super.getBundleExtras(extras)
extras?.let { extras?.let {
placeId = it.getString(Constant.ACTIVITY_ID, "") placeId = it.getString(Constant.ACTIVITY_ID, "")
activityTitle=it.getString(Constant.ACTIVITY_TITLE, "") activityTitle = it.getString(Constant.ACTIVITY_TITLE, "")
} }
} }
override fun initViewsAndEvents() { override fun initViewsAndEvents() {
iv_left_icon.visibility = View.VISIBLE iv_left_icon.visibility = View.VISIBLE
iv_left_icon.setImageResource(R.mipmap.ic_arrow_back) iv_left_icon.setImageResource(R.mipmap.ic_arrow_back)
...@@ -77,9 +67,8 @@ class XiaomanActivity : BaseActivity(), View.OnClickListener { ...@@ -77,9 +67,8 @@ class XiaomanActivity : BaseActivity(), View.OnClickListener {
* 为方便测试,demo中采用时间戳来标识用户唯一id * 为方便测试,demo中采用时间戳来标识用户唯一id
* 媒体对接时注意替换 * 媒体对接时注意替换
*/ */
val fragment = CampaignFragment.newInstance(System.currentTimeMillis().toString() + "") campaignFragment.setPlaceId(placeId)
fragment.setPlaceId(placeId) campaignFragment.setCallback(object : CampaignCallback() {
fragment.setCallback(object : CampaignCallback() {
override fun showAd(s: String) {//2.2.9.1//调用激励视频 override fun showAd(s: String) {//2.2.9.1//调用激励视频
super.showAd(s) super.showAd(s)
/** /**
...@@ -90,9 +79,9 @@ class XiaomanActivity : BaseActivity(), View.OnClickListener { ...@@ -90,9 +79,9 @@ class XiaomanActivity : BaseActivity(), View.OnClickListener {
*/ */
val bean: JsBridgeBean = Gson().fromJson(s, JsBridgeBean::class.java) val bean: JsBridgeBean = Gson().fromJson(s, JsBridgeBean::class.java)
if (bean.adType.equals("1")) { if (bean.adType.equals("1")) {
loadBytedanceAd(fragment, bean) loadBytedanceAd(campaignFragment, bean)
} else if (bean.adType.equals("2")) { } else if (bean.adType.equals("2")) {
loadGDTRewardVideo(fragment, bean) loadGDTRewardVideo(campaignFragment, bean)
} }
} }
...@@ -127,7 +116,7 @@ class XiaomanActivity : BaseActivity(), View.OnClickListener { ...@@ -127,7 +116,7 @@ class XiaomanActivity : BaseActivity(), View.OnClickListener {
}) })
val transaction: FragmentTransaction = supportFragmentManager.beginTransaction() val transaction: FragmentTransaction = supportFragmentManager.beginTransaction()
transaction.add(R.id.frame_layout, fragment) transaction.add(R.id.frame_layout, campaignFragment)
transaction.commitAllowingStateLoss() transaction.commitAllowingStateLoss()
} }
...@@ -503,23 +492,17 @@ class XiaomanActivity : BaseActivity(), View.OnClickListener { ...@@ -503,23 +492,17 @@ class XiaomanActivity : BaseActivity(), View.OnClickListener {
// } // }
override fun onBackPressed() { override fun onBackPressed() {
finish() if (campaignFragment != null) {
// Toast.makeText(this@XiaomanActivity2, "按下返回键onBackPressed", Toast.LENGTH_LONG).show() campaignFragment.backButtonClick(object : CampaignFragment.CallBack {
/* if (campaignFragment != null) { override fun onSuccess(jsonData: String) {
campaignFragment.backButtonClick(new CampaignFragment.CallBack() {//返回当前界面必须回调 super@XiaomanActivity.onBackPressed()
@Override
public void onSuccess(String jsonData) {
Main2Activity.super.onBackPressed();
} }
@Override override fun onFailure(code: String, errmsg: String) {}
public void onFailure(String code, String errmsg) { })
}
});
} else { } else {
super.onBackPressed(); super.onBackPressed()
}*/ }
} }
/** /**
...@@ -539,7 +522,15 @@ class XiaomanActivity : BaseActivity(), View.OnClickListener { ...@@ -539,7 +522,15 @@ class XiaomanActivity : BaseActivity(), View.OnClickListener {
override fun onClick(v: View) { override fun onClick(v: View) {
when (v.id) { when (v.id) {
R.id.iv_left_icon -> { R.id.iv_left_icon -> {
finish() campaignFragment?.backButtonClick(object : CampaignFragment.CallBack {
override fun onSuccess(p0: String?) {
super@XiaomanActivity.onBackPressed()
}
override fun onFailure(p0: String?, p1: String?) {
finish()
}
})
} }
} }
} }
......
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