Commit 87a07482 authored by mengcuiguang's avatar mengcuiguang

Merge branch 'dev_new_vedio' of http://gitlab.mints-id.com/android/android_vedio into dev_new_vedio

parents 2a114246 0c598e9b
...@@ -235,6 +235,18 @@ dependencies { ...@@ -235,6 +235,18 @@ dependencies {
// umeng 接入 // umeng 接入
// 穿山甲聚合 接入【穿山甲、快手】 // 穿山甲聚合 接入【穿山甲、快手】
// 穿山甲
implementation ("com.pangle.cn:pangrowth-sdk:3.7.0.1") {
exclude group: 'com.pangle.cn', module: 'pangrowth-game-sdk'
exclude group: 'com.pangle.cn', module: 'pangrowth-novel-sdk'
exclude group: 'com.pangle.cn', module: 'pangrowth-luckycat-sdk'
exclude group: 'com.pangle.cn', module: 'partner-luckycat-api-sdk'
exclude group: 'com.pangle.cn', module: 'pangrowth-reward-sdk'
exclude group: 'com.pangle.cn', module: 'partner-live-sdk'
exclude group: 'com.tencent.mm.opensdk', module: 'wechat-sdk-android'
}
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
......
...@@ -7,6 +7,12 @@ ...@@ -7,6 +7,12 @@
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<!-- 穿山甲 -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<application <application
android:name=".MintsApplication" android:name=".MintsApplication"
android:allowBackup="false" android:allowBackup="false"
...@@ -122,6 +128,10 @@ ...@@ -122,6 +128,10 @@
android:name=".video.VideoActivity" android:name=".video.VideoActivity"
android:exported="false" android:exported="false"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity
android:name=".video.DramaApiDetailActivity"
android:exported="false"
android:screenOrientation="portrait" />
<service <service
android:name=".ui.service.UpdateService" android:name=".ui.service.UpdateService"
...@@ -140,6 +150,13 @@ ...@@ -140,6 +150,13 @@
android:exported="true" android:exported="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar" /> android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<!-- 短剧SDK -->
<provider
android:name="com.bytedance.sdk.dp.act.DPProvider"
android:authorities="${applicationId}.BDDPProvider"
android:exported="false" />
<!-- 自有下载 --> <!-- 自有下载 -->
<provider <provider
android:name="androidx.core.content.FileProvider" android:name="androidx.core.content.FileProvider"
......
{
"init": {
"site_id": "5175152",
"app_id": "193842",
"partner": "pangle_193842",
"secure_key": "11146c60bf023251701462c31a44a28b"
},
"feed": {
"news_list_ad_code_id": "946175237",
"news_first_ad_code_id": "946175238",
"news_second_ad_code_id": "946175242",
"video_first_ad_code_id": "",
"video_second_ad_code_id": "946175251",
"related_ad_code_id": "946175239",
"news_draw_ad_code_id": "946175243",
"news_draw_native_ad_code_id": "946175244",
"news_interstitial_code_id": "947027583"
},
"small_video": {
"draw_ad_code_id": "946175245",
"draw_native_ad_code_id": "946175248",
"grid_ad_code_id": "946175241",
"grid_draw_ad_code_id": "946175246",
"grid_draw_native_ad_code_id": "946175250",
"video_card_ad_code_id": "946175247",
"video_card_draw_ad_code_id": "946175240",
"video_card_draw_native_ad_code_id": "946175249",
"interstitial_note_ad_code_id": "946506704",
"draw_fullscreen_interstitial_ad_code_id":"947490273",
"draw_interstitial_ad_code_id":"947490116",
"staggered_grid_ad_code_id": "946506705",
"staggered_grid_draw_ad_code_id": "946175245",
"staggered_grid_draw_native_ad_code_id": "946175248",
"draw_banner_code_id": "947490413",
"drama_rewarded_ad_code_id": "951008975",
"drama_rewarded_ad_code_id_02": "951011822",
"drama_draw_ad_code_id": "952225157"
},
"novel": {
"banner_ad_code_id": "946508521",
"exciting_ad_code_id": "946176105",
"interstitial_code_id": "946508522",
"mid_ad_code_id": "946176107",
"pre_ad_code_id": "946176106",
"status": 1
},
"live": {
"live_card_ad_code_id": "946192110",
"live_preview_draw_ad_code_id": "947474066",
"live_preview_draw_native_ad_code_id": "947474068"
}
}
...@@ -19,6 +19,7 @@ import com.lzf.easyfloat.anim.AppFloatDefaultAnimator ...@@ -19,6 +19,7 @@ import com.lzf.easyfloat.anim.AppFloatDefaultAnimator
import com.lzf.easyfloat.anim.DefaultAnimator import com.lzf.easyfloat.anim.DefaultAnimator
import com.lzf.easyfloat.enums.SidePattern import com.lzf.easyfloat.enums.SidePattern
import com.mints.wisdomclean.R import com.mints.wisdomclean.R
import com.mints.wisdomclean.ad.AdManager
import com.mints.wisdomclean.common.AppConfig import com.mints.wisdomclean.common.AppConfig
import com.mints.wisdomclean.common.Constant import com.mints.wisdomclean.common.Constant
import com.mints.wisdomclean.ui.activitys.base.BaseActivity import com.mints.wisdomclean.ui.activitys.base.BaseActivity
...@@ -81,6 +82,9 @@ class MainActivity : BaseActivity(), View.OnClickListener { ...@@ -81,6 +82,9 @@ class MainActivity : BaseActivity(), View.OnClickListener {
tabIvLoan!!.isSelected = true tabIvLoan!!.isSelected = true
} }
AdManager.instance.preLoadAd(this)
initEditView()
// initEasyFloat() // initEasyFloat()
} }
...@@ -273,4 +277,25 @@ class MainActivity : BaseActivity(), View.OnClickListener { ...@@ -273,4 +277,25 @@ class MainActivity : BaseActivity(), View.OnClickListener {
}) })
phoneDialog!!.show() phoneDialog!!.show()
} }
private fun initEditView() {
tv_full.setOnClickListener {
recommendFragment?.apply {
(this as RecommendFragment).fullChoice()
}
}
tv_delete.setOnClickListener {
recommendFragment?.apply {
(this as RecommendFragment).delete()
}
}
}
fun showEdit(isEdit: Boolean) {
if (isEdit) {
ll_edit.visibility = View.VISIBLE
} else {
ll_edit.visibility = View.GONE
}
}
} }
\ No newline at end of file
package com.mints.wisdomclean.ui.adapter package com.mints.wisdomclean.ui.adapter
import android.app.Activity import android.app.Activity
import android.view.View
import com.chad.library.adapter.base.BaseQuickAdapter import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.mints.wisdomclean.R import com.mints.wisdomclean.R
...@@ -13,7 +14,21 @@ import com.mints.wisdomclean.R ...@@ -13,7 +14,21 @@ import com.mints.wisdomclean.R
class FollowAdapter(var activity: Activity) : class FollowAdapter(var activity: Activity) :
BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_follow) { BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_follow) {
private var showEdit = false
override fun convert(holder: BaseViewHolder, item: String) { override fun convert(holder: BaseViewHolder, item: String) {
holder.getView<View>(R.id.fm_mask).visibility = if (showEdit) View.VISIBLE else View.GONE
}
// 设置编辑状态
fun setEditStyle(showEdit: Boolean) {
this.showEdit = showEdit
notifyDataSetChanged()
}
// 全选
fun fullChoice() {
} }
} }
\ No newline at end of file
...@@ -2,7 +2,6 @@ package com.mints.wisdomclean.ui.adapter ...@@ -2,7 +2,6 @@ package com.mints.wisdomclean.ui.adapter
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter import androidx.viewpager2.adapter.FragmentStateAdapter
import com.mints.wisdomclean.ui.fragment.FollowVideoFragment
/** /**
* @author Assen * @author Assen
......
...@@ -50,4 +50,8 @@ class FollowVideoFragment : BaseFragment() { ...@@ -50,4 +50,8 @@ class FollowVideoFragment : BaseFragment() {
rv_follow.adapter = followAdapter rv_follow.adapter = followAdapter
} }
fun getAdapter(): FollowAdapter {
return followAdapter
}
} }
\ No newline at end of file
package com.mints.wisdomclean.ui.fragment package com.mints.wisdomclean.ui.fragment
import android.app.Dialog import android.app.Dialog
import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.text.TextUtils import android.text.TextUtils
import android.util.Log
import android.view.View import android.view.View
import android.widget.Toast
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import com.bytedance.sdk.dp.DPDrama
import com.bytedance.sdk.dp.DPDramaDetailConfig
import com.bytedance.sdk.dp.DPSdk
import com.bytedance.sdk.dp.IDPWidgetFactory
import com.daimajia.androidanimations.library.YoYo import com.daimajia.androidanimations.library.YoYo
import com.mints.wisdomclean.R import com.mints.wisdomclean.R
import com.mints.wisdomclean.common.AppConfig import com.mints.wisdomclean.common.AppConfig
...@@ -17,10 +24,23 @@ import com.mints.wisdomclean.ui.activitys.* ...@@ -17,10 +24,23 @@ import com.mints.wisdomclean.ui.activitys.*
import com.mints.wisdomclean.ui.fragment.base.BaseFragment import com.mints.wisdomclean.ui.fragment.base.BaseFragment
import com.mints.wisdomclean.utils.TimeRender import com.mints.wisdomclean.utils.TimeRender
import com.mints.library.utils.nodoubleclick.AntiShake import com.mints.library.utils.nodoubleclick.AntiShake
import com.mints.wisdomclean.ad.AdManager
import com.mints.wisdomclean.ad.AdStatusListener
import com.mints.wisdomclean.ui.widgets.DialogListener import com.mints.wisdomclean.ui.widgets.DialogListener
import com.mints.wisdomclean.ui.widgets.DialogUtils import com.mints.wisdomclean.ui.widgets.DialogUtils
import com.mints.wisdomclean.utils.LogUtil
import com.mints.wisdomclean.utils.SpanUtils import com.mints.wisdomclean.utils.SpanUtils
import com.mints.wisdomclean.utils.UcropUtils import com.mints.wisdomclean.utils.UcropUtils
import com.mints.wisdomclean.video.DPHolderManager
import com.mints.wisdomclean.video.DramaApiDetailActivity
import com.mints.wisdomclean.video.DramaApiDetailActivity.Companion.KEY_DRAMA_CURRENT_DURATION
import com.mints.wisdomclean.video.DramaApiDetailActivity.Companion.KEY_DRAMA_CUSTOM_REPORT_ENABLED
import com.mints.wisdomclean.video.DramaApiDetailActivity.Companion.KEY_DRAMA_FREE_SET
import com.mints.wisdomclean.video.DramaApiDetailActivity.Companion.KEY_DRAMA_HIDE_LEFT_TOP_TIPS
import com.mints.wisdomclean.video.DramaApiDetailActivity.Companion.KEY_DRAMA_INFINITE_SCROLL_ENABLED
import com.mints.wisdomclean.video.DramaApiDetailActivity.Companion.KEY_DRAMA_LOCK_SET
import com.mints.wisdomclean.video.DramaApiDetailActivity.Companion.KEY_DRAMA_MODE
import com.mints.wisdomclean.video.DramaApiDetailActivity.Companion.KEY_DRAMA_UNLOCK_INDEX
import kotlinx.android.synthetic.main.fragment_main_my.* import kotlinx.android.synthetic.main.fragment_main_my.*
/** /**
...@@ -49,6 +69,8 @@ class MyFragment : BaseFragment(), MyView, View.OnClickListener { ...@@ -49,6 +69,8 @@ class MyFragment : BaseFragment(), MyView, View.OnClickListener {
.create() .create()
initListener() initListener()
DPHolderManager.initDpSdk(requireContext())
} }
override fun onHiddenChanged(hidden: Boolean) { override fun onHiddenChanged(hidden: Boolean) {
...@@ -89,12 +111,67 @@ class MyFragment : BaseFragment(), MyView, View.OnClickListener { ...@@ -89,12 +111,67 @@ class MyFragment : BaseFragment(), MyView, View.OnClickListener {
override fun onClick(v: View?) { override fun onClick(v: View?) {
when (v?.id) { when (v?.id) {
R.id.ll_my_vip, R.id.fl_my_vip, R.id.iv_my_hint -> { R.id.ll_my_vip, R.id.fl_my_vip, R.id.iv_my_hint -> {
if (!userManager.vipFlag) { // if (!userManager.vipFlag) {
readyGo(VipActivity::class.java) // readyGo(VipActivity::class.java)
} // }
AdManager.instance.showAd(requireActivity(), "", object : AdStatusListener {
override fun adSuccess() {
}
override fun adFail() {
}
override fun adClose() {
}
})
} }
R.id.iv_my_set -> { R.id.iv_my_set -> {
readyGo(SettingsActivity::class.java) val idList = mutableListOf<Long>()
idList.add(6L)
DPSdk.factory().requestDrama(idList, object : IDPWidgetFactory.DramaCallback {
override fun onError(code: Int, msg: String?) {
showToast("请求失败")
LogUtil.d("request failed, code = $code, msg = $msg")
}
override fun onSuccess(
dataList: MutableList<out DPDrama>?,
info: MutableMap<String, Any>?
) {
showToast("请求成功")
dataList?.takeIf { it.isNotEmpty() }?.first()?.let {
LogUtil.d("request success, $it")
// 短剧集数
it.index = 1
val intent =
Intent(requireActivity(), DramaApiDetailActivity::class.java)
DramaApiDetailActivity.outerDrama = it
// 免费观看集数
intent.putExtra(KEY_DRAMA_UNLOCK_INDEX, 10)
// 封装或者非封装模式
intent.putExtra(KEY_DRAMA_MODE, DPDramaDetailConfig.SPECIFIC_DETAIL)
// 免费集数
intent.putExtra(KEY_DRAMA_FREE_SET, 0)
// 解锁集数
intent.putExtra(KEY_DRAMA_LOCK_SET, 0)
// 启播时间点
intent.putExtra(KEY_DRAMA_CURRENT_DURATION, 0)
// 无限下滑
intent.putExtra(KEY_DRAMA_INFINITE_SCROLL_ENABLED, true)
// 举报页面
intent.putExtra(KEY_DRAMA_CUSTOM_REPORT_ENABLED, false)
intent.putExtra(KEY_DRAMA_HIDE_LEFT_TOP_TIPS, false)
startActivity(intent)
}
}
})
// AdManager.instance.preLoadAd(requireActivity(), true)
// readyGo(SettingsActivity::class.java)
} }
R.id.ll_feedback, R.id.ll_contactus2, R.id.ll_contactus -> { R.id.ll_feedback, R.id.ll_contactus2, R.id.ll_contactus -> {
// 联系客服 // 联系客服
......
...@@ -10,6 +10,7 @@ import com.google.android.material.tabs.TabLayoutMediator ...@@ -10,6 +10,7 @@ import com.google.android.material.tabs.TabLayoutMediator
import com.mints.wisdomclean.R import com.mints.wisdomclean.R
import com.mints.wisdomclean.common.AppConfig import com.mints.wisdomclean.common.AppConfig
import com.mints.wisdomclean.common.Constant import com.mints.wisdomclean.common.Constant
import com.mints.wisdomclean.ui.activitys.MainActivity
import com.mints.wisdomclean.ui.adapter.RecommendPageAdapter import com.mints.wisdomclean.ui.adapter.RecommendPageAdapter
import com.mints.wisdomclean.ui.fragment.base.BaseFragment import com.mints.wisdomclean.ui.fragment.base.BaseFragment
import kotlinx.android.synthetic.main.fragment_recommend.* import kotlinx.android.synthetic.main.fragment_recommend.*
...@@ -19,7 +20,9 @@ import kotlinx.android.synthetic.main.fragment_recommend.* ...@@ -19,7 +20,9 @@ import kotlinx.android.synthetic.main.fragment_recommend.*
* @date 2023/7/5 * @date 2023/7/5
* @desc 主页 -> 推荐 * @desc 主页 -> 推荐
*/ */
class RecommendFragment : BaseFragment() { class RecommendFragment : BaseFragment(), View.OnClickListener {
private var isEdit = false
private var mSelectTabIndex = -1 private var mSelectTabIndex = -1
private val tabsData = mutableListOf<String>() private val tabsData = mutableListOf<String>()
...@@ -27,6 +30,15 @@ class RecommendFragment : BaseFragment() { ...@@ -27,6 +30,15 @@ class RecommendFragment : BaseFragment() {
private var vpAdapter: RecommendPageAdapter? = null private var vpAdapter: RecommendPageAdapter? = null
override fun initViewsAndEvents() { override fun initViewsAndEvents() {
iv_edit.setOnClickListener(this)
iv_edit_close.setOnClickListener(this)
initVp2()
}
override fun getContentViewLayoutID() = R.layout.fragment_recommend
private fun initVp2() {
tabsData.add("追剧") tabsData.add("追剧")
tabsData.add("推荐") tabsData.add("推荐")
...@@ -58,8 +70,6 @@ class RecommendFragment : BaseFragment() { ...@@ -58,8 +70,6 @@ class RecommendFragment : BaseFragment() {
vp2_recommend.offscreenPageLimit = 2 vp2_recommend.offscreenPageLimit = 2
} }
override fun getContentViewLayoutID() = R.layout.fragment_recommend
private fun getTabView(position: Int): View { private fun getTabView(position: Int): View {
val view = LayoutInflater.from(requireContext()).inflate(R.layout.item_recommend_tab, null) val view = LayoutInflater.from(requireContext()).inflate(R.layout.item_recommend_tab, null)
view.findViewById<TextView>(R.id.item_tv).text = tabsData[position] view.findViewById<TextView>(R.id.item_tv).text = tabsData[position]
...@@ -79,7 +89,12 @@ class RecommendFragment : BaseFragment() { ...@@ -79,7 +89,12 @@ class RecommendFragment : BaseFragment() {
if (isSelected) { if (isSelected) {
text.setTextColor(ContextCompat.getColor(requireContext(), R.color.black)) text.setTextColor(ContextCompat.getColor(requireContext(), R.color.black))
} else { } else {
text.setTextColor(ContextCompat.getColor(requireContext(), R.color.my_color_gray)) text.setTextColor(
ContextCompat.getColor(
requireContext(),
R.color.my_color_gray
)
)
} }
line.background = line.background =
ContextCompat.getDrawable(requireContext(), R.drawable.shape_line_corner_red) ContextCompat.getDrawable(requireContext(), R.drawable.shape_line_corner_red)
...@@ -87,7 +102,12 @@ class RecommendFragment : BaseFragment() { ...@@ -87,7 +102,12 @@ class RecommendFragment : BaseFragment() {
if (isSelected) { if (isSelected) {
text.setTextColor(ContextCompat.getColor(requireContext(), R.color.white)) text.setTextColor(ContextCompat.getColor(requireContext(), R.color.white))
} else { } else {
text.setTextColor(ContextCompat.getColor(requireContext(), R.color.color_8D8F90)) text.setTextColor(
ContextCompat.getColor(
requireContext(),
R.color.color_8D8F90
)
)
} }
line.background = line.background =
ContextCompat.getDrawable(requireContext(), R.drawable.shape_line_corner_white) ContextCompat.getDrawable(requireContext(), R.drawable.shape_line_corner_white)
...@@ -102,4 +122,44 @@ class RecommendFragment : BaseFragment() { ...@@ -102,4 +122,44 @@ class RecommendFragment : BaseFragment() {
} }
} }
override fun onClick(v: View?) {
when (v?.id) {
R.id.iv_edit -> {
handleEditStyle(true)
}
R.id.iv_edit_close -> {
handleEditStyle(false)
}
else -> {}
}
}
private fun handleEditStyle(isEdit: Boolean) {
if (isEdit) {
// 禁止滑动
vp2_recommend.isUserInputEnabled = false
iv_edit.visibility = View.GONE
iv_edit_close.visibility = View.VISIBLE
tab_recommend.visibility = View.GONE
tv_edit_text.visibility = View.VISIBLE
} else {
// 允许滑动
vp2_recommend.isUserInputEnabled = true
iv_edit.visibility = View.VISIBLE
iv_edit_close.visibility = View.GONE
tab_recommend.visibility = View.VISIBLE
tv_edit_text.visibility = View.GONE
}
(requireActivity() as MainActivity).showEdit(isEdit)
(fragments[0] as FollowVideoFragment).getAdapter().setEditStyle(isEdit)
}
fun fullChoice() {
(fragments[0] as FollowVideoFragment).getAdapter().fullChoice()
}
fun delete() {
}
} }
\ No newline at end of file
package com.mints.wisdomclean.video
import android.content.Context
import android.util.Log
import com.bytedance.sdk.dp.DPSdk
import com.bytedance.sdk.dp.DPSdkConfig
/**
* @author Assen
* @date 2023/6/21
* @desc
*/
object DPHolderManager {
const val TAG = "DPHolderManager"
var isDPStarted = false
fun initDpSdk(context: Context) {
//1. 初始化,最好放到application.onCreate()执行
val configBuilder = DPSdkConfig.Builder().debug(true)
DPSdk.init(context, "SDK_Setting_5175152.json", configBuilder.build())
startDpSdk()
}
fun startDpSdk() {
DPSdk.start { isSuccess, message ->
//请确保使用Sdk时Sdk已经成功启动
//isSuccess=true表示启动成功
//启动失败,可以再次调用启动接口(建议最多不要超过3次)
isDPStarted = isSuccess
Log.e(TAG, "start result=$isSuccess, msg=$message")
}
}
}
\ No newline at end of file
package com.mints.wisdomclean.video
import android.content.Context
import android.util.Log
import android.view.View
import android.widget.Button
import android.widget.EditText
import android.widget.LinearLayout
import com.bytedance.sdk.dp.*
import com.mints.wisdomclean.MintsApplication
import com.mints.wisdomclean.R
import com.mints.wisdomclean.ad.AdManager
import com.mints.wisdomclean.ad.AdStatusListener
import com.mints.wisdomclean.ui.activitys.base.BaseActivity
import kotlinx.android.synthetic.main.drama_activity_api_detail.*
import org.json.JSONObject
/**
* @author Assen
* @date 2023/7/6
* @desc
*/
class DramaApiDetailActivity : BaseActivity() {
companion object {
const val KEY_DRAMA_UNLOCK_INDEX = "key_drama_unlock_index"
const val KEY_DRAMA_HISTORY = "drama_history"
const val KEY_DRAMA_MODE = "key_drama_mode"
const val KEY_DRAMA_FREE_SET = "key_drama_free_set"
const val KEY_DRAMA_LOCK_SET = "key_drama_lock_set"
const val KEY_DRAMA_CURRENT_DURATION = "drama_current_duration"
const val KEY_DRAMA_INFINITE_SCROLL_ENABLED = "key_drama_infinite_scroll_enabled"
const val KEY_DRAMA_CUSTOM_REPORT_ENABLED = "key_drama_custom_report_enabled"
const val KEY_DRAMA_HIDE_LEFT_TOP_TIPS = "key_drama_hide_left_top_tips"
private const val TAG = "DramaApiDetailActivity"
const val IS_FROM_CARD = "is_from_card"
const val FROM_GID = "from_gid"
var tipsTopMargin = -1
var outerDrama: DPDrama? = null
}
private var sp =
MintsApplication.getContext().getSharedPreferences("pangrowth", Context.MODE_PRIVATE)
private var dpWidget: IDPWidget? = null
private var isInited = false
private var drama: DPDrama? = null
private var mInitUnlockIndex = 0
//可免费观看的最大集数
private var mUnlockIndexMap = mutableMapOf<Long, Int>()
// 已经解锁的集数
private var mHasUnlockIndexMap = mutableMapOf<Long, MutableList<Int>>()
private var blockView: View? = null
private var unlockBtn: Button? = null
private var leaveBtn: Button? = null
private var indexEt: EditText? = null
private var goBtn: Button? = null
private var lastIndex = 1
private var currentDuration = 0
private var enableInfiniteScroll = true
private var enableCustomReport = false
private var hideLeftTopTips = false
private var hideMore = false
private var freeSet = 5 // 仅封装模式生效
private var lockSet = 2 // 仅封装模式生效
private var mode = DPDramaDetailConfig.SPECIFIC_DETAIL
private val isFromCard by lazy { intent?.getBooleanExtra(IS_FROM_CARD, false) ?: false }
private val fromGid by lazy { intent?.getLongExtra(FROM_GID, -1L) }
override fun getContentViewLayoutID() = R.layout.drama_activity_api_detail
override fun initViewsAndEvents() {
blockView = findViewById<LinearLayout>(R.id.block_view)
blockView?.isClickable = true
unlockBtn = findViewById(R.id.unlock)
leaveBtn = findViewById(R.id.leave)
indexEt = findViewById(R.id.et_drama_index)
goBtn = findViewById(R.id.btn_go)
blockView?.visibility = View.GONE
drama = outerDrama
drama?.let {
mInitUnlockIndex = intent.getIntExtra(KEY_DRAMA_UNLOCK_INDEX, 1)
mUnlockIndexMap[it.id] = mInitUnlockIndex
tv_info.text = String.format("《%s》共%d集", it.title, it.total)
}
currentDuration = intent.getIntExtra(KEY_DRAMA_CURRENT_DURATION, 0)
enableInfiniteScroll =
intent.getBooleanExtra(KEY_DRAMA_INFINITE_SCROLL_ENABLED, true)
enableCustomReport =
intent.getBooleanExtra(KEY_DRAMA_CUSTOM_REPORT_ENABLED, false)
mode = intent.getStringExtra(KEY_DRAMA_MODE)
?: DPDramaDetailConfig.SPECIFIC_DETAIL
hideLeftTopTips =
intent.getBooleanExtra(KEY_DRAMA_HIDE_LEFT_TOP_TIPS, false)
freeSet = intent.getIntExtra(KEY_DRAMA_FREE_SET, -1)
lockSet = intent.getIntExtra(KEY_DRAMA_LOCK_SET, -1)
if (DPSdk.isStartSuccess()) {
init()
}
}
override fun isApplyKitKatTranslucency() = true
private fun init() {
if (isInited) {
return
}
initWidget()
dpWidget?.let { widget ->
supportFragmentManager.beginTransaction().replace(R.id.fl_container, widget.fragment)
.commit()
goBtn?.setOnClickListener {
val index = indexEt?.editableText.toString().toInt()
widget.currentDramaIndex = index
}
leaveBtn?.setOnClickListener {
finish()
}
}
isInited = true
}
private fun initWidget() {
drama?.let { drama ->
dpWidget = DPSdk.factory().createDramaDetail(
DPWidgetDramaDetailParams.obtain()
.detailConfig(
DPDramaDetailConfig.obtain(mode)
.bottomOffset(20)
.infiniteScrollEnabled(enableInfiniteScroll)
.scriptTipsTopMargin(tipsTopMargin)
.hideLeftTopTips(hideLeftTopTips, null)
.showCellularToast(true)
.hideMore(hideMore)
.freeSet(freeSet)
.lockSet(lockSet)
.listener(dramaListener)
.adListener(dramaAdListener)
.setCustomReport(enableCustomReport) { context, id ->
// 举报
}
)
.id(drama.id)
.index(drama.index)
.currentDuration(currentDuration)
.fromCard(isFromCard, fromGid.toString())
)
}
}
override fun onDestroy() {
super.onDestroy()
dpWidget?.destroy()
}
override fun onPause() {
super.onPause()
drama?.let {
val json = JSONObject()
json.put("id", drama?.id)
json.put("status", drama?.status)
json.put("total", drama?.total)
json.put("title", drama?.title)
json.put("cover_image", drama?.coverImage)
json.put("index", lastIndex)
json.put("class", drama?.type)
json.put("desc", drama?.desc)
sp.edit().putString(KEY_DRAMA_HISTORY, json.toString()).apply()
}
}
private val dramaAdListener: IDPAdListener = object : IDPAdListener() {
override fun onDPAdRequest(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdRequest map = $map")
}
override fun onDPAdRequestSuccess(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdRequestSuccess map = $map")
}
override fun onDPAdRequestFail(code: Int, msg: String?, map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdRequestFail map = $map")
}
override fun onDPAdFillFail(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdFillFail map = $map")
}
override fun onDPAdShow(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdShow map = $map")
}
override fun onDPAdPlayStart(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdPlayStart: map = $map")
}
override fun onDPAdPlayPause(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdPlayPause map = $map")
}
override fun onDPAdPlayContinue(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdPlayContinue map = $map")
}
override fun onDPAdPlayComplete(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdPlayComplete map = $map")
}
override fun onDPAdClicked(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdClicked map = $map")
}
}
private var dramaListener: IDPDramaListener = object : IDPDramaListener() {
override fun onDPSeekTo(position: Int, time: Long) {
super.onDPSeekTo(position, time)
Log.d(TAG, "onDPSeekTo:")
}
override fun onDPPageChange(position: Int, map: MutableMap<String, Any>?) {
super.onDPPageChange(position, map)
Log.d(TAG, "onDPPageChange:" + map?.toString())
}
override fun onDPVideoPlay(map: MutableMap<String, Any>?) {
super.onDPVideoPlay(map)
Log.d(TAG, "onDPVideoPlay:" + map?.toString())
(map?.get("index") as? Int?)?.let {
lastIndex = it
}
}
override fun onDPVideoPause(map: MutableMap<String, Any>?) {
super.onDPVideoPause(map)
Log.d(TAG, "onDPVideoPause:" + map?.toString())
}
override fun onDPVideoContinue(map: MutableMap<String, Any>?) {
super.onDPVideoContinue(map)
Log.d(TAG, "onDPVideoContinue:" + map?.toString())
}
override fun onDPVideoCompletion(map: MutableMap<String, Any>?) {
super.onDPVideoCompletion(map)
Log.d(TAG, "onDPVideoCompletion:" + map?.toString())
}
override fun onDPVideoOver(map: MutableMap<String, Any>?) {
super.onDPVideoOver(map)
Log.d(TAG, "onDPVideoOver:" + map?.toString())
}
override fun onDPClose() {
super.onDPClose()
Log.d(TAG, "onDPClose")
}
override fun onDPRequestStart(map: MutableMap<String, Any>?) {
super.onDPRequestStart(map)
Log.d(TAG, "onDPRequestStart:" + map?.toString())
}
override fun onDPRequestFail(code: Int, msg: String?, map: MutableMap<String, Any>?) {
super.onDPRequestFail(code, msg, map)
Log.d(TAG, "onDPRequestFail:" + map?.toString())
}
override fun onDPRequestSuccess(list: MutableList<MutableMap<String, Any>>?) {
super.onDPRequestSuccess(list)
list?.forEach {
Log.d(TAG, "onDPRequestSuccess:$it")
}
}
override fun isNeedBlock(
drama: DPDrama?,
index: Int,
map: MutableMap<String, Any>?
): Boolean {
drama ?: return false
Log.d(TAG, "isNeedBlock: index = $index")
val unlockIndex = mUnlockIndexMap[drama.id] ?: mInitUnlockIndex
val hasUnlockList = mHasUnlockIndexMap[drama.id] ?: mutableListOf()
return index > unlockIndex && hasUnlockList.contains(index).not()
}
override fun showAdIfNeeded(
drama: DPDrama?,
callback: Callback?,
map: MutableMap<String, Any>?
) {
super.showAdIfNeeded(drama, callback, map)
drama ?: return
Log.d(TAG, "showAdIfNeeded:" + map?.toString())
blockView?.visibility = View.VISIBLE
dpWidget?.let { widget ->
unlockBtn?.setOnClickListener {
AdManager.instance.showAd(
this@DramaApiDetailActivity,
"",
object : AdStatusListener {
override fun adSuccess() {
val hasUnlockList: MutableList<Int> =
mHasUnlockIndexMap[drama.id] ?: mutableListOf()
hasUnlockList.add(widget.currentDramaIndex)
mHasUnlockIndexMap[drama.id] = hasUnlockList
blockView?.visibility = View.GONE
callback?.onDramaRewardArrived() // 解锁当前集
}
override fun adFail() {
}
override fun adClose() {
}
})
}
}
}
override fun onDramaSwitch(map: MutableMap<String, Any>?) {
super.onDramaSwitch(map)
Log.d(TAG, "onDramaSwitch:" + map?.toString())
val title = map?.get("title") as? String?
val total = map?.get("total") as? Int?
tv_info.text = String.format("《%s》共%d集", title, total)
}
override fun onDramaGalleryClick(map: MutableMap<String, Any>?) {
super.onDramaGalleryClick(map)
map?.let {
Log.d(TAG, "onDramaGalleryClick: $it")
}
}
override fun onDramaGalleryShow(map: MutableMap<String, Any>?) {
super.onDramaGalleryShow(map)
map?.let {
Log.d(TAG, "onDramaGalleryShow: $it")
}
}
override fun onRewardDialogShow(map: MutableMap<String, Any>?) {
super.onRewardDialogShow(map)
map?.let {
Log.d(TAG, "onRewardDialogShow: $it")
}
}
override fun onUnlockDialogAction(action: String?, map: MutableMap<String, Any>?) {
super.onUnlockDialogAction(action, map)
map?.let {
Log.d(TAG, "onUnlockDialogAction: action=$action map=$it")
}
}
}
}
\ No newline at end of file
package com.mints.wisdomclean.video
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.bytedance.sdk.dp.DPDramaDetailConfig
import com.bytedance.sdk.dp.DPSdk
import com.bytedance.sdk.dp.DPWidgetDrawParams
import com.bytedance.sdk.dp.IDPAdListener
import com.bytedance.sdk.dp.IDPDramaListener
import com.bytedance.sdk.dp.IDPDrawListener
import com.bytedance.sdk.dp.IDPWidget
import com.mints.wisdomclean.R
import com.mints.wisdomclean.ui.fragment.base.BaseFragment
/**
* Created by limingqi on 2023/1/17
*/
class DramaTabFragment : BaseFragment() {
companion object {
private const val TAG = "DramaTabFragment"
private const val FREE_SET = -1
private const val LOCK_SET = -1
}
private var dpWidget: IDPWidget? = null
private var isInited = false
override fun initViewsAndEvents() {
if (DPSdk.isStartSuccess()) {
init()
}
}
override fun getContentViewLayoutID() = R.layout.drama_home_frag_wrapper
private fun init() {
if (isInited) {
return
}
initDrawWidget()
isInited = true
}
private fun initDrawWidget() {
if (!DPHolderManager.isDPStarted) {
this.view?.postDelayed({
initDrawWidget()
}, 100)
return
}
val dramaDetailConfig = DPDramaDetailConfig.obtain(DPDramaDetailConfig.COMMON_DETAIL)
.freeSet(FREE_SET)
.lockSet(LOCK_SET)
.hideMore(false)
.hideLeftTopTips(false, null)
.listener(dramaListener) // 短剧详情页视频播放回调
.adListener(dramaAdListener) // 短剧详情页激励视频回调
dpWidget = DPSdk.factory().createDraw(
DPWidgetDrawParams.obtain()
.adOffset(0) //单位 dp,为 0 时可以不设置
.drawContentType(DPWidgetDrawParams.DRAW_CONTENT_TYPE_ONLY_DRAMA)
.drawChannelType(DPWidgetDrawParams.DRAW_CHANNEL_TYPE_RECOMMEND)
.hideClose(true, null)
.hideChannelName(true)
.dramaDetailConfig(dramaDetailConfig)
.listener(drawListener) // 混排流内视频监听
.adListener(drawAdListener) // 混排流内广告监听
)
dpWidget?.fragment?.userVisibleHint = userVisibleHint
dpWidget?.let {
if (isAdded.not()) {
return
}
childFragmentManager.beginTransaction().apply {
replace(R.id.fl_container, it.fragment)
this.commitNowAllowingStateLoss()
}
}
}
override fun onResume() {
super.onResume()
Log.d(TAG, "onResume")
dpWidget?.fragment?.onResume()
}
override fun onPause() {
super.onPause()
Log.d(TAG, "onPause")
dpWidget?.fragment?.onPause()
}
override fun onHiddenChanged(hidden: Boolean) {
super.onHiddenChanged(hidden)
dpWidget?.fragment?.onHiddenChanged(hidden)
}
override fun setUserVisibleHint(isVisibleToUser: Boolean) {
super.setUserVisibleHint(isVisibleToUser)
dpWidget?.fragment?.userVisibleHint = isVisibleToUser
}
private var dramaListener: IDPDramaListener = object : IDPDramaListener() {
override fun onDPSeekTo(position: Int, time: Long) {
super.onDPSeekTo(position, time)
Log.d(TAG, "onDPSeekTo:")
}
override fun onDPPageChange(position: Int, map: MutableMap<String, Any>?) {
super.onDPPageChange(position, map)
Log.d(TAG, "onDPPageChange:" + map?.toString())
}
override fun onDPVideoPlay(map: MutableMap<String, Any>?) {
super.onDPVideoPlay(map)
Log.d(TAG, "onDPVideoPlay:" + map?.toString())
}
override fun onDPVideoPause(map: MutableMap<String, Any>?) {
super.onDPVideoPause(map)
Log.d(TAG, "onDPVideoPause:" + map?.toString())
}
override fun onDPVideoContinue(map: MutableMap<String, Any>?) {
super.onDPVideoContinue(map)
Log.d(TAG, "onDPVideoContinue:" + map?.toString())
}
override fun onDPVideoCompletion(map: MutableMap<String, Any>?) {
super.onDPVideoCompletion(map)
Log.d(TAG, "onDPVideoCompletion:" + map?.toString())
}
override fun onDPVideoOver(map: MutableMap<String, Any>?) {
super.onDPVideoOver(map)
Log.d(TAG, "onDPVideoOver:" + map?.toString())
}
override fun onDPClose() {
super.onDPClose()
Log.d(TAG, "onDPClose")
}
override fun onDPRequestStart(map: MutableMap<String, Any>?) {
super.onDPRequestStart(map)
Log.d(TAG, "onDPRequestStart:" + map?.toString())
}
override fun onDPRequestFail(code: Int, msg: String?, map: MutableMap<String, Any>?) {
super.onDPRequestFail(code, msg, map)
Log.d(TAG, "onDPRequestFail:" + map?.toString())
}
override fun onDPRequestSuccess(list: MutableList<MutableMap<String, Any>>?) {
super.onDPRequestSuccess(list)
list?.forEach { it ->
Log.d(TAG, "onDPRequestSuccess:" + it.toString())
}
}
override fun onDramaSwitch(map: MutableMap<String, Any>?) {
super.onDramaSwitch(map)
Log.d(TAG, "onDramaSwitch:" + map?.toString())
}
}
private val drawListener = object : IDPDrawListener() {
override fun onDPRefreshFinish() {
Log.d(TAG, "onDPRefreshFinish")
}
override fun onDPPageChange(position: Int) {
Log.d(TAG, "onDPPageChange: $position")
}
override fun onDPVideoPlay(map: Map<String, Any>) {
Log.d(TAG, "onDPVideoPlay: $map")
}
override fun onDPVideoCompletion(map: Map<String, Any>) {
Log.d(TAG, "onDPVideoCompletion: $map")
}
override fun onDPVideoOver(map: Map<String, Any>) {
Log.d(TAG, "onDPVideoOver: $map")
}
override fun onDPClose() {
Log.d(TAG, "onDPClose")
}
override fun onDPRequestStart(map: Map<String, Any>?) {
Log.d(TAG, "onDPRequestStart: $map")
}
override fun onDPRequestSuccess(list: List<Map<String, Any>>) {
Log.d(TAG, "onDPRequestSuccess: $list")
}
override fun onDPRequestFail(
code: Int, msg: String, map: Map<String, Any>?
) {
Log.d(TAG, "onDPRequestFail: code = $code, msg = $msg, map = $map")
}
override fun onDPClickAuthorName(map: Map<String, Any>) {
Log.d(TAG, "onDPClickAuthorName: $map")
}
override fun onDPClickAvatar(map: Map<String, Any>) {
Log.d(TAG, "onDPClickAvatar: $map")
}
override fun onDPClickComment(map: Map<String, Any>) {
Log.d(TAG, "onDPClickComment: $map")
}
override fun onDPClickLike(
isLike: Boolean, map: Map<String, Any>
) {
Log.d(TAG, "onDPClickLike: isLike = $isLike, map = $map")
}
override fun onDPVideoPause(map: Map<String, Any>) {
Log.d(TAG, "onDPVideoPause: $map")
}
override fun onDPVideoContinue(map: Map<String, Any>) {
Log.d(TAG, "onDPVideoContinue: $map")
}
override fun onDPClickShare(map: MutableMap<String, Any>?) {
Log.d(TAG, "onDPClickShare $map")
}
}
private val dramaAdListener: IDPAdListener = object : IDPAdListener() {
override fun onDPAdRequest(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdRequest map = $map")
}
override fun onDPAdRequestSuccess(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdRequestSuccess map = $map")
}
override fun onDPAdRequestFail(code: Int, msg: String?, map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdRequestFail map = $map")
}
override fun onDPAdFillFail(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdFillFail map = $map")
}
override fun onDPAdShow(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdShow map = $map")
}
override fun onDPAdPlayStart(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdPlayStart: map = $map")
}
override fun onDPAdPlayPause(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdPlayPause map = $map")
}
override fun onRewardVerify(map: MutableMap<String, Any>?) {
Log.d(TAG, "onRewardVerify map = $map")
}
override fun onSkippedVideo(map: MutableMap<String, Any>?) {
Log.d(TAG, "onSkippedVideo map = $map")
}
override fun onDPAdPlayContinue(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdPlayContinue map = $map")
}
override fun onDPAdPlayComplete(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdPlayComplete map = $map")
}
override fun onDPAdClicked(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdClicked map = $map")
}
}
private val drawAdListener: IDPAdListener = object : IDPAdListener() {
override fun onDPAdRequest(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdRequest map = $map")
}
override fun onDPAdRequestSuccess(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdRequestSuccess map = $map")
}
override fun onDPAdRequestFail(code: Int, msg: String?, map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdRequestFail map = $map")
}
override fun onDPAdFillFail(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdFillFail map = $map")
}
override fun onDPAdShow(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdShow map = $map")
}
override fun onDPAdPlayStart(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdPlayStart: map = $map")
}
override fun onDPAdPlayPause(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdPlayPause map = $map")
}
override fun onDPAdPlayContinue(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdPlayContinue map = $map")
}
override fun onDPAdPlayComplete(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdPlayComplete map = $map")
}
override fun onDPAdClicked(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdClicked map = $map")
}
}
}
\ No newline at end of file
package com.mints.wisdomclean.video
import android.content.Intent
import android.os.Bundle
import android.os.SystemClock
import android.util.Log
import com.bytedance.sdk.dp.DPDramaDetailConfig
import com.bytedance.sdk.dp.DPSdk
import com.bytedance.sdk.dp.DPWidgetDrawParams
import com.bytedance.sdk.dp.IDPAdListener
import com.bytedance.sdk.dp.IDPDramaListener
import com.bytedance.sdk.dp.IDPDrawListener
import com.bytedance.sdk.dp.IDPWidget
import com.mints.wisdomclean.R
import com.mints.wisdomclean.ui.fragment.base.BaseFragment
import com.mints.wisdomclean.video.DramaApiDetailActivity.Companion.KEY_DRAMA_CURRENT_DURATION
import com.mints.wisdomclean.video.DramaApiDetailActivity.Companion.KEY_DRAMA_UNLOCK_INDEX
/**
* Created by limingqi on 2023/5/10
*/
class DrawDramaFragment : BaseFragment() {
companion object {
private const val TAG = "DrawDramaActivity"
const val CHANNEL_TYPE = "channel_type"
const val CONTENT_TYPE = "content_type"
const val DETAIL_MODE = "detail_mode"
const val HIDE_INFO = "hide_info"
const val HIDE_ENTER = "hide_enter"
private const val FREE_SET = -1
private const val LOCK_SET = -1
}
override fun initViewsAndEvents() {
if (DPSdk.isStartSuccess()) {
init()
}
}
override fun getContentViewLayoutID() = R.layout.draw_drama_activity
private var dpWidget: IDPWidget? = null
private var lastBackTime: Long = -1
private var channelType = DPWidgetDrawParams.DRAW_CHANNEL_TYPE_RECOMMEND
private var contentType = DPWidgetDrawParams.DRAW_CONTENT_TYPE_ONLY_DRAMA
private var detailMode = DPDramaDetailConfig.COMMON_DETAIL
private var mIsHideInfo = false
private var mIsHideEnter = false
private var isInited = false
// override fun onCreate(savedInstanceState: Bundle?) {
// super.onCreate(savedInstanceState)
// intent?.let { intent ->
// channelType =
// intent.getIntExtra(CHANNEL_TYPE, DPWidgetDrawParams.DRAW_CHANNEL_TYPE_RECOMMEND)
// contentType =
// intent.getIntExtra(CONTENT_TYPE, DPWidgetDrawParams.DRAW_CONTENT_TYPE_ONLY_DRAMA)
// intent.getStringExtra(DETAIL_MODE)?.let {
// detailMode = it
// }
// mIsHideInfo = intent.getBooleanExtra(HIDE_INFO, false)
// mIsHideEnter = intent.getBooleanExtra(HIDE_ENTER, false)
// }
//
// }
private fun init() {
if (isInited) {
return
}
//初始化draw组件
initDrawWidget()
dpWidget?.let {
supportFragmentManager.beginTransaction()
.replace(R.id.draw_drama_frame, it.fragment)
.commitAllowingStateLoss()
isInited = true
}
}
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
outState.putParcelable("android:support:fragments", null)
}
private fun initDrawWidget() {
val dramaDetailConfig = DPDramaDetailConfig.obtain(detailMode)
.setEnterDelegate { context, drama, current ->
DramaApiDetailActivity.outerDrama = drama
val intent = Intent(context, DramaApiDetailActivity::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
DramaApiDetailActivity.outerDrama = drama
intent.putExtra(KEY_DRAMA_UNLOCK_INDEX, 100)
intent.putExtra(KEY_DRAMA_CURRENT_DURATION, current)
context.startActivity(intent)
}
.freeSet(FREE_SET)
.lockSet(LOCK_SET)
.listener(dramaListener)
.adListener(dramaAdListener)
dpWidget = DPSdk.factory().createDraw(
DPWidgetDrawParams.obtain()
.adOffset(0) //单位 dp,为 0 时可以不设置
.drawContentType(contentType)
.drawChannelType(channelType)
.hideChannelName(channelType == DPWidgetDrawParams.DRAW_CHANNEL_TYPE_RECOMMEND)
.hideDramaInfo(mIsHideInfo)
.hideDramaEnter(mIsHideEnter)
.dramaDetailConfig(dramaDetailConfig)
.hideClose(false, null)
.listener(drawListener)
.adListener(drawAdListener)
)
}
private fun log(msg: String) {
Log.d(TAG, msg)
}
// override fun onBackPressed() {
// if (dpWidget != null && !dpWidget!!.canBackPress()) {
// return
// }
// if (dpWidget == null) {
// return
// }
// val current = SystemClock.elapsedRealtime()
// if (current - lastBackTime > 3000) {
// lastBackTime = current
// dpWidget?.backRefresh()
// return
// }
// super.onBackPressed()
// }
override fun onDestroy() {
super.onDestroy()
dpWidget?.destroy()
}
private var dramaListener: IDPDramaListener = object : IDPDramaListener() {
override fun onDPSeekTo(position: Int, time: Long) {
super.onDPSeekTo(position, time)
Log.d(TAG, "onDPSeekTo:")
}
override fun onDPPageChange(position: Int, map: MutableMap<String, Any>?) {
super.onDPPageChange(position, map)
Log.d(TAG, "onDPPageChange:" + map?.toString())
}
override fun onDPVideoPlay(map: MutableMap<String, Any>?) {
super.onDPVideoPlay(map)
Log.d(TAG, "onDPVideoPlay:" + map?.toString())
}
override fun onDPVideoPause(map: MutableMap<String, Any>?) {
super.onDPVideoPause(map)
Log.d(TAG, "onDPVideoPause:" + map?.toString())
}
override fun onDPVideoContinue(map: MutableMap<String, Any>?) {
super.onDPVideoContinue(map)
Log.d(TAG, "onDPVideoContinue:" + map?.toString())
}
override fun onDPVideoCompletion(map: MutableMap<String, Any>?) {
super.onDPVideoCompletion(map)
Log.d(TAG, "onDPVideoCompletion:" + map?.toString())
}
override fun onDPVideoOver(map: MutableMap<String, Any>?) {
super.onDPVideoOver(map)
Log.d(TAG, "onDPVideoOver:" + map?.toString())
}
override fun onDPClose() {
super.onDPClose()
Log.d(TAG, "onDPClose")
}
override fun onDPRequestStart(map: MutableMap<String, Any>?) {
super.onDPRequestStart(map)
Log.d(TAG, "onDPRequestStart:" + map?.toString())
}
override fun onDPRequestFail(code: Int, msg: String?, map: MutableMap<String, Any>?) {
super.onDPRequestFail(code, msg, map)
Log.d(TAG, "onDPRequestFail:" + map?.toString())
}
override fun onDPRequestSuccess(list: MutableList<MutableMap<String, Any>>?) {
super.onDPRequestSuccess(list)
list?.forEach { it ->
Log.d(TAG, "onDPRequestSuccess:" + it.toString())
}
}
override fun onDramaSwitch(map: MutableMap<String, Any>?) {
super.onDramaSwitch(map)
Log.d(TAG, "onDramaSwitch:" + map?.toString())
}
}
private val drawListener = object : IDPDrawListener() {
override fun onDPRefreshFinish() {
Log.d(TAG, "onDPRefreshFinish")
}
override fun onDPPageChange(position: Int) {
Log.d(TAG, "onDPPageChange: $position")
}
override fun onDPVideoPlay(map: Map<String, Any>) {
Log.d(TAG, "onDPVideoPlay: $map")
}
override fun onDPVideoCompletion(map: Map<String, Any>) {
Log.d(TAG, "onDPVideoCompletion: $map")
}
override fun onDPVideoOver(map: Map<String, Any>) {
Log.d(TAG, "onDPVideoOver: $map")
}
override fun onDPClose() {
Log.d(TAG, "onDPClose")
}
override fun onDPRequestStart(map: Map<String, Any>?) {
Log.d(TAG, "onDPRequestStart: $map")
}
override fun onDPRequestSuccess(list: List<Map<String, Any>>) {
Log.d(TAG, "onDPRequestSuccess: $list")
}
override fun onDPRequestFail(
code: Int, msg: String, map: Map<String, Any>?
) {
Log.d(TAG, "onDPRequestFail: code = $code, msg = $msg, map = $map")
}
override fun onDPClickAuthorName(map: Map<String, Any>) {
Log.d(TAG, "onDPClickAuthorName: $map")
}
override fun onDPClickAvatar(map: Map<String, Any>) {
Log.d(TAG, "onDPClickAvatar: $map")
}
override fun onDPClickComment(map: Map<String, Any>) {
Log.d(TAG, "onDPClickComment: $map")
}
override fun onDPClickLike(
isLike: Boolean, map: Map<String, Any>
) {
Log.d(TAG, "onDPClickLike: isLike = $isLike, map = $map")
}
override fun onDPVideoPause(map: Map<String, Any>) {
Log.d(TAG, "onDPVideoPause: $map")
}
override fun onDPVideoContinue(map: Map<String, Any>) {
Log.d(TAG, "onDPVideoContinue: $map")
}
override fun onDPClickShare(map: MutableMap<String, Any>?) {
Log.d(TAG, "onDPClickShare $map")
}
}
private val dramaAdListener: IDPAdListener = object : IDPAdListener() {
override fun onDPAdRequest(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdRequest map = $map")
}
override fun onDPAdRequestSuccess(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdRequestSuccess map = $map")
}
override fun onDPAdRequestFail(code: Int, msg: String?, map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdRequestFail map = $map")
}
override fun onDPAdFillFail(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdFillFail map = $map")
}
override fun onDPAdShow(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdShow map = $map")
}
override fun onDPAdPlayStart(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdPlayStart: map = $map")
}
override fun onDPAdPlayPause(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdPlayPause map = $map")
}
override fun onDPAdPlayContinue(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdPlayContinue map = $map")
}
override fun onDPAdPlayComplete(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdPlayComplete map = $map")
}
override fun onDPAdClicked(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdClicked map = $map")
}
}
private val drawAdListener: IDPAdListener = object : IDPAdListener() {
override fun onDPAdRequest(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdRequest map = $map")
}
override fun onDPAdRequestSuccess(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdRequestSuccess map = $map")
}
override fun onDPAdRequestFail(code: Int, msg: String?, map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdRequestFail map = $map")
}
override fun onDPAdFillFail(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdFillFail map = $map")
}
override fun onDPAdShow(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdShow map = $map")
}
override fun onDPAdPlayStart(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdPlayStart: map = $map")
}
override fun onDPAdPlayPause(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdPlayPause map = $map")
}
override fun onDPAdPlayContinue(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdPlayContinue map = $map")
}
override fun onDPAdPlayComplete(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdPlayComplete map = $map")
}
override fun onDPAdClicked(map: Map<String?, Any?>) {
Log.d(TAG, "onDPAdClicked map = $map")
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="6dp" />
<solid android:color="@color/half_transparent" />
</shape>
\ No newline at end of file
...@@ -82,5 +82,36 @@ ...@@ -82,5 +82,36 @@
android:textStyle="bold" /> android:textStyle="bold" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<LinearLayout
android:id="@+id/ll_edit"
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_alignParentBottom="true"
android:background="@color/white"
android:elevation="2dp"
android:orientation="horizontal"
android:visibility="gone">
<TextView
android:id="@+id/tv_full"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="全选"
android:textColor="@color/black" />
<TextView
android:id="@+id/tv_delete"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="删除"
android:textColor="@color/red" />
</LinearLayout>
</RelativeLayout> </RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/fl_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/tv_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:textColor="#FFFFFFFF"
android:textSize="16sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:gravity="bottom"
android:orientation="horizontal">
<EditText
android:id="@+id/et_drama_index"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:inputType="number"
android:text="10"
android:textColor="#f00"
android:textSize="14sp" />
<Button
android:id="@+id/btn_go"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="跳转到指定集数"
android:textSize="13sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/block_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#99000000"
android:gravity="center"
android:orientation="vertical">
<Button
android:id="@+id/unlock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="解锁" />
<Button
android:id="@+id/leave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="离开" />
</LinearLayout>
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/fl_container"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/draw_drama_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
\ No newline at end of file
...@@ -10,15 +10,48 @@ ...@@ -10,15 +10,48 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:overScrollMode="never" /> android:overScrollMode="never" />
<com.google.android.material.tabs.TabLayout <FrameLayout
android:id="@+id/tab_recommend" android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="48dp" android:layout_height="48dp"
android:layout_gravity="center_horizontal" android:layout_marginTop="20dp">
android:layout_marginTop="20dp"
app:tabBackground="@null" <com.google.android.material.tabs.TabLayout
app:tabIndicatorHeight="0dp" android:id="@+id/tab_recommend"
app:tabMode="fixed" android:layout_width="wrap_content"
app:tabRippleColor="@null" /> android:layout_height="48dp"
android:layout_gravity="center_horizontal"
app:tabBackground="@null"
app:tabIndicatorHeight="0dp"
app:tabMode="fixed"
app:tabRippleColor="@null" />
<TextView
android:id="@+id/tv_edit_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="追剧"
android:textColor="@color/black"
android:textSize="16sp"
android:visibility="gone" />
<ImageView
android:id="@+id/iv_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|center_vertical"
android:layout_marginEnd="10dp"
android:src="@mipmap/ic_arrow_back" />
<ImageView
android:id="@+id/iv_edit_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|center_vertical"
android:layout_marginEnd="10dp"
android:src="@mipmap/ic_close"
android:visibility="gone" />
</FrameLayout>
</FrameLayout> </FrameLayout>
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="180dp">
<ImageView <ImageView
android:id="@+id/image_iv" android:id="@+id/image_iv"
...@@ -44,4 +44,26 @@ ...@@ -44,4 +44,26 @@
app:layout_constraintStart_toStartOf="@id/image_iv" app:layout_constraintStart_toStartOf="@id/image_iv"
app:layout_constraintTop_toBottomOf="@id/title_tv" /> app:layout_constraintTop_toBottomOf="@id/title_tv" />
<FrameLayout
android:id="@+id/fm_mask"
android:layout_width="100dp"
android:layout_height="180dp"
android:background="@drawable/shape_half_trans2"
app:layout_constraintEnd_toEndOf="@id/image_iv"
app:layout_constraintStart_toStartOf="@id/image_iv"
app:layout_constraintTop_toTopOf="@id/image_iv">
<CheckBox
android:id="@+id/cb"
style="@style/Widget.AppCompat.CompoundButton.RadioButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginTop="4dp"
android:layout_marginEnd="4dp"
android:visibility="visible" />
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
...@@ -44,4 +44,4 @@ RELEASE_UMENG_KEY=64a67d4fa1a164591b44f0e8 ...@@ -44,4 +44,4 @@ RELEASE_UMENG_KEY=64a67d4fa1a164591b44f0e8
GROMORE_APP_ID="5404192" GROMORE_APP_ID="5404192"
GROMORE_SPLASH_CODE="102371299" GROMORE_SPLASH_CODE="102371299"
GROMORE_VIDEO_CODE="1" GROMORE_VIDEO_CODE="102385608"
\ No newline at end of file \ 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