Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Room Park Android
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
Vladislav Bogdashkin
Room Park Android
Commits
f177ab7f
Commit
f177ab7f
authored
Oct 15, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added article preview adapter and viewholder
parent
18718e87
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
6 deletions
+77
-6
ArticlesPreviewAdapter.kt
...presentation/screen/feeds/utils/ArticlesPreviewAdapter.kt
+71
-0
favorite_card_viewholder.xml
app/src/main/res/layout/favorite_card_viewholder.xml
+4
-4
feed_direct_viewholder.xml
app/src/main/res/layout/feed_direct_viewholder.xml
+1
-1
feed_viewholder.xml
app/src/main/res/layout/feed_viewholder.xml
+1
-1
No files found.
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/utils/ArticlesPreviewAdapter.kt
0 → 100644
View file @
f177ab7f
package
com.biganto.visual.roompark.presentation.screen.feeds.utils
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
butterknife.BindView
import
butterknife.ButterKnife
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.domain.model.ArticlePreviewModel
import
com.squareup.picasso.Picasso
import
java.text.SimpleDateFormat
import
java.util.*
/**
* Created by Vladislav Bogdashkin on 15.10.2019.
*/
class
ArticlesPreviewAdapter
:
RecyclerView
.
Adapter
<
ArticlePreviewViewHolder
>()
{
private
var
list
:
MutableList
<
ArticlePreviewModel
>
=
mutableListOf
()
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
ArticlePreviewViewHolder
=
ArticlePreviewViewHolder
(
LayoutInflater
.
from
(
parent
.
context
)
.
inflate
(
com
.
biganto
.
visual
.
roompark
.
R
.
layout
.
feed_direct_viewholder
,
parent
,
false
)
)
override
fun
getItemCount
():
Int
=
list
.
size
override
fun
onBindViewHolder
(
holder
:
ArticlePreviewViewHolder
,
position
:
Int
)
{
}
}
class
ArticlePreviewViewHolder
(
itemView
:
View
)
:
RecyclerView
.
ViewHolder
(
itemView
)
{
private
val
dateFormatter
=
SimpleDateFormat
(
"dd / MM / yyyy"
,
Locale
.
getDefault
())
@BindView
(
R
.
id
.
imageHolder
)
lateinit
var
preview
:
ImageView
@BindView
(
R
.
id
.
feed_date_text_view
)
lateinit
var
articleDate
:
TextView
@BindView
(
R
.
id
.
feed_title_info_text_view
)
lateinit
var
articleTitle
:
TextView
@BindView
(
R
.
id
.
feed_text_info_text_view
)
lateinit
var
articleDescription
:
TextView
@BindView
(
R
.
id
.
feed_read
)
lateinit
var
articleIsRead
:
View
init
{
ButterKnife
.
bind
(
this
,
itemView
)
}
fun
bindModel
(
model
:
ArticlePreviewModel
){
articleDate
.
text
=
dateFormatter
.
format
(
model
.
published
)
articleTitle
.
text
=
model
.
title
articleDescription
.
text
=
model
.
announce
articleIsRead
.
setGone
(
model
.
isRead
)
Picasso
.
get
()
.
load
(
model
.
previewUrl
)
.
into
(
preview
)
}
}
fun
View
.
setGone
(
isGone
:
Boolean
){
this
.
visibility
=
if
(
isGone
)
View
.
GONE
else
View
.
VISIBLE
}
\ No newline at end of file
app/src/main/res/layout/favorite_card_viewholder.xml
View file @
f177ab7f
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
<FrameLayout
<FrameLayout
android:id=
"@+id/f
rameLayout
"
android:id=
"@+id/f
eed_read
"
android:layout_width=
"12dp"
android:layout_width=
"12dp"
android:layout_height=
"12dp"
android:layout_height=
"12dp"
android:layout_marginStart=
"16dp"
android:layout_marginStart=
"16dp"
...
@@ -28,10 +28,10 @@
...
@@ -28,10 +28,10 @@
android:includeFontPadding=
"false"
android:includeFontPadding=
"false"
android:text=
"СВОБОДНА"
android:text=
"СВОБОДНА"
android:visibility=
"visible"
android:visibility=
"visible"
app:layout_constraintBottom_toBottomOf=
"@+id/f
rameLayout
"
app:layout_constraintBottom_toBottomOf=
"@+id/f
eed_read
"
app:layout_constraintEnd_toStartOf=
"@+id/object_plan_icon"
app:layout_constraintEnd_toStartOf=
"@+id/object_plan_icon"
app:layout_constraintStart_toEndOf=
"@+id/f
rameLayout
"
app:layout_constraintStart_toEndOf=
"@+id/f
eed_read
"
app:layout_constraintTop_toTopOf=
"@+id/f
rameLayout
"
/>
app:layout_constraintTop_toTopOf=
"@+id/f
eed_read
"
/>
<ImageView
<ImageView
android:id=
"@+id/object_plan_icon"
android:id=
"@+id/object_plan_icon"
...
...
app/src/main/res/layout/feed_direct_viewholder.xml
View file @
f177ab7f
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
app:layout_constraintGuide_begin=
"144dp"
/>
app:layout_constraintGuide_begin=
"144dp"
/>
<FrameLayout
<FrameLayout
android:id=
"@+id/f
rameLayout
"
android:id=
"@+id/f
eed_read
"
android:layout_width=
"8dp"
android:layout_width=
"8dp"
android:layout_height=
"8dp"
android:layout_height=
"8dp"
android:layout_marginTop=
"18dp"
android:layout_marginTop=
"18dp"
...
...
app/src/main/res/layout/feed_viewholder.xml
View file @
f177ab7f
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
app:layout_constraintGuide_begin=
"76dp"
/>
app:layout_constraintGuide_begin=
"76dp"
/>
<FrameLayout
<FrameLayout
android:id=
"@+id/f
rameLayout
"
android:id=
"@+id/f
eed_read
"
android:layout_width=
"8dp"
android:layout_width=
"8dp"
android:layout_height=
"8dp"
android:layout_height=
"8dp"
android:layout_marginTop=
"2dp"
android:layout_marginTop=
"2dp"
...
...
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