Commit f9715733 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent 4b98b35b
......@@ -238,6 +238,7 @@ dependencies {
// 友盟统计SDK
implementation 'com.umeng.umsdk:common:9.6.3'// 必选
implementation 'com.umeng.umsdk:asms:1.8.0'// 必选
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.4'
// 支付
api project(':rxpay')
api project(':wxpay')
......
......@@ -123,7 +123,11 @@
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.LoadingActivity"
android:name=".ui.activitys.ChangeVipActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.WatchRecordActivity"
android:exported="false"
android:screenOrientation="portrait" />
......
package com.mints.enjoyboxjia.mvp.model
import java.io.Serializable
import java.util.ArrayList
data class BookTypeBean(
var id: String,
var name: String,
var sort: Int,
) : Serializable
......@@ -5,36 +5,23 @@ import android.os.Parcelable
import kotlinx.android.parcel.Parcelize
import java.io.Serializable
/**
*
* @author jyx
* @date 2021/4/20
* @des
*/
data class HotStyleListBean(
val list: List<HotStyleBean>
): Serializable
@SuppressLint("ParcelCreator")
@Parcelize
data class HotStyleTypesList(
val list: List<HotStyleTypesBean>
) : Parcelable
@SuppressLint("ParcelCreator")
@Parcelize
data class HotStyleBean(
var effectUrl: String? = null,
var imageUrl: String? = null,
var imageid: Int? = 0,
var lock: Boolean? = false,
var name: String? = null,
var remark: String? = null
data class HotBookTypeList(
val records: List<BookTypeBean>
) : Parcelable
@SuppressLint("ParcelCreator")
@Parcelize
data class PreStyleBean(
var type: Int? = 1,
var effectUrl: String? = null,
var imageUrl: String? = null,
var imageid: Int? = 0,
var lock: Boolean? = false,
var name: String? = null,
var remark: String? = null,
var isOriginal: Boolean? = false
): Parcelable
\ No newline at end of file
data class HotStyleTypesBean(
var type: String = "",
var typeId: Int = 0,
var torder: Int = 0
) : Parcelable
......@@ -3,8 +3,7 @@ package com.mints.enjoyboxjia.mvp.presenters
import com.mints.enjoyboxjia.common.DeviceInfo
import com.mints.enjoyboxjia.manager.AppHttpManager
import com.mints.enjoyboxjia.manager.UserManager
import com.mints.enjoyboxjia.mvp.model.BaseResponse
import com.mints.enjoyboxjia.mvp.model.UserBean
import com.mints.enjoyboxjia.mvp.model.*
import com.mints.enjoyboxjia.mvp.views.CountView
import com.mints.enjoyboxjia.utils.DeviceUuidFactory
import com.mints.library.net.neterror.BaseSubscriber
......@@ -80,41 +79,34 @@ class CountPresenter : BasePresenter<CountView>() {
if (isLinkView) return
val code = baseResponse.status
when (code) {
200 -> getMyInfo()
200 -> getHomeV1Types()
}
}
})
}
fun getMyInfo() {
val vo = HashMap<String, Any>()
vo["os"] = "android"
fun getHomeV1Types() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.getMyInfo(vo),
object : BaseSubscriber<BaseResponse<UserBean>>() {
.call(loanService.homeV1Types,
object : BaseSubscriber<BaseResponse<HotBookTypeList>>() {
override fun onCompleted() {
if (isLinkView)
return
view.hideLoading()
if (isLinkView) return
}
override fun onError(e: Throwable?) {
override fun onError(e: Throwable) {
if (isLinkView) return
view.hideLoading()
view.showToast(e.message)
}
override fun onNext(baseResponse: BaseResponse<UserBean>) {
override fun onNext(baseResponse: BaseResponse<HotBookTypeList>) {
if (isLinkView) return
val code: Int = baseResponse.status
val message: String = baseResponse.message
val code = baseResponse.status
val message = baseResponse.message
when (code) {
200 -> {
UserManager.getInstance().saveUserInfo(baseResponse.data)
// view.getUserSuc(baseResponse.data)
view.getHomeV1MsgSuc(baseResponse.data)
}
else -> {
view.showToast(message)
......
package com.mints.enjoyboxjia.mvp.presenters
import com.mints.enjoyboxjia.manager.AppHttpManager
import com.mints.enjoyboxjia.mvp.model.BaseResponse
import com.mints.enjoyboxjia.mvp.views.PicContentView
import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable
import com.mints.enjoyboxjia.mvp.model.BannerList
class PicContentPresenter : BasePresenter<PicContentView>() {
fun getHomePageImageList(typeId: Int, page: Int, pageCount: Int) {
val vo = hashMapOf<String, Any>()
vo["categoryId"] = typeId
vo["pageNo"] = page
vo["pageSize"] = pageCount
AppHttpManager.getInstance(loanApplication)
.call(loanService.getHomeV1List(vo),
object : BaseSubscriber<BaseResponse<BannerList>>() {
override fun onCompleted() {
if (isLinkView) return
}
override fun onError(e: Throwable) {
if (isLinkView) return
view.showToast(e.message)
view.getHomePageImageListFail()
}
override fun onNext(baseResponse: BaseResponse<BannerList>) {
if (isLinkView) return
val code = baseResponse.status
val message = baseResponse.message
when (code) {
200 -> {
view.getHomePageImageListSuc(baseResponse.data)
}
else -> {
view.showToast(message)
view.getHomePageImageListFail()
}
}
}
})
}
}
\ No newline at end of file
package com.mints.enjoyboxjia.mvp.presenters
import com.google.gson.JsonObject
import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable
import com.mints.enjoyboxjia.manager.AppHttpManager
import com.mints.enjoyboxjia.mvp.model.BannerList
import com.mints.enjoyboxjia.mvp.model.BaseResponse
import com.mints.enjoyboxjia.mvp.views.WatchRecordView
import java.util.HashMap
class WatchRecordPresenter : BasePresenter<WatchRecordView>() {
fun getHistory() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.history(), object : BaseSubscriber<BaseResponse<BannerList>>() {
override fun onCompleted() {
if (isLinkView) return
view.hideLoading()
}
override fun onNext(baseResponse: BaseResponse<BannerList>) {
if (isLinkView) return
view.hideLoading()
val code = baseResponse.status
val message = baseResponse.message
when (code) {
200 -> view.getHistorySuc(baseResponse.data)
else -> {
view.getHistoryFail()
view.showToast(message)
}
}
}
override fun onError(e: Throwable?) {
if (isLinkView) return
view.hideLoading()
view.showToast(e?.message)
view.getHistoryFail()
}
})
}
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()
}
})
}
}
\ No newline at end of file
package com.mints.enjoyboxjia.mvp.views
import com.mints.enjoyboxjia.mvp.model.UserBean
import com.mints.enjoyboxjia.mvp.model.HotBookTypeList
interface CountView : BaseView {
// fun getUserSuc(data:UserBean)
fun getHomeV1MsgSuc(data: HotBookTypeList)
}
package com.mints.enjoyboxjia.mvp.views
import com.mints.enjoyboxjia.mvp.model.*
interface PicContentView : BaseView {
fun getHomePageImageListSuc(data: BannerList)
fun getHomePageImageListFail()
}
package com.mints.enjoyboxjia.mvp.views
import com.mints.enjoyboxjia.mvp.model.BannerList
interface WatchRecordView : BaseView {
fun getHistorySuc(historyBean: BannerList)
fun getHistoryFail()
fun collectSuc()
fun collectFail()
fun cancelCollectSuc()
fun cancelCollectFail()
}
\ No newline at end of file
......@@ -6,7 +6,9 @@ import com.google.gson.JsonObject;
import com.mints.enjoyboxjia.BuildConfig;
import com.mints.enjoyboxjia.mvp.model.BannerList;
import com.mints.enjoyboxjia.mvp.model.BaseResponse;
import com.mints.enjoyboxjia.mvp.model.HotStyleListBean;
import com.mints.enjoyboxjia.mvp.model.BookTypeBean;
import com.mints.enjoyboxjia.mvp.model.HotBookTypeList;
import com.mints.enjoyboxjia.mvp.model.HotStyleTypesList;
import com.mints.enjoyboxjia.mvp.model.OrderRecordBean;
import com.mints.enjoyboxjia.mvp.model.UserBean;
import com.mints.enjoyboxjia.mvp.model.Version;
......@@ -142,6 +144,47 @@ public interface LoanService {
@POST("api/vedio/orders")
Observable<BaseResponse<BannerList>> orders();
/**
* 历史记录
*
* @return
*/
@POST("api/vedioV1/history")
Observable<BaseResponse<BannerList>> history();
/**
* 收藏
*
* @return
*/
@POST("api/vedioV1/collect")
Observable<BaseResponse<Object>> collect(@Body Map<String, Object> vo);
/**
* 取消收藏
*
* @return
*/
@POST("api/vedioV1/cancelCollect")
Observable<BaseResponse<Object>> cancelCollect(@Body Map<String, Object> vo);
/**
* 书库列表
*
* @return
*/
@POST("api/book/articleList")
Observable<BaseResponse<BannerList>> getHomeV1List(@Body Map<String, Object> vo);
/**
* 书库分类
*
* @return
*/
@POST("api/book/categoryList")
Observable<BaseResponse<HotBookTypeList>> getHomeV1Types();
/**
* 默认http工厂
......
package com.mints.enjoyboxjia.ui.activitys
import android.view.View
import com.mints.enjoyboxjia.R
import com.mints.enjoyboxjia.ui.activitys.base.BaseActivity
import kotlinx.android.synthetic.main.activity_changevip.*
import kotlinx.android.synthetic.main.header_layout.*
class ChangeVipActivity : BaseActivity(), View.OnClickListener {
override fun getContentViewLayoutID() = R.layout.activity_changevip
override fun isApplyKitKatTranslucency() = false
override fun initViewsAndEvents() {
tv_title.text = "兑换会员"
iv_left_icon.visibility = View.VISIBLE
iv_left_icon.setImageResource(R.mipmap.ic_arrow_back)
iv_left_icon.setOnClickListener(this)
btn_changevip.setOnClickListener(this)
}
override fun onClick(v: View?) {
when (v?.id) {
R.id.iv_left_icon -> finish()
R.id.btn_changevip -> {
showToast("请输入正确cdk")
}
}
}
}
package com.mints.enjoyboxjia.ui.activitys
import android.os.Handler
import android.os.Looper
import com.mints.enjoyboxjia.R
import com.mints.enjoyboxjia.ui.activitys.base.BaseActivity
import kotlinx.android.synthetic.main.activity_loading.*
/**
* 加载页
*/
class LoadingActivity : BaseActivity() {
override fun getContentViewLayoutID() = R.layout.activity_loading
override fun isApplyKitKatTranslucency() = false
override fun toggleOverridePendingTransition() = true
override fun getOverridePendingTransitionMode() = TransitionMode.SCALE
override fun initViewsAndEvents() {
mProgressBar?.startOneAnim()
Handler(Looper.getMainLooper()).postDelayed({
if (!isFinishing) {
mProgressBar?.setCompleteNoAnim()
// finish()
}
}, 3000)
}
override fun finish() {
super.finish()
//关闭窗体动画显示
overridePendingTransition(0, R.anim.scale_out)
}
override fun onDestroy() {
super.onDestroy()
}
}
package com.mints.enjoyboxjia.ui.activitys
import android.view.LayoutInflater
import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import com.mints.enjoyboxjia.R
import com.mints.enjoyboxjia.mvp.model.BannerList
import com.mints.enjoyboxjia.mvp.model.VedioBean
import com.mints.enjoyboxjia.mvp.presenters.WatchRecordPresenter
import com.mints.enjoyboxjia.mvp.views.WatchRecordView
import com.mints.enjoyboxjia.ui.activitys.base.BaseActivity
import com.mints.enjoyboxjia.ui.adapter.WatchRecordAdapter
import com.mints.enjoyboxjia.ui.widgets.StickHeaderDecoration
import kotlinx.android.synthetic.main.activity_watch_record.*
import kotlinx.android.synthetic.main.header_layout.*
class WatchRecordActivity : BaseActivity(), WatchRecordView {
private val watchRecordPresenter by lazy { WatchRecordPresenter() }
private var mWatchRecordAdapter: WatchRecordAdapter? = null
private var datas = mutableListOf<VedioBean>()
override fun getContentViewLayoutID() = R.layout.activity_watch_record
override fun initViewsAndEvents() {
watchRecordPresenter.attachView(this)
tv_title.text = "观看记录"
iv_left_icon.visibility = View.VISIBLE
iv_left_icon.setImageResource(R.mipmap.ic_arrow_back)
iv_left_icon.setOnClickListener { finish() }
watchRecordPresenter.getHistory()
mWatchRecordAdapter = WatchRecordAdapter()
val emptyView = LayoutInflater.from(this).inflate(R.layout.item_empty_history, null)
mWatchRecordAdapter?.setEmptyView(emptyView)
mWatchRecordAdapter?.setNewInstance(datas)
mWatchRecordAdapter?.setOnItemClickListener { adapter, view, position ->
// LocalVedioManager.startVedioDetailActivityForType(
// this@WatchRecordActivity,
// datas[position]
// )
}
mWatchRecordAdapter?.setOnItemCollectClickListener(object :
WatchRecordAdapter.OnItemCollectClickListener {
override fun onItemCollectClick(position: Int) {
if (datas[position].collect == 0) {
datas[position].collect = 1
watchRecordPresenter.collect("" + datas[position].vedioId)
} else {
datas[position].collect = 0
watchRecordPresenter.cancelCollect("" + datas[position].vedioId)
}
mWatchRecordAdapter?.notifyItemChanged(position)
}
})
rv_watch_record.layoutManager = LinearLayoutManager(this)
rv_watch_record.addItemDecoration(StickHeaderDecoration(this))
rv_watch_record.adapter = mWatchRecordAdapter
}
override fun isApplyKitKatTranslucency() = true
override fun onDestroy() {
super.onDestroy()
watchRecordPresenter.detachView()
}
override fun getHistorySuc(historyBean: BannerList) {
// datas.clear()
val data = historyBean.list
for (datum in data) {
// datum.topTabsReamrk = TimeHelp.format(datum.seeUpdateTime * 1000)
datas.add(datum)
}
mWatchRecordAdapter?.notifyDataSetChanged()
}
override fun getHistoryFail() {
}
override fun collectSuc() {
}
override fun collectFail() {
}
override fun cancelCollectSuc() {
}
override fun cancelCollectFail() {
}
}
\ No newline at end of file
package com.mints.enjoyboxjia.ui.adapter
import android.view.View
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.airbnb.lottie.LottieAnimationView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.mints.enjoyboxjia.R
import com.mints.enjoyboxjia.mvp.model.VedioBean
import com.mints.enjoyboxjia.ui.adapter.base.OnItemClickListener
import com.mints.library.utils.GlideUtils
class CountAdapter :
BaseQuickAdapter<VedioBean, BaseViewHolder>(R.layout.item_list_orderrecord) {
override fun convert(holder: BaseViewHolder, item: VedioBean) {
// GlideUtils.loadImageViewNoAnim2(context, item.coverImage, holder.getView(R.id.image_iv))
holder.getView<TextView>(R.id.title_tv).text = "123123"
// holder.getView<TextView>(R.id.info_tv).text = "观看至第${item.seeIndex}集"
//
// if (item.collect == 0) {
// // 未收藏
// holder.getView<LottieAnimationView>(R.id.iv_collect)
// .setImageResource(R.mipmap.home_collect_img_0)
// } else {
// // 已收藏
// holder.getView<LottieAnimationView>(R.id.iv_collect)
// .setImageResource(R.mipmap.home_collect_img_1)
// }
}
private var mOnItemClickListener: OnItemClickListener? = null
fun setOnItemClickListener(listener: OnItemClickListener) {
mOnItemClickListener = listener
}
}
\ No newline at end of file
package com.mints.enjoyboxjia.ui.adapter
import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.mints.enjoyboxjia.mvp.model.BookTypeBean
import com.mints.enjoyboxjia.ui.fragment.MovieFragment
class HomeVideoPageAdapter(
private val data: List<BookTypeBean>,
fragment: Fragment
) :
FragmentStateAdapter(fragment) {
private val fragments = mutableMapOf<Int, Fragment>()
override fun getItemId(position: Int): Long {
return data[position].id.toLong()
}
override fun getItemCount() = data.size
override fun createFragment(position: Int): Fragment {
val newFragment = MovieFragment.newInstance(data[position].id.toInt(),position)
fragments[position] = newFragment
return newFragment
}
override fun containsItem(itemId: Long): Boolean {
data.forEach {
if (it.id.toLong() == itemId) {
return true
}
}
return false
}
fun getFragments(): MutableMap<Int, Fragment> {
return fragments
}
}
\ No newline at end of file
package com.mints.enjoyboxjia.ui.adapter
import android.view.View
import android.widget.TextView
import com.airbnb.lottie.LottieAnimationView
import com.airbnb.lottie.LottieComposition
import com.airbnb.lottie.LottieCompositionFactory
import com.airbnb.lottie.LottieDrawable
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.mints.library.utils.GlideUtils
import com.mints.enjoyboxjia.R
import com.mints.enjoyboxjia.mvp.model.VedioBean
class WatchRecordAdapter :
BaseQuickAdapter<VedioBean, BaseViewHolder>(R.layout.item_watch_record) {
override fun convert(holder: BaseViewHolder, item: VedioBean) {
GlideUtils.loadImageViewNoAnim2(context, item.coverImage, holder.getView(R.id.image_iv))
holder.getView<TextView>(R.id.title_tv).text = item.title
holder.getView<TextView>(R.id.info_tv).text = "观看至第${item.seeIndex}集"
if (item.collect == 0) {
// 未收藏
holder.getView<LottieAnimationView>(R.id.iv_collect)
.setImageResource(R.mipmap.home_collect_img_0)
} else {
// 已收藏
holder.getView<LottieAnimationView>(R.id.iv_collect)
.setImageResource(R.mipmap.home_collect_img_1)
}
holder.getView<View>(R.id.ll_collect).setOnClickListener {
if (item.collect == 0) {
mOnItemCollectClickListener?.onItemCollectClick(holder.adapterPosition)
playCollectAnim(holder.getView(R.id.iv_collect))
} else {
mOnItemCollectClickListener?.onItemCollectClick(holder.adapterPosition)
playCancelCollectAnim(holder.getView(R.id.iv_collect))
}
}
}
/**
* 判断position对应的Item是否是组的第一项
*
* @param position
* @return
*/
fun isItemHeader(position: Int): Boolean {
if (data.size == 0 || position >= data.size) return false
return if (position == 0) {
true
} else {
val lastGroupName: String = data[position - 1].topTabsReamrk
val currentGroupName: String = data[position].topTabsReamrk
//判断上一个数据的组别和下一个数据的组别是否一致,如果不一致则是不同组,也就是为第一项(头部)
lastGroupName != currentGroupName
}
}
/**
* 获取position对应的Item组名
*
* @param position
* @return
*/
fun getGroupName(position: Int): String {
if (data.size == 0) return ""
return data[position].topTabsReamrk
}
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 mOnItemCollectClickListener: OnItemCollectClickListener? = null
fun setOnItemCollectClickListener(onItemCollectClickListener: OnItemCollectClickListener) {
this.mOnItemCollectClickListener = onItemCollectClickListener
}
interface OnItemCollectClickListener {
fun onItemCollectClick(position: Int)
}
}
\ No newline at end of file
package com.mints.enjoyboxjia.ui.fragment
import android.os.Bundle
import android.text.TextUtils
import android.view.LayoutInflater
import android.view.View
import androidx.recyclerview.widget.GridLayoutManager
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.viewpager2.widget.ViewPager2
import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayoutMediator
import com.mints.enjoyboxjia.R
import com.mints.enjoyboxjia.common.AppConfig
import com.mints.enjoyboxjia.common.Constant
import com.mints.enjoyboxjia.manager.UserManager
import com.mints.enjoyboxjia.mvp.model.*
import com.mints.enjoyboxjia.mvp.presenters.CountPresenter
import com.mints.enjoyboxjia.mvp.views.CountView
import com.mints.enjoyboxjia.ui.adapter.CountAdapter
import com.mints.enjoyboxjia.ui.adapter.HomeVideoPageAdapter
import com.mints.enjoyboxjia.ui.fragment.base.LazyLoadBaseFragment
import com.mints.library.utils.nodoubleclick.AntiShake
import com.scwang.smartrefresh.layout.api.RefreshLayout
import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener
import com.scwang.smartrefresh.layout.listener.OnRefreshListener
import kotlinx.android.synthetic.main.fragment_main_count.*
import java.util.ArrayList
import java.lang.reflect.Field
import java.util.*
import kotlin.concurrent.schedule
/**
* 书库
*/
class CountFragment : LazyLoadBaseFragment(), CountView, OnRefreshListener,
OnLoadMoreListener {
class CountFragment : LazyLoadBaseFragment(), CountView {
companion object {
var mSelectTabIndex = -1
}
private val countPresenter by lazy { CountPresenter() }
private val userManager by lazy { UserManager.getInstance() }
private var hotPage = 1 // 分页
// private val videoData: ArrayList<VideoStyleBean> = arrayListOf()
private val videoData: ArrayList<Any> = arrayListOf()
// private lateinit var videoListAdapter: VideoListAdapter
private val tabsData = mutableListOf<BookTypeBean>()
private var vpAdapter: HomeVideoPageAdapter? = null
override fun getContentViewLayoutID() = R.layout.fragment_main_count
override fun initViewsAndEvents() {
countPresenter.attachView(this)
initView()
initListener()
}
private fun loadData() {
Timer().schedule(200) {
requireActivity().runOnUiThread {
if (AntiShake.check(tablayout?.id)) return@runOnUiThread
if (!TextUtils.isEmpty(userManager?.userID)) {
countPresenter.getHomeV1Types()
}
}
}
}
override fun onFragmentFirstVisible() {
super.onFragmentFirstVisible()
srlMainPage.autoRefresh()
initVp()
loadData()
}
override fun onDestroy() {
......@@ -53,72 +78,80 @@ class CountFragment : LazyLoadBaseFragment(), CountView, OnRefreshListener,
override fun onFragmentResume() {
super.onFragmentResume()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_THREE) {
// if (AntiShake.check(ll_my_cancel?.id)) return
if (!TextUtils.isEmpty(userManager?.userID)) {
// countPresenter.getMyInfo()
} else {
countPresenter.userLogin()
}
vpAdapter?.getFragments()?.get(mSelectTabIndex)?.onResume()
}
}
override fun onRefresh(refreshLayout: RefreshLayout) {
hotPage = 1
videoData.clear()
srlMainPage.resetNoMoreData()
if (!TextUtils.isEmpty(userManager?.userID)) {
// videoListPresenter.getVedioPageList(hotPage, Constant.PAGE_SIZE, mType)
override fun onPause() {
super.onPause()
vpAdapter?.getFragments()?.get(mSelectTabIndex)?.onPause()
}
override fun getHomeV1MsgSuc(data: HotBookTypeList) {
tabsData.clear()
tabsData.addAll(data.records)
if (tabsData.isNotEmpty()) {
mSelectTabIndex = 0
vpAdapter?.notifyDataSetChanged()
}
}
override fun onLoadMore(refreshLayout: RefreshLayout) {
hotPage = ++hotPage
// videoListPresenter.getVedioPageList(hotPage, Constant.PAGE_SIZE, mType)
private fun initVp() {
vpAdapter = HomeVideoPageAdapter(tabsData, this)
vp2.adapter = vpAdapter
vp2.desensitization()
TabLayoutMediator(tablayout, vp2) { tab, position ->
// 初始化Tab
tab.id = position
if (tabsData.size > 0) {
tab.customView = getTabView(tabsData[position].name)
}
}.attach()
tablayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
override fun onTabSelected(tab: TabLayout.Tab?) {
updateTab(tab, true)
mSelectTabIndex = tab!!.id
}
override fun onTabUnselected(tab: TabLayout.Tab?) {
updateTab(tab, false)
}
override fun onTabReselected(tab: TabLayout.Tab?) {
}
})
vp2.offscreenPageLimit = 100
}
// override fun getVedioPageListSuc(data: VideoStyleListBean) {
// if (activity == null || requireActivity().isFinishing
// ) {
// return
// }
//
// if (::videoListAdapter.isInitialized) {
// videoData.addAll(data.list)
// if (hotPage == 1) {
// srlMainPage.finishRefresh(true)
// videoListAdapter.notifyDataSetChanged()
// } else {
// if (data.list.size < Constant.PAGE_SIZE) {
// srlMainPage.finishLoadMoreWithNoMoreData()
// } else {
// srlMainPage.finishLoadMore()
// }
// videoListAdapter.notifyItemChanged(data.list.size)
// }
// }
// }
// override fun getVedioPageListFail() {
// srlMainPage.finishRefresh(false)
// srlMainPage.finishLoadMore(false)
// hotPage = if (hotPage == 1) 1 else hotPage - 1
// }
private fun initView() {
val gridLayoutManager = GridLayoutManager(requireContext(), 2)
// rv_video_list.layoutManager = gridLayoutManager
// videoListAdapter = VideoListAdapter(requireContext(), videoData)
// rv_video_list.adapter = videoListAdapter
// videoListAdapter.setOnItemClickListener(object : OnItemClickListener {
// override fun onItemClick(view: View?, position: Int) {
// if (videoData.size > 0) {
// }
// }
// })
private fun updateTab(tab: TabLayout.Tab?, isSelected: Boolean) {
tab?.customView?.let {
val text = it.findViewById<TextView>(R.id.item_tv)
if (isSelected) {
text.setTextColor(ContextCompat.getColor(requireContext(), R.color.white))
text.background=ContextCompat.getDrawable(requireContext(), R.drawable.shape_book_text_enable)
} else {
text.background=ContextCompat.getDrawable(requireContext(), R.drawable.shape_book_text_none)
text.setTextColor(ContextCompat.getColor(requireContext(), R.color.color_6B6B6B))
}
}
}
private fun initListener() {
srlMainPage.setOnRefreshListener(this)
srlMainPage.setOnLoadMoreListener(this)
private fun getTabView(text: String): View {
val view = LayoutInflater.from(requireContext()).inflate(R.layout.item_video_tab, null)
view.findViewById<TextView>(R.id.item_tv).text = text
return view
}
fun ViewPager2.desensitization() {
//动态设置ViewPager2 灵敏度
try {
val recyclerViewField: Field = ViewPager2::class.java.getDeclaredField("mRecyclerView")
recyclerViewField.isAccessible = true
val recyclerView = recyclerViewField.get(this) as RecyclerView
val touchSlopField: Field = RecyclerView::class.java.getDeclaredField("mTouchSlop")
touchSlopField.isAccessible = true
val touchSlop = touchSlopField.get(recyclerView) as Int
touchSlopField.set(recyclerView, touchSlop * 3) //6 is empirical value
} catch (ignore: java.lang.Exception) {
}
}
}
\ No newline at end of file
package com.mints.enjoyboxjia.ui.fragment
import android.os.Bundle
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import com.mints.enjoyboxjia.R
import com.mints.enjoyboxjia.ad.express.MainExpressManager
import com.mints.enjoyboxjia.common.Constant
import com.mints.enjoyboxjia.mvp.model.BannerList
import com.mints.enjoyboxjia.mvp.presenters.PicContentPresenter
import com.mints.enjoyboxjia.mvp.views.PicContentView
import com.mints.enjoyboxjia.ui.adapter.CountAdapter
import com.mints.enjoyboxjia.ui.fragment.base.LazyLoadBaseFragment
import com.scwang.smartrefresh.layout.api.RefreshLayout
import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener
import com.scwang.smartrefresh.layout.listener.OnRefreshListener
import kotlinx.android.synthetic.main.fragment_movie.*
class MovieFragment : LazyLoadBaseFragment(), PicContentView, OnRefreshListener, OnLoadMoreListener {
private var mType = 0
private var mPosition = 0 // 首页-第一个tab-第一个recyclerview Item
companion object {
private const val VIDEO_TYPE = "VIDEO_TYPE"
private const val VIDEO_POSITION = "VIDEO_POSITION"
fun newInstance(type: Int, position: Int): Fragment {
val args = Bundle()
args.putInt(VIDEO_TYPE, type)
args.putInt(VIDEO_POSITION, position)
val fragment = MovieFragment()
fragment.arguments = args
return fragment
}
}
private val picContentPresenter by lazy { PicContentPresenter() }
private var hotPage = 1 // 分页
private var hotPageSize = Constant.PAGE_SIZE // 分页
private lateinit var hotStyleAdapter: CountAdapter
override fun getContentViewLayoutID() = R.layout.fragment_movie
override fun initViewsAndEvents() {
arguments?.let {
mType = it.getInt(VIDEO_TYPE, mType)
mPosition = it.getInt(VIDEO_POSITION, mPosition)
}
picContentPresenter.attachView(this)
initView()
initListener()
}
override fun onResume() {
super.onResume()
hotPage = 1
srlMainPage.resetNoMoreData()
picContentPresenter.getHomePageImageList(mType, hotPage, hotPageSize)
}
override fun onDestroy() {
super.onDestroy()
picContentPresenter.detachView()
}
override fun onLoadMore(refreshLayout: RefreshLayout) {
hotPage = ++hotPage
picContentPresenter.getHomePageImageList(mType, hotPage, hotPageSize)
}
override fun getHomePageImageListSuc(data: BannerList) {
if (activity == null || requireActivity().isFinishing) {
srlMainPage?.finishRefresh(true)
return
}
if (::hotStyleAdapter.isInitialized) {
if (hotPage == 1) {
srlMainPage.finishRefresh(true)
hotStyleAdapter.setNewInstance(data.list)
} else {
if (data.list.size < hotPageSize) {
srlMainPage.finishLoadMoreWithNoMoreData()
} else {
srlMainPage.finishLoadMore()
}
hotStyleAdapter.addData(data.list)
}
}
}
override fun getHomePageImageListFail() {
hotPage = 1
srlMainPage?.finishRefresh(false)
}
private fun initView() {
rv_pic_list.layoutManager = LinearLayoutManager(context)
hotStyleAdapter = CountAdapter()
hotStyleAdapter.animationEnable = false
rv_pic_list.adapter = hotStyleAdapter
}
private fun initListener() {
srlMainPage.setOnRefreshListener(this)
srlMainPage.setOnLoadMoreListener(this)
// srlMainPage.autoRefresh()
}
override fun onDestroyView() {
super.onDestroyView()
MainExpressManager.instance.destroy()
}
override fun onRefresh(refreshLayout: RefreshLayout) {
hotPage = 1
srlMainPage.resetNoMoreData()
picContentPresenter.getHomePageImageList(mType, hotPage, hotPageSize)
}
}
\ No newline at end of file
......@@ -84,10 +84,10 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
}
}
R.id.ll_my_history -> {
readyGo(HistoryActivity::class.java)
readyGo(WatchRecordActivity::class.java)
}
R.id.ll_my_change -> {
// readyGo(HistoryActivity::class.java)
readyGo(ChangeVipActivity::class.java)
}
R.id.ll_my_cancel -> {
if (mAgreementDTO == null) {
......
package com.mints.enjoyboxjia.ui.widgets;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.view.View;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.mints.enjoyboxjia.ui.adapter.WatchRecordAdapter;
/**
* 自定义装饰器(实现分组+吸顶效果)
* Create by: chenWei.li
* Date: 2018/11/2
* Time: 上午1:14
* Email: lichenwei.me@foxmail.com
*/
public class StickHeaderDecoration extends RecyclerView.ItemDecoration {
//头部的高
private int mItemHeaderHeight;
private int mTextPaddingLeft;
//画笔,绘制头部和分割线
private Paint mItemHeaderPaint;
private Paint mTextPaint;
private Paint mLinePaint;
private Rect mTextRect;
public StickHeaderDecoration(Context context) {
mItemHeaderHeight = dp2px(context, 40);
mTextPaddingLeft = dp2px(context, 10);
mTextRect = new Rect();
mItemHeaderPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mItemHeaderPaint.setColor(Color.WHITE);
mTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mTextPaint.setTextSize(46);
mTextPaint.setColor(Color.BLACK);
mLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mLinePaint.setColor(Color.GRAY);
}
/**
* 绘制Item的分割线和组头
*
* @param c
* @param parent
* @param state
*/
@Override
public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
if (parent.getAdapter() instanceof WatchRecordAdapter) {
WatchRecordAdapter adapter = (WatchRecordAdapter) parent.getAdapter();
int count = parent.getChildCount();//获取可见范围内Item的总数
for (int i = 0; i < count; i++) {
View view = parent.getChildAt(i);
int position = parent.getChildLayoutPosition(view);
boolean isHeader = adapter.isItemHeader(position);
int left = parent.getPaddingLeft();
int right = parent.getWidth() - parent.getPaddingRight();
if (isHeader) {
c.drawRect(left, view.getTop() - mItemHeaderHeight, right, view.getTop(), mItemHeaderPaint);
mTextPaint.getTextBounds(adapter.getGroupName(position), 0, adapter.getGroupName(position).length(), mTextRect);
c.drawText(adapter.getGroupName(position), left + mTextPaddingLeft, (view.getTop() - mItemHeaderHeight) + mItemHeaderHeight / 2 + mTextRect.height() / 2, mTextPaint);
} else {
// c.drawRect(left, view.getTop() - 1, right, view.getTop(), mLinePaint);
}
}
}
}
/**
* 绘制Item的顶部布局(吸顶效果)
*
* @param c
* @param parent
* @param state
*/
@Override
public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) {
if (parent.getAdapter() instanceof WatchRecordAdapter) {
WatchRecordAdapter adapter = (WatchRecordAdapter) parent.getAdapter();
int position = ((LinearLayoutManager) (parent.getLayoutManager())).findFirstVisibleItemPosition();
View view = parent.findViewHolderForAdapterPosition(position).itemView;
boolean isHeader = adapter.isItemHeader(position + 1);
int top = parent.getPaddingTop();
int left = parent.getPaddingLeft();
int right = parent.getWidth() - parent.getPaddingRight();
if (isHeader) {
int bottom = Math.min(mItemHeaderHeight, view.getBottom());
c.drawRect(left, top + view.getTop() - mItemHeaderHeight, right, top + bottom, mItemHeaderPaint);
mTextPaint.getTextBounds(adapter.getGroupName(position), 0, adapter.getGroupName(position).length(), mTextRect);
c.drawText(adapter.getGroupName(position), left + mTextPaddingLeft, top + mItemHeaderHeight / 2 + mTextRect.height() / 2 - (mItemHeaderHeight - bottom), mTextPaint);
} else {
c.drawRect(left, top, right, top + mItemHeaderHeight, mItemHeaderPaint);
mTextPaint.getTextBounds(adapter.getGroupName(position), 0, adapter.getGroupName(position).length(), mTextRect);
c.drawText(adapter.getGroupName(position), left + mTextPaddingLeft, top + mItemHeaderHeight / 2 + mTextRect.height() / 2, mTextPaint);
}
c.save();
}
}
/**
* 设置Item的间距
*
* @param outRect
* @param view
* @param parent
* @param state
*/
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
if (parent.getAdapter() instanceof WatchRecordAdapter) {
WatchRecordAdapter adapter = (WatchRecordAdapter) parent.getAdapter();
int position = parent.getChildLayoutPosition(view);
boolean isHeader = adapter.isItemHeader(position);
if (isHeader) {
outRect.top = mItemHeaderHeight;
} else {
outRect.top = 1;
}
}
}
/**
* dp转换成px
*/
private int dp2px(Context context, float dpValue) {
float scale = context.getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 填充的颜色 -->
<solid android:color="#F1413C" />
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners android:radius="20dip" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 填充的颜色 -->
<solid android:color="#EEEEEE" />
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners android:radius="20dip" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#F9FAFB"
android:orientation="vertical">
<include layout="@layout/header_layout" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline22"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.95" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline21"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.05" />
<LinearLayout
android:id="@+id/ly_code"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="30dp"
android:background="@drawable/shape_bg_mobile"
android:elevation="5dp"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/guideline22"
app:layout_constraintStart_toStartOf="@+id/guideline21">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:background="@mipmap/ic_my_change"
android:gravity="center_horizontal" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="10dp">
<com.mints.enjoyboxjia.ui.widgets.ClearEditText
android:id="@+id/etLoginCode"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_marginRight="100dp"
android:background="@null"
android:hint="请输入cdk"
android:textColor="#172B54"
android:textColorHint="#BEC2CC"
android:textSize="12sp" />
<Button
android:id="@+id/btn_changevip"
android:layout_width="60dp"
android:layout_height="28dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical|right"
android:background="@drawable/shape_my"
android:text="兑换"
android:textColor="#4F301D"
android:textSize="14sp"
android:textStyle="bold" />
</RelativeLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
<pl.droidsonroids.gif.GifImageView
android:id="@+id/ivLoading"
android:layout_width="240dp"
android:layout_height="240dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="120dp"
android:src="@drawable/camera_loading" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="90dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="数据生成中….."
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold" />
<com.mints.enjoyboxjia.ui.widgets.LoadingProgress
android:id="@+id/mProgressBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginTop="20dp"
android:layout_marginRight="40dp" />
</LinearLayout>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<include layout="@layout/header_layout" />
<!-- <com.scwang.smartrefresh.layout.SmartRefreshLayout-->
<!-- android:id="@+id/srlMainPage"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="0dp"-->
<!-- android:layout_weight="1"-->
<!-- app:srlAccentColor="@color/black">-->
<!-- <com.scwang.smartrefresh.header.MaterialHeader-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content" />-->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_watch_record"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- <com.scwang.smartrefresh.layout.footer.ClassicsFooter-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- app:srlAccentColor="@color/black"-->
<!-- app:srlPrimaryColor="@color/color_FDFDFD" />-->
<!-- </com.scwang.smartrefresh.layout.SmartRefreshLayout>-->
</LinearLayout>
......@@ -5,29 +5,25 @@
android:background="@drawable/shape_mine"
android:orientation="vertical">
<com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/srlMainPage"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srlAccentColor="@color/black"
app:srlPrimaryColor="@color/color_FDFDFD">
<com.scwang.smartrefresh.layout.header.ClassicsHeader
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_count_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="600dp"
android:overScrollMode="never" />
<com.scwang.smartrefresh.layout.footer.ClassicsFooter
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:srlAccentColor="@color/black"
app:srlPrimaryColor="@color/color_FDFDFD" />
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
<com.google.android.material.tabs.TabLayout
android:id="@+id/tablayout"
android:layout_width="wrap_content"
android:layout_height="38dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp"
android:layout_marginRight="10dp"
android:paddingTop="-10dp"
app:tabBackground="@null"
app:tabIndicatorHeight="0dp"
app:tabMaxWidth="200dp"
app:tabMinWidth="20dp"
app:tabMode="scrollable"
app:tabPaddingEnd="6dp"
app:tabPaddingStart="6dp"
app:tabRippleColor="@null" />
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/vp2"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/srlMainPage"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srlAccentColor="@color/black"
app:srlPrimaryColor="#f0f2f5">
<com.scwang.smartrefresh.layout.header.ClassicsHeader
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_pic_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="14dp"
android:layout_marginRight="14dp"
android:overScrollMode="never" />
<com.scwang.smartrefresh.layout.footer.ClassicsFooter
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:srlAccentColor="@color/black"
app:srlPrimaryColor="#f0f2f5" />
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</FrameLayout>
\ No newline at end of file
<?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">
<View
android:layout_width="match_parent"
android:layout_height="match_parent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="还没有数据"
android:textSize="18sp" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/item_tv"
android:layout_width="70dp"
android:layout_height="wrap_content"
android:text="热闹"
android:gravity="center"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:textColor="@color/color_8D8F90"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp">
<ImageView
android:id="@+id/image_iv"
android:layout_width="100dp"
android:layout_height="120dp"
android:src="@mipmap/ic_launcher_main"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="@id/image_iv"
app:layout_constraintStart_toEndOf="@id/image_iv"
app:layout_constraintTop_toTopOf="@id/image_iv">
<TextView
android:id="@+id/title_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="重回80年代"
android:textColor="@color/black" />
<TextView
android:id="@+id/info_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:ellipsize="end"
android:maxWidth="140dp"
android:maxLines="2"
android:text="重回80年代"
android:textColor="@color/gray"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_collect"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/iv_collect"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginTop="10dp"
android:src="@mipmap/home_collect_img_0" />
<TextView
android:id="@+id/tv_collect_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:gravity="center"
android:text="追剧"
android:textSize="12sp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -14,6 +14,7 @@
<color name="btn_enabled">#F1F2F8</color>
<color name="black_text">#333333</color>
<color name="color_8D8F90">#8D8F90</color>
<color name="color_6B6B6B">#6B6B6B</color>
<color name="tv_message_recente_money">#FF5E5E</color>
<color name="authentic_text">#FFFFFF</color>
<color name="product_net_text">#121B32</color>
......
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