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
e0531ec9
Commit
e0531ec9
authored
Mar 12, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/photo_impr' into develop
parents
008819d4
bfc2a9e6
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
290 additions
and
32 deletions
+290
-32
AlertDialogController.kt
...isual/roompark/conductor/dialogs/AlertDialogController.kt
+6
-4
ChooseResolutionDialogController.kt
...ark/conductor/dialogs/ChooseResolutionDialogController.kt
+106
-0
ExceptionAlertDialogController.kt
...mpark/conductor/dialogs/ExceptionAlertDialogController.kt
+0
-1
UpdateAppAlertDialogController.kt
...mpark/conductor/dialogs/UpdateAppAlertDialogController.kt
+0
-1
PhotoDialogController.kt
...conductor/dialogs/change_handler/PhotoDialogController.kt
+61
-0
albums.kt
...n/java/com/biganto/visual/roompark/domain/model/albums.kt
+32
-4
ScreenController.kt
...l/roompark/presentation/screen/albums/ScreenController.kt
+3
-4
AlbumListAdapter.kt
...mpark/presentation/screen/albums/util/AlbumListAdapter.kt
+3
-2
ScreenController.kt
...al/roompark/presentation/screen/photo/ScreenController.kt
+39
-1
PhotoViewAdapter.kt
...ompark/presentation/screen/photo/util/PhotoViewAdapter.kt
+4
-1
choose_size_modal_screen.xml
app/src/main/res/layout/choose_size_modal_screen.xml
+16
-8
choose_size_viewholder.xml
app/src/main/res/layout/choose_size_viewholder.xml
+6
-4
photo_view_screen.xml
app/src/main/res/layout/photo_view_screen.xml
+2
-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/AlertDialogController.kt
View file @
e0531ec9
package
com.biganto.visual.
androidplayer
.conductor.dialogs
package
com.biganto.visual.
roompark
.conductor.dialogs
import
android.os.Bundle
import
android.os.Bundle
import
android.view.LayoutInflater
import
android.view.LayoutInflater
...
@@ -15,9 +15,9 @@ import com.bluelinelabs.conductor.Controller
...
@@ -15,9 +15,9 @@ import com.bluelinelabs.conductor.Controller
* Created by Vladislav Bogdashkin on 09.04.2019.
* Created by Vladislav Bogdashkin on 09.04.2019.
*/
*/
const
val
ALERT_DIALOG_MESSAGE_KEY
=
"BIGANTO_ALERT_MESSAGE"
internal
const
val
ALERT_DIALOG_MESSAGE_KEY
=
"BIGANTO_ALERT_MESSAGE"
const
val
ALERT_DIALOG_BUTTON_TEXT_KEY
=
"BIGANTO_ALERT_OK_BUTTON_TEXT"
internal
const
val
ALERT_DIALOG_BUTTON_TEXT_KEY
=
"BIGANTO_ALERT_OK_BUTTON_TEXT"
const
val
ALERT_DIALOG_BUTTON_CANCEL_TEXT_KEY
=
"BIGANTO_ALERT_CANCEL_BUTTON_TEXT"
internal
const
val
ALERT_DIALOG_BUTTON_CANCEL_TEXT_KEY
=
"BIGANTO_ALERT_CANCEL_BUTTON_TEXT"
fun
formBundle
(
message
:
String
):
Bundle
{
fun
formBundle
(
message
:
String
):
Bundle
{
val
b
=
Bundle
()
val
b
=
Bundle
()
...
@@ -40,6 +40,8 @@ fun formBundle(message:String,buttonText:String,cancelButtonText:String): Bundle
...
@@ -40,6 +40,8 @@ fun formBundle(message:String,buttonText:String,cancelButtonText:String): Bundle
return
b
return
b
}
}
open
class
AlertDialogController
:
Controller
{
open
class
AlertDialogController
:
Controller
{
constructor
():
super
()
constructor
():
super
()
...
...
app/src/main/java/com/biganto/visual/roompark/conductor/dialogs/ChooseResolutionDialogController.kt
0 → 100644
View file @
e0531ec9
package
com.biganto.visual.roompark.conductor.dialogs
import
android.os.Bundle
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
androidx.annotation.LayoutRes
import
androidx.recyclerview.widget.DividerItemDecoration
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
/**
* Created by Vladislav Bogdashkin on 09.04.2019.
*/
internal
const
val
PHOTOS_KEY
=
"CHHOSE_PHOTO_LIST_KEY"
private
fun
formBundle
(
photos
:
ArrayList
<
PhotoResolutionModel
>):
Bundle
{
val
b
=
Bundle
()
b
.
putParcelableArrayList
(
PHOTOS_KEY
,
photos
)
return
b
}
class
ChooseResolutionDialogController
:
Controller
{
constructor
(
args
:
Bundle
)
:
super
(
args
)
constructor
(
photos
:
ArrayList
<
PhotoResolutionModel
>)
:
super
(
formBundle
(
photos
))
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
)
recyclerView
=
view
.
findViewById
(
R
.
id
.
photoSizesRecyclerView
)
recyclerView
.
layoutManager
=
LinearLayoutManager
(
activity
,
RecyclerView
.
VERTICAL
,
false
)
recyclerView
.
adapter
=
PhotoSizeAdapter
()
recyclerView
.
itemAnimator
=
null
recyclerView
.
addItemDecoration
(
DividerItemDecoration
(
activity
,
DividerItemDecoration
.
VERTICAL
)
)
args
.
getParcelableArrayList
<
PhotoResolutionModel
>(
PHOTOS_KEY
)
?.
let
{
(
recyclerView
.
adapter
as
PhotoSizeAdapter
).
setItems
(
it
)
}
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
}
@LayoutRes
fun
getLayoutId
()
=
R
.
layout
.
choose_size_modal_screen
override
fun
handleBack
():
Boolean
{
return
router
.
popCurrentController
()
}
}
internal
class
PhotoSizeAdapter
:
CommonRecyclerAdapter
<
PhotoSizeViewHolder
,
PhotoResolutionModel
>(){
override
val
vhKlazz
=
PhotoSizeViewHolder
::
class
override
fun
getVhLayout
():
Int
=
R
.
layout
.
choose_size_viewholder
}
internal
class
PhotoSizeViewHolder
(
itemView
:
View
)
:
CommonViewHolder
<
PhotoResolutionModel
>(
itemView
){
@BindView
(
R
.
id
.
size_text
)
lateinit
var
textView
:
MaterialTextView
override
fun
onViewBound
(
model
:
PhotoResolutionModel
)
{
Timber
.
d
(
"resname: ${model.resName}"
)
textView
.
text
=
"${model.resWidth}x${model.resHeight}"
}
}
app/src/main/java/com/biganto/visual/roompark/conductor/dialogs/ExceptionAlertDialogController.kt
View file @
e0531ec9
package
com.biganto.visual.roompark.conductor.dialogs
package
com.biganto.visual.roompark.conductor.dialogs
import
android.os.Bundle
import
android.os.Bundle
import
com.biganto.visual.androidplayer.conductor.dialogs.AlertDialogController
/**
/**
* Created by Vladislav Bogdashkin on 09.04.2019.
* Created by Vladislav Bogdashkin on 09.04.2019.
...
...
app/src/main/java/com/biganto/visual/roompark/conductor/dialogs/UpdateAppAlertDialogController.kt
View file @
e0531ec9
...
@@ -3,7 +3,6 @@ package com.biganto.visual.roompark.conductor.dialogs
...
@@ -3,7 +3,6 @@ package com.biganto.visual.roompark.conductor.dialogs
import
android.content.Intent
import
android.content.Intent
import
android.net.Uri
import
android.net.Uri
import
android.os.Bundle
import
android.os.Bundle
import
com.biganto.visual.androidplayer.conductor.dialogs.AlertDialogController
import
timber.log.Timber
import
timber.log.Timber
...
...
app/src/main/java/com/biganto/visual/roompark/conductor/dialogs/change_handler/PhotoDialogController.kt
0 → 100644
View file @
e0531ec9
package
com.biganto.visual.roompark.conductor.dialogs.change_handler
import
android.content.pm.ActivityInfo
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
)
activity
?.
requestedOrientation
=
ActivityInfo
.
SCREEN_ORIENTATION_USER_LANDSCAPE
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
{
activity
?.
requestedOrientation
=
ActivityInfo
.
SCREEN_ORIENTATION_USER_PORTRAIT
return
router
.
popCurrentController
()
}
}
app/src/main/java/com/biganto/visual/roompark/domain/model/albums.kt
View file @
e0531ec9
package
com.biganto.visual.roompark.domain.model
package
com.biganto.visual.roompark.domain.model
import
android.os.Parcel
import
android.os.Parcelable
import
com.biganto.visual.roompark.data.repository.db.requrey.model.GalleryPhotoEntity
import
com.biganto.visual.roompark.data.repository.db.requrey.model.GalleryPhotoEntity
import
com.biganto.visual.roompark.data.repository.db.requrey.model.ImageAlbumEntity
import
com.biganto.visual.roompark.data.repository.db.requrey.model.ImageAlbumEntity
import
timber.log.Timber
import
timber.log.Timber
...
@@ -44,9 +46,8 @@ data class PhotoModel(
...
@@ -44,9 +46,8 @@ data class PhotoModel(
val
description
:
String
?,
val
description
:
String
?,
val
sort
:
Int
,
val
sort
:
Int
,
val
resolutionList
:
List
<
PhotoResolutionModel
>
val
resolutionList
:
List
<
PhotoResolutionModel
>
){
){
fun
optimalResolution
(
width
:
Int
,
height
:
Int
)
=
fun
optimalResolution
(
width
:
Int
,
height
:
Int
)
=
resolutionList
resolutionList
.
asSequence
()
.
asSequence
()
.
filter
{
it
.
resWidth
>=
width
||
it
.
resWidth
>=
height
}
.
filter
{
it
.
resWidth
>=
width
||
it
.
resWidth
>=
height
}
...
@@ -54,7 +55,6 @@ data class PhotoModel(
...
@@ -54,7 +55,6 @@ data class PhotoModel(
.
onEach
{
Timber
.
d
(
"res filtered: ${it.resWidth} / ${it.resHeight}"
)
}
.
onEach
{
Timber
.
d
(
"res filtered: ${it.resWidth} / ${it.resHeight}"
)
}
.
minBy
{
it
.
resHeight
*
it
.
resWidth
}
.
minBy
{
it
.
resHeight
*
it
.
resWidth
}
?:
resolutionList
.
maxBy
{
it
.
resHeight
*
it
.
resWidth
}
!!
?:
resolutionList
.
maxBy
{
it
.
resHeight
*
it
.
resWidth
}
!!
}
}
data class
PhotoResolutionModel
(
data class
PhotoResolutionModel
(
...
@@ -62,7 +62,35 @@ data class PhotoResolutionModel(
...
@@ -62,7 +62,35 @@ data class PhotoResolutionModel(
val
url
:
String
,
val
url
:
String
,
val
resWidth
:
Int
,
val
resWidth
:
Int
,
val
resHeight
:
Int
val
resHeight
:
Int
)
)
:
Parcelable
{
constructor
(
parcel
:
Parcel
)
:
this
(
parcel
.
readString
(),
parcel
.
readString
(),
parcel
.
readInt
(),
parcel
.
readInt
()
)
override
fun
writeToParcel
(
parcel
:
Parcel
,
flags
:
Int
)
{
parcel
.
writeString
(
resName
)
parcel
.
writeString
(
url
)
parcel
.
writeInt
(
resWidth
)
parcel
.
writeInt
(
resHeight
)
}
override
fun
describeContents
():
Int
{
return
0
}
companion
object
CREATOR
:
Parcelable
.
Creator
<
PhotoResolutionModel
>
{
override
fun
createFromParcel
(
parcel
:
Parcel
):
PhotoResolutionModel
{
return
PhotoResolutionModel
(
parcel
)
}
override
fun
newArray
(
size
:
Int
):
Array
<
PhotoResolutionModel
?
>
{
return
arrayOfNulls
(
size
)
}
}
}
fun
fromEntity
(
entity
:
ImageAlbumEntity
):
AlbumPreviewModel
=
fun
fromEntity
(
entity
:
ImageAlbumEntity
):
AlbumPreviewModel
=
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/albums/ScreenController.kt
View file @
e0531ec9
...
@@ -13,6 +13,7 @@ import com.biganto.visual.roompark.R
...
@@ -13,6 +13,7 @@ import com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.base.RoomParkApplication
import
com.biganto.visual.roompark.base.RoomParkApplication
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.conductor.BigantoBaseController
import
com.biganto.visual.roompark.conductor.BigantoBaseController
import
com.biganto.visual.roompark.conductor.dialogs.change_handler.DialogChangeHandler
import
com.biganto.visual.roompark.domain.model.AlbumPreviewModel
import
com.biganto.visual.roompark.domain.model.AlbumPreviewModel
import
com.biganto.visual.roompark.domain.model.PhotoModel
import
com.biganto.visual.roompark.domain.model.PhotoModel
import
com.biganto.visual.roompark.presentation.screen.albums.util.AlbumListAdapter
import
com.biganto.visual.roompark.presentation.screen.albums.util.AlbumListAdapter
...
@@ -20,8 +21,6 @@ import com.biganto.visual.roompark.presentation.screen.albums.util.AlbumsHeaderA
...
@@ -20,8 +21,6 @@ import com.biganto.visual.roompark.presentation.screen.albums.util.AlbumsHeaderA
import
com.biganto.visual.roompark.presentation.screen.photo.PhotoScreenController
import
com.biganto.visual.roompark.presentation.screen.photo.PhotoScreenController
import
com.biganto.visual.roompark.util.view_utils.grid.CeilsDecoration
import
com.biganto.visual.roompark.util.view_utils.grid.CeilsDecoration
import
com.bluelinelabs.conductor.RouterTransaction
import
com.bluelinelabs.conductor.RouterTransaction
import
com.bluelinelabs.conductor.changehandler.FadeChangeHandler
import
com.bluelinelabs.conductor.changehandler.VerticalChangeHandler
import
com.bumptech.glide.Glide
import
com.bumptech.glide.Glide
import
com.bumptech.glide.request.target.SimpleTarget
import
com.bumptech.glide.request.target.SimpleTarget
import
com.bumptech.glide.request.target.Target
import
com.bumptech.glide.request.target.Target
...
@@ -151,8 +150,8 @@ class AlbumsScreenController :
...
@@ -151,8 +150,8 @@ class AlbumsScreenController :
private
fun
render
(
viewState
:
AlbumsScreenViewState
.
PhotoSelected
){
private
fun
render
(
viewState
:
AlbumsScreenViewState
.
PhotoSelected
){
router
.
pushController
(
RouterTransaction
.
with
(
PhotoScreenController
(
viewState
.
photoId
))
router
.
pushController
(
RouterTransaction
.
with
(
PhotoScreenController
(
viewState
.
photoId
))
.
pushChangeHandler
(
Vertical
ChangeHandler
())
.
pushChangeHandler
(
Dialog
ChangeHandler
())
.
popChangeHandler
(
FadeChangeHandler
(
false
))
.
popChangeHandler
(
DialogChangeHandler
(
))
)
)
}
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/albums/util/AlbumListAdapter.kt
View file @
e0531ec9
...
@@ -84,8 +84,9 @@ class PhotosViewHolder(itemView: View) : CommonViewHolder<PhotoModel>(itemView)
...
@@ -84,8 +84,9 @@ class PhotosViewHolder(itemView: View) : CommonViewHolder<PhotoModel>(itemView)
@BindView
(
R
.
id
.
photo_preview_imageview
)
lateinit
var
photoPreview
:
RoundedImageView
@BindView
(
R
.
id
.
photo_preview_imageview
)
lateinit
var
photoPreview
:
RoundedImageView
override
fun
onViewBound
(
model
:
PhotoModel
)
{
override
fun
onViewBound
(
model
:
PhotoModel
)
{
model
.
resolutionList
.
low
e
lest
()
?.
let
{
model
.
resolutionList
.
lowlest
()
?.
let
{
Glide
.
with
(
itemView
)
Glide
.
with
(
itemView
)
.
asBitmap
()
.
load
(
it
.
url
)
.
load
(
it
.
url
)
.
centerCrop
()
.
centerCrop
()
.
fitCenter
()
.
fitCenter
()
...
@@ -93,5 +94,5 @@ class PhotosViewHolder(itemView: View) : CommonViewHolder<PhotoModel>(itemView)
...
@@ -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
}
this
.
minBy
{
it
.
resWidth
*
it
.
resHeight
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/photo/ScreenController.kt
View file @
e0531ec9
...
@@ -2,15 +2,21 @@ package com.biganto.visual.roompark.presentation.screen.photo
...
@@ -2,15 +2,21 @@ package com.biganto.visual.roompark.presentation.screen.photo
import
android.os.Bundle
import
android.os.Bundle
import
android.view.View
import
android.view.View
import
android.view.WindowManager
import
android.widget.ImageView
import
androidx.core.os.bundleOf
import
androidx.core.os.bundleOf
import
androidx.viewpager2.widget.ViewPager2
import
androidx.viewpager2.widget.ViewPager2
import
butterknife.BindView
import
butterknife.BindView
import
butterknife.OnClick
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.base.RoomParkApplication
import
com.biganto.visual.roompark.base.RoomParkApplication
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.conductor.BigantoBaseController
import
com.biganto.visual.roompark.conductor.BigantoBaseController
import
com.biganto.visual.roompark.conductor.dialogs.ChooseResolutionDialogController
import
com.biganto.visual.roompark.conductor.dialogs.change_handler.DialogChangeHandler
import
com.biganto.visual.roompark.presentation.screen.photo.util.PhotoPreviewSlider
import
com.biganto.visual.roompark.presentation.screen.photo.util.PhotoPreviewSlider
import
com.biganto.visual.roompark.presentation.screen.photo.util.PhotosAdapter
import
com.biganto.visual.roompark.presentation.screen.photo.util.PhotosAdapter
import
com.bluelinelabs.conductor.RouterTransaction
import
com.google.android.material.textview.MaterialTextView
import
com.google.android.material.textview.MaterialTextView
import
timber.log.Timber
import
timber.log.Timber
import
javax.inject.Inject
import
javax.inject.Inject
...
@@ -42,6 +48,30 @@ class PhotoScreenController :
...
@@ -42,6 +48,30 @@ class PhotoScreenController :
@BindView
(
R
.
id
.
photosPreviewSlider
)
@BindView
(
R
.
id
.
photosPreviewSlider
)
lateinit
var
slider
:
PhotoPreviewSlider
lateinit
var
slider
:
PhotoPreviewSlider
@BindView
(
R
.
id
.
choose_size_button
)
lateinit
var
chooseSizeButton
:
ImageView
@OnClick
(
R
.
id
.
choose_size_button
)
fun
onSwitchSize
(){
router
.
pushController
(
RouterTransaction
.
with
(
ChooseResolutionDialogController
(
ArrayList
(
(
photoViewPager
.
adapter
as
PhotosAdapter
)
.
getItem
(
photoViewPager
.
currentItem
).
resolutionList
)
)).
pushChangeHandler
(
DialogChangeHandler
())
.
popChangeHandler
(
DialogChangeHandler
())
)
}
override
fun
onAttach
(
view
:
View
)
{
// tempSystemUiFlag = activity?.window?.decorView?.systemUiVisibility
super
.
onAttach
(
view
)
}
private
var
tempSystemUiFlag
:
Int
?
=
View
.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
override
fun
onDetach
(
view
:
View
)
{
// activity?.window?.decorView?.systemUiVisibility = tempSystemUiFlag?:View.SYSTEM_UI_FLAG_LAYOUT_STABLE
super
.
onDetach
(
view
)
}
private
fun
bindRecycler
()
{
private
fun
bindRecycler
()
{
photoViewPager
.
isNestedScrollingEnabled
=
false
photoViewPager
.
isNestedScrollingEnabled
=
false
...
@@ -65,6 +95,9 @@ class PhotoScreenController :
...
@@ -65,6 +95,9 @@ class PhotoScreenController :
toolBar
.
setToolbar
()
toolBar
.
setToolbar
()
bottomNavigationController
.
hide
()
bottomNavigationController
.
hide
()
bindRecycler
()
bindRecycler
()
// activity?.window?.decorView?.systemUiVisibility = View.SYSTEM_UI_FLAG_FULLSCREEN
activity
?.
window
?.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_FULLSCREEN
)
}
}
override
fun
injectDependencies
()
{
override
fun
injectDependencies
()
{
...
@@ -129,7 +162,12 @@ class PhotoScreenController :
...
@@ -129,7 +162,12 @@ class PhotoScreenController :
// (photoViewPager.adapter as PhotoViewerAdapter).setItems(arrayListOf(viewState.model))
// (photoViewPager.adapter as PhotoViewerAdapter).setItems(arrayListOf(viewState.model))
}
}
override
fun
handleBack
():
Boolean
{
router
.
popController
(
this
);
return
true
}
override
fun
handleBack
():
Boolean
{
activity
?.
window
?.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_FULLSCREEN
)
// activity?.window?.decorView?.systemUiVisibility = tempSystemUiFlag?:View.SYSTEM_UI_FLAG_LAYOUT_STABLE
router
.
popController
(
this
)
return
true
}
override
fun
getLayoutId
():
Int
=
R
.
layout
.
photo_view_screen
override
fun
getLayoutId
():
Int
=
R
.
layout
.
photo_view_screen
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/photo/util/PhotoViewAdapter.kt
View file @
e0531ec9
...
@@ -28,9 +28,10 @@ class PhotosAdapter : CommonRecyclerAdapter<PhotosViewHolder, PhotoModel>() {
...
@@ -28,9 +28,10 @@ class PhotosAdapter : CommonRecyclerAdapter<PhotosViewHolder, PhotoModel>() {
val
ret
=
list
.
map
{
it
.
resolutionList
.
lowelest
()
?.
url
?:
error
(
"No res urls!"
)}.
toList
()
val
ret
=
list
.
map
{
it
.
resolutionList
.
lowelest
()
?.
url
?:
error
(
"No res urls!"
)}.
toList
()
Timber
.
d
(
"$ret"
)
Timber
.
d
(
"$ret"
)
return
ret
return
ret
}
}
fun
getItem
(
index
:
Int
)
=
list
[
index
]
fun
indexById
(
id
:
Int
):
Int
=
list
.
indexOfFirst
{
it
.
photoId
==
id
}
fun
indexById
(
id
:
Int
):
Int
=
list
.
indexOfFirst
{
it
.
photoId
==
id
}
...
@@ -71,7 +72,9 @@ class PhotosViewHolder(itemView: View) : CommonViewHolder<PhotoModel>(itemView)
...
@@ -71,7 +72,9 @@ class PhotosViewHolder(itemView: View) : CommonViewHolder<PhotoModel>(itemView)
.
load
(
photo
.
url
)
.
load
(
photo
.
url
)
.
thumbnail
(
model
.
resolutionList
.
lowelest
()
?.
let
{
thumb
->
.
thumbnail
(
model
.
resolutionList
.
lowelest
()
?.
let
{
thumb
->
Glide
.
with
(
photoPreview
).
load
(
thumb
.
url
).
diskCacheStrategy
(
DiskCacheStrategy
.
ALL
)
Glide
.
with
(
photoPreview
).
load
(
thumb
.
url
).
diskCacheStrategy
(
DiskCacheStrategy
.
ALL
)
.
centerCrop
()
})
})
.
centerCrop
()
.
diskCacheStrategy
(
DiskCacheStrategy
.
ALL
)
.
diskCacheStrategy
(
DiskCacheStrategy
.
ALL
)
.
into
(
photoPreview
)
.
into
(
photoPreview
)
}
}
...
...
app/src/main/res/layout/choose_size_modal_screen.xml
View file @
e0531ec9
...
@@ -25,8 +25,10 @@
...
@@ -25,8 +25,10 @@
style=
"@style/Header_TextView.Main_Header"
style=
"@style/Header_TextView.Main_Header"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:background=
"@color/colorPrimary"
android:paddingStart=
"16dp"
android:text=
"ОТКРЫТЬ\nВ ДРУГОМ РАЗМЕРЕ"
android:text=
"ОТКРЫТЬ\nВ ДРУГОМ РАЗМЕРЕ"
android:textAlignment=
"
center
"
android:textAlignment=
"
viewStart
"
app:layout_constraintBottom_toTopOf=
"@+id/include4"
app:layout_constraintBottom_toTopOf=
"@+id/include4"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
/>
app:layout_constraintStart_toStartOf=
"parent"
/>
...
@@ -35,26 +37,32 @@
...
@@ -35,26 +37,32 @@
android:id=
"@+id/include4"
android:id=
"@+id/include4"
layout=
"@layout/horizontal_divider"
layout=
"@layout/horizontal_divider"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_height=
"1dp"
app:layout_constraintBottom_toTopOf=
"@+id/recyclerView"
android:layout_marginStart=
"16dp"
app:layout_constraintBottom_toTopOf=
"@+id/photoSizesRecyclerView"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
/>
app:layout_constraintStart_toStartOf=
"parent"
/>
<androidx.recyclerview.widget.RecyclerView
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/
r
ecyclerView"
android:id=
"@+id/
photoSizesR
ecyclerView"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
app:layout_constraintBottom_toTopOf=
"@+id/materialTextView"
android:background=
"@color/colorPrimary"
android:paddingStart=
"16dp"
app:layout_constraintBottom_toTopOf=
"@+id/cancel_button"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
/>
app:layout_constraintStart_toStartOf=
"parent"
/>
<com.google.android.material.textview.MaterialTextView
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/
materialTextView
"
android:id=
"@+id/
cancel_button
"
style=
"@style/Default_TextView.Cancel_Text"
style=
"@style/Default_TextView.Cancel_Text"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"144dp"
android:layout_height=
"wrap_content"
android:background=
"@color/colorPrimary"
android:clickable=
"true"
android:gravity=
"center"
android:gravity=
"center"
android:paddingBottom=
"44dp"
android:paddingTop=
"32dp"
android:paddingBottom=
"64dp"
android:text=
"ОТМЕНА"
android:text=
"ОТМЕНА"
android:textAlignment=
"gravity"
android:textAlignment=
"gravity"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
...
...
app/src/main/res/layout/choose_size_viewholder.xml
View file @
e0531ec9
...
@@ -7,14 +7,15 @@
...
@@ -7,14 +7,15 @@
android:layout_height=
"wrap_content"
>
android:layout_height=
"wrap_content"
>
<com.google.android.material.textview.MaterialTextView
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/
textView12
"
android:id=
"@+id/
size_text
"
style=
"@style/Default_TextView.Accent_Text"
style=
"@style/Default_TextView.Accent_Text"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"20dp"
android:layout_marginTop=
"20dp"
android:layout_marginTop=
"20dp"
android:layout_marginBottom=
"20dp"
android:includeFontPadding=
"false"
android:includeFontPadding=
"false"
android:text=
"1080x1920"
android:text=
"1080x1920"
android:textAlignment=
"viewStart"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@+id/imageView6"
app:layout_constraintEnd_toStartOf=
"@+id/imageView6"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
...
@@ -24,8 +25,9 @@
...
@@ -24,8 +25,9 @@
android:id=
"@+id/imageView6"
android:id=
"@+id/imageView6"
android:layout_width=
"16dp"
android:layout_width=
"16dp"
android:layout_height=
"0dp"
android:layout_height=
"0dp"
app:layout_constraintBottom_toBottomOf=
"@+id/textView12"
android:layout_marginEnd=
"8dp"
app:layout_constraintBottom_toBottomOf=
"@+id/size_text"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"@+id/
textView12
"
app:layout_constraintTop_toTopOf=
"@+id/
size_text
"
app:srcCompat=
"@drawable/ic_favorites"
/>
app:srcCompat=
"@drawable/ic_favorites"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/photo_view_screen.xml
View file @
e0531ec9
...
@@ -60,7 +60,7 @@
...
@@ -60,7 +60,7 @@
app:srcCompat=
"@drawable/iic_full_view"
/>
app:srcCompat=
"@drawable/iic_full_view"
/>
<ImageView
<ImageView
android:id=
"@+id/ch
ang
e_size_button"
android:id=
"@+id/ch
oos
e_size_button"
android:layout_width=
"24dp"
android:layout_width=
"24dp"
android:layout_height=
"24dp"
android:layout_height=
"24dp"
android:layout_marginTop=
"16dp"
android:layout_marginTop=
"16dp"
...
@@ -82,7 +82,7 @@
...
@@ -82,7 +82,7 @@
android:orientation=
"horizontal"
android:orientation=
"horizontal"
android:visibility=
"invisible"
android:visibility=
"invisible"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@+id/ch
ang
e_size_button"
app:layout_constraintEnd_toStartOf=
"@+id/ch
oos
e_size_button"
app:layout_constraintStart_toEndOf=
"@+id/show_full_button"
app:layout_constraintStart_toEndOf=
"@+id/show_full_button"
app:layout_constraintTop_toTopOf=
"@+id/guideline2"
app:layout_constraintTop_toTopOf=
"@+id/guideline2"
app:layout_constraintVertical_bias=
"0.0"
/>
app:layout_constraintVertical_bias=
"0.0"
/>
...
...
app/src/main/res/layout/photo_viewer.xml
0 → 100644
View file @
e0531ec9
<?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