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
5cc743ad
Commit
5cc743ad
authored
Dec 03, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/web_cams_fetch' into develop
parents
4d0a9bdf
a1899c07
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
119 additions
and
26 deletions
+119
-26
AlbumsRepository.kt
...to/visual/roompark/data/data_provider/AlbumsRepository.kt
+21
-4
IApi.kt
...a/com/biganto/visual/roompark/data/repository/api/IApi.kt
+1
-0
IRoomParkMobileApi.kt
...ompark/data/repository/api/retrofit/IRoomParkMobileApi.kt
+12
-0
RetrofitRepository.kt
...ompark/data/repository/api/retrofit/RetrofitRepository.kt
+5
-0
response.kt
...ual/roompark/data/repository/api/retrofit/raw/response.kt
+1
-1
feeds.kt
...va/com/biganto/visual/roompark/domain/interactor/feeds.kt
+11
-5
webCamList.kt
...va/com/biganto/visual/roompark/domain/model/webCamList.kt
+32
-2
camsUseCase.kt
...om/biganto/visual/roompark/domain/use_case/camsUseCase.kt
+21
-0
ScreenPresenter.kt
...ual/roompark/presentation/screen/feeds/ScreenPresenter.kt
+1
-1
ScreenViewState.kt
...ual/roompark/presentation/screen/feeds/ScreenViewState.kt
+1
-1
CamsLIstAdapter.kt
...ompark/presentation/screen/feeds/utils/CamsLIstAdapter.kt
+7
-4
cam_button_viewholder.xml
app/src/main/res/layout/cam_button_viewholder.xml
+3
-5
splash_screen.xml
app/src/main/res/layout/splash_screen.xml
+3
-3
No files found.
app/src/main/java/com/biganto/visual/roompark/data/data_provider/AlbumsRepository.kt
View file @
5cc743ad
...
...
@@ -31,12 +31,11 @@ class AlbumsContractModule @Inject constructor(
TODO
(
"not implemented"
)
//To change body of created functions use File | Settings | File Templates.
}
override
fun
getWebCamsList
():
Observable
<
WebCamListModel
>
{
TODO
(
"not implemented"
)
//To change body of created functions use File | Settings | File Templates.
}
override
fun
getWebCamsList
():
Observable
<
WebCamListModel
>
=
fetchWebCams
()
override
fun
getWebCamStream
(
camId
:
Int
):
Observable
<
WebCamModel
>
{
TODO
(
"
not implemented"
)
//To change body of created functions use File | Settings | File Templates.
TODO
(
"
at current sight indeed function"
)
}
...
...
@@ -45,6 +44,7 @@ class AlbumsContractModule @Inject constructor(
}
//region allAlbums
private
val
fetchTopLevelAlbumsApi
=
api
.
getAlbums
()
.
doOnNext
{
Timber
.
d
(
"raw0 $it"
)
}
...
...
@@ -64,7 +64,10 @@ class AlbumsContractModule @Inject constructor(
arrayListOf
(
fetchTopLevelAlbumsApi
,
fetchTopLevelAlbumsDb
)
).
doOnNext
{
Timber
.
d
(
"got entity $it"
)
}.
map
{
fromEntity
(
it
,
::
fromEntity
)
}
//endregion allAlbums
//region concrete Albums
private
fun
fetchAlbumsApi
(
parentAlbumId
:
Int
)
=
api
.
getAlbums
(
parentAlbumId
)
.
doOnNext
{
Timber
.
d
(
"raw0 $it"
)
}
...
...
@@ -94,5 +97,19 @@ class AlbumsContractModule @Inject constructor(
arrayListOf
(
fetchAlbumsApi
(
parentId
),
fetchAlbumsDb
(
parentId
))
).
map
{
fromEntity
(
it
,
::
fromEntity
)
}
//endregion concrete Albums
//region cams
private
val
fetchWebCamsApi
=
api
.
getWebCamsList
()
.
doOnNext
{
Timber
.
d
(
"raw0 $it"
)
}
.
map
{
fromRawList
(
it
)}
.
doOnNext
{
Timber
.
d
(
"mapped raw0 $it"
)
}
.
subscribeOn
(
Schedulers
.
io
())
private
fun
fetchWebCams
():
Observable
<
WebCamListModel
>
=
fetchWebCamsApi
//endregion
}
app/src/main/java/com/biganto/visual/roompark/data/repository/api/IApi.kt
View file @
5cc743ad
...
...
@@ -47,6 +47,7 @@ interface IRoomParkApi {
fun
getAlbums
(
parentId
:
Int
?
=
null
):
Observable
<
List
<
ImageAlbumRaw
>>
fun
getEstate
(
building
:
Int
,
flat
:
Int
):
Observable
<
EstateRaw
>
fun
getWebCamsList
():
Observable
<
List
<
WebCamRaw
>>
}
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/api/retrofit/IRoomParkMobileApi.kt
View file @
5cc743ad
...
...
@@ -133,6 +133,9 @@ interface IRoomParkMobileApi{
const
val
ESTATE_FLAT_NUMBER_PARAM
=
"number "
//endregion
//region Get Web Cams
const
val
GET_WEB_CAMS_METHOD
=
"webcams.getCameras"
//endregion
}
...
...
@@ -193,6 +196,15 @@ interface IRoomParkMobileApi{
@Query
(
API_VERSION_PARAM
)
apiVersion
:
String
=
DEFAULT_API_VERSION
):
Observable
<
Response
<
List
<
FeedRaw
>>>
@GET
(
"$API_URL$GET_WEB_CAMS_METHOD$DELIMITER"
)
fun
getWebCams
(
@Query
(
CLIENT_TYPE_PARAM
)
clientType
:
String
=
DEFAULT_CLIENT_TYPE
,
@Query
(
CLIENT_VERSION_PARAM
)
clientVersion
:
String
=
DEFAULT_CLIENT_VERSION
,
@Query
(
API_VERSION_PARAM
)
apiVersion
:
String
=
DEFAULT_API_VERSION
):
Observable
<
Response
<
List
<
WebCamRaw
>>>
@GET
(
"$API_URL$GET_ARTICLES_PAGE_METHOD$DELIMITER"
)
fun
getArticlesPage
(
@Query
(
CLIENT_TYPE_PARAM
)
clientType
:
String
=
DEFAULT_CLIENT_TYPE
,
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/api/retrofit/RetrofitRepository.kt
View file @
5cc743ad
...
...
@@ -80,6 +80,11 @@ class RetrofitRepository @Inject constructor(retrofit: Retrofit) : IRoomParkApi
.
subscribeOn
(
Schedulers
.
io
())
.
compose
(
RetrofitResponseValidation
())
override
fun
getWebCamsList
():
Observable
<
List
<
WebCamRaw
>>
=
api
.
getWebCams
()
.
subscribeOn
(
Schedulers
.
io
())
.
compose
(
RetrofitResponseValidation
())
override
fun
getPhotos
(
parentId
:
Int
):
Observable
<
List
<
NewsPhotoRaw
>>
=
api
.
getPhotos
(
id
=
parentId
)
.
subscribeOn
(
Schedulers
.
io
())
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/api/retrofit/raw/response.kt
View file @
5cc743ad
...
...
@@ -162,7 +162,7 @@ data class AppVersionRaw(
data class
WebCamRaw
(
val
id
:
Int
,
val
title
:
String
,
val
S
treams
:
List
<
StreamRaw
>
val
s
treams
:
List
<
StreamRaw
>
)
data class
StreamRaw
(
...
...
app/src/main/java/com/biganto/visual/roompark/domain/interactor/feeds.kt
View file @
5cc743ad
...
...
@@ -2,6 +2,7 @@ package com.biganto.visual.roompark.domain.interactor
import
com.biganto.visual.roompark.domain.model.*
import
com.biganto.visual.roompark.domain.use_case.AlbumsUseCase
import
com.biganto.visual.roompark.domain.use_case.CamsUseCase
import
com.biganto.visual.roompark.domain.use_case.FeedUseCase
import
io.reactivex.Observable
import
java.util.*
...
...
@@ -13,7 +14,8 @@ import javax.inject.Inject
class
FeedsInteractor
@Inject
constructor
(
private
val
feedsUseCase
:
FeedUseCase
,
private
val
albumsUseCase
:
AlbumsUseCase
private
val
albumsUseCase
:
AlbumsUseCase
,
private
val
camsUseCase
:
CamsUseCase
)
{
fun
fetchTopFeeds
():
Observable
<
FeedsHeaderModel
>
=
...
...
@@ -36,7 +38,8 @@ class FeedsInteractor @Inject constructor(
fun
fetchAlbums
():
Observable
<
List
<
AlbumPreviewModel
>>
=
albumsUseCase
.
getProgressAlbums
()
fun
fetchCams
():
Observable
<
WebCamListModel
>
=
Observable
.
just
(
camsList
)
fun
fetchCams
():
Observable
<
WebCamListModel
>
=
camsUseCase
.
getWebCams
()
//Observable.just(camsList)
companion
object
{
...
...
@@ -178,17 +181,20 @@ class FeedsInteractor @Inject constructor(
WebCamModel
(
"Камера Дом №1"
,
1
,
"blob:https://room-park.ru/fd579683-4bda-4f87-8663-dfe6c02af2f1"
arrayListOf
()
// "blob:https://room-park.ru/fd579683-4bda-4f87-8663-dfe6c02af2f1"
),
WebCamModel
(
"Камера Дом №2"
,
2
,
"blob:https://room-park.ru/58956693-f36d-4f8a-bc89-9bded955dfdd"
arrayListOf
()
// "blob:https://room-park.ru/58956693-f36d-4f8a-bc89-9bded955dfdd"
),
WebCamModel
(
"Камера Дом №3"
,
3
,
"blob:https://room-park.ru/19d41d5a-565b-4fc9-a72f-06fbe87e8fb6"
arrayListOf
()
// "blob:https://room-park.ru/19d41d5a-565b-4fc9-a72f-06fbe87e8fb6"
)
))
}
...
...
app/src/main/java/com/biganto/visual/roompark/domain/model/webCamList.kt
View file @
5cc743ad
package
com.biganto.visual.roompark.domain.model
import
com.biganto.visual.roompark.data.repository.api.retrofit.raw.StreamRaw
import
com.biganto.visual.roompark.data.repository.api.retrofit.raw.WebCamRaw
/**
* Created by Vladislav Bogdashkin on 23.09.2019.
*/
...
...
@@ -7,7 +10,34 @@ package com.biganto.visual.roompark.domain.model
data class
WebCamModel
(
val
title
:
String
,
val
index
:
Int
,
val
streamUrl
:
String
val
streams
:
List
<
StreamModel
>
)
data class
StreamModel
(
val
res_name
:
String
,
val
hls
:
String
,
val
rtmp
:
String
)
data class
WebCamListModel
(
val
items
:
List
<
WebCamModel
>)
fun
fromRaw
(
raw
:
StreamRaw
)
=
StreamModel
(
raw
.
res_name
,
raw
.
hls
,
raw
.
rtmp
)
fun
fromRaw
(
raw
:
WebCamRaw
)
=
WebCamModel
(
raw
.
title
,
raw
.
id
,
List
(
raw
.
streams
.
size
){
i
->
fromRaw
(
raw
.
streams
[
i
])
}
)
data class
WebCamListModel
(
val
items
:
List
<
WebCamModel
>)
\ No newline at end of file
fun
fromRawList
(
raw
:
List
<
WebCamRaw
>)
=
WebCamListModel
(
List
(
raw
.
size
){
i
->
fromRaw
(
raw
[
i
])
})
app/src/main/java/com/biganto/visual/roompark/domain/use_case/camsUseCase.kt
0 → 100644
View file @
5cc743ad
package
com.biganto.visual.roompark.domain.use_case
import
com.biganto.visual.roompark.domain.contract.DevProgressContract
import
javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 24.09.2019.
*/
class
CamsUseCase
@Inject
constructor
(
private
val
contract
:
DevProgressContract
){
fun
getWebCams
()
=
contract
.
getWebCamsList
()
fun
getCam
(
camId
:
Int
)
=
contract
.
getWebCamStream
(
camId
)
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/ScreenPresenter.kt
View file @
5cc743ad
...
...
@@ -76,7 +76,7 @@ class FeedsScreenPresenter @Inject constructor(
val
selectCamera
=
intent
(
FeedsScreen
::
onCameraSelected
)
.
map
<
FeedsScreenViewState
>
{
FeedsScreenViewState
.
ToWebCam
(
it
.
index
,
it
.
streamUrl
)
FeedsScreenViewState
.
ToWebCam
(
it
.
index
)
}
val
selectArticle
=
intent
(
FeedsScreen
::
onArticleSelected
)
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/ScreenViewState.kt
View file @
5cc743ad
...
...
@@ -31,7 +31,7 @@ sealed class FeedsScreenViewState : BigantoBaseViewState() {
class
ToAlbum
(
val
albumId
:
Int
)
:
FeedsScreenViewState
()
class
ToWebCam
(
val
camId
:
Int
,
val
camUrl
:
String
)
:
FeedsScreenViewState
()
class
ToWebCam
(
val
camId
:
Int
)
:
FeedsScreenViewState
()
}
data class
RestoreModel
(
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/utils/CamsLIstAdapter.kt
View file @
5cc743ad
package
com.biganto.visual.roompark.presentation.screen.feeds.utils
import
android.view.View
import
android.widget.
Text
View
import
android.widget.
Image
View
import
butterknife.BindView
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.domain.model.WebCamModel
import
com.biganto.visual.roompark.presentation.screen.settings.util.CommonRecyclerAdapter
import
com.biganto.visual.roompark.presentation.screen.settings.util.CommonViewHolder
import
com.google.android.material.textview.MaterialTextView
/**
...
...
@@ -18,13 +19,15 @@ class CamsListAdapter : CommonRecyclerAdapter<CamListViewHolder,WebCamModel>() {
override
fun
getVhLayout
():
Int
=
R
.
layout
.
cam_button_viewholder
}
class
CamListViewHolder
(
itemView
:
View
)
:
CommonViewHolder
<
WebCamModel
>(
itemView
)
{
@BindView
(
R
.
id
.
camTitle
)
lateinit
var
camTitle
:
TextView
@BindView
(
R
.
id
.
camStatus
)
lateinit
var
camStatus
:
View
@BindView
(
R
.
id
.
camTitle
)
lateinit
var
camTitle
:
MaterialTextView
@BindView
(
R
.
id
.
camStatus
)
lateinit
var
camStatus
:
MaterialTextView
@BindView
(
R
.
id
.
camStatusIcon
)
lateinit
var
camStatusIcon
:
ImageView
override
fun
onViewBound
(
model
:
WebCamModel
)
{
camTitle
.
text
=
model
.
title
camStatus
.
text
=
if
(
model
.
streams
.
isNullOrEmpty
())
"ОФФЛАЙН"
else
"ОНЛАЙН"
camStatusIcon
.
visibility
=
if
(
model
.
streams
.
isNullOrEmpty
())
View
.
GONE
else
View
.
VISIBLE
}
}
app/src/main/res/layout/cam_button_viewholder.xml
View file @
5cc743ad
...
...
@@ -33,11 +33,10 @@
android:layout_marginLeft=
"16dp"
android:layout_weight=
"1"
android:gravity=
"center_vertical|fill_vertical"
android:text=
"TextView"
android:textAlignment=
"viewStart"
/>
android:text=
"TextView"
/>
<ImageView
android:id=
"@+id/
imageView3
"
android:id=
"@+id/
camStatusIcon
"
android:layout_width=
"8dp"
android:layout_height=
"8dp"
android:layout_gravity=
"start|center_vertical"
...
...
@@ -55,7 +54,6 @@
android:layout_marginEnd=
"16dp"
android:layout_weight=
"0"
android:gravity=
"center_vertical|fill_vertical"
android:text=
"ОНЛАЙН"
android:textAlignment=
"viewStart"
/>
android:text=
"ОНЛАЙН"
/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/splash_screen.xml
View file @
5cc743ad
...
...
@@ -14,7 +14,7 @@
<ImageView
android:layout_width=
"32dp"
android:layout_height=
"wrap_content"
app:srcCompat=
"@drawable/ic_onlyr"
android:id=
"@+id/
imageView3
"
android:id=
"@+id/
camStatusIcon
"
app:layout_constraintEnd_toEndOf=
"@+id/splashBackground"
app:layout_constraintStart_toStartOf=
"@+id/splashBackground"
app:layout_constraintBottom_toBottomOf=
"parent"
android:layout_marginTop=
"8dp"
app:layout_constraintTop_toTopOf=
"@+id/splashBackground"
...
...
@@ -25,7 +25,7 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/logo_header"
android:layout_marginBottom=
"8dp"
app:layout_constraintBottom_toBottomOf=
"parent"
android:layout_marginTop=
"8dp"
app:layout_constraintTop_toBottomOf=
"@+id/
imageView3
"
app:layout_constraintStart_toStartOf=
"@+id/
imageView3"
app:layout_constraintEnd_toEndOf=
"@+id/imageView3
"
app:layout_constraintTop_toBottomOf=
"@+id/
camStatusIcon
"
app:layout_constraintStart_toStartOf=
"@+id/
camStatusIcon"
app:layout_constraintEnd_toEndOf=
"@+id/camStatusIcon
"
app:layout_constraintVertical_bias=
"0.0"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ 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