Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
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
56eaee29
Commit
56eaee29
authored
Oct 15, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add album card preview
parent
948b06c0
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
259 additions
and
20 deletions
+259
-20
feeds.kt
...va/com/biganto/visual/roompark/domain/interactor/feeds.kt
+30
-4
ScreenController.kt
...al/roompark/presentation/screen/feeds/ScreenController.kt
+16
-3
ScreenPresenter.kt
...ual/roompark/presentation/screen/feeds/ScreenPresenter.kt
+5
-0
ScreenViewState.kt
...ual/roompark/presentation/screen/feeds/ScreenViewState.kt
+3
-0
DevProgressPreviewAdapter.kt
...sentation/screen/feeds/utils/DevProgressPreviewAdapter.kt
+66
-0
estate_card_viewholder.xml
app/src/main/res/layout-v23/estate_card_viewholder.xml
+64
-0
album_preview_card_viewholder.xml
app/src/main/res/layout/album_preview_card_viewholder.xml
+57
-0
estate_card_viewholder.xml
app/src/main/res/layout/estate_card_viewholder.xml
+4
-3
feeds_block_view.xml
app/src/main/res/layout/feeds_block_view.xml
+1
-0
feeds_screen.xml
app/src/main/res/layout/feeds_screen.xml
+13
-10
No files found.
app/src/main/java/com/biganto/visual/roompark/domain/interactor/feeds.kt
View file @
56eaee29
package
com.biganto.visual.roompark.domain.interactor
import
com.biganto.visual.roompark.domain.model.ArticlePreviewModel
import
com.biganto.visual.roompark.domain.model.ArticlesPreviewModel
import
com.biganto.visual.roompark.domain.model.FeedModel
import
com.biganto.visual.roompark.domain.model.FeedsHeaderModel
import
com.biganto.visual.roompark.domain.model.*
import
io.reactivex.Single
import
java.util.*
import
javax.inject.Inject
...
...
@@ -26,6 +23,8 @@ class FeedsInteractor @Inject constructor(
}
)
fun
fetchAlbums
():
Single
<
List
<
AlbumPreviewModel
>>
=
Single
.
just
(
albumsPreviews
)
private
companion
object
{
...
...
@@ -133,6 +132,33 @@ class FeedsInteractor @Inject constructor(
)
)
)
val
albumsPreviews
=
listOf
<
AlbumPreviewModel
>(
AlbumPreviewModel
(
1
,
2
,
Date
(
3131231L
),
"Dom 1"
,
"https://room-park.ru/assets/gallery_images/image_2600/00/00/02/764-1d9795.png"
,
false
),
AlbumPreviewModel
(
1
,
2
,
Date
(
31312323421L
),
"Dom 1"
,
"https://room-park.ru/assets/gallery_images/image_2600/00/00/02/626-8afd4a.jpeg"
,
false
),
AlbumPreviewModel
(
1
,
2
,
Date
(
3131232131L
),
"Dom 1"
,
"https://room-park.ru/assets/gallery_images/image_2600/00/00/02/573-1fa95c.jpeg"
,
false
)
)
}
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/ScreenController.kt
View file @
56eaee29
...
...
@@ -10,6 +10,7 @@ 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.AlbumsPreviewAdapter
import
com.biganto.visual.roompark.presentation.screen.feeds.utils.ArticlesPreviewAdapter
import
com.google.android.material.tabs.TabLayout
import
com.jakewharton.rxbinding3.material.selections
...
...
@@ -44,21 +45,30 @@ class FeedsScreenController :
@BindView
(
R
.
id
.
feedsRecyclerView
)
lateinit
var
feedsRecyclerView
:
RecyclerView
@BindView
(
R
.
id
.
dev_progress_recycler_view
)
lateinit
var
devProgressRecyclerView
:
RecyclerView
private
fun
bindRecycler
(){
feedsRecyclerView
.
isNestedScrollingEnabled
=
true
feedsRecyclerView
.
layoutManager
=
LinearLayoutManager
(
activity
,
RecyclerView
.
VERTICAL
,
false
)
feedsRecyclerView
.
adapter
=
ArticlesPreviewAdapter
()
feedsRecyclerView
.
itemAnimator
=
null
}
devProgressRecyclerView
.
isNestedScrollingEnabled
=
true
devProgressRecyclerView
.
layoutManager
=
LinearLayoutManager
(
activity
,
RecyclerView
.
HORIZONTAL
,
false
)
devProgressRecyclerView
.
adapter
=
AlbumsPreviewAdapter
()
devProgressRecyclerView
.
itemAnimator
=
null
}
private
var
storedFeedsList
:
List
<
FeedModel
>
=
arrayListOf
()
@Inject
override
lateinit
var
injectedPresenter
:
FeedsScreenPresenter
override
fun
onViewBound
(
v
:
View
)
{
bindRecycler
()
}
...
...
@@ -69,6 +79,7 @@ class FeedsScreenController :
when
(
viewState
){
is
FeedsScreenViewState
.
Idle
->
render
(
viewState
)
is
FeedsScreenViewState
.
FeedsPages
->
render
(
viewState
)
is
FeedsScreenViewState
.
AlbumsPages
->
render
(
viewState
)
is
FeedsScreenViewState
.
GetFeedArticlesPreview
->
render
(
viewState
)
}
}
...
...
@@ -96,10 +107,12 @@ class FeedsScreenController :
storedFeedsList
=
viewState
.
items
}
private
fun
render
(
viewState
:
FeedsScreenViewState
.
AlbumsPages
){
(
devProgressRecyclerView
.
adapter
as
AlbumsPreviewAdapter
).
addItems
(
viewState
.
items
)
}
private
fun
render
(
viewState
:
FeedsScreenViewState
.
GetFeedArticlesPreview
){
(
feedsRecyclerView
.
adapter
as
ArticlesPreviewAdapter
).
addItems
(
viewState
.
items
)
snackbar
.
showSnackBar
(
viewState
.
items
.
first
().
announce
)
}
private
fun
getComponent
()
=
DaggerFeedsScreenComponent
.
factory
()
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/ScreenPresenter.kt
View file @
56eaee29
...
...
@@ -20,6 +20,10 @@ class FeedsScreenPresenter @Inject constructor(
override
fun
bindIntents
()
{
val
fetchAlbums
=
interactor
.
fetchAlbums
()
.
map
{
FeedsScreenViewState
.
AlbumsPages
(
it
)
}
val
fetchFeeds
=
interactor
.
fetchTopFeeds
()
.
map
{
FeedsScreenViewState
.
FeedsPages
(
it
.
feeds
.
toList
())
}
...
...
@@ -30,6 +34,7 @@ class FeedsScreenPresenter @Inject constructor(
val
state
=
restoreStateObservable
.
mergeWith
(
fetchFeeds
)
.
mergeWith
(
getFeedArticlesPreview
)
.
mergeWith
(
fetchAlbums
)
.
doOnError
{
Timber
.
e
(
it
)}
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/ScreenViewState.kt
View file @
56eaee29
package
com.biganto.visual.roompark.presentation.screen.feeds
import
com.biganto.visual.roompark.conductor.BigantoBaseViewState
import
com.biganto.visual.roompark.domain.model.AlbumPreviewModel
import
com.biganto.visual.roompark.domain.model.ArticlePreviewModel
import
com.biganto.visual.roompark.domain.model.FeedModel
...
...
@@ -12,5 +13,7 @@ import com.biganto.visual.roompark.domain.model.FeedModel
sealed
class
FeedsScreenViewState
:
BigantoBaseViewState
()
{
class
Idle
:
FeedsScreenViewState
()
class
FeedsPages
(
val
items
:
List
<
FeedModel
>)
:
FeedsScreenViewState
()
class
AlbumsPages
(
val
items
:
List
<
AlbumPreviewModel
>)
:
FeedsScreenViewState
()
class
GetFeedArticlesPreview
(
val
items
:
List
<
ArticlePreviewModel
>)
:
FeedsScreenViewState
()
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/utils/DevProgressPreviewAdapter.kt
0 → 100644
View file @
56eaee29
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.AlbumPreviewModel
import
com.squareup.picasso.Picasso
import
java.text.SimpleDateFormat
import
java.util.*
/**
* Created by Vladislav Bogdashkin on 15.10.2019.
*/
class
AlbumsPreviewAdapter
:
RecyclerView
.
Adapter
<
AlbumCardViewHolder
>()
{
private
var
list
:
MutableList
<
AlbumPreviewModel
>
=
mutableListOf
()
fun
addItems
(
list
:
List
<
AlbumPreviewModel
>){
this
.
list
.
clear
()
this
.
list
.
addAll
(
list
)
notifyDataSetChanged
()
}
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
AlbumCardViewHolder
=
AlbumCardViewHolder
(
LayoutInflater
.
from
(
parent
.
context
)
.
inflate
(
R
.
layout
.
album_preview_card_viewholder
,
parent
,
false
)
)
override
fun
getItemCount
():
Int
=
list
.
size
override
fun
onBindViewHolder
(
holder
:
AlbumCardViewHolder
,
position
:
Int
)
{
holder
.
bindModel
(
list
[
position
])
}
}
class
AlbumCardViewHolder
(
itemView
:
View
)
:
RecyclerView
.
ViewHolder
(
itemView
)
{
private
val
dateFormatter
=
SimpleDateFormat
(
"dd MMMM yyyy"
,
Locale
(
"ru"
))
@BindView
(
R
.
id
.
preview
)
lateinit
var
preview
:
ImageView
@BindView
(
R
.
id
.
card_title
)
lateinit
var
articleTitle
:
TextView
@BindView
(
R
.
id
.
card_updated
)
lateinit
var
articleDate
:
TextView
init
{
ButterKnife
.
bind
(
this
,
itemView
)
}
fun
bindModel
(
model
:
AlbumPreviewModel
){
articleDate
.
text
=
dateFormatter
.
format
(
model
.
published
)
articleTitle
.
text
=
model
.
title
Picasso
.
get
()
.
load
(
model
.
previewUrl
)
.
into
(
preview
)
}
}
app/src/main/res/layout-v23/estate_card_viewholder.xml
0 → 100644
View file @
56eaee29
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"284dp"
android:layout_height=
"189dp"
app:cardElevation=
"0dp"
app:cardForegroundColor=
"#00000000"
app:cardPreventCornerOverlap=
"false"
app:cardUseCompatPadding=
"false"
>
<com.biganto.visual.roompark.view_utils.image_view.RoundedImageView
android:id=
"@+id/preview"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:adjustViewBounds=
"true"
android:background=
"@drawable/default_image_placeholder"
android:cropToPadding=
"true"
android:foreground=
"@drawable/catalog_item_mask"
android:scaleType=
"centerCrop"
app:image_corner_radius=
"4dp"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/card_title"
style=
"@style/Header_TextView.Inverted_Header"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"64dp"
android:layout_marginBottom=
"4dp"
android:text=
"Дом №1"
android:textAlignment=
"center"
/>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/textView6"
style=
"@style/Common_Text.Inverted"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Последнее обновление"
android:textAlignment=
"center"
/>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/card_updated"
style=
"@style/Accent_Minor_TextView.DatePlaceHolder"
android:layout_width=
"match_parent"
android:layout_height=
"24dp"
android:layout_marginStart=
"64dp"
android:layout_marginTop=
"4dp"
android:layout_marginEnd=
"64dp"
android:gravity=
"center"
android:maxLines=
"1"
android:text=
"14 декабря 2019г"
android:textAlignment=
"center"
/>
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
</FrameLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
\ No newline at end of file
app/src/main/res/layout/album_preview_card_viewholder.xml
0 → 100644
View file @
56eaee29
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"142dp"
android:layout_height=
"94dp"
android:layout_margin=
"16dp"
app:cardElevation=
"2dp"
app:cardForegroundColor=
"#00000000"
app:cardPreventCornerOverlap=
"false"
app:cardUseCompatPadding=
"false"
>
<com.biganto.visual.roompark.view_utils.image_view.RoundedImageView
android:id=
"@+id/preview"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:adjustViewBounds=
"true"
android:background=
"@drawable/default_image_placeholder"
android:cropToPadding=
"true"
android:foreground=
"@color/colorOpacityBackground"
android:scaleType=
"centerCrop"
app:image_corner_radius=
"4dp"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/card_title"
style=
"@style/Default_TextView.Inverted_Text"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"32dp"
android:layout_marginBottom=
"4dp"
android:text=
"Дом №1"
android:textAlignment=
"center"
/>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/card_updated"
style=
"@style/Accent_Minor_TextView.Inverted"
android:layout_width=
"match_parent"
android:layout_height=
"16dp"
android:layout_marginStart=
"8dp"
android:layout_marginTop=
"12dp"
android:layout_marginEnd=
"8dp"
android:gravity=
"center"
android:maxLines=
"1"
android:text=
"14 декабря 2019г"
android:textAlignment=
"center"
/>
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
</FrameLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
\ No newline at end of file
app/src/main/res/layout/estate_card_viewholder.xml
View file @
56eaee29
...
...
@@ -3,13 +3,14 @@
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"284dp"
android:layout_height=
"189dp"
android:layout_margin=
"16dp"
app:cardElevation=
"0dp"
app:cardForegroundColor=
"#00000000"
app:cardPreventCornerOverlap=
"false"
app:cardUseCompatPadding=
"false"
>
<com.biganto.visual.roompark.view_utils.image_view.RoundedImageView
android:id=
"@+id/
imageV
iew"
android:id=
"@+id/
prev
iew"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:adjustViewBounds=
"true"
...
...
@@ -25,7 +26,7 @@
android:orientation=
"vertical"
>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/
textView5
"
android:id=
"@+id/
card_title
"
style=
"@style/Header_TextView.Inverted_Header"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
...
...
@@ -43,7 +44,7 @@
android:textAlignment=
"center"
/>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/
button
"
android:id=
"@+id/
card_updated
"
style=
"@style/Accent_Minor_TextView.DatePlaceHolder"
android:layout_width=
"match_parent"
android:layout_height=
"24dp"
...
...
app/src/main/res/layout/feeds_block_view.xml
View file @
56eaee29
...
...
@@ -27,6 +27,7 @@
android:layout_marginTop=
"16dp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
tools:itemCount=
"3"
app:layout_constraintTop_toBottomOf=
"@+id/feedsTabs"
tools:listitem=
"@layout/feed_direct_viewholder"
/>
...
...
app/src/main/res/layout/feeds_screen.xml
View file @
56eaee29
...
...
@@ -2,6 +2,7 @@
<androidx.core.widget.NestedScrollView
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
...
...
@@ -30,16 +31,18 @@
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/include"
/>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/dev_progress_recycler_view"
android:layout_width=
"match_parent"
android:layout_height=
"16dp"
android:layout_marginStart=
"16dp"
android:layout_marginTop=
"16dp"
android:orientation=
"horizontal"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/dev_progress_header"
/>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/dev_progress_recycler_view"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"16dp"
android:layout_marginTop=
"16dp"
android:orientation=
"horizontal"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/dev_progress_header"
tools:itemCount=
"3"
tools:listitem=
"@layout/estate_card_viewholder"
/>
<androidx.recyclerview.widget.RecyclerView
...
...
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