Commit 9d934027 authored by mengcuiguang's avatar mengcuiguang

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

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