Commit 8f4943c3 authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

Merge branch 'feature/read_flag' into develop

parents 68531f19 e310dd12
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<component name="GradleSettings"> <component name="GradleSettings">
<option name="linkedExternalProjectsSettings"> <option name="linkedExternalProjectsSettings">
<GradleProjectSettings> <GradleProjectSettings>
<option name="delegatedBuild" value="false" />
<option name="testRunner" value="PLATFORM" /> <option name="testRunner" value="PLATFORM" />
<option name="distributionType" value="DEFAULT_WRAPPED" /> <option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
......
...@@ -16,6 +16,7 @@ import com.biganto.visual.roompark.domain.model.DealModel ...@@ -16,6 +16,7 @@ import com.biganto.visual.roompark.domain.model.DealModel
import com.biganto.visual.roompark.domain.model.EstateModel import com.biganto.visual.roompark.domain.model.EstateModel
import com.biganto.visual.roompark.domain.model.PlanPresetModel import com.biganto.visual.roompark.domain.model.PlanPresetModel
import com.biganto.visual.roompark.domain.model.fromEntity import com.biganto.visual.roompark.domain.model.fromEntity
import io.reactivex.Completable
import io.reactivex.Observable import io.reactivex.Observable
import io.reactivex.schedulers.Schedulers import io.reactivex.schedulers.Schedulers
import timber.log.Timber import timber.log.Timber
...@@ -241,6 +242,10 @@ class EstateRepository @Inject constructor( ...@@ -241,6 +242,10 @@ class EstateRepository @Inject constructor(
} }
override fun setDealRead(dealId: String): Completable =
db.setDealReadState(dealId,true)
private fun fetchEstateApi(building: Int,number:Int)= private fun fetchEstateApi(building: Int,number:Int)=
......
...@@ -10,6 +10,7 @@ import com.biganto.visual.roompark.domain.model.ArticleModel ...@@ -10,6 +10,7 @@ import com.biganto.visual.roompark.domain.model.ArticleModel
import com.biganto.visual.roompark.domain.model.ArticlesPreviewModel import com.biganto.visual.roompark.domain.model.ArticlesPreviewModel
import com.biganto.visual.roompark.domain.model.FeedModel import com.biganto.visual.roompark.domain.model.FeedModel
import com.biganto.visual.roompark.domain.model.fromEntity import com.biganto.visual.roompark.domain.model.fromEntity
import io.reactivex.Completable
import io.reactivex.Observable import io.reactivex.Observable
import io.reactivex.schedulers.Schedulers import io.reactivex.schedulers.Schedulers
import timber.log.Timber import timber.log.Timber
...@@ -33,6 +34,7 @@ class FeedsContractModule @Inject constructor( ...@@ -33,6 +34,7 @@ class FeedsContractModule @Inject constructor(
override fun fetchFeedObservable(feedAlias: String): Observable<ArticlesPreviewModel> = override fun fetchFeedObservable(feedAlias: String): Observable<ArticlesPreviewModel> =
fetchArticles(feedAlias) fetchArticles(feedAlias)
override fun fetchFeedObservable(feedAlias: String,pageSize:Int, startIndex:Int) override fun fetchFeedObservable(feedAlias: String,pageSize:Int, startIndex:Int)
: Observable<ArticlesPreviewModel> = fetchArticles(feedAlias,pageSize,startIndex) : Observable<ArticlesPreviewModel> = fetchArticles(feedAlias,pageSize,startIndex)
...@@ -53,7 +55,6 @@ class FeedsContractModule @Inject constructor( ...@@ -53,7 +55,6 @@ class FeedsContractModule @Inject constructor(
.doOnNext { Timber.d("raw0 $it") } .doOnNext { Timber.d("raw0 $it") }
.map { it.items } .map { it.items }
.map { fromRaw(it, feedAlias) } .map { fromRaw(it, feedAlias) }
.doOnNext { Timber.d("raw enitites $it") }
.doOnNext(db::blockingUpsert) .doOnNext(db::blockingUpsert)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
...@@ -64,7 +65,6 @@ class FeedsContractModule @Inject constructor( ...@@ -64,7 +65,6 @@ class FeedsContractModule @Inject constructor(
db.fetchArticles(feedAlias, pageSize, startIndex) db.fetchArticles(feedAlias, pageSize, startIndex)
.toList() .toList()
.toObservable() .toObservable()
.doOnNext { Timber.d("db items: ${it.size}") }
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
private fun fetchArticles(feedAlias: String,pageSize:Int = 10, startIndex:Int = 0) private fun fetchArticles(feedAlias: String,pageSize:Int = 10, startIndex:Int = 0)
...@@ -121,7 +121,11 @@ class FeedsContractModule @Inject constructor( ...@@ -121,7 +121,11 @@ class FeedsContractModule @Inject constructor(
private fun fetchArticle(articleId:Int): Observable<ArticleModel> = private fun fetchArticle(articleId:Int): Observable<ArticleModel> =
Observable.mergeDelayError( Observable.mergeDelayError(
arrayListOf(fetchArticleDb(articleId),fetchArticleApi(articleId)) arrayListOf(fetchArticleDb(articleId),fetchArticleApi(articleId))
).map { fromEntity(it,true) } ).map { fromEntity(it) }
override fun articleRead(articleId: Int): Completable =
db.setArticleReadState(articleId,true)
} }
package com.biganto.visual.roompark.data.repository.db package com.biganto.visual.roompark.data.repository.db
import com.biganto.visual.roompark.data.repository.db.requrey.model.* import com.biganto.visual.roompark.data.repository.db.requrey.model.*
import io.reactivex.Completable
import io.reactivex.Observable import io.reactivex.Observable
import io.reactivex.Single import io.reactivex.Single
import io.requery.Persistable import io.requery.Persistable
...@@ -31,4 +32,6 @@ interface IDb { ...@@ -31,4 +32,6 @@ interface IDb {
fun getEstate(estateId: Int): Observable<EstateEntity> fun getEstate(estateId: Int): Observable<EstateEntity>
fun upsertEstate(entity: EstateEntity) fun upsertEstate(entity: EstateEntity)
fun fetchEstateByNumber(building: Int, number: String): ReactiveResult<EstateEntity> fun fetchEstateByNumber(building: Int, number: String): ReactiveResult<EstateEntity>
fun setArticleReadState(id: Int, state: Boolean): Completable
fun setDealReadState(id: String, state: Boolean): Completable
} }
\ No newline at end of file
...@@ -6,6 +6,7 @@ import com.biganto.visual.roompark.data.repository.db.requrey.model.* ...@@ -6,6 +6,7 @@ import com.biganto.visual.roompark.data.repository.db.requrey.model.*
import com.biganto.visual.roompark.di.dagger.DATABASE_VERSION import com.biganto.visual.roompark.di.dagger.DATABASE_VERSION
import dagger.Module import dagger.Module
import dagger.Provides import dagger.Provides
import io.reactivex.Completable
import io.reactivex.Observable import io.reactivex.Observable
import io.reactivex.Single import io.reactivex.Single
import io.requery.Persistable import io.requery.Persistable
...@@ -157,4 +158,21 @@ class RequeryRepository @Inject constructor( ...@@ -157,4 +158,21 @@ class RequeryRepository @Inject constructor(
.where(EstateEntity.USER_ID.eq(uuid)) .where(EstateEntity.USER_ID.eq(uuid))
.and(EstateEntity.FAVORITE.eq(true)) .and(EstateEntity.FAVORITE.eq(true))
.get().observable() .get().observable()
}
\ No newline at end of file override fun setArticleReadState(id:Int,state:Boolean): Completable =
store.update(ArticleEntity::class)
.set(ArticleEntity.READ,state)
.where(ArticleEntity.ID.eq(id))
.get()
.single()
.ignoreElement()
override fun setDealReadState(id:String,state:Boolean): Completable =
store.update(DealEntity::class)
.set(DealEntity.READ,state)
.where(DealEntity.ID.eq(id))
.get()
.single()
.ignoreElement()
}
...@@ -27,4 +27,7 @@ interface Article : Persistable { ...@@ -27,4 +27,7 @@ interface Article : Persistable {
val feed : Feed? val feed : Feed?
@get:Convert(TitledPhotoListConverter::class) @get:Convert(TitledPhotoListConverter::class)
var photo : List<TitledPhoto>? var photo : List<TitledPhoto>?
val read : Boolean
} }
\ No newline at end of file
...@@ -25,4 +25,6 @@ interface Deal : Persistable { ...@@ -25,4 +25,6 @@ interface Deal : Persistable {
@get:ForeignKey(references = User::class ) @get:ForeignKey(references = User::class )
@get:ManyToOne(cascade = [CascadeAction.NONE]) @get:ManyToOne(cascade = [CascadeAction.NONE])
var user:User? var user:User?
val read : Boolean
} }
\ No newline at end of file
...@@ -21,7 +21,7 @@ const val ESTATES_CACHE_LIMIT_SECONDS_INACTIVE = 200L ...@@ -21,7 +21,7 @@ const val ESTATES_CACHE_LIMIT_SECONDS_INACTIVE = 200L
const val FILES_CACHE_LIMIT_SIZE = 10000 const val FILES_CACHE_LIMIT_SIZE = 10000
const val FILES_CACHE_LIMIT_SECONDS_INACTIVE = 60L const val FILES_CACHE_LIMIT_SECONDS_INACTIVE = 60L
const val DATABASE_VERSION = 10 const val DATABASE_VERSION = 11
@Module @Module
abstract class AppModule{ abstract class AppModule{
......
...@@ -3,6 +3,7 @@ package com.biganto.visual.roompark.domain.contract ...@@ -3,6 +3,7 @@ package com.biganto.visual.roompark.domain.contract
import com.biganto.visual.roompark.domain.model.DealModel import com.biganto.visual.roompark.domain.model.DealModel
import com.biganto.visual.roompark.domain.model.EstateModel import com.biganto.visual.roompark.domain.model.EstateModel
import com.biganto.visual.roompark.domain.model.PlanPresetModel import com.biganto.visual.roompark.domain.model.PlanPresetModel
import io.reactivex.Completable
import io.reactivex.Observable import io.reactivex.Observable
/** /**
...@@ -27,4 +28,5 @@ interface DealContract{ ...@@ -27,4 +28,5 @@ interface DealContract{
fun getDeals(): Observable<List<DealModel>> fun getDeals(): Observable<List<DealModel>>
fun fetchEstate(building: Int, number: Int): Observable<EstateModel> fun fetchEstate(building: Int, number: Int): Observable<EstateModel>
fun setDealRead(dealId: String): Completable
} }
\ No newline at end of file
...@@ -3,6 +3,7 @@ package com.biganto.visual.roompark.domain.contract ...@@ -3,6 +3,7 @@ package com.biganto.visual.roompark.domain.contract
import com.biganto.visual.roompark.domain.model.ArticleModel import com.biganto.visual.roompark.domain.model.ArticleModel
import com.biganto.visual.roompark.domain.model.ArticlesPreviewModel import com.biganto.visual.roompark.domain.model.ArticlesPreviewModel
import com.biganto.visual.roompark.domain.model.FeedModel import com.biganto.visual.roompark.domain.model.FeedModel
import io.reactivex.Completable
import io.reactivex.Observable import io.reactivex.Observable
/** /**
...@@ -20,4 +21,5 @@ interface FeedsContract{ ...@@ -20,4 +21,5 @@ interface FeedsContract{
): Observable<ArticlesPreviewModel> ): Observable<ArticlesPreviewModel>
fun fetchFeedObservable(feedAlias: String): Observable<ArticlesPreviewModel> fun fetchFeedObservable(feedAlias: String): Observable<ArticlesPreviewModel>
fun articleRead(articleId:Int):Completable
} }
\ No newline at end of file
...@@ -17,6 +17,8 @@ class ArticleInteractor @Inject constructor( ...@@ -17,6 +17,8 @@ class ArticleInteractor @Inject constructor(
fun fetchArticle(articleId: Int): Observable<ArticleModel> = fun fetchArticle(articleId: Int): Observable<ArticleModel> =
uc.getArticle(articleId) uc.getArticle(articleId)
fun setArticleRead(articleId: Int) = uc.setRead(articleId)
// Single.just( // Single.just(
// when (articleId) { // when (articleId) {
// 2 -> article2 // 2 -> article2
......
...@@ -17,6 +17,7 @@ data class DealPreviewModel( ...@@ -17,6 +17,7 @@ data class DealPreviewModel(
val dealTourIds : List<Int?>?, val dealTourIds : List<Int?>?,
val isViewed: Boolean = true, val isViewed: Boolean = true,
val tourPreview: String?, val tourPreview: String?,
val isRead: Boolean,
val statusList : List<StatusModel> val statusList : List<StatusModel>
){ ){
constructor(data:Pair<DealModel,List<StatusModel>>) : this( constructor(data:Pair<DealModel,List<StatusModel>>) : this(
...@@ -36,6 +37,7 @@ data class DealPreviewModel( ...@@ -36,6 +37,7 @@ data class DealPreviewModel(
arrayListOf<Int?>(data.first.estate.multitourId), arrayListOf<Int?>(data.first.estate.multitourId),
false, false,
data.first.estate.multitourPreview, data.first.estate.multitourPreview,
data.first.isRead,
data.second data.second
) )
} }
......
...@@ -30,6 +30,7 @@ data class DealModel( ...@@ -30,6 +30,7 @@ data class DealModel(
val amount_pay_sum:Int, val amount_pay_sum:Int,
val statusId:Int, val statusId:Int,
val managerName: String, val managerName: String,
val isRead: Boolean,
val estate:EstateModel val estate:EstateModel
) )
...@@ -41,6 +42,7 @@ fun fromEntity(entity:DealEntity) = DealModel( ...@@ -41,6 +42,7 @@ fun fromEntity(entity:DealEntity) = DealModel(
amount_pay_sum = entity.amountPaySum, amount_pay_sum = entity.amountPaySum,
statusId = entity.statusId, statusId = entity.statusId,
managerName = entity.managerName, managerName = entity.managerName,
isRead = entity.read,
estate = fromEntity(entity.estate as EstateEntity) estate = fromEntity(entity.estate as EstateEntity)
) )
......
...@@ -48,22 +48,22 @@ fun fromEntity(entity: FeedEntity):FeedModel = FeedModel( ...@@ -48,22 +48,22 @@ fun fromEntity(entity: FeedEntity):FeedModel = FeedModel(
alias = entity.alias alias = entity.alias
) )
fun fromEntity(entity: ArticleEntity):ArticlePreviewModel = ArticlePreviewModel( fun fromEntityPreview(entity: ArticleEntity):ArticlePreviewModel = ArticlePreviewModel(
articleId = entity.id, articleId = entity.id,
published = entity.published, published = entity.published,
title = entity.title, title = entity.title,
announce = entity.announce?:"", announce = entity.announce?:"",
previewUrl = entity.preview?:"", previewUrl = entity.preview?:"",
isRead = false isRead = entity.read
) )
fun fromEntity(parentId:String,entity: List<ArticleEntity>):ArticlesPreviewModel = fun fromEntity(parentId:String,entity: List<ArticleEntity>):ArticlesPreviewModel =
ArticlesPreviewModel( ArticlesPreviewModel(
parentFeedAlias = parentId, parentFeedAlias = parentId,
articles = fromEntity(entity,::fromEntity) articles = fromEntity(entity,::fromEntityPreview)
) )
fun fromEntity(entity: ArticleEntity,read:Boolean) : ArticleModel = fun fromEntity(entity: ArticleEntity) : ArticleModel =
ArticleModel( ArticleModel(
articleId = entity.id, articleId = entity.id,
published = entity.published, published = entity.published,
...@@ -71,7 +71,7 @@ fun fromEntity(entity: ArticleEntity,read:Boolean) : ArticleModel = ...@@ -71,7 +71,7 @@ fun fromEntity(entity: ArticleEntity,read:Boolean) : ArticleModel =
htmlBody = entity.body!!, htmlBody = entity.body!!,
previewUrl = entity.preview?:DEFAULT_ROOM_PARK_PREVIEW, previewUrl = entity.preview?:DEFAULT_ROOM_PARK_PREVIEW,
bottomPhotoList = entity.photo, bottomPhotoList = entity.photo,
isRead = read isRead = entity.read
) )
......
...@@ -13,5 +13,7 @@ class DealseUseCase @Inject constructor( ...@@ -13,5 +13,7 @@ class DealseUseCase @Inject constructor(
fun getDeals() = contract.getDeals() fun getDeals() = contract.getDeals()
fun setDealRead(id:String) = contract.setDealRead(id)
} }
\ No newline at end of file
...@@ -21,4 +21,6 @@ class FeedUseCase @Inject constructor( ...@@ -21,4 +21,6 @@ class FeedUseCase @Inject constructor(
fun getArticle(articleId:Int) = fun getArticle(articleId:Int) =
contract.getArticle(articleId) contract.getArticle(articleId)
fun setRead(articleId: Int) = contract.articleRead(articleId)
} }
\ No newline at end of file
...@@ -3,6 +3,7 @@ package com.biganto.visual.roompark.presentation.screen.article ...@@ -3,6 +3,7 @@ package com.biganto.visual.roompark.presentation.screen.article
import com.biganto.visual.roompark.conductor.BigantoBasePresenter import com.biganto.visual.roompark.conductor.BigantoBasePresenter
import com.biganto.visual.roompark.domain.interactor.ArticleInteractor import com.biganto.visual.roompark.domain.interactor.ArticleInteractor
import com.biganto.visual.roompark.util.monades.ExceptionString import com.biganto.visual.roompark.util.monades.ExceptionString
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers import io.reactivex.schedulers.Schedulers
import timber.log.Timber import timber.log.Timber
...@@ -28,8 +29,13 @@ class ArticleScreenPresenter @Inject constructor( ...@@ -28,8 +29,13 @@ class ArticleScreenPresenter @Inject constructor(
val prefetchCards = interactor.fetchArticle(selectedArticleId) val prefetchCards = interactor.fetchArticle(selectedArticleId)
.map { ArticleScreenViewState.ArticleLoaded(it) } .map { ArticleScreenViewState.ArticleLoaded(it) }
val setRead = interactor.setArticleRead(selectedArticleId)
.andThen(Observable.just(ArticleScreenViewState.Idle()))
val state = restoreStateObservable val state = restoreStateObservable
.mergeWith(prefetchCards) .mergeWith(prefetchCards)
.mergeWith(setRead)
.doOnError{ Timber.e(it)} .doOnError{ Timber.e(it)}
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
......
...@@ -46,7 +46,7 @@ class AuthScreenPresenter @Inject constructor( ...@@ -46,7 +46,7 @@ class AuthScreenPresenter @Inject constructor(
val state = restoreStateObservable val state = restoreStateObservable
.mergeWith(onAuth) .mergeWith(onAuth)
.doOnError { Timber.e(it) } .doOnError { Timber.e(it) }
.onErrorReturn(::parseError) .onErrorReturn(::parseError)
.subscribeOn(Schedulers.single()) .subscribeOn(Schedulers.single())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
......
...@@ -4,11 +4,11 @@ import android.content.Context ...@@ -4,11 +4,11 @@ import android.content.Context
import androidx.annotation.StringRes import androidx.annotation.StringRes
import com.biganto.visual.roompark.conductor.BigantoBasePresenter import com.biganto.visual.roompark.conductor.BigantoBasePresenter
import com.biganto.visual.roompark.domain.interactor.DealInteractor import com.biganto.visual.roompark.domain.interactor.DealInteractor
import com.biganto.visual.roompark.domain.interactor.EstateInteractor
import com.biganto.visual.roompark.domain.model.DealModel import com.biganto.visual.roompark.domain.model.DealModel
import com.biganto.visual.roompark.domain.model.PlanPresetModel import com.biganto.visual.roompark.domain.model.PlanPresetModel
import com.biganto.visual.roompark.presentation.screen.estate.InfoShowType import com.biganto.visual.roompark.presentation.screen.estate.InfoShowType
import com.biganto.visual.roompark.util.monades.ExceptionString import com.biganto.visual.roompark.util.monades.ExceptionString
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers import io.reactivex.schedulers.Schedulers
import timber.log.Timber import timber.log.Timber
...@@ -22,7 +22,6 @@ import javax.inject.Named ...@@ -22,7 +22,6 @@ import javax.inject.Named
class DealScreenPresenter @Inject constructor( class DealScreenPresenter @Inject constructor(
private val interactor: DealInteractor, private val interactor: DealInteractor,
private val interactor2: EstateInteractor,
private val context: Context, private val context: Context,
@Named(SELECTED_DEAL_ID_KEY) private val dealId:String @Named(SELECTED_DEAL_ID_KEY) private val dealId:String
) )
...@@ -45,8 +44,13 @@ class DealScreenPresenter @Inject constructor( ...@@ -45,8 +44,13 @@ class DealScreenPresenter @Inject constructor(
DealScreenViewState.LoadDeal(deal ,interactor.getStatusListSync()) DealScreenViewState.LoadDeal(deal ,interactor.getStatusListSync())
} }
val setRead = interactor.setDealRead(dealId)
.andThen(Observable.just(DealScreenViewState.Idle()))
val state = restoreStateObservable val state = restoreStateObservable
.mergeWith(fetchDeal) .mergeWith(fetchDeal)
.mergeWith(setRead)
.doOnError { Timber.e(it) } .doOnError { Timber.e(it) }
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
......
...@@ -40,6 +40,7 @@ class DealsScreenPresenter @Inject constructor( ...@@ -40,6 +40,7 @@ class DealsScreenPresenter @Inject constructor(
val state = restoreStateObservable val state = restoreStateObservable
.mergeWith(fetchDeals) .mergeWith(fetchDeals)
.doOnError{ Timber.e(it)} .doOnError{ Timber.e(it)}
.onErrorReturn(::parseError)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
......
...@@ -13,6 +13,7 @@ import com.biganto.visual.roompark.domain.model.StatusModel ...@@ -13,6 +13,7 @@ import com.biganto.visual.roompark.domain.model.StatusModel
import com.biganto.visual.roompark.domain.model.typeDoubleString import com.biganto.visual.roompark.domain.model.typeDoubleString
import com.biganto.visual.roompark.presentation.screen.settings.util.CommonRecyclerAdapter import com.biganto.visual.roompark.presentation.screen.settings.util.CommonRecyclerAdapter
import com.biganto.visual.roompark.presentation.screen.settings.util.CommonViewHolder import com.biganto.visual.roompark.presentation.screen.settings.util.CommonViewHolder
import com.biganto.visual.roompark.util.extensions.setGone
import com.biganto.visual.roompark.util.extensions.toRubly import com.biganto.visual.roompark.util.extensions.toRubly
import com.biganto.visual.roompark.util.view_utils.image_view.RoundedImageView import com.biganto.visual.roompark.util.view_utils.image_view.RoundedImageView
import com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressAnimationState import com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressAnimationState
...@@ -68,10 +69,15 @@ class DealViewHolder(itemView: View) : CommonViewHolder<DealPreviewModel>(itemVi ...@@ -68,10 +69,15 @@ class DealViewHolder(itemView: View) : CommonViewHolder<DealPreviewModel>(itemVi
@BindView(R.id.start_tour_image_view) lateinit var tourScreen:RoundedImageView @BindView(R.id.start_tour_image_view) lateinit var tourScreen:RoundedImageView
@BindView(R.id.deal_read) lateinit var dealReadFlag:View
val onStartFlatObs: Observable<Int?> get() = startFlat.clicks().map { bindedModel.estateId } val onStartFlatObs: Observable<Int?> get() = startFlat.clicks().map { bindedModel.estateId }
val onStartTourObs: Observable<Int?> get() = startTour.clicks().map { bindedModel.tourId } val onStartTourObs: Observable<Int?> get() = startTour.clicks().map { bindedModel.tourId }
override fun onViewBound(model: DealPreviewModel) { override fun onViewBound(model: DealPreviewModel) {
dealReadFlag.setGone(model.isRead)
estateTitle.text = estateTitle.text =
itemView.context.resources?.getString(model.type.typeDoubleString(),model.name) itemView.context.resources?.getString(model.type.typeDoubleString(),model.name)
renderCommonInfo(model) renderCommonInfo(model)
...@@ -93,6 +99,8 @@ class DealViewHolder(itemView: View) : CommonViewHolder<DealPreviewModel>(itemVi ...@@ -93,6 +99,8 @@ class DealViewHolder(itemView: View) : CommonViewHolder<DealPreviewModel>(itemVi
statusLayout.invalidate() statusLayout.invalidate()
model.tourPreview?.let { model.tourPreview?.let {
Glide.with(tourScreen) Glide.with(tourScreen)
.load(it) .load(it)
......
...@@ -29,6 +29,7 @@ class FavoritesScreenPresenter @Inject constructor( ...@@ -29,6 +29,7 @@ class FavoritesScreenPresenter @Inject constructor(
val state = restoreStateObservable val state = restoreStateObservable
.mergeWith(prefetchCards) .mergeWith(prefetchCards)
.doOnError{ Timber.e(it)} .doOnError{ Timber.e(it)}
.onErrorReturn(::parseError)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
......
...@@ -34,6 +34,7 @@ class ArticlesScreenPresenter @Inject constructor( ...@@ -34,6 +34,7 @@ class ArticlesScreenPresenter @Inject constructor(
val state = restoreStateObservable val state = restoreStateObservable
.mergeWith(prefetchCards) .mergeWith(prefetchCards)
.doOnError{ Timber.e(it)} .doOnError{ Timber.e(it)}
.onErrorReturn(::parseError)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
......
...@@ -10,6 +10,7 @@ import com.biganto.visual.roompark.presentation.screen.settings.util.CommonRecyc ...@@ -10,6 +10,7 @@ import com.biganto.visual.roompark.presentation.screen.settings.util.CommonRecyc
import com.biganto.visual.roompark.presentation.screen.settings.util.CommonViewHolder import com.biganto.visual.roompark.presentation.screen.settings.util.CommonViewHolder
import com.biganto.visual.roompark.util.extensions.setGone import com.biganto.visual.roompark.util.extensions.setGone
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import timber.log.Timber
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.* import java.util.*
...@@ -38,6 +39,7 @@ class ArticleViewHolder(itemView: View) : CommonViewHolder<ArticlePreviewModel>( ...@@ -38,6 +39,7 @@ class ArticleViewHolder(itemView: View) : CommonViewHolder<ArticlePreviewModel>(
override fun onViewBound(model: ArticlePreviewModel) { override fun onViewBound(model: ArticlePreviewModel) {
Timber.d("readeed?: ${model.isRead} of ${model.title}")
articleDate.text = dateFormatter.format(model.published) articleDate.text = dateFormatter.format(model.published)
articleTitle.text = model.title articleTitle.text = model.title
articleIsRead.setGone(model.isRead) articleIsRead.setGone(model.isRead)
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout
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_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="16dp" android:layout_margin="4dp"
>
<FrameLayout
android:elevation="10dp"
android:id="@+id/deal_read"
android:layout_width="12dp"
android:layout_height="12dp"
android:background="@drawable/new_feed_icon"
android:backgroundTint="@color/colorAccent"
android:visibility="visible"
android:layout_margin="6dp"/>
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:orientation="vertical" android:orientation="vertical"
app:cardElevation="6dp" app:cardElevation="6dp"
app:cardMaxElevation="8dp"> app:cardMaxElevation="8dp">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -239,4 +260,5 @@ ...@@ -239,4 +260,5 @@
</com.google.android.material.card.MaterialCardView> </com.google.android.material.card.MaterialCardView>
</LinearLayout> </LinearLayout>
</com.google.android.material.card.MaterialCardView> </com.google.android.material.card.MaterialCardView>
\ No newline at end of file </FrameLayout>
\ No newline at end of file
...@@ -12,11 +12,9 @@ ...@@ -12,11 +12,9 @@
android:layout_height="128dp" android:layout_height="128dp"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp" android:layout_marginBottom="16dp"
app:image_corner_radius="4dp" app:image_corner_radius="4dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/feed_title_info_text_view"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
...@@ -24,31 +22,35 @@ ...@@ -24,31 +22,35 @@
android:id="@+id/guideline" android:id="@+id/guideline"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:orientation="vertical" android:orientation="vertical"
app:layout_constraintGuide_begin="160dp" /> app:layout_constraintGuide_begin="150dp" />
<FrameLayout <FrameLayout
android:id="@+id/feed_read" android:id="@+id/feed_read"
android:layout_width="8dp" android:layout_width="wrap_content"
android:layout_height="8dp" android:layout_height="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="18dp" android:layout_marginTop="18dp"
android:background="@drawable/new_feed_icon" android:background="@drawable/new_feed_icon"
android:visibility="visible" android:visibility="visible"
app:layout_constraintStart_toStartOf="@+id/guideline" app:layout_constraintStart_toStartOf="@+id/guideline"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
<TextView <TextView
android:id="@+id/feed_date_text_view" android:id="@+id/feed_date_text_view"
style="@style/Feed.Notice" style="@style/Feed.Notice"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_marginStart="8dp"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:includeFontPadding="false" android:includeFontPadding="false"
android:text="22 / 02 / 2019" android:text="22 / 02 / 2019"
android:visibility="visible" android:visibility="visible"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/guideline" app:layout_constraintStart_toEndOf="@+id/feed_read"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<TextView <TextView
...@@ -56,6 +58,7 @@ ...@@ -56,6 +58,7 @@
style="@style/Feed_Title" style="@style/Feed_Title"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:includeFontPadding="false" android:includeFontPadding="false"
android:text="В «РУМЯНЦЕВО-ПАРК» ПРИСТУПИЛИ К МОНТАЖУ ОКОННЫХ БЛОКОВ" android:text="В «РУМЯНЦЕВО-ПАРК» ПРИСТУПИЛИ К МОНТАЖУ ОКОННЫХ БЛОКОВ"
...@@ -68,6 +71,7 @@ ...@@ -68,6 +71,7 @@
style="@style/Feed.Description" style="@style/Feed.Description"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:includeFontPadding="false" android:includeFontPadding="false"
android:text="В «РУМЯНЦЕВО-ПАРК» ПРИСТУПИЛИ К МОНТАЖУ ОКОННЫХ БЛОКОВ" android:text="В «РУМЯНЦЕВО-ПАРК» ПРИСТУПИЛИ К МОНТАЖУ ОКОННЫХ БЛОКОВ"
......
...@@ -23,12 +23,13 @@ ...@@ -23,12 +23,13 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
app:layout_constraintGuide_begin="76dp" /> app:layout_constraintGuide_begin="68dp" />
<FrameLayout <FrameLayout
android:id="@+id/feed_read" android:id="@+id/feed_read"
android:layout_width="8dp" android:layout_width="8dp"
android:layout_height="8dp" android:layout_height="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:background="@drawable/new_feed_icon" android:background="@drawable/new_feed_icon"
android:visibility="visible" android:visibility="visible"
...@@ -40,13 +41,13 @@ ...@@ -40,13 +41,13 @@
style="@style/Feed.Notice" style="@style/Feed.Notice"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_marginStart="8dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:includeFontPadding="false" android:includeFontPadding="false"
android:text="22 / 02 / 2019" android:text="22 / 02 / 2019"
android:visibility="visible" android:visibility="visible"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/guideline" app:layout_constraintStart_toEndOf="@+id/feed_read"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<TextView <TextView
...@@ -54,6 +55,7 @@ ...@@ -54,6 +55,7 @@
style="@style/Feed_Title" style="@style/Feed_Title"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
android:includeFontPadding="false" android:includeFontPadding="false"
android:text="В «РУМЯНЦЕВО-ПАРК» ПРИСТУПИЛИ К МОНТАЖУ ОКОННЫХ БЛОКОВ" android:text="В «РУМЯНЦЕВО-ПАРК» ПРИСТУПИЛИ К МОНТАЖУ ОКОННЫХ БЛОКОВ"
......
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