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(
fun fetchAlbums(): Single<List<AlbumPreviewModel>> = Single.just(albumsPreviews)
fun fetchCams(): Single<WebCamListModel> = Single.just(camsList)
private companion object {
......@@ -159,6 +161,24 @@ class FeedsInteractor @Inject constructor(
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(
val streamUrl:String
)
data class WebCamListModel(val items:List<WebCamListModel>)
\ No newline at end of file
data class WebCamListModel(val items:List<WebCamModel>)
\ No newline at end of file
......@@ -12,6 +12,7 @@ import com.biganto.visual.roompark.conductor.BigantoBaseController
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.ArticlesPreviewAdapter
import com.biganto.visual.roompark.presentation.screen.feeds.utils.CamsListAdapter
import com.google.android.material.tabs.TabLayout
import com.jakewharton.rxbinding3.material.selections
import io.reactivex.Observable
......@@ -48,6 +49,9 @@ class FeedsScreenController :
@BindView(R.id.dev_progress_recycler_view)
lateinit var devProgressRecyclerView:RecyclerView
@BindView(R.id.cams_recycler_view)
lateinit var camsRecyclerView:RecyclerView
private fun bindRecycler(){
feedsRecyclerView.isNestedScrollingEnabled = true
......@@ -62,6 +66,12 @@ class FeedsScreenController :
LinearLayoutManager(activity, RecyclerView.HORIZONTAL, false)
devProgressRecyclerView.adapter = AlbumsPreviewAdapter()
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()
......@@ -79,7 +89,8 @@ class FeedsScreenController :
when(viewState){
is FeedsScreenViewState.Idle -> 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)
}
}
......@@ -115,6 +126,10 @@ class FeedsScreenController :
(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()
.create(RoomParkApplication.component,activity as RoomParkMainActivity)
.inject(this)
......
......@@ -20,6 +20,8 @@ class FeedsScreenPresenter @Inject constructor(
override fun bindIntents() {
val fetchCams = interactor.fetchCams()
.map {FeedsScreenViewState.CamsList(it.items) }
val fetchAlbums = interactor.fetchAlbums()
.map {FeedsScreenViewState.AlbumsPages(it) }
......@@ -35,6 +37,7 @@ class FeedsScreenPresenter @Inject constructor(
.mergeWith(fetchFeeds)
.mergeWith(getFeedArticlesPreview)
.mergeWith(fetchAlbums)
.mergeWith(fetchCams)
.doOnError{ Timber.e(it)}
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
......
......@@ -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.ArticlePreviewModel
import com.biganto.visual.roompark.domain.model.FeedModel
import com.biganto.visual.roompark.domain.model.WebCamModel
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
......@@ -14,6 +15,7 @@ sealed class FeedsScreenViewState : BigantoBaseViewState() {
class Idle : FeedsScreenViewState()
class FeedsPages(val items:List<FeedModel>) : FeedsScreenViewState()
class AlbumsPages(val items:List<AlbumPreviewModel>) : FeedsScreenViewState()
class CamsList(val items:List<WebCamModel>) : 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>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AlbumCardViewHolder =
AlbumCardViewHolder(
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
......
......@@ -3,6 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="284dp"
android:layout_height="189dp"
android:layout_margin="16dp"
app:cardElevation="0dp"
app:cardForegroundColor="#00000000"
app:cardPreventCornerOverlap="false"
......@@ -15,7 +16,7 @@
android:adjustViewBounds="true"
android:background="@drawable/default_image_placeholder"
android:cropToPadding="true"
android:foreground="@drawable/catalog_item_mask"
android:foreground="@color/colorOpacityBackground"
android:scaleType="centerCrop"
app:image_corner_radius="4dp" />
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
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_height="46dp"
xmlns:style="http://schemas.android.com/tools"
android:orientation="horizontal">
<ImageView
......@@ -16,7 +26,7 @@
app:srcCompat="@drawable/ic_webcam" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/textView7"
android:id="@+id/camTitle"
style="@style/Accent_Minor_TextView.Default"
android:layout_width="wrap_content"
android:layout_height="match_parent"
......@@ -37,12 +47,15 @@
app:srcCompat="@drawable/new_feed_icon" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/textView8"
android:id="@+id/camStatus"
style="@style/Feed.Notice"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="2dp"
android:layout_marginEnd="16dp"
android:layout_weight="0"
android:gravity="center_vertical|fill_vertical"
android:text="ОНЛАЙН"
android:textAlignment="viewStart" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
......@@ -4,7 +4,7 @@
android:layout_width="284dp"
android:layout_height="189dp"
android:layout_margin="16dp"
app:cardElevation="0dp"
app:cardElevation="2dp"
app:cardForegroundColor="#00000000"
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="false">
......@@ -16,7 +16,7 @@
android:adjustViewBounds="true"
android:background="@drawable/default_image_placeholder"
android:cropToPadding="true"
android:foreground="@drawable/catalog_item_mask"
android:foreground="@color/colorOpacityBackground"
android:scaleType="centerCrop"
app:image_corner_radius="4dp" />
......
......@@ -35,8 +35,6 @@
android:id="@+id/dev_progress_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
......@@ -45,16 +43,17 @@
tools:listitem="@layout/estate_card_viewholder" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/cams_recycler_view"
android:layout_width="match_parent"
android:layout_height="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/dev_progress_recycler_view" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/cams_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/dev_progress_recycler_view"
tools:listitem="@layout/cam_button_viewholder" />
</androidx.constraintlayout.widget.ConstraintLayout>
</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