Commit 358761de authored by maxiaoliang's avatar maxiaoliang

修改大图关闭功能

parent 0d0a6abd
PACKAGE_NAME=com.zxhl.economize PACKAGE_NAME=com.zxhl.economize
VERSION_CODE=4 VERSION_CODE=5
VERSION_NAME=1.0.3 VERSION_NAME=1.0.4
\ No newline at end of file \ No newline at end of file
package com.zxbw.modulemain.fragment package com.zxbw.modulemain.fragment
import android.content.Intent
import android.net.Uri
import android.text.TextUtils import android.text.TextUtils
import android.util.Log import android.util.Log
import android.view.View import android.view.View
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.CircleCrop import com.bumptech.glide.load.resource.bitmap.CircleCrop
import com.bumptech.glide.request.RequestOptions import com.bumptech.glide.request.RequestOptions
import com.bytedance.sdk.openadsdk.TTAdDislike.DislikeInteractionCallback
import com.bytedance.sdk.openadsdk.TTAdNative import com.bytedance.sdk.openadsdk.TTAdNative
import com.bytedance.sdk.openadsdk.TTNativeExpressAd import com.bytedance.sdk.openadsdk.TTNativeExpressAd
import com.zx.ad.AdManager import com.zx.ad.AdManager
...@@ -24,10 +23,10 @@ import com.zxhl.cms.net.ApiClient ...@@ -24,10 +23,10 @@ import com.zxhl.cms.net.ApiClient
import com.zxhl.cms.net.RxSchedulers import com.zxhl.cms.net.RxSchedulers
import com.zxhl.cms.net.SettingPreference import com.zxhl.cms.net.SettingPreference
import com.zxhl.cms.net.callback.BaseObserver import com.zxhl.cms.net.callback.BaseObserver
import com.zxhl.cms.pay.H5PayUtil
import com.zxhl.cms.utils.* import com.zxhl.cms.utils.*
import kotlinx.android.synthetic.main.fragment_layout_user_center.* import kotlinx.android.synthetic.main.fragment_layout_user_center.*
/** /**
* Created by gaoleichao on 2019/3/12 * Created by gaoleichao on 2019/3/12
*/ */
...@@ -248,6 +247,7 @@ class UserCenterFragment : BaseFragment(), AdCallback<String> { ...@@ -248,6 +247,7 @@ class UserCenterFragment : BaseFragment(), AdCallback<String> {
if (p0?.isNotEmpty() == true) { if (p0?.isNotEmpty() == true) {
id_fragment_user_ad_layout?.visibility = View.VISIBLE id_fragment_user_ad_layout?.visibility = View.VISIBLE
mTTAd = p0.get(0) mTTAd = p0.get(0)
bindDislike(mTTAd)
mTTAd?.setExpressInteractionListener(object : mTTAd?.setExpressInteractionListener(object :
TTNativeExpressAd.ExpressAdInteractionListener { TTNativeExpressAd.ExpressAdInteractionListener {
override fun onAdClicked(p0: View?, p1: Int) { override fun onAdClicked(p0: View?, p1: Int) {
...@@ -278,4 +278,39 @@ class UserCenterFragment : BaseFragment(), AdCallback<String> { ...@@ -278,4 +278,39 @@ class UserCenterFragment : BaseFragment(), AdCallback<String> {
}) })
} }
} }
/**
* 设置广告的不喜欢,开发者可自定义样式
* @param ad
* @param customStyle 是否自定义样式,true:样式自定义
*/
private fun bindDislike(ad: TTNativeExpressAd?) {
//使用默认模板中默认dislike弹出样式
ad?.setDislikeCallback(mActivity, object : DislikeInteractionCallback {
override fun onShow() {}
override fun onSelected(position: Int, value: String, enforce: Boolean) {
// showToast("点击 $value")
id_fragment_user_ad_layout.removeAllViews()
//用户选择不喜欢原因后,移除广告展示
if (enforce) {
// TToast.show(mContext, "模版Banner 穿山甲sdk强制将view关闭了")
}
}
override fun onCancel() {
// showToast("取消")
}
fun onRefuse() {}
})
}
override fun onDestroy() {
super.onDestroy()
if (mTTAd != null) {
mTTAd?.destroy()
}
}
} }
\ No newline at end of file
...@@ -221,9 +221,9 @@ ...@@ -221,9 +221,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:visibility="gone"
android:background="@drawable/shape_ffffff_r10_s" android:background="@drawable/shape_ffffff_r10_s"
android:orientation="horizontal"> android:orientation="horizontal"
android:visibility="gone">
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="0dp"
...@@ -570,24 +570,27 @@ ...@@ -570,24 +570,27 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<TextView <TextView
android:id="@+id/id_tv_daili" android:id="@+id/id_tv_daili"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="16dp" android:layout_margin="16dp"
android:background="@color/white"
android:gravity="center"
android:paddingTop="10dp" android:paddingTop="10dp"
android:paddingBottom="10dp" android:paddingBottom="10dp"
android:text="申请成为代理"
android:textColor="@color/color_333333" android:textColor="@color/color_333333"
android:background="@color/white" android:textSize="14sp" />
android:textSize="14sp"
android:gravity="center"
android:text="申请成为代理"/>
<RelativeLayout <RelativeLayout
android:id="@+id/id_fragment_user_ad_layout" android:id="@+id/id_fragment_user_ad_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp" android:layout_marginLeft="10dp"
android:layout_marginBottom="20dp" android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:background="@color/white" android:background="@color/white"
android:gravity="center" android:gravity="center"
android:visibility="gone" /> android:visibility="gone" />
......
...@@ -7,6 +7,7 @@ import android.util.Log ...@@ -7,6 +7,7 @@ import android.util.Log
import android.view.View import android.view.View
import android.widget.FrameLayout import android.widget.FrameLayout
import com.bytedance.sdk.openadsdk.* import com.bytedance.sdk.openadsdk.*
import com.bytedance.sdk.openadsdk.TTAdDislike.DislikeInteractionCallback
import com.zx.ad.callback.AdLoadCallBack import com.zx.ad.callback.AdLoadCallBack
import com.zx.ad.callback.InterertionAdListener import com.zx.ad.callback.InterertionAdListener
import com.zx.ad.callback.RewardVideoAdListener import com.zx.ad.callback.RewardVideoAdListener
...@@ -336,7 +337,7 @@ object CSJAdManager { ...@@ -336,7 +337,7 @@ object CSJAdManager {
splashAd = null splashAd = null
rewardVideoAd = null rewardVideoAd = null
} }
private var mTTAd: TTNativeExpressAd? = null
fun requestByteDailyActiveBigImgFeed( fun requestByteDailyActiveBigImgFeed(
codeId: String, codeId: String,
expressViewWidth: Float, expressViewWidth: Float,
...@@ -357,6 +358,8 @@ object CSJAdManager { ...@@ -357,6 +358,8 @@ object CSJAdManager {
mTTAdNative?.loadNativeExpressAd(adSlot, object : TTAdNative.NativeExpressAdListener { mTTAdNative?.loadNativeExpressAd(adSlot, object : TTAdNative.NativeExpressAdListener {
override fun onNativeExpressAdLoad(p0: MutableList<TTNativeExpressAd>?) { override fun onNativeExpressAdLoad(p0: MutableList<TTNativeExpressAd>?) {
if (p0 != null && p0.size > 0) { if (p0 != null && p0.size > 0) {
mTTAd = p0[0]
// bindDislike(mTTAd, false)
callBack.onNativeExpressAdLoad(p0) callBack.onNativeExpressAdLoad(p0)
} else { } else {
callBack?.onError(1000, "没有拉取到广告") callBack?.onError(1000, "没有拉取到广告")
...@@ -369,4 +372,6 @@ object CSJAdManager { ...@@ -369,4 +372,6 @@ object CSJAdManager {
} }
}) })
} }
} }
\ No newline at end of file
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