Commit e8efc237 authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

added camslist

finish feeds screen pattern design
parent 56eaee29
...@@ -25,6 +25,8 @@ class FeedsInteractor @Inject constructor( ...@@ -25,6 +25,8 @@ class FeedsInteractor @Inject constructor(
fun fetchAlbums(): Single<List<AlbumPreviewModel>> = Single.just(albumsPreviews) fun fetchAlbums(): Single<List<AlbumPreviewModel>> = Single.just(albumsPreviews)
fun fetchCams(): Single<WebCamListModel> = Single.just(camsList)
private companion object { private companion object {
...@@ -159,6 +161,24 @@ class FeedsInteractor @Inject constructor( ...@@ -159,6 +161,24 @@ class FeedsInteractor @Inject constructor(
false false
) )
) )
val camsList = WebCamListModel(arrayListOf(
WebCamModel(
"Камера Дом №1",
1,
"blob:https://room-park.ru/fd579683-4bda-4f87-8663-dfe6c02af2f1"
),
WebCamModel(
"Камера Дом №2",
2,
"blob:https://room-park.ru/58956693-f36d-4f8a-bc89-9bded955dfdd"
),
WebCamModel(
"Камера Дом №3",
3,
"blob:https://room-park.ru/19d41d5a-565b-4fc9-a72f-06fbe87e8fb6"
)
))
} }
} }
......
...@@ -10,4 +10,4 @@ data class WebCamModel( ...@@ -10,4 +10,4 @@ data class WebCamModel(
val streamUrl:String val streamUrl:String
) )
data class WebCamListModel(val items:List<WebCamListModel>) data class WebCamListModel(val items:List<WebCamModel>)
\ No newline at end of file \ No newline at end of file
...@@ -12,6 +12,7 @@ import com.biganto.visual.roompark.conductor.BigantoBaseController ...@@ -12,6 +12,7 @@ import com.biganto.visual.roompark.conductor.BigantoBaseController
import com.biganto.visual.roompark.domain.model.FeedModel import com.biganto.visual.roompark.domain.model.FeedModel
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.google.android.material.tabs.TabLayout import com.google.android.material.tabs.TabLayout
import com.jakewharton.rxbinding3.material.selections import com.jakewharton.rxbinding3.material.selections
import io.reactivex.Observable import io.reactivex.Observable
...@@ -48,6 +49,9 @@ class FeedsScreenController : ...@@ -48,6 +49,9 @@ class FeedsScreenController :
@BindView(R.id.dev_progress_recycler_view) @BindView(R.id.dev_progress_recycler_view)
lateinit var devProgressRecyclerView:RecyclerView lateinit var devProgressRecyclerView:RecyclerView
@BindView(R.id.cams_recycler_view)
lateinit var camsRecyclerView:RecyclerView
private fun bindRecycler(){ private fun bindRecycler(){
feedsRecyclerView.isNestedScrollingEnabled = true feedsRecyclerView.isNestedScrollingEnabled = true
...@@ -62,6 +66,12 @@ class FeedsScreenController : ...@@ -62,6 +66,12 @@ class FeedsScreenController :
LinearLayoutManager(activity, RecyclerView.HORIZONTAL, false) LinearLayoutManager(activity, RecyclerView.HORIZONTAL, false)
devProgressRecyclerView.adapter = AlbumsPreviewAdapter() devProgressRecyclerView.adapter = AlbumsPreviewAdapter()
devProgressRecyclerView.itemAnimator = null devProgressRecyclerView.itemAnimator = null
camsRecyclerView.isNestedScrollingEnabled = true
camsRecyclerView.layoutManager =
LinearLayoutManager(activity, RecyclerView.VERTICAL, false)
camsRecyclerView.adapter = CamsListAdapter()
camsRecyclerView.itemAnimator = null
} }
private var storedFeedsList:List<FeedModel> = arrayListOf() private var storedFeedsList:List<FeedModel> = arrayListOf()
...@@ -79,7 +89,8 @@ class FeedsScreenController : ...@@ -79,7 +89,8 @@ class FeedsScreenController :
when(viewState){ when(viewState){
is FeedsScreenViewState.Idle -> render(viewState) is FeedsScreenViewState.Idle -> render(viewState)
is FeedsScreenViewState.FeedsPages -> render(viewState) is FeedsScreenViewState.FeedsPages -> render(viewState)
is FeedsScreenViewState.AlbumsPages-> render(viewState) is FeedsScreenViewState.AlbumsPages -> render(viewState)
is FeedsScreenViewState.CamsList -> render(viewState)
is FeedsScreenViewState.GetFeedArticlesPreview -> render(viewState) is FeedsScreenViewState.GetFeedArticlesPreview -> render(viewState)
} }
} }
...@@ -115,6 +126,10 @@ class FeedsScreenController : ...@@ -115,6 +126,10 @@ class FeedsScreenController :
(feedsRecyclerView.adapter as ArticlesPreviewAdapter).addItems(viewState.items) (feedsRecyclerView.adapter as ArticlesPreviewAdapter).addItems(viewState.items)
} }
private fun render(viewState: FeedsScreenViewState.CamsList){
(camsRecyclerView.adapter as CamsListAdapter).addItems(viewState.items)
}
private fun getComponent() = DaggerFeedsScreenComponent.factory() private fun getComponent() = DaggerFeedsScreenComponent.factory()
.create(RoomParkApplication.component,activity as RoomParkMainActivity) .create(RoomParkApplication.component,activity as RoomParkMainActivity)
.inject(this) .inject(this)
......
...@@ -20,6 +20,8 @@ class FeedsScreenPresenter @Inject constructor( ...@@ -20,6 +20,8 @@ class FeedsScreenPresenter @Inject constructor(
override fun bindIntents() { override fun bindIntents() {
val fetchCams = interactor.fetchCams()
.map {FeedsScreenViewState.CamsList(it.items) }
val fetchAlbums = interactor.fetchAlbums() val fetchAlbums = interactor.fetchAlbums()
.map {FeedsScreenViewState.AlbumsPages(it) } .map {FeedsScreenViewState.AlbumsPages(it) }
...@@ -35,6 +37,7 @@ class FeedsScreenPresenter @Inject constructor( ...@@ -35,6 +37,7 @@ class FeedsScreenPresenter @Inject constructor(
.mergeWith(fetchFeeds) .mergeWith(fetchFeeds)
.mergeWith(getFeedArticlesPreview) .mergeWith(getFeedArticlesPreview)
.mergeWith(fetchAlbums) .mergeWith(fetchAlbums)
.mergeWith(fetchCams)
.doOnError{ Timber.e(it)} .doOnError{ Timber.e(it)}
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
......
...@@ -4,6 +4,7 @@ import com.biganto.visual.roompark.conductor.BigantoBaseViewState ...@@ -4,6 +4,7 @@ import com.biganto.visual.roompark.conductor.BigantoBaseViewState
import com.biganto.visual.roompark.domain.model.AlbumPreviewModel import com.biganto.visual.roompark.domain.model.AlbumPreviewModel
import com.biganto.visual.roompark.domain.model.ArticlePreviewModel import com.biganto.visual.roompark.domain.model.ArticlePreviewModel
import com.biganto.visual.roompark.domain.model.FeedModel import com.biganto.visual.roompark.domain.model.FeedModel
import com.biganto.visual.roompark.domain.model.WebCamModel
/** /**
* Created by Vladislav Bogdashkin on 30.09.2019. * Created by Vladislav Bogdashkin on 30.09.2019.
...@@ -14,6 +15,7 @@ sealed class FeedsScreenViewState : BigantoBaseViewState() { ...@@ -14,6 +15,7 @@ sealed class FeedsScreenViewState : BigantoBaseViewState() {
class Idle : FeedsScreenViewState() class Idle : FeedsScreenViewState()
class FeedsPages(val items:List<FeedModel>) : FeedsScreenViewState() class FeedsPages(val items:List<FeedModel>) : FeedsScreenViewState()
class AlbumsPages(val items:List<AlbumPreviewModel>) : FeedsScreenViewState() class AlbumsPages(val items:List<AlbumPreviewModel>) : FeedsScreenViewState()
class CamsList(val items:List<WebCamModel>) : FeedsScreenViewState()
class GetFeedArticlesPreview(val items:List<ArticlePreviewModel>) : FeedsScreenViewState() class GetFeedArticlesPreview(val items:List<ArticlePreviewModel>) : FeedsScreenViewState()
} }
\ No newline at end of file
package com.biganto.visual.roompark.presentation.screen.feeds.utils
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import butterknife.BindView
import butterknife.ButterKnife
import com.biganto.visual.roompark.R
import com.biganto.visual.roompark.domain.model.WebCamModel
/**
* Created by Vladislav Bogdashkin on 15.10.2019.
*/
class CamsListAdapter : RecyclerView.Adapter<CamListViewHolder>() {
private var list: MutableList<WebCamModel> = mutableListOf()
fun addItems(list:List<WebCamModel>){
this.list.clear()
this.list.addAll(list)
notifyDataSetChanged()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CamListViewHolder =
CamListViewHolder(
LayoutInflater.from(parent.context)
.inflate(R.layout.cam_button_viewholder, parent, false)
)
override fun getItemCount(): Int = list.size
override fun onBindViewHolder(holder: CamListViewHolder, position: Int) {
holder.bindModel(list[position])
}
}
class CamListViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
@BindView(R.id.camTitle) lateinit var camTitle:TextView
@BindView(R.id.camStatus) lateinit var camStatus:View
init {
ButterKnife.bind(this, itemView)
}
fun bindModel(model: WebCamModel) {
camTitle.text = model.title
}
}
...@@ -31,7 +31,7 @@ class AlbumsPreviewAdapter : RecyclerView.Adapter<AlbumCardViewHolder>() { ...@@ -31,7 +31,7 @@ class AlbumsPreviewAdapter : RecyclerView.Adapter<AlbumCardViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AlbumCardViewHolder = override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AlbumCardViewHolder =
AlbumCardViewHolder( AlbumCardViewHolder(
LayoutInflater.from(parent.context) LayoutInflater.from(parent.context)
.inflate(R.layout.album_preview_card_viewholder, parent, false) .inflate(R.layout.estate_card_viewholder, parent, false)
) )
override fun getItemCount(): Int = list.size override fun getItemCount(): Int = list.size
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="284dp" android:layout_width="284dp"
android:layout_height="189dp" android:layout_height="189dp"
android:layout_margin="16dp"
app:cardElevation="0dp" app:cardElevation="0dp"
app:cardForegroundColor="#00000000" app:cardForegroundColor="#00000000"
app:cardPreventCornerOverlap="false" app:cardPreventCornerOverlap="false"
...@@ -15,7 +16,7 @@ ...@@ -15,7 +16,7 @@
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:background="@drawable/default_image_placeholder" android:background="@drawable/default_image_placeholder"
android:cropToPadding="true" android:cropToPadding="true"
android:foreground="@drawable/catalog_item_mask" android:foreground="@color/colorOpacityBackground"
android:scaleType="centerCrop" android:scaleType="centerCrop"
app:image_corner_radius="4dp" /> app:image_corner_radius="4dp" />
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include
layout="@layout/horizontal_divider"
android:layout_width="match_parent"
android:layout_height="1dp" />
<LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="46dp" android:layout_height="46dp"
xmlns:style="http://schemas.android.com/tools"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageView
...@@ -16,7 +26,7 @@ ...@@ -16,7 +26,7 @@
app:srcCompat="@drawable/ic_webcam" /> app:srcCompat="@drawable/ic_webcam" />
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
android:id="@+id/textView7" android:id="@+id/camTitle"
style="@style/Accent_Minor_TextView.Default" style="@style/Accent_Minor_TextView.Default"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
...@@ -37,12 +47,15 @@ ...@@ -37,12 +47,15 @@
app:srcCompat="@drawable/new_feed_icon" /> app:srcCompat="@drawable/new_feed_icon" />
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
android:id="@+id/textView8" android:id="@+id/camStatus"
style="@style/Feed.Notice" style="@style/Feed.Notice"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginTop="2dp"
android:layout_marginEnd="16dp"
android:layout_weight="0" android:layout_weight="0"
android:gravity="center_vertical|fill_vertical" android:gravity="center_vertical|fill_vertical"
android:text="ОНЛАЙН" android:text="ОНЛАЙН"
android:textAlignment="viewStart" /> android:textAlignment="viewStart" />
</LinearLayout> </LinearLayout>
</LinearLayout>
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
android:layout_width="284dp" android:layout_width="284dp"
android:layout_height="189dp" android:layout_height="189dp"
android:layout_margin="16dp" android:layout_margin="16dp"
app:cardElevation="0dp" app:cardElevation="2dp"
app:cardForegroundColor="#00000000" app:cardForegroundColor="#00000000"
app:cardPreventCornerOverlap="false" app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="false"> app:cardUseCompatPadding="false">
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:background="@drawable/default_image_placeholder" android:background="@drawable/default_image_placeholder"
android:cropToPadding="true" android:cropToPadding="true"
android:foreground="@drawable/catalog_item_mask" android:foreground="@color/colorOpacityBackground"
android:scaleType="centerCrop" android:scaleType="centerCrop"
app:image_corner_radius="4dp" /> app:image_corner_radius="4dp" />
......
...@@ -35,8 +35,6 @@ ...@@ -35,8 +35,6 @@
android:id="@+id/dev_progress_recycler_view" android:id="@+id/dev_progress_recycler_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:orientation="horizontal" android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
...@@ -48,13 +46,14 @@ ...@@ -48,13 +46,14 @@
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/cams_recycler_view" android:id="@+id/cams_recycler_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="16dp" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:orientation="vertical" android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/dev_progress_recycler_view" /> app:layout_constraintTop_toBottomOf="@+id/dev_progress_recycler_view"
tools:listitem="@layout/cam_button_viewholder" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment