Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_vedio
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
android
android_vedio
Commits
0f079764
Commit
0f079764
authored
Jul 19, 2023
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
a5edb06c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
90 additions
and
12 deletions
+90
-12
HotStyleAdapter.kt
...in/java/com/xinfu/helivideo/ui/adapter/HotStyleAdapter.kt
+63
-0
NewHotStyleAdapter.kt
...java/com/xinfu/helivideo/ui/adapter/NewHotStyleAdapter.kt
+9
-12
MovieFragment.kt
...ain/java/com/xinfu/helivideo/ui/fragment/MovieFragment.kt
+18
-0
No files found.
video/app/src/main/java/com/xinfu/helivideo/ui/adapter/HotStyleAdapter.kt
0 → 100644
View file @
0f079764
package
com.mints.wisdomclean.ui.adapter
import
android.annotation.SuppressLint
import
android.content.Context
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
android.widget.ImageView
import
android.widget.TextView
import
androidx.recyclerview.widget.RecyclerView
import
com.xinfu.helivideo.R
import
com.xinfu.helivideo.mvp.model.VedioBean
import
com.xinfu.library.utils.GlideUtils
class
HotStyleAdapter
(
val
context
:
Context
,
val
dataList
:
ArrayList
<
VedioBean
>?)
:
RecyclerView
.
Adapter
<
HotStyleAdapter
.
ViewHolder
>()
{
lateinit
var
mOnItemClickListener
:
OnItemClickListener
inner
class
ViewHolder
(
view
:
View
)
:
RecyclerView
.
ViewHolder
(
view
)
{
val
ivVedioItem
:
ImageView
=
view
.
findViewById
(
R
.
id
.
ivVedioItem
)
val
tvVedioItemCount
:
TextView
=
view
.
findViewById
(
R
.
id
.
tvVedioItemCount
)
val
tvVedioItemTitle
:
TextView
=
view
.
findViewById
(
R
.
id
.
tvVedioItemTitle
)
val
tvVedioItemText
:
TextView
=
view
.
findViewById
(
R
.
id
.
tvVedioItemText
)
}
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
ViewHolder
{
val
view
=
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
item_hot_style
,
parent
,
false
)
return
ViewHolder
(
view
)
}
override
fun
onBindViewHolder
(
holder
:
ViewHolder
,
position
:
Int
)
{
val
topBean
=
dataList
?.
get
(
position
)
if
(
topBean
!=
null
)
{
holder
.
tvVedioItemCount
.
text
=
"${if (topBean.completeStatus == 0) "
已完结
" else "
更新至$
{
topBean
.
vedioTotal
}
集
"}"
holder
.
tvVedioItemTitle
.
text
=
"${topBean.title}"
holder
.
tvVedioItemText
.
text
=
"${topBean.vedioDesc}"
GlideUtils
.
loadImageViewGifForFitCenter
(
context
,
topBean
.
coverImage
,
holder
.
ivVedioItem
)
}
holder
.
itemView
.
setOnClickListener
{
mOnItemClickListener
.
onItemClick
(
position
)
}
holder
.
itemView
.
setTag
(
position
)
}
override
fun
getItemCount
():
Int
=
dataList
?.
size
?:
0
interface
OnItemClickListener
{
fun
onItemClick
(
position
:
Int
)
}
fun
setOnItemClickListener
(
listener
:
OnItemClickListener
)
{
mOnItemClickListener
=
listener
}
}
\ No newline at end of file
video/app/src/main/java/com/xinfu/helivideo/ui/adapter/NewHotStyleAdapter.kt
View file @
0f079764
...
...
@@ -8,29 +8,26 @@ import com.xinfu.helivideo.mvp.model.VedioBean
class
NewHotStyleAdapter
:
BaseQuickAdapter
<
VedioBean
,
BaseViewHolder
>(
R
.
layout
.
item_hot_style
)
{
override
fun
convert
(
holder
:
BaseViewHolder
,
item
:
VedioBean
)
{
holder
.
setText
(
R
.
id
.
tvVedioItemCount
,
"${if (item.completeStatus == 0) "
已完结
" else "
更新至$
{
item
.
vedioTotal
}
集
"}"
)
if
(
item
.
title
!=
null
)
{
item
?.
let
{
holder
.
setText
(
R
.
id
.
tvVedioItemCount
,
"${if (it.completeStatus == 0) "
已完结
" else "
更新至$
{
it
.
vedioTotal
}
集
"}"
)
holder
.
setText
(
R
.
id
.
tvVedioItemTitle
,
"${it
em
.title}"
"${it.title}"
)
}
if
(
item
.
vedioDesc
!=
null
)
{
holder
.
setText
(
R
.
id
.
tvVedioItemText
,
"${it
em
.vedioDesc}"
"${it.vedioDesc}"
)
}
if
(
item
.
coverImage
!=
null
)
{
GlideUtils
.
loadImageViewGifForFitCenter
(
context
,
it
em
.
coverImage
,
it
.
coverImage
,
holder
.
getView
(
R
.
id
.
ivVedioItem
)
)
}
}
}
\ No newline at end of file
video/app/src/main/java/com/xinfu/helivideo/ui/fragment/MovieFragment.kt
View file @
0f079764
...
...
@@ -2,8 +2,10 @@ package com.xinfu.helivideo.ui.fragment
import
android.os.Bundle
import
android.view.LayoutInflater
import
android.view.View
import
androidx.fragment.app.Fragment
import
androidx.recyclerview.widget.GridLayoutManager
import
com.mints.wisdomclean.ui.adapter.HotStyleAdapter
import
com.xinfu.helivideo.R
import
com.xinfu.helivideo.common.Constant
import
com.xinfu.helivideo.manager.LocalVedioManager
...
...
@@ -42,6 +44,7 @@ class MovieFragment : LazyLoadBaseFragment(), PicContentView, OnLoadMoreListener
private
var
hotPage
=
1
// 分页
private
val
hotList
:
ArrayList
<
VedioBean
>
=
arrayListOf
()
private
lateinit
var
hotStyleAdapter
:
NewHotStyleAdapter
// private lateinit var hotStyleAdapter: HotStyleAdapter
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
fragment_movie
...
...
@@ -121,6 +124,21 @@ class MovieFragment : LazyLoadBaseFragment(), PicContentView, OnLoadMoreListener
)
}
}
// val gridLayoutManager = GridLayoutManager(context, 3)
// rv_pic_list.layoutManager = gridLayoutManager
// hotStyleAdapter = HotStyleAdapter(requireContext(), hotList)
// rv_pic_list.adapter = hotStyleAdapter
// hotStyleAdapter.setOnItemClickListener(object : HotStyleAdapter.OnItemClickListener {
// override fun onItemClick(position: Int) {
// if (hotList!=null&&hotList!!.size > 0) {
// LocalVedioManager.startVedioDetailActivityForType(
// requireActivity(),
// hotList!!.get(position)
// )
// }
// }
// })
}
private
fun
initListener
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment