Commit 11b52bac authored by mengcuiguang's avatar mengcuiguang

代码优化

parent 46d9c269
......@@ -210,7 +210,7 @@ dependencies {
implementation 'com.umeng.umsdk:crash:0.0.4' // native crash包依赖(必选)
// TalkingDada(已集成)
// 一览视频
implementation("com.yilan.sdk:ui:3.3.1.2") {
implementation("com.yilan.sdk:ui:3.3.1.8") {
exclude group: 'com.yilan.sdk', module: 'yb_extra'
exclude group: 'com.yilan.sdk', module: 'gdt'
exclude group: 'com.yilan.sdk', module: 'ks'
......
......@@ -13,10 +13,10 @@ import com.bumptech.glide.Glide
import com.kwad.sdk.api.*
import com.kwad.sdk.api.KsNativeAd.VideoPlayListener
import com.mints.goldspace.MintsApplication
import com.mints.goldspace.R
import com.mints.goldspace.manager.KsManager
import com.mints.goldspace.utils.LogUtil
import java.util.*
import com.mints.goldspace.R
/**
* 快手预加载信息流
......@@ -32,8 +32,6 @@ object KsPreLoadExpressManager {
}
fun loadKsFrameLayout(parent: ViewGroup) {
parent.removeAllViews()
try {
var ksNativeAd: KsNativeAd?
val scene = KsScene
......@@ -98,6 +96,7 @@ object KsPreLoadExpressManager {
}
override fun onVideoPlayError(what: Int, extra: Int) {
LogUtil.d("KsPreLoadExpressManager","id=${what} extra=${extra}")
}
})
......
......@@ -106,10 +106,9 @@ class KsVideoAdManager private constructor() :
}
})
videoAdStatusListener?.adSuccess()
// PlayConfig默认竖屏播放,传null
// mRewardVideoAd!!.showRewardVideoAd(activity, null)
mRewardVideoAd!!.showRewardVideoAd(activity, null)
}
}
......
......@@ -98,7 +98,7 @@ class ShVideoAdManager private constructor(activity: Activity) :
}
override fun onAdFailed(adError: ADError) {
LogUtil.d(TAG, "onAdFailed")
LogUtil.d(TAG, "onAdFailed"+adError.description)
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SH, Constant.EVENT_TYPE_ONE, (adError.code).toString(), adError.description)
......
......@@ -139,6 +139,7 @@ object Constant {
const val CARRIER_FULLVEDIO_COMMON = "FULLVEDIO_COMMON" //全屏视频-通用
const val CARRIER_EXPRESS_COMMON = "EXPRESS_COMMON" //信息流-通用
const val CARRIER_EXPRESS_DIALOG = "EXPRESS_DIALOG" //信息流-弹窗
const val CARRIER_MC_FIRSTDOWNLOAD = "MC_FIRSTDOWNLOAD" // 牧场人生下载奖励
const val CARRIER_FIRSTDOWNLOADS = "FIRSTDOWNLOADS" // 其他下载奖励
......
......@@ -3,6 +3,7 @@ package com.mints.goldspace.manager
import android.app.Application
import com.kwad.sdk.api.KsAdSDK
import com.kwad.sdk.api.SdkConfig
import com.mints.goldspace.BuildConfig
import com.mints.goldspace.R
/**
......@@ -27,7 +28,7 @@ object KsManager {
.appId(KS_APP_ID) // 测试aapId,请联系快⼿平台申请正式AppId,必填
.appName(application.getString(R.string.app_name)) // 测试appName,请填写您应⽤的名称,⾮必填
.showNotification(true) // 是否展示下载通知栏
.debug(false) // 是否开启sdk 调试⽇志 可选
.debug(BuildConfig.DEBUG) // 是否开启sdk 调试⽇志 可选
.build())
}
......
package com.mints.goldspace.mvp.presenters
import android.app.Activity
import com.mints.goldspace.MintsApplication
import com.mints.goldspace.mvp.model.BaseResponse
import com.mints.goldspace.mvp.views.VideoAdManagerView
import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable
import rx.android.schedulers.AndroidSchedulers
import java.util.*
class CsjFullVedioAdPresenter : BasePresenter<VideoAdManagerView>() {
fun reportAddCoinMsg(activity: Activity?, vo: HashMap<String, Any>) {
if (activity == null) return
loanApplication = activity.application as MintsApplication
loanService = loanApplication.loanService
subscription = loanService.reportAddCoinMsg(vo)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(loanApplication.defaultSubscribeScheduler())
.subscribe(object : BaseSubscriber<BaseResponse<Any>>() {
override fun onCompleted() {}
override fun onError(e: Throwable) {
}
override fun onNext(baseResponse: BaseResponse<Any>) {}
})
}
fun dispose() {
loanService = null
loanApplication = null
if (subscription != null && !subscription.isUnsubscribed()) {
subscription.unsubscribe()
}
}
}
\ No newline at end of file
package com.mints.goldspace.mvp.presenters
import android.app.Activity
import com.mints.goldspace.MintsApplication
import com.mints.goldspace.mvp.model.BaseResponse
import com.mints.goldspace.mvp.views.VideoAdManagerView
import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable
import rx.android.schedulers.AndroidSchedulers
import java.util.*
class MhVideoAdPresenter : BasePresenter<VideoAdManagerView>() {
fun reportAddCoinMsg(activity: Activity?, vo: HashMap<String, Any>) {
if (activity == null) return
loanApplication = activity.application as MintsApplication
loanService = loanApplication.loanService
subscription = loanService.reportAddCoinMsg(vo)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(loanApplication.defaultSubscribeScheduler())
.subscribe(object : BaseSubscriber<BaseResponse<Any>>() {
override fun onCompleted() {}
override fun onError(e: Throwable) {
}
override fun onNext(baseResponse: BaseResponse<Any>) {}
})
}
fun dispose() {
loanService = null
loanApplication = null
if (subscription != null && !subscription.isUnsubscribed()) {
subscription.unsubscribe()
}
}
}
\ No newline at end of file
......@@ -173,7 +173,8 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
Constant.CARRIER_HOMEVEDIO_CHALLENGE, Constant.CARRIER_MINIVEDIO_CHALLENGE,
Constant.CARRIER_GAME_ONLINE, Constant.CARRIER_EATMEAL,
Constant.CARRIER_RUISHINEWS_CHALLANGE, Constant.CARRIER_ZHANGYUE_CHALLENGE,
Constant.CARRIER_XMLY_CHALLENGE, Constant.CARRIER_SHARE_NEWS -> {
Constant.CARRIER_XMLY_CHALLENGE, Constant.CARRIER_SHARE_NEWS,
Constant.CARRIER_MC_FIRSTDOWNLOAD-> {
val vo = HashMap<String, Any>()
vo["carrierType"] = carrierType
awardPresenter.reportAddCoinMsg(vo)
......
......@@ -55,6 +55,9 @@ class MainMyAdapter(context: Context, taskData: MutableList<MyInfo.AutoListBean>
// 喜马拉雅
const val TO_XMLY = "TO_XMLY"
// 下载牧场人生
const val TO_FIRSTDOWNLOAD = "TO_FIRSTDOWNLOAD"
// 其他下载应用
const val TO_DOWNLOADS = "TO_DOWNLOADS"
}
......
......@@ -790,6 +790,33 @@ class MyFragment : BaseFragment(),
bundle.putString(Constant.MAIN_EXTRA_ID, taskBean.otherConfig.key)
readyGo(AwardActivity::class.java, bundle)
onDestroyBroadcastReceiver()
}
}
}
}
MainMyAdapter.TO_FIRSTDOWNLOAD -> {
if (taskBean.otherConfig != null) {
when (taskBean.otherConfig.status) {
0 -> {
// 牧场人生包名
pkgMCRSCarrier = Constant.CARRIER_MC_FIRSTDOWNLOAD
pkgMCRSKey = ""
pkgMCRSName = taskBean.otherConfig.pkg
// 下载牧场人生
DownloadApkManager.downloadApk(requireActivity(), taskBean.otherConfig.downloadUrl, pkgMCRSName)
// 开启广播监听安装事件
registerBroad()
}
1 -> {
// 牧场人生APP,直接弹奖励框
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, taskBean.otherConfig.coin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_MC_FIRSTDOWNLOAD)
readyGo(AwardActivity::class.java, bundle)
onDestroyBroadcastReceiver()
}
}
......
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