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
a098be97
Commit
a098be97
authored
Dec 12, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
album list adapter && photo adapter
parent
0073535e
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
58 additions
and
13 deletions
+58
-13
response.kt
...ual/roompark/data/repository/api/retrofit/raw/response.kt
+2
-2
raw2entity.kt
...anto/visual/roompark/data/repository/mapper/raw2entity.kt
+1
-1
ScreenController.kt
...l/roompark/presentation/screen/albums/ScreenController.kt
+1
-1
AlbumListAdapter.kt
...mpark/presentation/screen/albums/util/AlbumListAdapter.kt
+42
-8
date_album_viewholder.xml
app/src/main/res/layout/date_album_viewholder.xml
+1
-1
photo_preview_viewholder.xml
app/src/main/res/layout/photo_preview_viewholder.xml
+11
-0
No files found.
app/src/main/java/com/biganto/visual/roompark/data/repository/api/retrofit/raw/response.kt
View file @
a098be97
...
...
@@ -115,8 +115,8 @@ data class ImageAlbumRaw(
val
title
:
String
,
val
sort
:
Int
,
val
date
:
Date
,
val
parent_id
:
Int
,
val
preview
:
String
val
parent_id
:
Int
?
,
val
preview
:
String
?
)
data class
GalleryImageRaw
(
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/mapper/raw2entity.kt
View file @
a098be97
...
...
@@ -72,7 +72,7 @@ fun fromRaw(raw:ImageAlbumRaw) : ImageAlbumEntity {
entity
.
setTitle
(
raw
.
title
)
entity
.
setPublished
(
raw
.
date
)
entity
.
setSort
(
raw
.
sort
)
entity
.
setPreview
(
raw
.
preview
)
entity
.
setPreview
(
raw
.
preview
?:
"https://room-park.ru/assets/gallery_images/image_2600/00/00/03/800-1b7546.png"
)
return
entity
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/albums/ScreenController.kt
View file @
a098be97
...
...
@@ -121,7 +121,7 @@ class AlbumsScreenController :
}
private
fun
render
(
viewState
:
AlbumsScreenViewState
.
AlbumsSelected
){
(
albumsRecyclerView
.
adapter
as
AlbumListAdapter
).
setItems
(
viewState
.
list
)
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/albums/util/AlbumListAdapter.kt
View file @
a098be97
package
com.biganto.visual.roompark.presentation.screen.favorites.util
import
android.view.View
import
androidx.recyclerview.widget.RecyclerView
import
androidx.recyclerview.widget.StaggeredGridLayoutManager
import
butterknife.BindView
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.domain.model.AlbumPhotoPreviewModel
import
com.biganto.visual.roompark.domain.model.AlbumSortedModel
import
com.biganto.visual.roompark.domain.model.PhotoModel
import
com.biganto.visual.roompark.domain.model.PhotoResolutionModel
import
com.biganto.visual.roompark.presentation.screen.settings.util.CommonRecyclerAdapter
import
com.biganto.visual.roompark.presentation.screen.settings.util.CommonViewHolder
import
com.biganto.visual.roompark.util.view_utils.image_view.RoundedImageView
import
com.google.android.material.textview.MaterialTextView
import
com.squareup.picasso.Picasso
/**
* Created by Vladislav Bogdashkin on 16.10.2019.
*/
class
AlbumListAdapter
:
CommonRecyclerAdapter
<
AlbumViewHolder
,
Album
PhotoPreview
Model
>()
{
class
AlbumListAdapter
:
CommonRecyclerAdapter
<
AlbumViewHolder
,
Album
Sorted
Model
>()
{
override
val
vhKlazz
=
AlbumViewHolder
::
class
override
fun
getVhLayout
():
Int
=
R
.
layout
.
date_album_viewholder
}
class
AlbumViewHolder
(
itemView
:
View
)
:
CommonViewHolder
<
Album
PhotoPreview
Model
>(
itemView
)
{
class
AlbumViewHolder
(
itemView
:
View
)
:
CommonViewHolder
<
Album
Sorted
Model
>(
itemView
)
{
@BindView
(
R
.
id
.
date_title_textview
)
lateinit
var
albumTitle
:
MaterialTextView
// @BindView(R.id.camStatus) lateinit var camStatus: MaterialText
View
@BindView
(
R
.
id
.
photos_recyclerview
)
lateinit
var
photosRecyclerView
:
Recycler
View
// @BindView(R.id.camStatusIcon) lateinit var camStatusIcon:ImageView
override
fun
onViewBound
(
model
:
Album
PhotoPreview
Model
)
{
override
fun
onViewBound
(
model
:
Album
Sorted
Model
)
{
albumTitle
.
text
=
model
.
title
// camTitle.text = model.title
// camStatus.text = if (model.streams.isNullOrEmpty()) "ОФФЛАЙН" else "ОНЛАЙН"
// camStatusIcon.visibility = if (model.streams.isNullOrEmpty()) View.GONE else View.VISIBLE
photosRecyclerView
.
isNestedScrollingEnabled
=
true
photosRecyclerView
.
layoutManager
=
StaggeredGridLayoutManager
(
4
,
RecyclerView
.
VERTICAL
)
val
adapter
=
PhotosAdapter
()
photosRecyclerView
.
adapter
=
adapter
photosRecyclerView
.
itemAnimator
=
null
adapter
.
setItems
(
model
.
items
)
}
}
class
PhotosAdapter
:
CommonRecyclerAdapter
<
PhotosViewHolder
,
PhotoModel
>()
{
override
val
vhKlazz
=
PhotosViewHolder
::
class
override
fun
getVhLayout
():
Int
=
R
.
layout
.
photo_preview_viewholder
}
class
PhotosViewHolder
(
itemView
:
View
)
:
CommonViewHolder
<
PhotoModel
>(
itemView
)
{
@BindView
(
R
.
id
.
photo_preview_imageview
)
lateinit
var
photoPreview
:
RoundedImageView
override
fun
onViewBound
(
model
:
PhotoModel
)
{
model
.
resolutionList
.
lowelest
()
?.
let
{
Picasso
.
get
()
.
load
(
it
.
url
)
.
onlyScaleDown
()
.
fit
()
.
into
(
photoPreview
)
}}
}
fun
List
<
PhotoResolutionModel
>.
lowelest
()
=
this
.
minBy
{
it
.
resWidth
*
it
.
resHeight
}
\ No newline at end of file
app/src/main/res/layout/date_album_viewholder.xml
View file @
a098be97
...
...
@@ -11,7 +11,7 @@
android:text=
"TextView"
/>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/photos_recycler
_
iew"
android:id=
"@+id/photos_recycler
v
iew"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
...
...
app/src/main/res/layout/photo_preview_viewholder.xml
0 → 100644
View file @
a098be97
<?xml version="1.0" encoding="utf-8"?>
<com.biganto.visual.roompark.util.view_utils.image_view.RoundedImageView
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:id=
"@+id/photo_preview_imageview"
android:layout_width=
"80dp"
android:layout_height=
"80dp"
android:layout_margin=
"4dp"
android:orientation=
"vertical"
app:image_corner_radius=
"4dp"
>
</com.biganto.visual.roompark.util.view_utils.image_view.RoundedImageView>
\ No newline at end of file
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