Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
beyond-clouds-android
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
云深项目组
beyond-clouds-android
Commits
bafa2052
Commit
bafa2052
authored
Mar 16, 2020
by
段启岩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
动态列表框架优化
parent
1e01f6c6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
58 additions
and
59 deletions
+58
-59
app/src/main/java/cn/yunliyunwai/beyondclouds/adapter/BlogListRecyclerViewAdapter.java
+2
-2
app/src/main/java/cn/yunliyunwai/beyondclouds/adapter/DynamicListRecyclerViewAdapter.java
+18
-2
app/src/main/java/cn/yunliyunwai/beyondclouds/adapter/ProjectListRecyclerViewAdapter.java
+2
-2
app/src/main/res/drawable/placeholder_rectangle.png
+0
-0
app/src/main/res/drawable/placeholder_square.png
+0
-0
app/src/main/res/layout/post_item.xml
+36
-53
No files found.
app/src/main/java/cn/yunliyunwai/beyondclouds/adapter/BlogListRecyclerViewAdapter.java
View file @
bafa2052
...
@@ -36,8 +36,8 @@ public class BlogListRecyclerViewAdapter extends BaseQuickAdapter<Blog ,BaseView
...
@@ -36,8 +36,8 @@ public class BlogListRecyclerViewAdapter extends BaseQuickAdapter<Blog ,BaseView
binding
.
blogCover
.
setVisibility
(
View
.
VISIBLE
);
binding
.
blogCover
.
setVisibility
(
View
.
VISIBLE
);
RequestOptions
options
=
new
RequestOptions
()
RequestOptions
options
=
new
RequestOptions
()
.
centerCrop
()
.
centerCrop
()
.
placeholder
(
R
.
drawable
.
p
re_load_blog
)
.
placeholder
(
R
.
drawable
.
p
laceholder_rectangle
)
.
error
(
R
.
drawable
.
p
re_load_blog
)
.
error
(
R
.
drawable
.
p
laceholder_rectangle
)
.
priority
(
Priority
.
HIGH
)
.
priority
(
Priority
.
HIGH
)
.
skipMemoryCache
(
true
)
.
skipMemoryCache
(
true
)
.
diskCacheStrategy
(
DiskCacheStrategy
.
NONE
)
.
diskCacheStrategy
(
DiskCacheStrategy
.
NONE
)
...
...
app/src/main/java/cn/yunliyunwai/beyondclouds/adapter/DynamicListRecyclerViewAdapter.java
View file @
bafa2052
...
@@ -14,6 +14,10 @@ import android.widget.Toast;
...
@@ -14,6 +14,10 @@ import android.widget.Toast;
import
androidx.annotation.NonNull
;
import
androidx.annotation.NonNull
;
import
com.bumptech.glide.Glide
;
import
com.bumptech.glide.Priority
;
import
com.bumptech.glide.load.engine.DiskCacheStrategy
;
import
com.bumptech.glide.request.RequestOptions
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.chad.library.adapter.base.BaseViewHolder
;
import
com.chad.library.adapter.base.BaseViewHolder
;
...
@@ -22,6 +26,7 @@ import java.util.List;
...
@@ -22,6 +26,7 @@ import java.util.List;
import
java.util.regex.Matcher
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.util.regex.Pattern
;
import
cn.yunliyunwai.beyondclouds.R
;
import
cn.yunliyunwai.beyondclouds.data.model.Post
;
import
cn.yunliyunwai.beyondclouds.data.model.Post
;
import
cn.yunliyunwai.beyondclouds.databinding.PostItemBinding
;
import
cn.yunliyunwai.beyondclouds.databinding.PostItemBinding
;
import
cn.yunliyunwai.beyondclouds.util.DateUtils
;
import
cn.yunliyunwai.beyondclouds.util.DateUtils
;
...
@@ -59,7 +64,7 @@ public class DynamicListRecyclerViewAdapter extends BaseQuickAdapter<Post,BaseVi
...
@@ -59,7 +64,7 @@ public class DynamicListRecyclerViewAdapter extends BaseQuickAdapter<Post,BaseVi
private
static
final
Pattern
TOPIC_LINK_PATTERN
=
Pattern
.
compile
(
"<a.+?href=['\"](.+?)['\"]>(.+?)</a>"
);
private
static
final
Pattern
TOPIC_LINK_PATTERN
=
Pattern
.
compile
(
"<a.+?href=['\"](.+?)['\"]>(.+?)</a>"
);
private
static
final
String
TOPIC_BARRIER
=
"#"
;
private
static
final
String
TOPIC_BARRIER
=
"#"
;
private
static
final
GlideRoundTransform
glideRoundTransform
=
new
GlideRoundTransform
(
3
);
private
static
final
GlideRoundTransform
glideRoundTransform
=
new
GlideRoundTransform
(
20
);
public
DynamicListRecyclerViewAdapter
(
int
layoutResId
)
{
public
DynamicListRecyclerViewAdapter
(
int
layoutResId
)
{
super
(
layoutResId
);
super
(
layoutResId
);
}
}
...
@@ -69,8 +74,19 @@ public class DynamicListRecyclerViewAdapter extends BaseQuickAdapter<Post,BaseVi
...
@@ -69,8 +74,19 @@ public class DynamicListRecyclerViewAdapter extends BaseQuickAdapter<Post,BaseVi
PostItemBinding
binding
=
PostItemBinding
.
bind
(
helper
.
itemView
);
PostItemBinding
binding
=
PostItemBinding
.
bind
(
helper
.
itemView
);
parseAndSetContent
(
binding
.
txtContent
,
post
.
getContent
());
parseAndSetContent
(
binding
.
txtContent
,
post
.
getContent
());
binding
.
txt
Author
.
setText
(
post
.
getUserNick
());
binding
.
txt
UserNick
.
setText
(
post
.
getUserNick
());
binding
.
txtCreateTime
.
setText
(
DateUtils
.
format
(
post
.
getCreateTime
()));
binding
.
txtCreateTime
.
setText
(
DateUtils
.
format
(
post
.
getCreateTime
()));
if
(
null
!=
post
.
getUserAvatar
()
&&
!
TextUtils
.
isEmpty
(
post
.
getUserAvatar
().
trim
())
&&
post
.
getUserAvatar
().
startsWith
(
"http"
))
{
RequestOptions
options
=
new
RequestOptions
()
.
centerCrop
()
.
placeholder
(
R
.
drawable
.
placeholder_square
)
.
error
(
R
.
drawable
.
placeholder_square
)
.
priority
(
Priority
.
HIGH
)
.
skipMemoryCache
(
true
)
.
diskCacheStrategy
(
DiskCacheStrategy
.
NONE
)
.
transform
(
glideRoundTransform
);
Glide
.
with
(
binding
.
getRoot
()).
applyDefaultRequestOptions
(
options
).
load
(
post
.
getUserAvatar
()).
into
(
binding
.
imgUserAvatar
);
}
}
}
...
...
app/src/main/java/cn/yunliyunwai/beyondclouds/adapter/ProjectListRecyclerViewAdapter.java
View file @
bafa2052
...
@@ -36,8 +36,8 @@ public class ProjectListRecyclerViewAdapter extends BaseQuickAdapter<Project,Bas
...
@@ -36,8 +36,8 @@ public class ProjectListRecyclerViewAdapter extends BaseQuickAdapter<Project,Bas
binding
.
blogCover
.
setVisibility
(
View
.
VISIBLE
);
binding
.
blogCover
.
setVisibility
(
View
.
VISIBLE
);
RequestOptions
options
=
new
RequestOptions
()
RequestOptions
options
=
new
RequestOptions
()
.
centerCrop
()
.
centerCrop
()
.
placeholder
(
R
.
drawable
.
p
re_load_blog
)
.
placeholder
(
R
.
drawable
.
p
laceholder_rectangle
)
.
error
(
R
.
drawable
.
p
re_load_blog
)
.
error
(
R
.
drawable
.
p
laceholder_rectangle
)
.
priority
(
Priority
.
HIGH
)
.
priority
(
Priority
.
HIGH
)
.
skipMemoryCache
(
true
)
.
skipMemoryCache
(
true
)
.
diskCacheStrategy
(
DiskCacheStrategy
.
NONE
)
.
diskCacheStrategy
(
DiskCacheStrategy
.
NONE
)
...
...
app/src/main/res/drawable/p
re_load_blog
.png
→
app/src/main/res/drawable/p
laceholder_rectangle
.png
View file @
bafa2052
File moved
app/src/main/res/drawable/placeholder_square.png
0 → 100644
View file @
bafa2052
2.34 KB
app/src/main/res/layout/post_item.xml
View file @
bafa2052
...
@@ -8,23 +8,50 @@
...
@@ -8,23 +8,50 @@
android:clickable=
"true"
android:clickable=
"true"
android:paddingStart=
"12dp"
android:paddingStart=
"12dp"
android:paddingLeft=
"12dp"
android:paddingLeft=
"12dp"
android:paddingTop=
"1
6
dp"
android:paddingTop=
"1
8
dp"
android:paddingEnd=
"12dp"
android:paddingEnd=
"12dp"
android:paddingRight=
"12dp"
>
android:paddingRight=
"12dp"
>
<ImageView
android:id=
"@+id/img_user_avatar"
android:src=
"@drawable/placeholder_square"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
android:layout_width=
"40dp"
android:layout_height=
"40dp"
/>
<TextView
<TextView
android:id=
"@+id/txt_title"
android:id=
"@+id/txt_user_nick"
android:text=
"段启岩"
app:layout_constraintStart_toStartOf=
"parent"
android:layout_marginStart=
"60dp"
android:layout_marginLeft=
"60dp"
app:layout_constraintTop_toTopOf=
"parent"
android:textColor=
"@color/colorTextAccent"
android:textSize=
"14sp"
android:gravity=
"center_vertical"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"22dp"
/>
<TextView
android:id=
"@+id/txt_create_time"
android:text=
"2020-2-18 10:24:00"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
android:layout_marginStart=
"60dp"
android:layout_marginLeft=
"60dp"
android:layout_marginTop=
"3dp"
app:layout_constraintTop_toBottomOf=
"@id/txt_user_nick"
android:textColor=
"#999999"
android:textSize=
"12sp"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
<androidx.constraintlayout.widget.Barrier
<androidx.constraintlayout.widget.Barrier
android:id=
"@+id/barrier_user_info"
android:id=
"@+id/barrier_user_info"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
app:barrierDirection=
"bottom"
app:barrierDirection=
"bottom"
app:constraint_referenced_ids=
"
txt_titl
e"
app:constraint_referenced_ids=
"
img_user_avatar,txt_user_nick,txt_create_tim
e"
tools:layout_editor_absoluteX=
"12dp"
tools:layout_editor_absoluteX=
"12dp"
tools:layout_editor_absoluteY=
"16dp"
/>
tools:layout_editor_absoluteY=
"16dp"
/>
...
@@ -34,7 +61,7 @@
...
@@ -34,7 +61,7 @@
android:text=
"SpringBoot迭代发布JRA瘦身配置"
android:text=
"SpringBoot迭代发布JRA瘦身配置"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:textSize=
"1
6
sp"
android:textSize=
"1
4
sp"
android:textColorHint=
"@color/colorPrimaryTouched"
android:textColorHint=
"@color/colorPrimaryTouched"
android:linksClickable=
"true"
android:linksClickable=
"true"
android:textColorHighlight=
"@color/colorBackgroundTopicTouched"
android:textColorHighlight=
"@color/colorBackgroundTopicTouched"
...
@@ -53,55 +80,11 @@
...
@@ -53,55 +80,11 @@
tools:layout_editor_absoluteX=
"12dp"
tools:layout_editor_absoluteX=
"12dp"
tools:layout_editor_absoluteY=
"16dp"
/>
tools:layout_editor_absoluteY=
"16dp"
/>
<TextView
android:id=
"@+id/txt_author"
android:layout_marginTop=
"10dp"
android:text=
"段启岩"
android:textSize=
"10sp"
android:textColor=
"@color/colorText"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/barrier_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
<TextView
android:id=
"@+id/txt_dot"
android:text=
"·"
android:layout_marginTop=
"10dp"
android:textSize=
"10sp"
android:textStyle=
"bold"
android:textColor=
"@color/colorText"
app:layout_constraintTop_toBottomOf=
"@id/barrier_content"
app:layout_constraintStart_toEndOf=
"@id/txt_author"
android:paddingStart=
"6dp"
android:paddingLeft=
"6dp"
android:paddingEnd=
"6dp"
android:paddingRight=
"6dp"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
<TextView
android:id=
"@+id/txt_create_time"
android:layout_marginTop=
"10dp"
android:textSize=
"10sp"
android:textColor=
"@color/colorText"
android:text=
"2020-2-18 10:24:00"
app:layout_constraintTop_toBottomOf=
"@id/barrier_content"
app:layout_constraintStart_toEndOf=
"@id/txt_dot"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
<androidx.constraintlayout.widget.Barrier
android:id=
"@+id/barrier_info"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:barrierDirection=
"bottom"
app:constraint_referenced_ids=
"txt_create_time,txt_author,txt_dot"
tools:layout_editor_absoluteX=
"12dp"
tools:layout_editor_absoluteY=
"16dp"
/>
<View
<View
app:layout_constraintTop_toBottomOf=
"@id/barrier_info"
android:layout_marginTop=
"18dp"
android:layout_marginTop=
"18dp"
app:layout_constraintTop_toBottomOf=
"@id/barrier_content"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"1dp"
android:layout_height=
"1dp"
android:background=
"#efefef"
/>
android:background=
"#efefef"
/>
...
...
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