Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
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
杨凯
YDL-Component-Medical
Commits
46dfcf97
Commit
46dfcf97
authored
Jul 07, 2022
by
范玉宾
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
article home net combine_debug to be continue
parent
480dc309
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
552 additions
and
74 deletions
+552
-74
DemoGlobalConfig.java
app/src/main/java/com/ydl/component/base/DemoGlobalConfig.java
+2
-2
ArticleHomeActivity.kt
m-article/src/main/java/activity/ArticleHomeActivity.kt
+65
-51
ArticleHomeItemAdapter.kt
m-article/src/main/java/adapter/ArticleHomeItemAdapter.kt
+77
-0
ArticlePagerAdapter.kt
m-article/src/main/java/adapter/ArticlePagerAdapter.kt
+26
-0
ArticleListBean.kt
m-article/src/main/java/data/ArticleListBean.kt
+14
-1
ArticleHomeFragment.kt
m-article/src/main/java/fragment/ArticleHomeFragment.kt
+138
-0
ArticleApi.kt
m-article/src/main/java/http/ArticleApi.kt
+17
-2
ArticleHttp.kt
m-article/src/main/java/http/ArticleHttp.kt
+11
-0
article_home_back_icon.xml
m-article/src/main/res/drawable/article_home_back_icon.xml
+14
-0
article_fragment_layout.xml
m-article/src/main/res/layout/article_fragment_layout.xml
+38
-6
article_home_activity_layout.xml
m-article/src/main/res/layout/article_home_activity_layout.xml
+1
-1
article_home_item_layout.xml
m-article/src/main/res/layout/article_home_item_layout.xml
+126
-0
HomeArticleItemView.kt
m-home/src/ydl/java/com/yidianling/home/ui/view/HomeArticleItemView.kt
+2
-0
home_article_item_view.xml
m-home/src/ydl/res/layout/home_article_item_view.xml
+21
-11
No files found.
app/src/main/java/com/ydl/component/base/DemoGlobalConfig.java
View file @
46dfcf97
...
...
@@ -20,8 +20,8 @@ import java.util.List;
*/
public
final
class
DemoGlobalConfig
implements
IConfigModule
{
String
APP_DOMAIN
=
"https://api.github.com/"
;
//
public static String appEnv = YDLConstants.ENV_TEST;
public
static
String
appEnv
=
YDLConstants
.
ENV_PROD
;
public
static
String
appEnv
=
YDLConstants
.
ENV_TEST
;
//
public static String appEnv = YDLConstants.ENV_PROD;
// public static String appEnv = YDLConstants.ENV_NEW_TEST;//配置未上传到maven库
@Override
...
...
m-article/src/main/java/activity/ArticleHomeActivity.kt
View file @
46dfcf97
package
activity
import
adapter.Article
Home
Adapter
import
adapter.Article
Pager
Adapter
import
android.graphics.Typeface
import
android.text.SpannableString
import
android.text.Spanned
import
android.text.style.StyleSpan
import
android.widget.ImageView
import
androidx.viewpager2.widget.ViewPager2
import
com.alibaba.android.arouter.facade.annotation.Route
import
com.google.android.material.tabs.TabLayout
...
...
@@ -12,73 +13,86 @@ import com.google.android.material.tabs.TabLayoutMediator
import
com.ydl.ydlcommon.base.BaseActivity
import
com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import
com.yidianling.article.R
import
fragment.ArticleHomeFragment
import
http.ArticleHttp
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
@Route
(
path
=
"/article/list"
)
class
ArticleHomeActivity
:
BaseActivity
()
{
private
var
TAG_IDS
=
mutableListOf
(
0
,
1
,
2
,
3
,
4
,
5
)
private
var
TAGS
=
mutableListOf
(
"推荐"
,
"情绪"
,
"亲子"
,
"职能部门"
,
"健康"
,
"科普"
)
private
var
mTabLayout
:
TabLayout
?=
null
private
var
mViewPager
:
ViewPager2
?=
null
class
ArticleHomeActivity
:
BaseActivity
()
{
private
var
TAG_IDS
=
mutableListOf
(
0
)
private
var
TAGS
=
mutableListOf
(
"推荐"
)
private
var
mTabLayout
:
TabLayout
?
=
null
private
var
mViewPager
:
ViewPager2
?
=
null
private
var
mFragments
=
mutableListOf
(
ArticleHomeFragment
.
newInstance
(
0
))
override
fun
initDataAndEvent
()
{
mTabLayout
=
findViewById
(
R
.
id
.
tab_layout
)
mViewPager
=
findViewById
(
R
.
id
.
view_pager
)
mViewPager
?.
isUserInputEnabled
=
false
mViewPager
?.
adapter
=
ArticleHomeAdapter
()
mTabLayout
?.
addOnTabSelectedListener
(
object
:
TabLayout
.
OnTabSelectedListener
{
override
fun
onTabSelected
(
tab
:
TabLayout
.
Tab
?)
{
//冥想|声音|睡眠点击事件
// ActionCountUtils.count(HomeBIConstants.YDL_HOME_MEDITATION_SUBJECT_CLICK,
// tab?.let { bean?.mditationListResponse?.get(it.position)?.buried } ?:"")
var
text
:
String
?
=
tab
?.
text
.
toString
().
trim
()
val
spStr
=
SpannableString
(
text
)
val
styleSpan
=
StyleSpan
(
Typeface
.
BOLD
)
spStr
.
setSpan
(
styleSpan
,
0
,
text
?.
length
?:
0
,
Spanned
.
SPAN_INCLUSIVE_EXCLUSIVE
)
tab
?.
text
=
spStr
}
override
fun
onTabUnselected
(
tab
:
TabLayout
.
Tab
?)
{
var
text
:
String
?
=
tab
?.
text
.
toString
().
trim
()
val
spStr
=
SpannableString
(
text
)
val
styleSpan
=
StyleSpan
(
Typeface
.
NORMAL
)
spStr
.
setSpan
(
styleSpan
,
0
,
text
?.
length
?:
0
,
Spanned
.
SPAN_INCLUSIVE_EXCLUSIVE
)
tab
?.
text
=
spStr
}
findViewById
<
ImageView
>(
R
.
id
.
iv_back
).
setOnClickListener
{
finish
()
}
override
fun
onTabReselected
(
tab
:
TabLayout
.
Tab
?)
{
}
})
TabLayoutMediator
(
mTabLayout
!!
,
mViewPager
!!
)
{
tab
,
position
->
tab
.
text
=
TAGS
[
position
]
}.
attach
()
}
override
fun
onResume
()
{
super
.
onResume
()
getArticleList
()
}
private
fun
getArticleList
(){
ArticleHttp
.
getInstance
().
getArticleList
(
perPageRows
=
20
,
page
=
1
,
tagId
=
485
)
ArticleHttp
.
getInstance
().
getArticleCategoryList
()
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
{
.
subscribe
{
response
->
if
(
response
.
code
==
"200"
&&
response
.
data
!=
null
&&
!
response
.
data
.
articleCategoryResponseList
.
isNullOrEmpty
())
{
response
.
data
.
articleCategoryResponseList
!!
.
forEach
{
TAGS
.
add
(
it
.
name
)
TAG_IDS
.
add
(
it
.
categoryId
)
mFragments
.
add
(
ArticleHomeFragment
.
newInstance
(
it
.
categoryId
))
}
mViewPager
?.
post
{
mViewPager
?.
adapter
=
ArticlePagerAdapter
(
this
,
mFragments
)
mTabLayout
?.
addOnTabSelectedListener
(
object
:
TabLayout
.
OnTabSelectedListener
{
override
fun
onTabSelected
(
tab
:
TabLayout
.
Tab
?)
{
//冥想|声音|睡眠点击事件
// ActionCountUtils.count(HomeBIConstants.YDL_HOME_MEDITATION_SUBJECT_CLICK,
// tab?.let { bean?.mditationListResponse?.get(it.position)?.buried } ?:"")
var
text
:
String
?
=
tab
?.
text
.
toString
().
trim
()
val
spStr
=
SpannableString
(
text
)
val
styleSpan
=
StyleSpan
(
Typeface
.
BOLD
)
spStr
.
setSpan
(
styleSpan
,
0
,
text
?.
length
?:
0
,
Spanned
.
SPAN_INCLUSIVE_EXCLUSIVE
)
tab
?.
text
=
spStr
}
override
fun
onTabUnselected
(
tab
:
TabLayout
.
Tab
?)
{
var
text
:
String
?
=
tab
?.
text
.
toString
().
trim
()
val
spStr
=
SpannableString
(
text
)
val
styleSpan
=
StyleSpan
(
Typeface
.
NORMAL
)
spStr
.
setSpan
(
styleSpan
,
0
,
text
?.
length
?:
0
,
Spanned
.
SPAN_INCLUSIVE_EXCLUSIVE
)
tab
?.
text
=
spStr
}
override
fun
onTabReselected
(
tab
:
TabLayout
.
Tab
?)
{
}
})
TabLayoutMediator
(
mTabLayout
!!
,
mViewPager
!!
)
{
tab
,
position
->
tab
.
text
=
TAGS
[
position
]
}.
attach
()
}
}
}
}
...
...
m-article/src/main/java/adapter/ArticleHomeItemAdapter.kt
0 → 100644
View file @
46dfcf97
package
adapter
import
android.content.Context
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
androidx.appcompat.widget.AppCompatImageView
import
androidx.appcompat.widget.AppCompatTextView
import
androidx.recyclerview.widget.RecyclerView
import
com.ydl.ydl_image.manager.YDLImageCacheManager
import
com.yidianling.article.R
import
data.ArticleBean
class
ArticleHomeItemAdapter
(
private
val
mContext
:
Context
):
RecyclerView
.
Adapter
<
ArticleHomeItemAdapter
.
ArticleViewHolder
>()
{
private
var
mData
=
mutableListOf
<
ArticleBean
>()
private
var
mListener
:
OnItemClickListener
?=
null
fun
setOnItemClickListener
(
listener
:
OnItemClickListener
){
mListener
=
listener
}
fun
setData
(
data
:
MutableList
<
ArticleBean
>){
mData
.
clear
()
mData
.
addAll
(
data
)
notifyDataSetChanged
()
}
fun
addData
(
data
:
MutableList
<
ArticleBean
>){
mData
.
addAll
(
data
)
notifyDataSetChanged
()
}
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
position
:
Int
):
ArticleViewHolder
{
val
view
=
LayoutInflater
.
from
(
parent
.
context
).
inflate
(
R
.
layout
.
article_home_item_layout
,
parent
,
false
)
return
ArticleViewHolder
(
view
)
}
override
fun
onBindViewHolder
(
holder
:
ArticleViewHolder
,
position
:
Int
)
{
holder
.
tvTitle
.
text
=
mData
[
position
].
title
holder
.
tvDesc
.
text
=
mData
[
position
].
desc
holder
.
tvAuthorName
.
text
=
mData
[
position
].
name
holder
.
tvArticleViewNum
.
text
=
"${mData[position].readNum}浏览"
holder
.
tvArticleLikeNum
.
text
=
"${mData[position].zanNum}点赞"
YDLImageCacheManager
.
showImage
(
mContext
,
mData
[
position
]
?.
imgUrl
,
holder
.
ivArticleImage
)
YDLImageCacheManager
.
showImage
(
mContext
,
mData
[
position
]
?.
smallImage
,
holder
.
ivAuthorAvatar
)
holder
.
itemView
.
setOnClickListener
{
mListener
?.
onItemClick
(
mData
[
position
])
}
}
override
fun
getItemCount
():
Int
{
return
mData
.
size
}
inner
class
ArticleViewHolder
(
itemView
:
View
):
RecyclerView
.
ViewHolder
(
itemView
){
var
tvTitle
:
AppCompatTextView
=
itemView
.
findViewById
(
R
.
id
.
tv_article_title
)
var
tvDesc
:
AppCompatTextView
=
itemView
.
findViewById
(
R
.
id
.
tv_article_desc
)
var
ivArticleImage
:
AppCompatImageView
=
itemView
.
findViewById
(
R
.
id
.
iv_article_image
)
var
ivAuthorAvatar
:
AppCompatImageView
=
itemView
.
findViewById
(
R
.
id
.
iv_author_avatar
)
var
tvAuthorName
:
AppCompatTextView
=
itemView
.
findViewById
(
R
.
id
.
tv_author_name
)
var
tvArticleViewNum
:
AppCompatTextView
=
itemView
.
findViewById
(
R
.
id
.
tv_article_view_num
)
var
tvArticleLikeNum
:
AppCompatTextView
=
itemView
.
findViewById
(
R
.
id
.
tv_article_like_num
)
}
interface
OnItemClickListener
{
fun
onItemClick
(
articleBean
:
ArticleBean
)
}
}
\ No newline at end of file
m-article/src/main/java/adapter/ArticlePagerAdapter.kt
0 → 100644
View file @
46dfcf97
package
adapter
import
androidx.fragment.app.Fragment
import
androidx.fragment.app.FragmentActivity
import
androidx.viewpager2.adapter.FragmentStateAdapter
import
fragment.ArticleHomeFragment
class
ArticlePagerAdapter
constructor
(
activity
:
FragmentActivity
,
list
:
MutableList
<
ArticleHomeFragment
>):
FragmentStateAdapter
(
activity
)
{
private
var
list
=
mutableListOf
<
ArticleHomeFragment
>()
init
{
this
.
list
=
list
}
override
fun
getItemCount
():
Int
{
return
list
.
size
}
override
fun
createFragment
(
position
:
Int
):
Fragment
{
return
list
[
position
]
}
}
\ No newline at end of file
m-article/src/main/java/data/ArticleListBean.kt
View file @
46dfcf97
package
data
data class
ArticleCategoryListBean
(
val
articleCategoryResponseList
:
MutableList
<
ArticleCategoryBean
>?=
null
)
data class
ArticleCategoryBean
(
val
categoryId
:
Int
,
val
name
:
String
)
data class
ArticleListBean
(
val
list
:
MutableList
<
ArticleBean
>?=
null
val
list
:
MutableList
<
ArticleBean
>?=
null
,
val
totalPage
:
Int
=
0
,
val
currentPage
:
Int
=
0
)
//"id": 12516,
...
...
m-article/src/main/java/fragment/ArticleHomeFragment.kt
0 → 100644
View file @
46dfcf97
package
fragment
import
adapter.ArticleHomeItemAdapter
import
android.content.Context
import
android.os.Bundle
import
android.view.View
import
android.widget.LinearLayout
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
com.ydl.webview.H5Params
import
com.ydl.webview.NewH5Activity
import
com.ydl.ydl_router.manager.YDLRouterManager
import
com.ydl.ydlcommon.base.BaseFragment
import
com.yidianling.article.R
import
data.ArticleBean
import
http.ArticleHttp
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
class
ArticleHomeFragment
:
BaseFragment
()
{
private
lateinit
var
mLvArticleContent
:
RecyclerView
private
lateinit
var
mLlEmptyLayout
:
LinearLayout
private
var
mCurrentPage
=
0
private
var
mHasMore
=
true
private
var
mTagId
:
Int
=
0
private
lateinit
var
mAdapter
:
ArticleHomeItemAdapter
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
mTagId
=
arguments
?.
getInt
(
KEY_ARTICLE_TAG_ID
,
0
)
?:
0
}
override
fun
initDataAndEvent
()
{
mLvArticleContent
=
rootView
.
findViewById
(
R
.
id
.
rv_article_content
)
mLlEmptyLayout
=
rootView
.
findViewById
(
R
.
id
.
ll_empty
)
mAdapter
=
ArticleHomeItemAdapter
(
activity
as
Context
)
mAdapter
.
setOnItemClickListener
(
object
:
ArticleHomeItemAdapter
.
OnItemClickListener
{
override
fun
onItemClick
(
articleBean
:
ArticleBean
)
{
YDLRouterManager
.
router
(
"ydl-user://h5/h5?params={'url':'${articleBean.hUrl}'}"
)
}
})
mLvArticleContent
.
layoutManager
=
LinearLayoutManager
(
activity
,
RecyclerView
.
VERTICAL
,
false
)
mLvArticleContent
.
adapter
=
mAdapter
if
(
mTagId
==
0
){
getRecommendArticleList
()
}
else
{
getArticleList
()
}
}
override
fun
initDataAndEventLazy
()
{
}
override
fun
layoutResId
():
Int
{
return
R
.
layout
.
article_fragment_layout
}
private
fun
getRecommendArticleList
(
loadMore
:
Boolean
=
false
)
{
ArticleHttp
.
getInstance
().
getRecommendArticleList
(
perPageRows
=
10
,
page
=
mCurrentPage
)
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
{
if
(
it
.
code
==
"200"
&&
it
.
data
!=
null
)
{
if
(
it
.
data
.
list
.
isNullOrEmpty
())
{
mLlEmptyLayout
.
visibility
=
View
.
VISIBLE
mLvArticleContent
.
visibility
=
View
.
GONE
}
else
{
mLlEmptyLayout
.
visibility
=
View
.
GONE
mLvArticleContent
.
visibility
=
View
.
VISIBLE
val
articles
=
it
.
data
.
list
if
(
articles
!=
null
)
{
mAdapter
.
setData
(
articles
)
}
}
}
else
{
mLlEmptyLayout
.
visibility
=
View
.
VISIBLE
mLvArticleContent
.
visibility
=
View
.
GONE
}
}
}
private
fun
getArticleList
(
loadMore
:
Boolean
=
false
)
{
ArticleHttp
.
getInstance
().
getArticleList
(
perPageRows
=
10
,
page
=
mCurrentPage
,
tagId
=
mTagId
)
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
{
if
(
it
.
code
==
"200"
&&
it
.
data
!=
null
)
{
if
(
it
.
data
.
list
.
isNullOrEmpty
())
{
mLlEmptyLayout
.
visibility
=
View
.
VISIBLE
mLvArticleContent
.
visibility
=
View
.
GONE
}
else
{
mLlEmptyLayout
.
visibility
=
View
.
GONE
mLvArticleContent
.
visibility
=
View
.
VISIBLE
val
articles
=
it
.
data
.
list
if
(
articles
!=
null
)
{
mAdapter
.
setData
(
articles
)
}
}
}
else
{
mLlEmptyLayout
.
visibility
=
View
.
VISIBLE
mLvArticleContent
.
visibility
=
View
.
GONE
}
}
}
companion
object
{
const
val
KEY_ARTICLE_TAG_ID
=
"key_article_tag_id"
fun
newInstance
(
tagId
:
Int
):
ArticleHomeFragment
{
val
args
=
Bundle
()
args
.
putInt
(
KEY_ARTICLE_TAG_ID
,
tagId
)
val
fragment
=
ArticleHomeFragment
()
fragment
.
arguments
=
args
return
fragment
}
}
}
\ No newline at end of file
m-article/src/main/java/http/ArticleApi.kt
View file @
46dfcf97
...
...
@@ -3,6 +3,7 @@ package http
import
com.ydl.ydlcommon.base.config.YDL_DOMAIN
import
com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA
import
com.ydl.ydlcommon.data.http.BaseAPIResponse
import
data.ArticleCategoryListBean
import
data.ArticleListBean
import
io.reactivex.Observable
import
retrofit2.http.GET
...
...
@@ -11,13 +12,26 @@ import retrofit2.http.Query
interface
ArticleApi
{
//文章标签
@GET
(
"newArticle/ArticleCate"
)
@Headers
(
YDL_DOMAIN
+
YDL_DOMAIN_JAVA
)
fun
getArticleTagList
():
Observable
<
BaseAPIResponse
<
ArticleCategoryListBean
>>
//文章列表
@GET
(
"
a
rticle/list/all"
)
@GET
(
"
newA
rticle/list/all"
)
@Headers
(
YDL_DOMAIN
+
YDL_DOMAIN_JAVA
)
fun
getArticleList
(
@Query
(
"perPageRows"
)
perPageRows
:
Int
=
2
0
,
@Query
(
"perPageRows"
)
perPageRows
:
Int
=
1
0
,
@Query
(
"page"
)
page
:
Int
=
1
,
@Query
(
"tagId"
)
tagId
:
Int
=
0
):
Observable
<
BaseAPIResponse
<
ArticleListBean
>>
//文章列表 推荐列表
@GET
(
"article/list/recommend"
)
@Headers
(
YDL_DOMAIN
+
YDL_DOMAIN_JAVA
)
fun
getRecommendArticleList
(
@Query
(
"perPageRows"
)
perPageRows
:
Int
=
10
,
@Query
(
"page"
)
page
:
Int
=
1
):
Observable
<
BaseAPIResponse
<
ArticleListBean
>>
}
\ No newline at end of file
m-article/src/main/java/http/ArticleHttp.kt
View file @
46dfcf97
...
...
@@ -2,6 +2,7 @@ package http
import
com.ydl.ydlcommon.data.http.BaseAPIResponse
import
com.ydl.ydlnet.YDLHttpUtils
import
data.ArticleCategoryListBean
import
data.ArticleListBean
import
io.reactivex.Observable
...
...
@@ -24,8 +25,17 @@ class ArticleHttp {
return
articleApi
!!
}
fun
getArticleCategoryList
():
Observable
<
BaseAPIResponse
<
ArticleCategoryListBean
>>{
return
getArticleApi
().
getArticleTagList
()
}
fun
getRecommendArticleList
(
perPageRows
:
Int
,
page
:
Int
):
Observable
<
BaseAPIResponse
<
ArticleListBean
>>{
return
getArticleApi
().
getRecommendArticleList
(
perPageRows
=
perPageRows
,
page
=
page
)
}
fun
getArticleList
(
perPageRows
:
Int
,
page
:
Int
,
tagId
:
Int
):
Observable
<
BaseAPIResponse
<
ArticleListBean
>>{
return
getArticleApi
().
getArticleList
(
perPageRows
=
perPageRows
,
page
=
page
,
tagId
=
tagId
)
}
}
\ No newline at end of file
m-article/src/main/res/drawable/article_home_back_icon.xml
0 → 100644
View file @
46dfcf97
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"24dp"
android:height=
"24dp"
android:viewportWidth=
"24"
android:viewportHeight=
"24"
>
<path
android:pathData=
"M15,3l-8,8l8,8"
android:strokeLineJoin=
"round"
android:strokeWidth=
"2"
android:fillColor=
"#00000000"
android:strokeColor=
"#10233A"
android:fillType=
"evenOdd"
android:strokeLineCap=
"round"
/>
</vector>
m-article/src/main/res/layout/article_fragment_layout.xml
View file @
46dfcf97
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
android:layout_height=
"match_parent"
xmlns:tools=
"http://schemas.android.com/tools"
>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_article_content"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
android:layout_height=
"match_parent"
android:paddingTop=
"20dp"
android:clipToPadding=
"false"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<LinearLayout
android:id=
"@+id/ll_empty"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
android:visibility=
"gone"
android:gravity=
"center"
tools:visibility=
"visible"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:src=
"@drawable/platform_ydlcommon_blank"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"14dp"
android:text=
"暂无相应记录"
android:textColor=
"#b2b2b2"
/>
</LinearLayout>
</FrameLayout>
\ No newline at end of file
m-article/src/main/res/layout/article_home_activity_layout.xml
View file @
46dfcf97
...
...
@@ -18,7 +18,7 @@
android:layout_height=
"42dp"
android:layout_marginStart=
"9dp"
android:padding=
"9dp"
android:src=
"@drawable/
platform_common_back
"
android:src=
"@drawable/
article_home_back_icon
"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
/>
...
...
m-article/src/main/res/layout/article_home_item_layout.xml
0 → 100644
View file @
46dfcf97
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:paddingHorizontal=
"16dp"
android:paddingTop=
"4dp"
>
<androidx.cardview.widget.CardView
android:id=
"@+id/card_view_article_image"
android:layout_width=
"70dp"
android:layout_height=
"70dp"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:cardCornerRadius=
"6dp"
app:cardElevation=
"0dp"
>
<androidx.appcompat.widget.AppCompatImageView
android:id=
"@+id/iv_article_image"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:scaleType=
"centerCrop"
tools:src=
"@drawable/platform_ydl_common_dialog_bg"
/>
</androidx.cardview.widget.CardView>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tv_article_title"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:maxHeight=
"44dp"
android:layout_marginEnd=
"84dp"
android:maxLines=
"2"
android:ellipsize=
"end"
android:textSize=
"16sp"
android:textStyle=
"bold"
android:textColor=
"#1C1F28"
android:lineSpacingExtra=
"1dp"
tools:text=
"最伟大的作品,是魔术啊,最伟大的作品,是魔术啊。"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"@id/card_view_article_image"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tv_article_desc"
android:layout_width=
"match_parent"
android:layout_height=
"18dp"
android:layout_marginTop=
"8dp"
android:layout_marginEnd=
"70dp"
android:maxLines=
"1"
android:ellipsize=
"end"
android:textSize=
"13sp"
android:textStyle=
"bold"
android:textColor=
"#9D9EA7"
tools:text=
"最伟大的作品,是魔术啊,最伟大的作品,是魔术啊。"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/tv_article_title"
/>
<androidx.cardview.widget.CardView
android:id=
"@+id/card_view_avatar"
android:layout_width=
"16dp"
android:layout_height=
"16dp"
android:layout_marginTop=
"20dp"
app:layout_constraintStart_toStartOf=
"@id/tv_article_title"
app:layout_constraintTop_toBottomOf=
"@id/card_view_article_image"
app:cardCornerRadius=
"8dp"
>
<androidx.appcompat.widget.AppCompatImageView
android:id=
"@+id/iv_author_avatar"
android:layout_width=
"16dp"
android:layout_height=
"16dp"
tools:src=
"@drawable/icon_meditation_share_wechat"
/>
</androidx.cardview.widget.CardView>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tv_author_name"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"3dp"
android:textSize=
"13sp"
android:textColor=
"#666666"
android:textStyle=
"bold"
tools:text=
"黄秀章"
app:layout_constraintStart_toEndOf=
"@id/card_view_avatar"
app:layout_constraintTop_toTopOf=
"@id/card_view_avatar"
app:layout_constraintBottom_toBottomOf=
"@id/card_view_avatar"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tv_article_view_num"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"85dp"
tools:text=
"2656浏览"
android:textSize=
"13sp"
android:textColor=
"#62636F"
app:layout_constraintTop_toTopOf=
"@id/card_view_avatar"
app:layout_constraintBottom_toBottomOf=
"@id/card_view_avatar"
app:layout_constraintEnd_toEndOf=
"parent"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/tv_article_like_num"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
tools:text=
"3327点赞"
android:textSize=
"13sp"
android:textColor=
"#62636F"
app:layout_constraintTop_toTopOf=
"@id/card_view_avatar"
app:layout_constraintBottom_toBottomOf=
"@id/card_view_avatar"
app:layout_constraintEnd_toEndOf=
"parent"
/>
<View
android:id=
"@+id/homeModuleArticleItemViewBottomLine"
android:layout_width=
"match_parent"
android:layout_height=
"0.5dp"
android:background=
"#EFEFF1"
android:layout_marginTop=
"20dp"
android:layout_marginBottom=
"20dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/card_view_avatar"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
m-home/src/ydl/java/com/yidianling/home/ui/view/HomeArticleItemView.kt
View file @
46dfcf97
...
...
@@ -3,6 +3,7 @@ package com.yidianling.home.ui.view
import
android.content.Context
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewTreeObserver
import
android.widget.LinearLayout
import
androidx.recyclerview.widget.RecyclerView
import
com.ydl.ydl_image.manager.YDLImageCacheManager
...
...
@@ -41,6 +42,7 @@ class HomeArticleItemView(private val mContext: Context, private var homeEvent:
homeModuleArticleItemViewGreatNum
.
text
=
"${bean?.countOfFavorite}点赞"
homeModuleArticleItemViewLookNum
.
text
=
"${bean?.readNum}浏览"
YDLImageCacheManager
.
showImage
(
mContext
,
bean
?.
imgUrl
,
homeModuleArticleItemViewImg
)
YDLImageCacheManager
.
showImage
(
mContext
,
bean
?.
smallImage
,
homeModuleArticleItemViewIcon
)
setOnClickListener
{
homeEvent
?.
articleItemClick
(
bean
)
...
...
m-home/src/ydl/res/layout/home_article_item_view.xml
View file @
46dfcf97
...
...
@@ -10,7 +10,7 @@
<androidx.cardview.widget.CardView
android:id=
"@+id/homeModuleArticleItemViewCardImg"
android:layout_width=
"
70
dp"
android:layout_width=
"
84
dp"
android:layout_height=
"70dp"
android:layout_alignParentRight=
"true"
app:cardCornerRadius=
"@dimen/platform_dp_6"
...
...
@@ -27,22 +27,24 @@
android:id=
"@+id/homeModuleArticleItemViewTitle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:maxHeight=
"44dp"
android:maxLines=
"2"
android:ellipsize=
"end"
android:textSize=
"16sp"
android:textStyle=
"bold"
android:textColor=
"#1C1F28"
android:lineSpacingExtra=
"@dimen/platform_dp_1"
tools:text=
"喧嚣的世界中,你的重要何以而来?
喧嚣的世界中,你的重要何以而来?
"
tools:text=
"喧嚣的世界中,你的重要何以而来?"
android:layout_alignParentLeft=
"true"
android:layout_alignTop=
"@id/homeModuleArticleItemViewCardImg"
android:layout_toLeftOf=
"@+id/homeModuleArticleItemViewCardImg"
android:layout_marginRight=
"1
4
dp"
/>
android:layout_marginRight=
"1
8
dp"
/>
<TextView
android:id=
"@+id/homeModuleArticleItemViewContent"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"18dp"
android:layout_marginTop=
"8dp"
android:maxLines=
"1"
android:gravity=
"center_vertical"
android:ellipsize=
"end"
...
...
@@ -51,8 +53,8 @@
android:layout_alignParentLeft=
"true"
tools:text=
"喧嚣的世界中,你的重要何以而来?当我伫立在我所伫立之处..."
android:layout_toLeftOf=
"@+id/homeModuleArticleItemViewCardImg"
android:layout_
alignBottom=
"@id/homeModuleArticleItemViewCardImg
"
android:layout_marginRight=
"
9
dp"
/>
android:layout_
below=
"@id/homeModuleArticleItemViewTitle
"
android:layout_marginRight=
"
18
dp"
/>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/homeModuleArticleItemViewBottomLayout"
...
...
@@ -61,14 +63,22 @@
android:layout_below=
"@+id/homeModuleArticleItemViewCardImg"
android:layout_marginTop=
"20dp"
>
<
Image
View
android:id=
"@+id/
homeModuleArticleItemViewIcon
"
<
androidx.cardview.widget.Card
View
android:id=
"@+id/
card_view_avatar
"
android:layout_width=
"16dp"
android:layout_height=
"16dp"
android:src=
"@drawable/home_article_item_icon"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
/>
app:layout_constraintBottom_toBottomOf=
"parent"
app:cardCornerRadius=
"8dp"
>
<ImageView
android:id=
"@+id/homeModuleArticleItemViewIcon"
android:layout_width=
"16dp"
android:layout_height=
"16dp"
android:src=
"@drawable/home_article_item_icon"
/>
</androidx.cardview.widget.CardView>
<TextView
android:id=
"@+id/homeModuleArticleItemViewAuthor"
...
...
@@ -78,7 +88,7 @@
android:textColor=
"#666666"
android:layout_marginLeft=
"@dimen/platform_dp_3"
android:textStyle=
"bold"
app:layout_constraintStart_toEndOf=
"@id/
homeModuleArticleItemViewIcon
"
app:layout_constraintStart_toEndOf=
"@id/
card_view_avatar
"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
tools:text=
"赵秀英"
/>
...
...
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