Commit 51690ed9 authored by mengcuiguang's avatar mengcuiguang

添加视频详情页广告开关

parent 95812cdb
...@@ -26,6 +26,7 @@ public class AppConfig { ...@@ -26,6 +26,7 @@ public class AppConfig {
public static boolean enterAlipay = false; public static boolean enterAlipay = false;
public static boolean showVipVedio = false; public static boolean showVipVedio = false;
public static boolean showVipAdDialog = false; public static boolean showVipAdDialog = false;
public static boolean showVedioPageAdFlag = false;
public static String detailDialogUnlockText = ""; public static String detailDialogUnlockText = "";
public static long splashTime = 0L; public static long splashTime = 0L;
......
...@@ -3,6 +3,7 @@ package com.changzhi.yipinplaylet.mvp.presenters ...@@ -3,6 +3,7 @@ package com.changzhi.yipinplaylet.mvp.presenters
import com.google.gson.JsonObject import com.google.gson.JsonObject
import com.changzhi.library.net.neterror.BaseSubscriber import com.changzhi.library.net.neterror.BaseSubscriber
import com.changzhi.library.net.neterror.Throwable import com.changzhi.library.net.neterror.Throwable
import com.changzhi.yipinplaylet.common.AppConfig
import com.changzhi.yipinplaylet.manager.AppHttpManager import com.changzhi.yipinplaylet.manager.AppHttpManager
import com.changzhi.yipinplaylet.mvp.model.BaseResponse import com.changzhi.yipinplaylet.mvp.model.BaseResponse
import com.changzhi.yipinplaylet.mvp.model.IndexList import com.changzhi.yipinplaylet.mvp.model.IndexList
...@@ -203,24 +204,28 @@ class VideoPresenter : BasePresenter<VideoView>() { ...@@ -203,24 +204,28 @@ class VideoPresenter : BasePresenter<VideoView>() {
} }
fun showTurn() { fun showVedioConfs() {
AppHttpManager.getInstance(loanApplication) AppHttpManager.getInstance(loanApplication)
.call(loanService.showTurn(), .call(loanService.showVedioConfs(),
object : BaseSubscriber<BaseResponse<NineShowBean>>() { object : BaseSubscriber<BaseResponse<JsonObject>>() {
override fun onCompleted() { override fun onCompleted() {
if (isLinkView) return if (isLinkView) return
view.hideLoading()
} }
override fun onNext(baseResponse: BaseResponse<NineShowBean>) { override fun onNext(baseResponse: BaseResponse<JsonObject>) {
if (isLinkView) return if (isLinkView) return
view.hideLoading()
val code = baseResponse.status val code = baseResponse.status
val message = baseResponse.message val message = baseResponse.message
when (code) { when (code) {
200 -> view.showTurnSuc(baseResponse.data) 200 -> {
try {
AppConfig.showVedioPageAdFlag =
baseResponse.data.get("open_unlockByad").asBoolean
} catch (e: Exception) {
e.printStackTrace()
}
}
else -> { else -> {
view.showToast(message) view.showToast(message)
} }
...@@ -229,11 +234,8 @@ class VideoPresenter : BasePresenter<VideoView>() { ...@@ -229,11 +234,8 @@ class VideoPresenter : BasePresenter<VideoView>() {
override fun onError(e: Throwable?) { override fun onError(e: Throwable?) {
if (isLinkView) return if (isLinkView) return
view.hideLoading()
view.showToast(e?.message)
} }
}) })
} }
} }
\ No newline at end of file
...@@ -337,6 +337,12 @@ public interface LoanService { ...@@ -337,6 +337,12 @@ public interface LoanService {
@POST("api/vedioV1/reportOpenAdEcpm") @POST("api/vedioV1/reportOpenAdEcpm")
Observable<BaseResponse<Object>> cmtEcpm(@Body Map<String, Object> vo); Observable<BaseResponse<Object>> cmtEcpm(@Body Map<String, Object> vo);
/**
* 视频页广告开关
*/
@POST("api/vedioV1/confs")
Observable<BaseResponse<JsonObject>> showVedioConfs();
/** /**
* 默认http工厂 * 默认http工厂
......
...@@ -62,7 +62,7 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView, ...@@ -62,7 +62,7 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
initView() initView()
videoPresenter.getVipProducts() videoPresenter.getVipProducts()
videoPresenter.showVedioConfs()
} }
override fun getBundleExtras(extras: Bundle?) { override fun getBundleExtras(extras: Bundle?) {
...@@ -93,11 +93,13 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView, ...@@ -93,11 +93,13 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
} }
// vip界面返回弹出广告弹窗 // vip界面返回弹出广告弹窗
if (AppConfig.showVipAdDialog && !UserManager.getInstance().vipFlag) { if (AppConfig.showVedioPageAdFlag) {
Handler(Looper.getMainLooper()).postDelayed({ if (AppConfig.showVipAdDialog && !UserManager.getInstance().vipFlag) {
adDialog() Handler(Looper.getMainLooper()).postDelayed({
AppConfig.showVipAdDialog = false adDialog()
}, 300) AppConfig.showVipAdDialog = false
}, 300)
}
} }
} }
......
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