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
e2bbafb7
Commit
e2bbafb7
authored
Dec 04, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
provide cam screen mvp impl
parent
5cc743ad
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
233 additions
and
12 deletions
+233
-12
webcams.kt
.../com/biganto/visual/roompark/domain/interactor/webcams.kt
+20
-0
ScreenController.kt
.../roompark/presentation/screen/article/ScreenController.kt
+6
-6
ScreenController.kt
...al/roompark/presentation/screen/feeds/ScreenController.kt
+6
-6
ScreenContract.kt
...al/roompark/presentation/screen/web_cam/ScreenContract.kt
+11
-0
ScreenController.kt
.../roompark/presentation/screen/web_cam/ScreenController.kt
+89
-0
ScreenDI.kt
...o/visual/roompark/presentation/screen/web_cam/ScreenDI.kt
+48
-0
ScreenPresenter.kt
...l/roompark/presentation/screen/web_cam/ScreenPresenter.kt
+36
-0
ScreenViewState.kt
...l/roompark/presentation/screen/web_cam/ScreenViewState.kt
+17
-0
No files found.
app/src/main/java/com/biganto/visual/roompark/domain/interactor/webcams.kt
0 → 100644
View file @
e2bbafb7
package
com.biganto.visual.roompark.domain.interactor
import
com.biganto.visual.roompark.domain.model.WebCamListModel
import
com.biganto.visual.roompark.domain.use_case.CamsUseCase
import
io.reactivex.Observable
import
javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 09.10.2019.
*/
class
WebCamsInteractor
@Inject
constructor
(
private
val
camsUseCase
:
CamsUseCase
)
{
fun
fetchCams
():
Observable
<
WebCamListModel
>
=
camsUseCase
.
getWebCams
()
}
app/src/main/java/com/biganto/visual/roompark/presentation/screen/article/ScreenController.kt
View file @
e2bbafb7
...
@@ -2,6 +2,7 @@ package com.biganto.visual.roompark.presentation.screen.article
...
@@ -2,6 +2,7 @@ package com.biganto.visual.roompark.presentation.screen.article
import
PicassoImageGetter
import
PicassoImageGetter
import
android.os.Build
import
android.os.Build
import
android.os.Bundle
import
android.text.Html
import
android.text.Html
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewGroup
...
@@ -34,10 +35,9 @@ class ArticleScreenController :
...
@@ -34,10 +35,9 @@ class ArticleScreenController :
,
ArticleScreenPresenter
>
,
ArticleScreenPresenter
>
,
ArticleScreen
{
,
ArticleScreen
{
constructor
(
args
:
Bundle
):
super
(
args
)
constructor
()
constructor
(
id
:
Int
)
:
super
(
bundleOf
(
ARTICLE_ID
to
id
))
constructor
(
id
:
Int
):
super
(
bundleOf
(
ARTICLE_ID
to
id
))
override
fun
injectDependencies
()
{
override
fun
injectDependencies
()
{
getComponent
()
getComponent
()
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/ScreenController.kt
View file @
e2bbafb7
...
@@ -19,6 +19,7 @@ import com.biganto.visual.roompark.presentation.screen.feed_list.ArticlesScreenC
...
@@ -19,6 +19,7 @@ import com.biganto.visual.roompark.presentation.screen.feed_list.ArticlesScreenC
import
com.biganto.visual.roompark.presentation.screen.feeds.utils.AlbumsPreviewAdapter
import
com.biganto.visual.roompark.presentation.screen.feeds.utils.AlbumsPreviewAdapter
import
com.biganto.visual.roompark.presentation.screen.feeds.utils.ArticlesPreviewAdapter
import
com.biganto.visual.roompark.presentation.screen.feeds.utils.ArticlesPreviewAdapter
import
com.biganto.visual.roompark.presentation.screen.feeds.utils.CamsListAdapter
import
com.biganto.visual.roompark.presentation.screen.feeds.utils.CamsListAdapter
import
com.biganto.visual.roompark.presentation.screen.web_cam.WebCamScreenController
import
com.bluelinelabs.conductor.RouterTransaction
import
com.bluelinelabs.conductor.RouterTransaction
import
com.bluelinelabs.conductor.changehandler.FadeChangeHandler
import
com.bluelinelabs.conductor.changehandler.FadeChangeHandler
import
com.google.android.material.button.MaterialButton
import
com.google.android.material.button.MaterialButton
...
@@ -177,12 +178,11 @@ class FeedsScreenController :
...
@@ -177,12 +178,11 @@ class FeedsScreenController :
}
}
private
fun
render
(
viewState
:
FeedsScreenViewState
.
ToWebCam
)
{
private
fun
render
(
viewState
:
FeedsScreenViewState
.
ToWebCam
)
{
TODO
(
"to webcam screen"
)
router
.
pushController
(
// router.pushController(
RouterTransaction
.
with
(
WebCamScreenController
(
viewState
.
camId
))
// RouterTransaction.with(ArticlesScreenController(viewState.feedId))
.
popChangeHandler
(
FadeChangeHandler
())
// .popChangeHandler(FadeChangeHandler())
.
pushChangeHandler
(
FadeChangeHandler
())
// .pushChangeHandler(FadeChangeHandler())
)
// )
}
}
private
fun
render
(
viewState
:
FeedsScreenViewState
.
ToArticle
)
{
private
fun
render
(
viewState
:
FeedsScreenViewState
.
ToArticle
)
{
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/web_cam/ScreenContract.kt
0 → 100644
View file @
e2bbafb7
package
com.biganto.visual.roompark.presentation.screen.web_cam
import
com.biganto.visual.roompark.conductor.BigantoBaseContract
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
interface
WebCamScreen
:
BigantoBaseContract
<
WebCamScreenViewState
>
{
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/web_cam/ScreenController.kt
0 → 100644
View file @
e2bbafb7
package
com.biganto.visual.roompark.presentation.screen.web_cam
import
android.os.Bundle
import
android.view.View
import
androidx.core.os.bundleOf
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.base.IBottomNavigation
import
com.biganto.visual.roompark.base.RoomParkApplication
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.conductor.BigantoBaseController
import
javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
const
val
SELECTED_CAM_INDEX_KEY
=
"SELECTED_CAM_INDEX"
class
WebCamScreenController
:
BigantoBaseController
<
WebCamScreenViewState
,
WebCamScreen
,
WebCamScreenPresenter
>
,
WebCamScreen
{
constructor
(
args
:
Bundle
):
super
(
args
)
constructor
(
id
:
Int
)
:
super
(
bundleOf
(
SELECTED_CAM_INDEX_KEY
to
id
))
override
fun
onViewBound
(
v
:
View
)
{
toolBar
.
hideAll
()
bottomNavigation
.
hide
()
}
override
fun
injectDependencies
()
{
getComponent
()
}
@Inject
override
lateinit
var
injectedPresenter
:
WebCamScreenPresenter
// @Inject
// lateinit var snacky:ISnackBarProvider
lateinit
var
rpActivity
:
RoomParkMainActivity
fun
getComponent
()
=
DaggerWebCamScreenComponent
.
factory
()
.
create
(
RoomParkApplication
.
component
,
activity
as
RoomParkMainActivity
,
args
.
getInt
(
SELECTED_CAM_INDEX_KEY
))
.
inject
(
this
)
// @Inject
// lateinit var ac: RoomParkMainActivity
@Inject
lateinit
var
bottomNavigation
:
IBottomNavigation
override
fun
render
(
viewState
:
WebCamScreenViewState
)
{
when
(
viewState
){
is
WebCamScreenViewState
.
Idle
->
render
(
viewState
)
is
WebCamScreenViewState
.
CamSelected
->
render
(
viewState
)
is
WebCamScreenViewState
.
WebCamsLIstLoaded
->
render
(
viewState
)
is
WebCamScreenViewState
.
SomeError
->
render
(
viewState
)
}
}
private
fun
render
(
viewState
:
WebCamScreenViewState
.
Idle
){
}
private
fun
render
(
viewState
:
WebCamScreenViewState
.
SomeError
)
=
showError
(
viewState
.
exception
)
private
fun
render
(
viewState
:
WebCamScreenViewState
.
CamSelected
){
}
private
fun
render
(
viewState
:
WebCamScreenViewState
.
WebCamsLIstLoaded
){
}
override
fun
getLayoutId
():
Int
=
R
.
layout
.
webcam_screen
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/web_cam/ScreenDI.kt
0 → 100644
View file @
e2bbafb7
package
com.biganto.visual.roompark.presentation.screen.web_cam
import
android.content.Context
import
com.biganto.visual.roompark.base.IBottomNavigation
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.di.dagger.AppComponent
import
com.biganto.visual.roompark.di.dagger.PerScreen
import
dagger.Binds
import
dagger.BindsInstance
import
dagger.Component
import
dagger.Module
import
javax.inject.Named
///**
// * Created by Vladislav Bogdashkin on 30.09.2019.
// */
@PerScreen
@Component
(
modules
=
[
WebCamScreenModule
::
class
]
,
dependencies
=
[
AppComponent
::
class
]
)
interface
WebCamScreenComponent
{
@Component
.
Factory
interface
Factory
{
fun
create
(
appComponent
:
AppComponent
,
@BindsInstance
activity
:
RoomParkMainActivity
,
@BindsInstance
@Named
(
SELECTED_CAM_INDEX_KEY
)
camIndex
:
Int
):
WebCamScreenComponent
}
fun
inject
(
controller
:
WebCamScreenController
)
}
@Module
abstract
class
WebCamScreenModule
{
@PerScreen
@Binds
abstract
fun
provideContext
(
activity
:
RoomParkMainActivity
):
Context
@PerScreen
@Binds
abstract
fun
provideBottomNavigation
(
activitiy
:
RoomParkMainActivity
):
IBottomNavigation
}
app/src/main/java/com/biganto/visual/roompark/presentation/screen/web_cam/ScreenPresenter.kt
0 → 100644
View file @
e2bbafb7
package
com.biganto.visual.roompark.presentation.screen.web_cam
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.domain.interactor.WebCamsInteractor
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
import
javax.inject.Inject
import
javax.inject.Named
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
class
WebCamScreenPresenter
@Inject
constructor
(
private
val
interactor
:
WebCamsInteractor
,
@Named
(
SELECTED_CAM_INDEX_KEY
)
private
var
selectedCamIndex
:
Int
)
:
BigantoBasePresenter
<
WebCamScreen
,
WebCamScreenViewState
>()
{
override
fun
defaultErrorViewStateHandler
()
=
{
e
:
ExceptionString
->
WebCamScreenViewState
.
SomeError
(
e
)
}
override
fun
bindIntents
()
{
val
state
=
restoreStateObservable
.
mergeWith
(
interactor
.
fetchCams
()
.
map
{
WebCamScreenViewState
.
WebCamsLIstLoaded
(
it
.
items
.
toList
(),
selectedCamIndex
)}
)
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
subscribeViewState
(
state
.
cast
(
WebCamScreenViewState
::
class
.
java
),
WebCamScreen
::
render
)
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/web_cam/ScreenViewState.kt
0 → 100644
View file @
e2bbafb7
package
com.biganto.visual.roompark.presentation.screen.web_cam
import
com.biganto.visual.roompark.conductor.BigantoBaseViewState
import
com.biganto.visual.roompark.domain.model.WebCamModel
import
com.biganto.visual.roompark.util.monades.ExceptionString
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
sealed
class
WebCamScreenViewState
:
BigantoBaseViewState
()
{
class
Idle
:
WebCamScreenViewState
()
class
WebCamsLIstLoaded
(
camList
:
List
<
WebCamModel
>,
selectedCamIndex
:
Int
)
:
WebCamScreenViewState
()
class
CamSelected
(
model
:
WebCamModel
)
:
WebCamScreenViewState
()
class
SomeError
(
val
exception
:
ExceptionString
)
:
WebCamScreenViewState
()
}
\ 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