Commit f58eb093 authored by jyx's avatar jyx

代码优化

parent 542ea2b7
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" /> <component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_15" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">
......
...@@ -69,11 +69,7 @@ ...@@ -69,11 +69,7 @@
android:configChanges="orientation|screenSize|keyboardHidden" android:configChanges="orientation|screenSize|keyboardHidden"
android:exported="true" android:exported="true"
android:theme="@style/AppTheme.TranslucentSplish"> android:theme="@style/AppTheme.TranslucentSplish">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity> </activity>
<activity <activity
android:name=".ui.activitys.SplashAdActivity" android:name=".ui.activitys.SplashAdActivity"
...@@ -89,11 +85,15 @@ ...@@ -89,11 +85,15 @@
<activity <activity
android:name=".ui.activitys.MainActivity" android:name=".ui.activitys.MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize" android:configChanges="orientation|keyboardHidden|screenSize"
android:exported="false" android:exported="true"
android:launchMode="singleTask" android:launchMode="singleTask"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoneTranslucent"> android:theme="@style/AppTheme.NoneTranslucent">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity> </activity>
<activity <activity
android:name=".ui.activitys.WebActivity" android:name=".ui.activitys.WebActivity"
......
...@@ -52,4 +52,5 @@ public class TrackManager { ...@@ -52,4 +52,5 @@ public class TrackManager {
trackPresenter.commitVedio(vo); trackPresenter.commitVedio(vo);
} }
} }
} }
package com.mints.wisdomclean.mvp.model;
import java.io.Serializable;
import java.util.List;
public class IndexList implements Serializable {
private VedioBean vedioMsg;
private List<VedioEpisodeBean> list;
public VedioBean getVedioMsg() {
return vedioMsg;
}
public void setVedioMsg(VedioBean list) {
this.vedioMsg = list;
}
public List<VedioEpisodeBean> getList() {
return list;
}
public void setList(List<VedioEpisodeBean> list) {
this.list = list;
}
public class VedioEpisodeBean implements Serializable {
private String vedioUrl;
private int vedioIndex;
private boolean lock;
private String title;
private int vedioId;
public String getVedioUrl() {
return vedioUrl;
}
public void setVedioUrl(String vedioUrl) {
this.vedioUrl = vedioUrl;
}
public int getVedioIndex() {
return vedioIndex;
}
public void setVedioIndex(int vedioIndex) {
this.vedioIndex = vedioIndex;
}
public boolean isLock() {
return lock;
}
public void setLock(boolean lock) {
this.lock = lock;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public int getVedioId() {
return vedioId;
}
public void setVedioId(int vedioId) {
this.vedioId = vedioId;
}
}
}
package com.mints.wisdomclean.mvp.model
import com.chad.library.adapter.base.entity.MultiItemEntity
data class VideoMultiItemEntity(
override val itemType: Int,
var video: IndexList.VedioEpisodeBean
) : MultiItemEntity,
java.io.Serializable {
companion object {
const val MULTI_ITEM_1 = 1
const val MULTI_ITEM_2 = 2
}
}
\ No newline at end of file
package com.mints.wisdomclean.mvp.presenters package com.mints.wisdomclean.mvp.presenters
import com.google.gson.JsonObject
import com.mints.library.net.neterror.BaseSubscriber import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable import com.mints.library.net.neterror.Throwable
import com.mints.wisdomclean.manager.AppHttpManager import com.mints.wisdomclean.manager.AppHttpManager
import com.mints.wisdomclean.mvp.model.BannerList
import com.mints.wisdomclean.mvp.model.BaseResponse import com.mints.wisdomclean.mvp.model.BaseResponse
import com.mints.wisdomclean.mvp.model.IndexList
import com.mints.wisdomclean.mvp.views.VideoView import com.mints.wisdomclean.mvp.views.VideoView
import java.util.HashMap import java.util.HashMap
...@@ -12,16 +13,16 @@ class VideoPresenter : BasePresenter<VideoView>() { ...@@ -12,16 +13,16 @@ class VideoPresenter : BasePresenter<VideoView>() {
fun getIndexList(videoId: String) { fun getIndexList(videoId: String) {
val vo = HashMap<String, Any>() val vo = HashMap<String, Any>()
vo["videoId"] = videoId vo["vedioId"] = videoId
AppHttpManager.getInstance(loanApplication) AppHttpManager.getInstance(loanApplication)
.call(loanService.getIndexList(vo), .call(loanService.getIndexList(vo),
object : BaseSubscriber<BaseResponse<BannerList>>() { object : BaseSubscriber<BaseResponse<IndexList>>() {
override fun onCompleted() { override fun onCompleted() {
if (isLinkView) return if (isLinkView) return
view.hideLoading() view.hideLoading()
} }
override fun onNext(baseResponse: BaseResponse<BannerList>) { override fun onNext(baseResponse: BaseResponse<IndexList>) {
if (isLinkView) return if (isLinkView) return
view.hideLoading() view.hideLoading()
...@@ -29,7 +30,7 @@ class VideoPresenter : BasePresenter<VideoView>() { ...@@ -29,7 +30,7 @@ class VideoPresenter : BasePresenter<VideoView>() {
val message = baseResponse.message val message = baseResponse.message
when (code) { when (code) {
200 -> view.getIndexListSuc() 200 -> view.getIndexListSuc(baseResponse.data)
else -> { else -> {
view.getIndexListFail() view.getIndexListFail()
view.showToast(message) view.showToast(message)
...@@ -46,6 +47,122 @@ class VideoPresenter : BasePresenter<VideoView>() { ...@@ -46,6 +47,122 @@ class VideoPresenter : BasePresenter<VideoView>() {
} }
}) })
}
fun collect(videoId: String) {
val vo = HashMap<String, Any>()
vo["vedioId"] = videoId
AppHttpManager.getInstance(loanApplication)
.call(loanService.collect(vo), object : BaseSubscriber<BaseResponse<JsonObject>>() {
override fun onCompleted() {
if (isLinkView) return
view.hideLoading()
}
override fun onNext(baseResponse: BaseResponse<JsonObject>) {
if (isLinkView) return
view.hideLoading()
val code = baseResponse.status
val message = baseResponse.message
when (code) {
200 -> view.collectSuc()
else -> {
view.collectFail()
view.showToast(message)
}
}
}
override fun onError(e: Throwable?) {
if (isLinkView) return
view.hideLoading()
view.showToast(e?.message)
view.collectFail()
}
})
}
fun cancelCollect(videoId: String) {
val vo = HashMap<String, Any>()
vo["vedioId"] = videoId
AppHttpManager.getInstance(loanApplication)
.call(
loanService.cancelCollect(vo),
object : BaseSubscriber<BaseResponse<JsonObject>>() {
override fun onCompleted() {
if (isLinkView) return
view.hideLoading()
}
override fun onNext(baseResponse: BaseResponse<JsonObject>) {
if (isLinkView) return
view.hideLoading()
val code = baseResponse.status
val message = baseResponse.message
when (code) {
200 -> view.cancelCollectSuc()
else -> {
view.cancelCollectFail()
view.showToast(message)
}
}
}
override fun onError(e: Throwable?) {
if (isLinkView) return
view.hideLoading()
view.showToast(e?.message)
view.cancelCollectFail()
}
})
}
fun unlock(vo: HashMap<String, Any>) {
AppHttpManager.getInstance(loanApplication)
.call(
loanService.unlock(vo),
object : BaseSubscriber<BaseResponse<IndexList>>() {
override fun onCompleted() {
if (isLinkView) return
view.hideLoading()
}
override fun onNext(baseResponse: BaseResponse<IndexList>) {
if (isLinkView) return
view.hideLoading()
val code = baseResponse.status
val message = baseResponse.message
when (code) {
200 -> view.unlockSuc(baseResponse.data)
else -> {
view.unlockFail()
view.showToast(message)
}
}
}
override fun onError(e: Throwable?) {
if (isLinkView) return
view.hideLoading()
view.showToast(e?.message)
view.unlockFail()
}
})
} }
......
package com.mints.wisdomclean.mvp.views package com.mints.wisdomclean.mvp.views
import com.mints.wisdomclean.mvp.model.IndexList
interface VideoView : BaseView { interface VideoView : BaseView {
fun getIndexListSuc() fun getIndexListSuc(indexList: IndexList)
fun getIndexListFail() fun getIndexListFail()
fun collectSuc()
fun collectFail()
fun cancelCollectSuc()
fun cancelCollectFail()
fun unlockSuc(indexList: IndexList)
fun unlockFail()
} }
\ No newline at end of file
...@@ -9,6 +9,7 @@ import com.mints.wisdomclean.mvp.model.BannerList; ...@@ -9,6 +9,7 @@ import com.mints.wisdomclean.mvp.model.BannerList;
import com.mints.wisdomclean.mvp.model.BaseResponse; import com.mints.wisdomclean.mvp.model.BaseResponse;
import com.mints.wisdomclean.mvp.model.BannerList; import com.mints.wisdomclean.mvp.model.BannerList;
import com.mints.wisdomclean.mvp.model.HotStyleTypesList; import com.mints.wisdomclean.mvp.model.HotStyleTypesList;
import com.mints.wisdomclean.mvp.model.IndexList;
import com.mints.wisdomclean.mvp.model.OrderRecordBean; import com.mints.wisdomclean.mvp.model.OrderRecordBean;
import com.mints.wisdomclean.mvp.model.UserBean; import com.mints.wisdomclean.mvp.model.UserBean;
import com.mints.wisdomclean.mvp.model.Version; import com.mints.wisdomclean.mvp.model.Version;
...@@ -150,7 +151,7 @@ public interface LoanService { ...@@ -150,7 +151,7 @@ public interface LoanService {
* @return * @return
*/ */
@POST("api/vedio/unlock") @POST("api/vedio/unlock")
Observable<BaseResponse<JsonObject>> unlock(@Body Map<String, Object> vo); Observable<BaseResponse<IndexList>> unlock(@Body Map<String, Object> vo);
/** /**
* 首页分类 * 首页分类
...@@ -199,7 +200,7 @@ public interface LoanService { ...@@ -199,7 +200,7 @@ public interface LoanService {
* @return * @return
*/ */
@POST("api/vedio/getIndexList") @POST("api/vedio/getIndexList")
Observable<BaseResponse<Object>> getIndexList(@Body Map<String, Object> vo); Observable<BaseResponse<IndexList>> getIndexList(@Body Map<String, Object> vo);
/** /**
* 播放链接 * 播放链接
......
...@@ -82,5 +82,4 @@ class WatchRecordAdapter : ...@@ -82,5 +82,4 @@ class WatchRecordAdapter :
view.setImageDrawable(lottieDrawable) view.setImageDrawable(lottieDrawable)
} }
} }
\ No newline at end of file
...@@ -71,6 +71,10 @@ class FollowVideoFragment : BaseFragment(), FollowView { ...@@ -71,6 +71,10 @@ class FollowVideoFragment : BaseFragment(), FollowView {
followPresenter.detachView() followPresenter.detachView()
} }
fun isListEmpty(): Boolean {
return datas.isEmpty()
}
override fun getCollectListSuc(bannerList: BannerList) { override fun getCollectListSuc(bannerList: BannerList) {
if (bannerList.list.isNotEmpty()) { if (bannerList.list.isNotEmpty()) {
......
...@@ -57,7 +57,11 @@ class RecommendFragment : BaseFragment(), View.OnClickListener { ...@@ -57,7 +57,11 @@ class RecommendFragment : BaseFragment(), View.OnClickListener {
updateTab(tab, true, mSelectTabIndex) updateTab(tab, true, mSelectTabIndex)
if (mSelectTabIndex == 0) { if (mSelectTabIndex == 0) {
changeBottomTabColor(false) changeBottomTabColor(false)
if ((fragments[0] as FollowVideoFragment).isListEmpty()) {
iv_edit.visibility = View.GONE
} else {
iv_edit.visibility = View.VISIBLE iv_edit.visibility = View.VISIBLE
}
} else { } else {
changeBottomTabColor(true) changeBottomTabColor(true)
iv_edit.visibility = View.GONE iv_edit.visibility = View.GONE
......
...@@ -11,6 +11,7 @@ import com.google.android.material.tabs.TabLayout ...@@ -11,6 +11,7 @@ import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayoutMediator import com.google.android.material.tabs.TabLayoutMediator
import com.mints.wisdomclean.R import com.mints.wisdomclean.R
import com.mints.wisdomclean.mvp.model.EpisodeBean import com.mints.wisdomclean.mvp.model.EpisodeBean
import com.mints.wisdomclean.mvp.model.IndexList
import com.mints.wisdomclean.ui.adapter.VideoEpisodeAdapter import com.mints.wisdomclean.ui.adapter.VideoEpisodeAdapter
import com.mints.wisdomclean.utils.CommonUtils import com.mints.wisdomclean.utils.CommonUtils
...@@ -19,7 +20,11 @@ import com.mints.wisdomclean.utils.CommonUtils ...@@ -19,7 +20,11 @@ import com.mints.wisdomclean.utils.CommonUtils
* @date 2023/7/5 * @date 2023/7/5
* @desc * @desc
*/ */
class VideoEpisodeDialog(context: Context, private val listener: DialogListener) : class VideoEpisodeDialog(
context: Context,
val indexList: IndexList?,
private val listener: DialogListener
) :
Dialog(context, R.style.dialog) { Dialog(context, R.style.dialog) {
private val lp: WindowManager.LayoutParams private val lp: WindowManager.LayoutParams
...@@ -35,8 +40,9 @@ class VideoEpisodeDialog(context: Context, private val listener: DialogListener) ...@@ -35,8 +40,9 @@ class VideoEpisodeDialog(context: Context, private val listener: DialogListener)
setContentView(R.layout.dialog_video_episode) setContentView(R.layout.dialog_video_episode)
// 设置window属性 // 设置window属性
lp = window!!.attributes lp = window!!.attributes
lp.gravity = Gravity.CENTER lp.gravity = Gravity.BOTTOM
lp.width = WindowManager.LayoutParams.MATCH_PARENT lp.width = WindowManager.LayoutParams.MATCH_PARENT
lp.height = WindowManager.LayoutParams.WRAP_CONTENT
lp.windowAnimations = R.style.DialogAnimBottom lp.windowAnimations = R.style.DialogAnimBottom
// lp.dimAmount = 0; // 去背景遮盖 // lp.dimAmount = 0; // 去背景遮盖
// lp.alpha = 1.0f;//透明效果 // lp.alpha = 1.0f;//透明效果
...@@ -55,12 +61,25 @@ class VideoEpisodeDialog(context: Context, private val listener: DialogListener) ...@@ -55,12 +61,25 @@ class VideoEpisodeDialog(context: Context, private val listener: DialogListener)
ivClose = findViewById(R.id.close_iv) ivClose = findViewById(R.id.close_iv)
ivClose.setOnClickListener(listener) ivClose.setOnClickListener(listener)
findViewById<TextView>(R.id.title_tv).text = indexList?.vedioMsg?.title
findViewById<TextView>(R.id.label_tv).text =
if (indexList?.vedioMsg?.completeStatus == 0) "已完结" else "未完结"
initVp() initVp()
} }
private fun initVp() { private fun initVp() {
for (i in 1..100) { for (i in 0 until indexList!!.vedioMsg.vedioTotal) {
mData.add(EpisodeBean(lock = false, playing = false, "" + i)) if (i < indexList.list.size) {
val index = indexList.list[i]
var playing = false
if (indexList.vedioMsg.seeIndex == i) {
playing = true
}
mData.add(EpisodeBean(index.isLock, playing, "" + (i + 1)))
} else {
mData.add(EpisodeBean(lock = true, playing = false, title = "" + (i + 1)))
}
} }
val subList = CommonUtils.getSubList(30, mData) val subList = CommonUtils.getSubList(30, mData)
adapter = VideoEpisodeAdapter() adapter = VideoEpisodeAdapter()
...@@ -115,8 +134,7 @@ class VideoEpisodeDialog(context: Context, private val listener: DialogListener) ...@@ -115,8 +134,7 @@ class VideoEpisodeDialog(context: Context, private val listener: DialogListener)
for (mDatum in mData) { for (mDatum in mData) {
mDatum.playing = false mDatum.playing = false
} }
mData[position - 1].playing = true mData[position].playing = true
// adapter?.notifyItemChanged(position)
adapter?.notifyDataSetChanged() adapter?.notifyDataSetChanged()
} }
......
...@@ -398,7 +398,7 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic ...@@ -398,7 +398,7 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
dialog!!.setCurrentIndex(lastIndex) dialog!!.setCurrentIndex(lastIndex)
dialog!!.show() dialog!!.show()
} else { } else {
dialog = VideoEpisodeDialog(this, object : DialogListener() { dialog = VideoEpisodeDialog(this,null, object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) { override fun onClick(dialog: Dialog?, v: View?) {
super.onClick(dialog, v) super.onClick(dialog, v)
dialog?.dismiss() dialog?.dismiss()
......
package com.mints.wisdomclean.video package com.mints.wisdomclean.video
import android.app.Activity
import android.util.Log import android.util.Log
import android.view.View
import android.widget.Button
import android.widget.LinearLayout
import cn.jzvd.Jzvd import cn.jzvd.Jzvd
import cn.jzvd.JzvdStd import cn.jzvd.JzvdStd
import com.airbnb.lottie.LottieAnimationView
import com.airbnb.lottie.LottieComposition
import com.airbnb.lottie.LottieCompositionFactory
import com.airbnb.lottie.LottieDrawable
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
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.MintsApplication import com.mints.wisdomclean.MintsApplication
import com.mints.wisdomclean.R import com.mints.wisdomclean.R
import com.mints.wisdomclean.mvp.model.VedioBean
import com.mints.wisdomclean.mvp.model.VideoMultiItemEntity
/** /**
* author : ChenWenJie * author : ChenWenJie
...@@ -17,35 +24,86 @@ import com.mints.wisdomclean.R ...@@ -17,35 +24,86 @@ import com.mints.wisdomclean.R
* date : 2020/9/22 * date : 2020/9/22
* desc : 适配器 * desc : 适配器
*/ */
class VideoAdapter(var activity: Activity) : class VideoAdapter(private var vedioBean: VedioBean) :
BaseQuickAdapter<VideoBean, BaseViewHolder>(R.layout.item_video) { BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewHolder>() {
override fun convert(holder: BaseViewHolder, item: VideoBean) {
//用户名 init {
holder.setText(R.id.username_tv, item.user_name) addItemType(VideoMultiItemEntity.MULTI_ITEM_1, R.layout.item_video)
addItemType(VideoMultiItemEntity.MULTI_ITEM_2, R.layout.item_block_view)
}
override fun convert(holder: BaseViewHolder, item: VideoMultiItemEntity) {
if (holder.itemViewType == VideoMultiItemEntity.MULTI_ITEM_1) {
initVideoHolder(holder, item)
} else {
initLockHolder(holder, item)
}
}
private fun initLockHolder(holder: BaseViewHolder, item: VideoMultiItemEntity) {
Glide.with(context).load(vedioBean.coverImage)
.into(holder.getView(R.id.iv_bg))
holder.getView<View>(R.id.vip).setOnClickListener {
mOnCustomChildClickListener?.onCustomChildClick(it, holder.adapterPosition)
}
holder.getView<View>(R.id.leave).visibility = View.GONE
holder.getView<View>(R.id.leave).setOnClickListener {
mOnCustomChildClickListener?.onCustomChildClick(it, holder.adapterPosition)
}
holder.getView<View>(R.id.unlock).setOnClickListener {
mOnCustomChildClickListener?.onCustomChildClick(it, holder.adapterPosition)
}
}
private fun initVideoHolder(holder: BaseViewHolder, item: VideoMultiItemEntity) {
//标题 //标题
holder.setText(R.id.usertitle_tv, item.video_title) holder.setText(R.id.title_tv, item.video.title)
//介绍
holder.setText(R.id.info_tv, "第" + item.video.vedioIndex + "集")
//收藏数量
holder.setText(R.id.zan_num_tv, "" + vedioBean.hot)
//缩略图 //缩略图
Glide.with(activity).load(item.video_image) Glide.with(context).load(vedioBean.coverImage)
.into(holder.getView<JzvdStdTikTok>(R.id.jz_video).posterImageView) .into(holder.getView<JzvdStdTikTok>(R.id.jz_video).posterImageView)
holder.getView<LinearLayout>(R.id.ll_collect).setOnClickListener {
mOnCustomChildClickListener?.onCustomChildClick(it, holder.adapterPosition)
if (vedioBean.collect == 0) {
vedioBean.collect = 1
playCollectAnim(holder.getView(R.id.zan_iv))
} else {
vedioBean.collect = 0
playCancelCollectAnim(holder.getView(R.id.zan_iv))
}
}
if (vedioBean.collect == 0) {
// 未收藏
holder.getView<LottieAnimationView>(R.id.zan_iv)
.setImageResource(R.mipmap.home_collect_img_0)
} else {
// 已收藏
holder.getView<LottieAnimationView>(R.id.zan_iv)
.setImageResource(R.mipmap.home_collect_img_1)
}
//声明 代理服务缓存 //声明 代理服务缓存
val proxy = MintsApplication.StaticParams.getProxy() val proxy = MintsApplication.StaticParams.getProxy()
//这个缓存下一个 //这个缓存下一个
if (holder.layoutPosition + 1 < itemCount) { if (holder.layoutPosition + 1 < itemCount) {
var item1 = getItem(holder.layoutPosition + 1) val item1 = getItem(holder.layoutPosition + 1)
//缓存下一个 10秒 //缓存下一个 10秒
proxy!!.preLoad(item1.video_path, 10) proxy!!.preLoad(item1.video.vedioUrl, 10)
} }
//缓存当前,播放当前 //缓存当前,播放当前
var proxyUrl = proxy?.getProxyUrl(item.video_path).toString() //设置视 val proxyUrl = proxy?.getProxyUrl(item.video.vedioUrl).toString() //设置视
setPlay(holder.getView(R.id.jz_video), proxyUrl) setPlay(holder.getView(R.id.jz_video), proxyUrl)
} }
fun setPlay(jzvdStdTikTok: JzvdStdTikTok, path: String) { fun setPlay(jzvdStdTikTok: JzvdStdTikTok, path: String) {
Log.e("VideoAdapter", "${path}") Log.e("VideoAdapter", "$path")
//不保存播放进度 //不保存播放进度
Jzvd.SAVE_PROGRESS = false Jzvd.SAVE_PROGRESS = false
//取消播放时在非WIFIDialog提示 //取消播放时在非WIFIDialog提示
...@@ -63,6 +121,41 @@ class VideoAdapter(var activity: Activity) : ...@@ -63,6 +121,41 @@ class VideoAdapter(var activity: Activity) :
this.onVideoCompletion = onVideoCompletion this.onVideoCompletion = onVideoCompletion
} }
private fun playCollectAnim(view: LottieAnimationView) {
val lottieDrawable = LottieDrawable()
LottieCompositionFactory.fromAsset(context, "home_collect.json")
.addListener { result: LottieComposition? ->
lottieDrawable.setImagesAssetsFolder("images/")
lottieDrawable.composition = result
lottieDrawable.loop(false)
lottieDrawable.playAnimation()
}
view.setImageDrawable(lottieDrawable)
}
private fun playCancelCollectAnim(view: LottieAnimationView) {
val lottieDrawable = LottieDrawable()
LottieCompositionFactory.fromAsset(context, "home_cancel_collect.json")
.addListener { result: LottieComposition? ->
lottieDrawable.setImagesAssetsFolder("images/")
lottieDrawable.composition = result
lottieDrawable.loop(false)
lottieDrawable.playAnimation()
}
view.setImageDrawable(lottieDrawable)
}
private var mOnCustomChildClickListener: OnCustomChildClickListener? = null
fun setOnCustomChildClickListener(onCustomChildClickListener: OnCustomChildClickListener) {
this.mOnCustomChildClickListener = onCustomChildClickListener
}
interface OnCustomChildClickListener {
fun onCustomChildClick(view: View, position: Int)
}
} }
\ No newline at end of file
...@@ -5,15 +5,7 @@ ...@@ -5,15 +5,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/black" android:background="@color/black"
android:orientation="vertical" android:orientation="vertical"
tools:context=".video.VideoActivity"> tools:context=".video.VideoActivity">r
<ImageView
android:id="@+id/close_iv"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:src="@mipmap/ic_arrow_back" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/recy" android:id="@+id/recy"
...@@ -21,6 +13,14 @@ ...@@ -21,6 +13,14 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginBottom="50dp" /> android:layout_marginBottom="50dp" />
<ImageView
android:id="@+id/close_iv"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginTop="20dp"
android:padding="10dp"
android:src="@mipmap/ic_arrow_white" />
<FrameLayout <FrameLayout
android:id="@+id/fm_bottom" android:id="@+id/fm_bottom"
android:layout_width="match_parent" android:layout_width="match_parent"
......
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout 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="wrap_content">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@drawable/shape_tab_friends" android:background="@drawable/shape_tab_friends"
android:orientation="vertical"> android:orientation="vertical">
...@@ -24,7 +23,7 @@ ...@@ -24,7 +23,7 @@
android:id="@+id/title_tv" android:id="@+id/title_tv"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="霸道总裁爱上我" android:text="-"
android:textColor="@color/black" /> android:textColor="@color/black" />
<TextView <TextView
...@@ -32,10 +31,13 @@ ...@@ -32,10 +31,13 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_10" android:layout_marginStart="@dimen/dp_10"
android:background="@drawable/shape_green" android:background="@drawable/shape_red"
android:padding="2dp" android:paddingStart="6dp"
android:paddingTop="2dp"
android:paddingEnd="6dp"
android:paddingBottom="2dp"
android:text="已完结" android:text="已完结"
android:textColor="@color/gray" android:textColor="@color/white"
android:textSize="12sp" /> android:textSize="12sp" />
<View <View
......
...@@ -67,53 +67,6 @@ ...@@ -67,53 +67,6 @@
</LinearLayout> </LinearLayout>
<FrameLayout <include layout="@layout/item_block_view" />
android:id="@+id/block_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#99000000">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:text="试看已结束"
android:textColor="@color/white"
android:textSize="16sp" />
<Button
android:id="@+id/unlock"
android:layout_width="280dp"
android:layout_height="40dp"
android:layout_marginBottom="10dp"
android:background="@drawable/shape_red"
android:text="看广告解锁1集"
android:textColor="@color/white" />
<Button
android:id="@+id/vip"
android:layout_width="280dp"
android:layout_height="40dp"
android:background="@drawable/shape_green"
android:text="开通会员" />
</LinearLayout>
<ImageView
android:id="@+id/leave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:padding="10dp"
android:src="@mipmap/ic_arrow_white" />
</FrameLayout>
</FrameLayout> </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:id="@+id/block_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#99000000">
<ImageView
android:id="@+id/iv_bg"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:text="试看已结束"
android:textColor="@color/white"
android:textSize="16sp" />
<Button
android:id="@+id/unlock"
android:layout_width="280dp"
android:layout_height="40dp"
android:layout_marginBottom="10dp"
android:background="@drawable/shape_red"
android:text="看广告解锁1集"
android:textColor="@color/white" />
<Button
android:id="@+id/vip"
android:layout_width="280dp"
android:layout_height="40dp"
android:background="@drawable/shape_green"
android:text="开通会员"
android:textColor="@color/white" />
</LinearLayout>
<ImageView
android:id="@+id/leave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:padding="10dp"
android:src="@mipmap/ic_arrow_white" />
</FrameLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#99000000">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="暂无视频"
android:textColor="@color/white"
android:textSize="18sp" />
</RelativeLayout>
\ No newline at end of file
...@@ -21,24 +21,24 @@ ...@@ -21,24 +21,24 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="15dp" android:layout_marginStart="15dp"
android:orientation="horizontal" android:orientation="horizontal"
app:layout_constraintBottom_toTopOf="@id/usertitle_tv" app:layout_constraintBottom_toTopOf="@id/info_tv"
app:layout_constraintLeft_toLeftOf="parent"> app:layout_constraintLeft_toLeftOf="parent">
<TextView <TextView
android:id="@+id/username_tv" android:id="@+id/title_tv"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:ellipsize="end" android:ellipsize="end"
android:gravity="center" android:gravity="center"
android:maxEms="9" android:maxEms="9"
android:maxLines="1" android:maxLines="1"
android:text="飞翔的企鹅" android:text="-"
android:textColor="#fff" android:textColor="#fff"
android:textSize="16sp" /> android:textSize="16sp" />
</LinearLayout> </LinearLayout>
<TextView <TextView
android:id="@+id/usertitle_tv" android:id="@+id/info_tv"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="50dp" android:layout_height="50dp"
android:layout_marginStart="15dp" android:layout_marginStart="15dp"
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
android:gravity="center|left" android:gravity="center|left"
android:maxEms="14" android:maxEms="14"
android:maxLines="3" android:maxLines="3"
android:text="飞翔的企鹅飞翔的企鹅飞翔的企鹅飞翔的企鹅飞翔/n的企鹅飞翔的企鹅" android:text="-"
android:textColor="#fff" android:textColor="#fff"
android:textSize="14sp" android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
tools:ignore="RtlHardcoded" /> tools:ignore="RtlHardcoded" />
<LinearLayout <LinearLayout
android:id="@+id/ll_collect"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="15dp" android:layout_marginEnd="15dp"
...@@ -74,7 +75,7 @@ ...@@ -74,7 +75,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center" android:gravity="center"
android:text="199.9w" android:text="-"
android:textColor="#fff" android:textColor="#fff"
android:textSize="14sp" /> android:textSize="14sp" />
......
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