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
9f75c250
Commit
9f75c250
authored
Mar 12, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
photo screen viewer
parent
127391e9
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
92 additions
and
5 deletions
+92
-5
ChooseResolutionDialogController.kt
...ark/conductor/dialogs/ChooseResolutionDialogController.kt
+20
-3
PhotoDialogController.kt
...conductor/dialogs/change_handler/PhotoDialogController.kt
+57
-0
AlbumListAdapter.kt
...mpark/presentation/screen/albums/util/AlbumListAdapter.kt
+3
-2
photo_viewer.xml
app/src/main/res/layout/photo_viewer.xml
+12
-0
No files found.
app/src/main/java/com/biganto/visual/roompark/conductor/dialogs/ChooseResolutionDialogController.kt
View file @
9f75c250
...
...
@@ -10,11 +10,15 @@ import androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
butterknife.BindView
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.conductor.dialogs.change_handler.DialogChangeHandler
import
com.biganto.visual.roompark.conductor.dialogs.change_handler.PhotoDialogController
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.bluelinelabs.conductor.Controller
import
com.bluelinelabs.conductor.RouterTransaction
import
com.google.android.material.textview.MaterialTextView
import
io.reactivex.disposables.CompositeDisposable
import
timber.log.Timber
...
...
@@ -38,6 +42,13 @@ class ChooseResolutionDialogController : Controller {
lateinit
var
recyclerView
:
RecyclerView
private
val
detachDisposable
=
CompositeDisposable
()
override
fun
onDetach
(
view
:
View
)
{
detachDisposable
.
clear
()
super
.
onDetach
(
view
)
}
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
):
View
{
val
view
=
inflater
.
inflate
(
getLayoutId
(),
container
,
false
)
...
...
@@ -51,12 +62,18 @@ class ChooseResolutionDialogController : Controller {
)
args
.
getParcelableArrayList
<
PhotoResolutionModel
>(
PHOTOS_KEY
)
?.
let
{
Timber
.
d
(
"items; $it"
)
Timber
.
d
(
"recyclerView; $recyclerView"
)
(
recyclerView
.
adapter
as
PhotoSizeAdapter
).
setItems
(
it
)
(
recyclerView
.
adapter
as
PhotoSizeAdapter
).
notifyDataSetChanged
()
}
detachDisposable
.
add
(
(
recyclerView
.
adapter
as
PhotoSizeAdapter
).
onItemClicked
.
subscribe
{
Timber
.
d
(
"gonna shit : $it"
)
router
.
replaceTopController
(
RouterTransaction
.
with
(
PhotoDialogController
(
it
.
url
))
.
popChangeHandler
(
DialogChangeHandler
())
.
pushChangeHandler
(
DialogChangeHandler
())
)
})
view
.
findViewById
<
View
>(
R
.
id
.
cancel_button
).
setOnClickListener
{
handleBack
()
}
return
view
...
...
app/src/main/java/com/biganto/visual/roompark/conductor/dialogs/change_handler/PhotoDialogController.kt
0 → 100644
View file @
9f75c250
package
com.biganto.visual.roompark.conductor.dialogs.change_handler
import
android.os.Bundle
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
androidx.annotation.LayoutRes
import
androidx.core.os.bundleOf
import
androidx.recyclerview.widget.RecyclerView
import
com.biganto.visual.roompark.R
import
com.bluelinelabs.conductor.Controller
import
com.bumptech.glide.Glide
import
com.bumptech.glide.load.engine.DiskCacheStrategy
import
com.github.chrisbanes.photoview.PhotoView
/**
* Created by Vladislav Bogdashkin on 09.04.2019.
*/
internal
const
val
PHOTO_URL_KEY
=
"CHHOSE_PHOTO_LIST_KEY"
class
PhotoDialogController
:
Controller
{
constructor
(
args
:
Bundle
)
:
super
(
args
)
constructor
(
photoUrl
:
String
)
:
super
(
bundleOf
(
PHOTO_URL_KEY
to
photoUrl
))
lateinit
var
recyclerView
:
RecyclerView
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
):
View
{
val
view
=
inflater
.
inflate
(
getLayoutId
(),
container
,
false
)
args
.
getString
(
PHOTO_URL_KEY
)
?.
let
{
val
photoView
=
view
.
findViewById
<
PhotoView
>(
R
.
id
.
photo_frame
)
Glide
.
with
(
photoView
)
.
load
(
it
)
// .thumbnail(model.resolutionList.lowelest()?.let { thumb ->
// Glide.with(photoPreview).load(thumb.url).diskCacheStrategy(DiskCacheStrategy.ALL)
// .centerCrop()
// })
.
diskCacheStrategy
(
DiskCacheStrategy
.
ALL
)
.
into
(
photoView
)
}
return
view
}
@LayoutRes
fun
getLayoutId
()
=
R
.
layout
.
photo_viewer
override
fun
handleBack
():
Boolean
{
return
router
.
popCurrentController
()
}
}
app/src/main/java/com/biganto/visual/roompark/presentation/screen/albums/util/AlbumListAdapter.kt
View file @
9f75c250
...
...
@@ -84,8 +84,9 @@ class PhotosViewHolder(itemView: View) : CommonViewHolder<PhotoModel>(itemView)
@BindView
(
R
.
id
.
photo_preview_imageview
)
lateinit
var
photoPreview
:
RoundedImageView
override
fun
onViewBound
(
model
:
PhotoModel
)
{
model
.
resolutionList
.
low
e
lest
()
?.
let
{
model
.
resolutionList
.
lowlest
()
?.
let
{
Glide
.
with
(
itemView
)
.
asBitmap
()
.
load
(
it
.
url
)
.
centerCrop
()
.
fitCenter
()
...
...
@@ -93,5 +94,5 @@ class PhotosViewHolder(itemView: View) : CommonViewHolder<PhotoModel>(itemView)
}}
}
fun
List
<
PhotoResolutionModel
>.
low
e
lest
()
=
fun
List
<
PhotoResolutionModel
>.
lowlest
()
=
this
.
minBy
{
it
.
resWidth
*
it
.
resHeight
}
\ No newline at end of file
app/src/main/res/layout/photo_viewer.xml
0 → 100644
View file @
9f75c250
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"#000000"
>
<com.github.chrisbanes.photoview.PhotoView
android:id=
"@+id/photo_frame"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
</RelativeLayout>
\ 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