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
948b06c0
Commit
948b06c0
authored
Oct 15, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feeds preview block
parent
089f00bc
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
27 deletions
+59
-27
ScreenController.kt
...al/roompark/presentation/screen/feeds/ScreenController.kt
+16
-1
ArticlesPreviewAdapter.kt
...presentation/screen/feeds/utils/ArticlesPreviewAdapter.kt
+8
-3
feed_viewholder.xml
app/src/main/res/layout/feed_viewholder.xml
+16
-8
feeds_block_view.xml
app/src/main/res/layout/feeds_block_view.xml
+13
-9
feeds_screen.xml
app/src/main/res/layout/feeds_screen.xml
+6
-6
No files found.
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/ScreenController.kt
View file @
948b06c0
...
...
@@ -2,12 +2,15 @@ package com.biganto.visual.roompark.presentation.screen.feeds
import
android.view.View
import
android.widget.TextView
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
butterknife.BindView
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.base.RoomParkApplication
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.conductor.BigantoBaseController
import
com.biganto.visual.roompark.domain.model.FeedModel
import
com.biganto.visual.roompark.presentation.screen.feeds.utils.ArticlesPreviewAdapter
import
com.google.android.material.tabs.TabLayout
import
com.jakewharton.rxbinding3.material.selections
import
io.reactivex.Observable
...
...
@@ -38,6 +41,17 @@ class FeedsScreenController :
@BindView
(
R
.
id
.
feedsTabs
)
lateinit
var
feedsTabs
:
TabLayout
@BindView
(
R
.
id
.
feedsRecyclerView
)
lateinit
var
feedsRecyclerView
:
RecyclerView
private
fun
bindRecycler
(){
feedsRecyclerView
.
isNestedScrollingEnabled
=
true
feedsRecyclerView
.
layoutManager
=
LinearLayoutManager
(
activity
,
RecyclerView
.
VERTICAL
,
false
)
feedsRecyclerView
.
adapter
=
ArticlesPreviewAdapter
()
feedsRecyclerView
.
itemAnimator
=
null
}
private
var
storedFeedsList
:
List
<
FeedModel
>
=
arrayListOf
()
...
...
@@ -46,7 +60,7 @@ class FeedsScreenController :
override
fun
onViewBound
(
v
:
View
)
{
bindRecycler
()
}
override
fun
render
(
viewState
:
FeedsScreenViewState
)
{
...
...
@@ -84,6 +98,7 @@ class FeedsScreenController :
private
fun
render
(
viewState
:
FeedsScreenViewState
.
GetFeedArticlesPreview
){
(
feedsRecyclerView
.
adapter
as
ArticlesPreviewAdapter
).
addItems
(
viewState
.
items
)
snackbar
.
showSnackBar
(
viewState
.
items
.
first
().
announce
)
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/utils/ArticlesPreviewAdapter.kt
View file @
948b06c0
...
...
@@ -22,10 +22,17 @@ class ArticlesPreviewAdapter : RecyclerView.Adapter<ArticlePreviewViewHolder>()
private
var
list
:
MutableList
<
ArticlePreviewModel
>
=
mutableListOf
()
fun
addItems
(
list
:
List
<
ArticlePreviewModel
>){
this
.
list
.
clear
()
this
.
list
.
addAll
(
list
)
notifyDataSetChanged
()
}
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
)
.
inflate
(
R
.
layout
.
feed
_viewholder
,
parent
,
false
)
)
override
fun
getItemCount
():
Int
=
list
.
size
...
...
@@ -45,7 +52,6 @@ class ArticlePreviewViewHolder(itemView: View) : RecyclerView.ViewHolder(itemVie
@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
...
...
@@ -56,7 +62,6 @@ class ArticlePreviewViewHolder(itemView: View) : RecyclerView.ViewHolder(itemVie
fun
bindModel
(
model
:
ArticlePreviewModel
){
articleDate
.
text
=
dateFormatter
.
format
(
model
.
published
)
articleTitle
.
text
=
model
.
title
articleDescription
.
text
=
model
.
announce
articleIsRead
.
setGone
(
model
.
isRead
)
Picasso
.
get
()
...
...
app/src/main/res/layout/feed_viewholder.xml
View file @
948b06c0
...
...
@@ -4,15 +4,16 @@
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/linearLayout3"
android:layout_width=
"match_parent"
android:layout_height=
"
60dp
"
android:layout_height=
"
wrap_content
"
android:background=
"@color/colorFeedViewHolderBackground"
android:orientation=
"vertical"
android:paddingEnd=
"128dp"
>
android:orientation=
"vertical"
>
<com.biganto.visual.roompark.view_utils.image_view.RoundedImageView
android:id=
"@+id/imageHolder"
android:layout_width=
"60dp"
android:layout_height=
"60dp"
android:layout_marginTop=
"8dp"
android:layout_marginBottom=
"8dp"
android:background=
"@color/colorAccentSecondary"
app:image_corner_radius=
"4dp"
app:layout_constraintBottom_toBottomOf=
"parent"
...
...
@@ -31,7 +32,7 @@
android:id=
"@+id/feed_read"
android:layout_width=
"8dp"
android:layout_height=
"8dp"
android:layout_marginTop=
"
2
dp"
android:layout_marginTop=
"
10
dp"
android:background=
"@drawable/new_feed_icon"
android:visibility=
"visible"
app:layout_constraintStart_toStartOf=
"@+id/guideline"
...
...
@@ -40,26 +41,33 @@
<TextView
android:id=
"@+id/feed_date_text_view"
style=
"@style/Feed.Notice"
android:layout_width=
"
0dp
"
android:layout_width=
"
wrap_content
"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"16dp"
android:layout_marginTop=
"8dp"
android:layout_marginEnd=
"32dp"
android:includeFontPadding=
"false"
android:text=
"22 / 02 / 2019"
android:visibility=
"visible"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"@+id/guideline"
app:layout_constraintHorizontal_bias=
"0.0"
app:layout_constraintStart_toEndOf=
"@+id/guideline"
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:id=
"@+id/feed_title_info_text_view"
style=
"@style/Common_Text.Inverted"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"32dp"
android:layout_marginBottom=
"8dp"
android:includeFontPadding=
"false"
android:maxLines=
"3"
android:text=
"В «РУМЯНЦЕВО-ПАРК» ПРИСТУПИЛИ К МОНТАЖУ ОКОННЫХ БЛОКОВ"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"@+id/guideline"
app:layout_constraintTop_toBottomOf=
"@+id/feed_date_text_view"
/>
app:layout_constraintStart_toEndOf=
"@+id/guideline"
app:layout_constraintTop_toBottomOf=
"@+id/feed_date_text_view"
app:layout_constraintVertical_bias=
"0.0"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
app/src/main/res/layout/feeds_block_view.xml
View file @
948b06c0
...
...
@@ -4,7 +4,7 @@
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/linearLayout2"
android:layout_width=
"match_parent"
android:layout_height=
"
448dp
"
android:layout_height=
"
wrap_content
"
android:background=
"@drawable/gradient_background_accent"
android:orientation=
"vertical"
android:paddingStart=
"16dp"
>
...
...
@@ -14,32 +14,35 @@
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:background=
"#00000000"
app:tabMaxWidth=
"@dimen/feeds_tab_max_width"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:tabMaxWidth=
"@dimen/feeds_tab_max_width"
app:tabMode=
"scrollable"
/>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/feedsRecyclerView"
android:layout_width=
"0dp"
android:layout_height=
"0dp"
tools:listitem=
"@layout/feed_direct_viewholder"
app:layout_constraintBottom_toTopOf=
"@+id/feeds_divider"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"16dp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/feedsTabs"
/>
app:layout_constraintTop_toBottomOf=
"@+id/feedsTabs"
tools:listitem=
"@layout/feed_direct_viewholder"
/>
<include
android:id=
"@+id/feeds_divider"
layout=
"@layout/horizontal_divider"
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:layout_marginTop=
"8dp"
android:background=
"@drawable/botttom_bar_shadow"
app:layout_constraintBottom_toTopOf=
"@+id/textView4"
/>
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/feedsRecyclerView"
/>
<com.google.android.material.button.MaterialButton
android:id=
"@+id/t
extView4
"
android:id=
"@+id/t
o_feed_articles
"
style=
"@style/AllFeeds.News"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
...
...
@@ -47,5 +50,6 @@
android:gravity=
"center_vertical|end"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
/>
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/feeds_divider"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/feeds_screen.xml
View file @
948b06c0
...
...
@@ -10,12 +10,12 @@
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<include
android:id=
"@+id/include"
layout=
"@layout/feeds_block_view"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<include
android:id=
"@+id/include"
layout=
"@layout/feeds_block_view"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/dev_progress_header"
...
...
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