Commit 4aaa457d authored by mengcuiguang's avatar mengcuiguang

首页添加接口、业务逻辑

parent 3f929fbe
...@@ -7,29 +7,10 @@ import java.io.Serializable ...@@ -7,29 +7,10 @@ import java.io.Serializable
@SuppressLint("ParcelCreator") @SuppressLint("ParcelCreator")
@Parcelize @Parcelize
data class HotStyleListBean( data class HotStyleTypesList(
val list: List<HotStyleBean>
) : Parcelable
@SuppressLint("ParcelCreator")
@Parcelize
data class HotStyleTypesListBean(
val list: List<HotStyleTypesBean> val list: List<HotStyleTypesBean>
) : Parcelable ) : Parcelable
@SuppressLint("ParcelCreator")
@Parcelize
data class HotStyleBean(
var effectUrl: String? = null,
var imageUrl: String? = null,
var topUrl: String? = null,
var imageid: Int? = 0,
var lock: Boolean? = false,
var name: String? = null,
var isChecked: Boolean = false,
var remark: String? = null,
var typeId: Int = 0,
) : Parcelable
@SuppressLint("ParcelCreator") @SuppressLint("ParcelCreator")
...@@ -39,9 +20,3 @@ data class HotStyleTypesBean( ...@@ -39,9 +20,3 @@ data class HotStyleTypesBean(
var torder: Int = 0 var torder: Int = 0
) : Parcelable ) : Parcelable
@SuppressLint("ParcelCreator")
@Parcelize
data class HotStyleMsgBean(
val images: List<HotStyleBean>,
val types: List<HotStyleTypesBean>
) : Parcelable
package com.mints.wisdomclean.mvp.model; package com.mints.wisdomclean.mvp.model;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList;
public class VedioBean implements Serializable { public class VedioBean implements Serializable {
...@@ -9,7 +10,7 @@ public class VedioBean implements Serializable { ...@@ -9,7 +10,7 @@ public class VedioBean implements Serializable {
private String title; private String title;
private String type; private String type;
private String topTabsReamrk; private String topTabsReamrk;
private Object orderTags; private ArrayList<String> orderTags;//标签
private int vedioTotal;//同穿山甲 total private int vedioTotal;//同穿山甲 total
private String vedioDesc; private String vedioDesc;
private String coverImage; private String coverImage;
...@@ -58,11 +59,11 @@ public class VedioBean implements Serializable { ...@@ -58,11 +59,11 @@ public class VedioBean implements Serializable {
this.topTabsReamrk = topTabsReamrk; this.topTabsReamrk = topTabsReamrk;
} }
public Object getOrderTags() { public ArrayList<String> getOrderTags() {
return orderTags; return orderTags;
} }
public void setOrderTags(Object orderTags) { public void setOrderTags(ArrayList<String> orderTags) {
this.orderTags = orderTags; this.orderTags = orderTags;
} }
......
...@@ -16,7 +16,7 @@ class HomePresenter : BasePresenter<HomeView>() { ...@@ -16,7 +16,7 @@ class HomePresenter : BasePresenter<HomeView>() {
fun getHomeV1Types() { fun getHomeV1Types() {
AppHttpManager.getInstance(loanApplication) AppHttpManager.getInstance(loanApplication)
.call(loanService.homeV1Types, .call(loanService.homeV1Types,
object : BaseSubscriber<BaseResponse<HotStyleTypesListBean>>() { object : BaseSubscriber<BaseResponse<HotStyleTypesList>>() {
override fun onCompleted() { override fun onCompleted() {
if (isLinkView) return if (isLinkView) return
} }
...@@ -26,7 +26,7 @@ class HomePresenter : BasePresenter<HomeView>() { ...@@ -26,7 +26,7 @@ class HomePresenter : BasePresenter<HomeView>() {
view.showToast(e.message) view.showToast(e.message)
} }
override fun onNext(baseResponse: BaseResponse<HotStyleTypesListBean>) { override fun onNext(baseResponse: BaseResponse<HotStyleTypesList>) {
if (isLinkView) return if (isLinkView) return
val code = baseResponse.status val code = baseResponse.status
...@@ -176,9 +176,9 @@ class HomePresenter : BasePresenter<HomeView>() { ...@@ -176,9 +176,9 @@ class HomePresenter : BasePresenter<HomeView>() {
val code = baseResponse.status val code = baseResponse.status
when (code) { when (code) {
200 -> { 200 -> {
getHomeV1Types()
topTabs() topTabs()
orders() orders()
getHomeV1Types()
} }
} }
} }
......
package com.mints.wisdomclean.mvp.presenters package com.mints.wisdomclean.mvp.presenters
import com.mints.wisdomclean.common.AppConfig
import com.mints.wisdomclean.manager.AppHttpManager import com.mints.wisdomclean.manager.AppHttpManager
import com.mints.wisdomclean.mvp.model.BaseResponse import com.mints.wisdomclean.mvp.model.BaseResponse
import com.mints.wisdomclean.mvp.model.HotStyleListBean
import com.mints.wisdomclean.mvp.views.PicContentView import com.mints.wisdomclean.mvp.views.PicContentView
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.mvp.model.BannerList
class PicContentPresenter : BasePresenter<PicContentView>() { class PicContentPresenter : BasePresenter<PicContentView>() {
fun getHomePageImageList(typeId: Int, page: Int, pageCount: Int) { fun getHomePageImageList(type: String, page: Int, pageCount: Int) {
val vo = hashMapOf<String, Any>() val vo = hashMapOf<String, Any>()
vo["typeId"] = typeId vo["type"] = type
vo["page"] = page vo["page"] = page
vo["size"] = pageCount vo["size"] = pageCount
AppHttpManager.getInstance(loanApplication) AppHttpManager.getInstance(loanApplication)
.call(loanService.getHomeV1List(vo), .call(loanService.getHomeV1List(vo),
object : BaseSubscriber<BaseResponse<HotStyleListBean>>() { object : BaseSubscriber<BaseResponse<BannerList>>() {
override fun onCompleted() { override fun onCompleted() {
if (isLinkView) return if (isLinkView) return
} }
...@@ -29,7 +28,7 @@ class PicContentPresenter : BasePresenter<PicContentView>() { ...@@ -29,7 +28,7 @@ class PicContentPresenter : BasePresenter<PicContentView>() {
view.getHomePageImageListFail() view.getHomePageImageListFail()
} }
override fun onNext(baseResponse: BaseResponse<HotStyleListBean>) { override fun onNext(baseResponse: BaseResponse<BannerList>) {
if (isLinkView) return if (isLinkView) return
val code = baseResponse.status val code = baseResponse.status
......
package com.mints.wisdomclean.mvp.views package com.mints.wisdomclean.mvp.views
import com.mints.wisdomclean.mvp.model.BannerList import com.mints.wisdomclean.mvp.model.BannerList
import com.mints.wisdomclean.mvp.model.HotStyleTypesListBean import com.mints.wisdomclean.mvp.model.HotStyleTypesList
interface HomeView : BaseView { interface HomeView : BaseView {
fun getHomeV1MsgSuc(data: HotStyleTypesListBean) fun getHomeV1MsgSuc(data: HotStyleTypesList)
fun topTabsSuc(data: BannerList) fun topTabsSuc(data: BannerList?)
fun ordersSuc(data: BannerList) fun ordersSuc(data: BannerList?)
} }
...@@ -3,6 +3,6 @@ package com.mints.wisdomclean.mvp.views ...@@ -3,6 +3,6 @@ package com.mints.wisdomclean.mvp.views
import com.mints.wisdomclean.mvp.model.* import com.mints.wisdomclean.mvp.model.*
interface PicContentView : BaseView { interface PicContentView : BaseView {
fun getHomePageImageListSuc(data: HotStyleListBean) fun getHomePageImageListSuc(data: BannerList)
fun getHomePageImageListFail() fun getHomePageImageListFail()
} }
...@@ -7,8 +7,8 @@ import com.google.gson.JsonObject; ...@@ -7,8 +7,8 @@ import com.google.gson.JsonObject;
import com.mints.wisdomclean.BuildConfig; import com.mints.wisdomclean.BuildConfig;
import com.mints.wisdomclean.mvp.model.BannerList; 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.HotStyleListBean; import com.mints.wisdomclean.mvp.model.BannerList;
import com.mints.wisdomclean.mvp.model.HotStyleTypesListBean; import com.mints.wisdomclean.mvp.model.HotStyleTypesList;
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;
...@@ -166,15 +166,15 @@ public interface LoanService { ...@@ -166,15 +166,15 @@ public interface LoanService {
* @return * @return
*/ */
@POST("api/vedio/types") @POST("api/vedio/types")
Observable<BaseResponse<HotStyleTypesListBean>> getHomeV1Types(); Observable<BaseResponse<HotStyleTypesList>> getHomeV1Types();
/** /**
* 首页列表 * 首页列表
* *
* @return * @return
*/ */
@POST("api/ai/homeV1List") @POST("api/vedio/listByType")
Observable<BaseResponse<HotStyleListBean>> getHomeV1List(@Body Map<String, Object> vo); Observable<BaseResponse<BannerList>> getHomeV1List(@Body Map<String, Object> vo);
/** /**
* 用户反馈 * 用户反馈
......
...@@ -23,7 +23,7 @@ class HomeVideoPageAdapter( ...@@ -23,7 +23,7 @@ class HomeVideoPageAdapter(
val fragment = fragments[position] val fragment = fragments[position]
if (fragment != null) return fragment if (fragment != null) return fragment
val newFragment = MovieFragment.newInstance(data[position].torder,position) val newFragment = MovieFragment.newInstance(data[position].type,position)
fragments[position] = newFragment fragments[position] = newFragment
return newFragment return newFragment
} }
......
...@@ -10,11 +10,11 @@ import android.widget.TextView ...@@ -10,11 +10,11 @@ import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.mints.library.utils.GlideUtils import com.mints.library.utils.GlideUtils
import com.mints.wisdomclean.R import com.mints.wisdomclean.R
import com.mints.wisdomclean.mvp.model.HotStyleBean import com.mints.wisdomclean.mvp.model.VedioBean
import com.mints.wisdomclean.ui.adapter.base.OnItemClickListener import com.mints.wisdomclean.ui.adapter.base.OnItemClickListener
class HotStyleAdapter(val context: Context, val dataList: ArrayList<HotStyleBean>) : class HotStyleAdapter(val context: Context, val dataList: ArrayList<VedioBean>) :
RecyclerView.Adapter<HotStyleAdapter.ViewHolder>() { RecyclerView.Adapter<HotStyleAdapter.ViewHolder>() {
lateinit var mOnItemClickListener: OnItemClickListener lateinit var mOnItemClickListener: OnItemClickListener
...@@ -32,44 +32,19 @@ class HotStyleAdapter(val context: Context, val dataList: ArrayList<HotStyleBean ...@@ -32,44 +32,19 @@ class HotStyleAdapter(val context: Context, val dataList: ArrayList<HotStyleBean
} }
override fun onBindViewHolder(holder: ViewHolder, position: Int) { override fun onBindViewHolder(holder: ViewHolder, position: Int) {
// if (dataList.size > 0) {
// val data = dataList[position]
// if (position == 0 && showAnim) {
// val lottieDrawable = LottieDrawable()
// LottieCompositionFactory.fromAsset(context, "guide_template_category.json")
// .addListener { result: LottieComposition? ->
// lottieDrawable.setImagesAssetsFolder("guild_template_category/")
// lottieDrawable.composition = result
// lottieDrawable.loop(true)
// lottieDrawable.playAnimation()
// }
// holder.ivXmlyPage.setImageDrawable(lottieDrawable)
// holder.ivXmlyPage.visibility = View.VISIBLE
// holder.tvHotBtn.visibility = View.VISIBLE
// holder.rivXmlyPage.visibility = View.GONE
// holder.tvHotBtn.postDelayed({
// YoYo.with(Techniques.Pulse).duration(500).repeat(-1).playOn(holder.tvHotBtn)
// }, 300)
// } else {
//// GlideUtils.loadRoundImageViewGif(
//// holder.itemView.context,
//// data.imageUrl!!,
//// holder.rivXmlyPage
//// )
// holder.ivXmlyPage.visibility = View.GONE
// holder.tvHotBtn.visibility = View.GONE
// holder.rivXmlyPage.visibility = View.VISIBLE
// }
// viewHolder.tvTitle.text = data.name
//
// } val topBean = dataList?.get(position)
if (topBean != null) {
// GlideUtils.loadImageViewGifForFitCenter( holder.tvVedioItemCount.text =
// context, "${if (topBean.completeStatus == 0) "已完结" else "更新至${topBean.vedioTotal}"}"
// "https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg-bcurd/img/bg_vip_top3.png", holder.tvVedioItemTitle.text = "${topBean.title}"
// holder.ivVedioItem holder.tvVedioItemText.text = "${topBean.topTabsReamrk}"
// ) GlideUtils.loadImageViewGifForFitCenter(
context,
topBean.coverImage,
holder.ivVedioItem
)
}
holder.itemView.setOnClickListener { holder.itemView.setOnClickListener {
mOnItemClickListener.onItemClick(holder.itemView, position) mOnItemClickListener.onItemClick(holder.itemView, position)
......
...@@ -36,13 +36,24 @@ class TopAdapter(val topList: MutableList<VedioBean>?) : ...@@ -36,13 +36,24 @@ class TopAdapter(val topList: MutableList<VedioBean>?) :
} }
override fun onBindViewHolder(holder: ViewHolder, position: Int) { override fun onBindViewHolder(holder: ViewHolder, position: Int) {
// val topBean = topList[position] val topBean = topList?.get(position)
holder.tvTopItemLable.text = "${position + 1}" if (topBean != null) {
GlideUtils.loadImageViewGifForFitCenter( holder.tvTopItemLable.text = "${position + 1}"
context, holder.tvTopItemTitle.text = "${topBean.title}"
"https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg-bcurd/img/bg_vip_top1.png", if (topBean.orderTags != null && topBean.orderTags.size > 0) {
holder.ivTopItem val sb = StringBuilder()
) for (i in 0 until topBean.orderTags.size) {
sb.append(topBean.orderTags.get(i) + " ")
}
holder.tvTopItemText.text = "${sb}"
}
GlideUtils.loadImageViewGifForFitCenter(
context,
topBean.coverImage,
holder.ivTopItem
)
}
when (position) { when (position) {
......
...@@ -104,7 +104,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR ...@@ -104,7 +104,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
R.id.tv_main_watching_goto -> { R.id.tv_main_watching_goto -> {
val cacheVedio = LocalVedioManager.getCacheVedio() val cacheVedio = LocalVedioManager.getCacheVedio()
if (cacheVedio != null) { if (cacheVedio != null) {
LocalVedioManager.startVedioDetailActivityForType(requireActivity(), null) LocalVedioManager.startVedioDetailActivityForType(requireActivity(), cacheVedio)
} }
} }
} }
...@@ -120,9 +120,9 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR ...@@ -120,9 +120,9 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
//获取游客登录数据 //获取游客登录数据
homePresenter.userLogin() homePresenter.userLogin()
} else { } else {
homePresenter.getHomeV1Types()
homePresenter.topTabs() homePresenter.topTabs()
homePresenter.orders() homePresenter.orders()
homePresenter.getHomeV1Types()
} }
} }
} }
...@@ -136,7 +136,12 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR ...@@ -136,7 +136,12 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
rv_main_list.adapter = topAdapter rv_main_list.adapter = topAdapter
topAdapter?.setOnItemClickListener(object : TopAdapter.OnItemClickListener { topAdapter?.setOnItemClickListener(object : TopAdapter.OnItemClickListener {
override fun onItemClick(position: Int) { override fun onItemClick(position: Int) {
LocalVedioManager.startVedioDetailActivityForType(requireActivity(), null) if (topList.size > 0) {
LocalVedioManager.startVedioDetailActivityForType(
requireActivity(),
topList.get(position)
)
}
} }
}) })
...@@ -216,7 +221,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR ...@@ -216,7 +221,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
// } // }
} }
override fun getHomeV1MsgSuc(data: HotStyleTypesListBean) { override fun getHomeV1MsgSuc(data: HotStyleTypesList) {
tabsData.clear() tabsData.clear()
tabsData.addAll(data.list) tabsData.addAll(data.list)
if (tabsData.isNotEmpty()) { if (tabsData.isNotEmpty()) {
...@@ -225,7 +230,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR ...@@ -225,7 +230,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
} }
} }
override fun topTabsSuc(data: BannerList) { override fun topTabsSuc(data: BannerList?) {
if (data != null && data.list != null && data.list.size > 0) { if (data != null && data.list != null && data.list.size > 0) {
bannerList.clear() bannerList.clear()
for (i in 0 until data.list.size) { for (i in 0 until data.list.size) {
...@@ -237,15 +242,20 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR ...@@ -237,15 +242,20 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
banner.addBannerLifecycleObserver(this) banner.addBannerLifecycleObserver(this)
.setAdapter(ImageTitleAdapter(bannerList)) .setAdapter(ImageTitleAdapter(bannerList))
.setOnBannerListener { data, position -> .setOnBannerListener { data2, position ->
LocalVedioManager.startVedioDetailActivityForType(requireActivity(), null) LocalVedioManager.startVedioDetailActivityForType(
requireActivity(),
data.list.get(position)
)
} }
} }
} }
override fun ordersSuc(data: BannerList) { override fun ordersSuc(data: BannerList?) {
topList.clear() topList.clear()
topList.addAll(data.list) if (data != null) {
topList.addAll(data.list)
}
topAdapter?.notifyDataSetChanged() topAdapter?.notifyDataSetChanged()
} }
} }
\ No newline at end of file
...@@ -20,16 +20,16 @@ import java.util.* ...@@ -20,16 +20,16 @@ import java.util.*
class MovieFragment : LazyLoadBaseFragment(), PicContentView, OnLoadMoreListener { class MovieFragment : LazyLoadBaseFragment(), PicContentView, OnLoadMoreListener {
private var mType = 0 private var mType = ""
private var mPosition = 0 // 首页-第一个tab-第一个recyclerview Item private var mPosition = 0 // 首页-第一个tab-第一个recyclerview Item
companion object { companion object {
private const val VIDEO_TYPE = "VIDEO_TYPE" private const val VIDEO_TYPE = "VIDEO_TYPE"
private const val VIDEO_POSITION = "VIDEO_POSITION" private const val VIDEO_POSITION = "VIDEO_POSITION"
fun newInstance(type: Int, position: Int): Fragment { fun newInstance(type: String, position: Int): Fragment {
val args = Bundle() val args = Bundle()
args.putInt(VIDEO_TYPE, type) args.putString(VIDEO_TYPE, type)
args.putInt(VIDEO_POSITION, position) args.putInt(VIDEO_POSITION, position)
val fragment = MovieFragment() val fragment = MovieFragment()
fragment.arguments = args fragment.arguments = args
...@@ -40,7 +40,7 @@ class MovieFragment : LazyLoadBaseFragment(), PicContentView, OnLoadMoreListener ...@@ -40,7 +40,7 @@ class MovieFragment : LazyLoadBaseFragment(), PicContentView, OnLoadMoreListener
private val picContentPresenter by lazy { PicContentPresenter() } private val picContentPresenter by lazy { PicContentPresenter() }
private var hotPage = 1 // 分页 private var hotPage = 1 // 分页
private val hotList: ArrayList<HotStyleBean> = arrayListOf() private val hotList: ArrayList<VedioBean> = arrayListOf()
private lateinit var hotStyleAdapter: HotStyleAdapter private lateinit var hotStyleAdapter: HotStyleAdapter
private var mCurrentPosition = 0 private var mCurrentPosition = 0
...@@ -48,7 +48,7 @@ class MovieFragment : LazyLoadBaseFragment(), PicContentView, OnLoadMoreListener ...@@ -48,7 +48,7 @@ class MovieFragment : LazyLoadBaseFragment(), PicContentView, OnLoadMoreListener
override fun initViewsAndEvents() { override fun initViewsAndEvents() {
arguments?.let { arguments?.let {
mType = it.getInt(VIDEO_TYPE, mType) mType = it.getString(VIDEO_TYPE, mType)
mPosition = it.getInt(VIDEO_POSITION, mPosition) mPosition = it.getInt(VIDEO_POSITION, mPosition)
} }
} }
...@@ -89,7 +89,7 @@ class MovieFragment : LazyLoadBaseFragment(), PicContentView, OnLoadMoreListener ...@@ -89,7 +89,7 @@ class MovieFragment : LazyLoadBaseFragment(), PicContentView, OnLoadMoreListener
picContentPresenter.getHomePageImageList(mType, hotPage, Constant.PAGE_SIZE) picContentPresenter.getHomePageImageList(mType, hotPage, Constant.PAGE_SIZE)
} }
override fun getHomePageImageListSuc(data: HotStyleListBean) { override fun getHomePageImageListSuc(data: BannerList) {
if (activity == null || requireActivity().isFinishing) { if (activity == null || requireActivity().isFinishing) {
srlMainPage?.finishRefresh(true) srlMainPage?.finishRefresh(true)
return return
...@@ -121,11 +121,12 @@ class MovieFragment : LazyLoadBaseFragment(), PicContentView, OnLoadMoreListener ...@@ -121,11 +121,12 @@ class MovieFragment : LazyLoadBaseFragment(), PicContentView, OnLoadMoreListener
rv_pic_list.adapter = hotStyleAdapter rv_pic_list.adapter = hotStyleAdapter
hotStyleAdapter.setOnItemClickListener(object : OnItemClickListener { hotStyleAdapter.setOnItemClickListener(object : OnItemClickListener {
override fun onItemClick(view: View?, position: Int) { override fun onItemClick(view: View?, position: Int) {
// if (hotList.size > 0) { if (hotList.size > 0) {
// LocalVedioManager.startVedioDetailActivityForType(
// } requireActivity(),
LocalVedioManager.startVedioDetailActivityForType(requireActivity(),null) hotList.get(position)
// showToast(position.toString()) )
}
} }
}) })
} }
......
...@@ -19,8 +19,7 @@ ...@@ -19,8 +19,7 @@
android:id="@+id/ivVedioItem" android:id="@+id/ivVedioItem"
android:layout_width="110dp" android:layout_width="110dp"
android:layout_height="150dp" android:layout_height="150dp"
android:scaleType="fitXY" android:scaleType="fitXY" />
android:background="#0ff" />
<TextView <TextView
android:id="@+id/tvVedioItemCount" android:id="@+id/tvVedioItemCount"
......
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