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
6c81fb51
Commit
6c81fb51
authored
Dec 24, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sets current page as actual selected
parent
d72a59a7
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
22 additions
and
44 deletions
+22
-44
ScreenController.kt
...l/roompark/presentation/screen/albums/ScreenController.kt
+2
-2
ScreenDI.kt
...to/visual/roompark/presentation/screen/albums/ScreenDI.kt
+1
-1
ScreenPresenter.kt
...al/roompark/presentation/screen/albums/ScreenPresenter.kt
+1
-1
ScreenController.kt
...al/roompark/presentation/screen/photo/ScreenController.kt
+5
-3
ScreenDI.kt
...nto/visual/roompark/presentation/screen/photo/ScreenDI.kt
+1
-1
ScreenPresenter.kt
...ual/roompark/presentation/screen/photo/ScreenPresenter.kt
+11
-35
ScreenViewState.kt
...ual/roompark/presentation/screen/photo/ScreenViewState.kt
+1
-1
No files found.
app/src/main/java/com/biganto/visual/roompark/presentation/screen/albums/ScreenController.kt
View file @
6c81fb51
...
...
@@ -48,7 +48,7 @@ class AlbumsScreenController :
constructor
(
args
:
Bundle
):
super
(
args
)
constructor
(
id
:
Int
)
:
super
(
bundleOf
(
com
.
biganto
.
visual
.
roompark
.
presentation
.
screen
.
photo
.
SELECTED_ALBUM_INDEX_KEY
to
id
))
constructor
(
id
:
Int
)
:
super
(
bundleOf
(
SELECTED_ALBUM_INDEX_KEY
to
id
))
@BindView
(
R
.
id
.
headers_recycler_view
)
...
...
@@ -126,7 +126,7 @@ class AlbumsScreenController :
fun
getComponent
()
=
DaggerAlbumsScreenComponent
.
factory
()
.
create
(
RoomParkApplication
.
component
,
activity
as
RoomParkMainActivity
,
args
.
getInt
(
com
.
biganto
.
visual
.
roompark
.
presentation
.
screen
.
photo
.
SELECTED_ALBUM_INDEX_KEY
))
,
args
.
getInt
(
SELECTED_ALBUM_INDEX_KEY
))
.
inject
(
this
)
// @Inject
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/albums/ScreenDI.kt
View file @
6c81fb51
...
...
@@ -27,7 +27,7 @@ interface AlbumsScreenComponent {
fun
create
(
appComponent
:
AppComponent
,
@BindsInstance
activity
:
RoomParkMainActivity
,
@BindsInstance
@Named
(
com
.
biganto
.
visual
.
roompark
.
presentation
.
screen
.
photo
.
SELECTED_ALBUM_INDEX_KEY
)
camIndex
:
Int
,
@BindsInstance
@Named
(
SELECTED_ALBUM_INDEX_KEY
)
camIndex
:
Int
):
AlbumsScreenComponent
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/albums/ScreenPresenter.kt
View file @
6c81fb51
...
...
@@ -16,7 +16,7 @@ import javax.inject.Named
class
AlbumsScreenPresenter
@Inject
constructor
(
private
val
interactor
:
AlbumsInteractor
,
@Named
(
com
.
biganto
.
visual
.
roompark
.
presentation
.
screen
.
photo
.
SELECTED_ALBUM_INDEX_KEY
)
private
var
selectedIndex
:
Int
,
@Named
(
SELECTED_ALBUM_INDEX_KEY
)
private
var
selectedIndex
:
Int
)
:
BigantoBasePresenter
<
AlbumsScreen
,
AlbumsScreenViewState
>()
{
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/photo/ScreenController.kt
View file @
6c81fb51
...
...
@@ -21,7 +21,7 @@ import javax.inject.Inject
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
const
val
SELECTED_
ALBUM_INDEX_KEY
=
"SELECTED_ALBUM_INDEX
"
const
val
SELECTED_
PHOTO_KEY
=
"SELECTED_PHOTO_ID
"
class
PhotoScreenController
:
BigantoBaseController
<
PhotoScreenViewState
...
...
@@ -31,7 +31,7 @@ class PhotoScreenController :
constructor
(
args
:
Bundle
):
super
(
args
)
constructor
(
id
:
Int
)
:
super
(
bundleOf
(
SELECTED_
ALBUM_INDEX
_KEY
to
id
))
constructor
(
id
:
Int
)
:
super
(
bundleOf
(
SELECTED_
PHOTO
_KEY
to
id
))
@BindView
(
R
.
id
.
photoTitle
)
...
...
@@ -69,7 +69,7 @@ class PhotoScreenController :
fun
getComponent
()
=
DaggerPhotoScreenComponent
.
factory
()
.
create
(
RoomParkApplication
.
component
,
activity
as
RoomParkMainActivity
,
args
.
getInt
(
SELECTED_
ALBUM_INDEX
_KEY
))
,
args
.
getInt
(
SELECTED_
PHOTO
_KEY
))
.
inject
(
this
)
// @Inject
...
...
@@ -104,6 +104,8 @@ class PhotoScreenController :
(
photoViewPager
.
adapter
as
PhotoViewerAdapter
).
setItems
(
viewState
.
list
.
asSequence
().
sortedBy
{
it
.
sort
}.
toList
()
)
photoViewPager
.
currentItem
=
(
photoViewPager
.
adapter
as
PhotoViewerAdapter
)
.
getItemPosition
(
viewState
.
selectedId
)
}
private
fun
render
(
viewState
:
PhotoScreenViewState
.
AldumFetched
)
{
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/photo/ScreenDI.kt
View file @
6c81fb51
...
...
@@ -27,7 +27,7 @@ interface PhotoScreenComponent {
fun
create
(
appComponent
:
AppComponent
,
@BindsInstance
activity
:
RoomParkMainActivity
,
@BindsInstance
@Named
(
SELECTED_
ALBUM_INDEX
_KEY
)
camIndex
:
Int
,
@BindsInstance
@Named
(
SELECTED_
PHOTO
_KEY
)
camIndex
:
Int
):
PhotoScreenComponent
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/photo/ScreenPresenter.kt
View file @
6c81fb51
...
...
@@ -6,7 +6,6 @@ import com.biganto.visual.roompark.util.monades.ExceptionString
import
io.reactivex.Observable
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
import
timber.log.Timber
import
javax.inject.Inject
import
javax.inject.Named
...
...
@@ -14,59 +13,36 @@ import javax.inject.Named
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
class
PhotoScreenPresenter
@Inject
constructor
(
private
val
interactor
:
PhotoInteractor
,
@Named
(
SELECTED_
ALBUM_INDEX
_KEY
)
private
var
selectedIndex
:
Int
,
@Named
(
SELECTED_
PHOTO
_KEY
)
private
var
selectedIndex
:
Int
)
:
BigantoBasePresenter
<
PhotoScreen
,
PhotoScreenViewState
>()
{
override
fun
defaultErrorViewStateHandler
()
=
{
e
:
ExceptionString
->
PhotoScreenViewState
.
SomeError
(
e
)
}
{
e
:
ExceptionString
->
PhotoScreenViewState
.
SomeError
(
e
)
}
override
fun
bindIntents
()
{
// val fetchSelected = requestAlbum(selectedIndex)
//
//
// val headerItemSelected = intent(PhotoScreen::onAlbumSelected)
// .doOnNext { selectedIndex = it.albumId }
//
// .flatMap<PhotoScreenViewState> { model ->
// requestAlbum(model.albumId)
// }
Timber
.
d
(
"fetch photoId: $selectedIndex"
)
val
fetchAlbum
=
interactor
.
fetchPhoto
(
selectedIndex
)
.
doOnNext
{
Timber
.
d
(
"got photo: $it"
)}
.
flatMap
{
photo
->
Observable
.
merge
<
PhotoScreenViewState
>(
arrayListOf
(
interactor
.
getAlbum
(
photo
.
albumId
)
.
map
{
PhotoScreenViewState
.
AldumFetched
(
it
)
}
,
interactor
.
fetchPhotos
(
photo
.
albumId
)
.
doOnNext
{
Timber
.
d
(
"got photos: $it"
)}
.
map
<
PhotoScreenViewState
>
{
PhotoScreenViewState
.
PhotoListLoaded
(
it
)
}
.
startWith
(
Observable
.
just
(
PhotoScreenViewState
.
PhotoFetched
(
photo
)))
))
}
,
interactor
.
fetchPhotos
(
photo
.
albumId
)
.
map
<
PhotoScreenViewState
>
{
PhotoScreenViewState
.
PhotoListLoaded
(
it
,
selectedIndex
)
}
.
startWith
(
Observable
.
just
(
PhotoScreenViewState
.
PhotoFetched
(
photo
)))
))
}
val
state
=
restoreStateObservable
.
mergeWith
(
fetchAlbum
)
// .mergeWith(fetchParents)
// .mergeWith(fetchSelected)
// .mergeWith(headerItemSelected)
.
mergeWith
(
fetchAlbum
)
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
subscribeViewState
(
state
.
cast
(
PhotoScreenViewState
::
class
.
java
),
PhotoScreen
::
render
)
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/photo/ScreenViewState.kt
View file @
6c81fb51
...
...
@@ -13,7 +13,7 @@ import com.biganto.visual.roompark.util.monades.ExceptionString
sealed
class
PhotoScreenViewState
:
BigantoBaseViewState
()
{
class
Idle
:
PhotoScreenViewState
()
class
PhotoListLoaded
(
val
list
:
List
<
PhotoModel
>)
:
PhotoScreenViewState
()
class
PhotoListLoaded
(
val
list
:
List
<
PhotoModel
>
,
val
selectedId
:
Int
)
:
PhotoScreenViewState
()
class
PhotoFetched
(
val
model
:
PhotoModel
)
:
PhotoScreenViewState
()
class
PhotoSelected
(
val
model
:
PhotoResolutionModel
)
:
PhotoScreenViewState
()
class
SomeError
(
val
exception
:
ExceptionString
)
:
PhotoScreenViewState
()
...
...
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