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
667d20b1
Commit
667d20b1
authored
Mar 19, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
deal read flag provided
parent
ef7eb238
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
47 additions
and
248 deletions
+47
-248
EstateRepository.kt
...to/visual/roompark/data/data_provider/EstateRepository.kt
+5
-0
IDb.kt
...ava/com/biganto/visual/roompark/data/repository/db/IDb.kt
+1
-0
RequeryRepository.kt
.../roompark/data/repository/db/requrey/RequeryRepository.kt
+12
-2
DealContract.kt
...m/biganto/visual/roompark/domain/contract/DealContract.kt
+2
-0
deal.kt
...ava/com/biganto/visual/roompark/domain/interactor/deal.kt
+1
-237
DealPreviewModel.kt
.../biganto/visual/roompark/domain/model/DealPreviewModel.kt
+2
-0
deals.kt
...in/java/com/biganto/visual/roompark/domain/model/deals.kt
+2
-0
dealUseCase.kt
...om/biganto/visual/roompark/domain/use_case/dealUseCase.kt
+2
-0
ScreenPresenter.kt
...l/roompark/presentation/screen/article/ScreenPresenter.kt
+2
-2
ScreenPresenter.kt
...sual/roompark/presentation/screen/deal/ScreenPresenter.kt
+6
-2
Adapter.kt
...visual/roompark/presentation/screen/deals/util/Adapter.kt
+8
-0
deal_card_viewholder.xml
app/src/main/res/layout/deal_card_viewholder.xml
+4
-5
No files found.
app/src/main/java/com/biganto/visual/roompark/data/data_provider/EstateRepository.kt
View file @
667d20b1
...
...
@@ -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.PlanPresetModel
import
com.biganto.visual.roompark.domain.model.fromEntity
import
io.reactivex.Completable
import
io.reactivex.Observable
import
io.reactivex.schedulers.Schedulers
import
timber.log.Timber
...
...
@@ -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
)=
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/db/IDb.kt
View file @
667d20b1
...
...
@@ -33,4 +33,5 @@ interface IDb {
fun
upsertEstate
(
entity
:
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
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/RequeryRepository.kt
View file @
667d20b1
...
...
@@ -6,6 +6,7 @@ import com.biganto.visual.roompark.data.repository.db.requrey.model.*
import
com.biganto.visual.roompark.di.dagger.DATABASE_VERSION
import
dagger.Module
import
dagger.Provides
import
io.reactivex.Completable
import
io.reactivex.Observable
import
io.reactivex.Single
import
io.requery.Persistable
...
...
@@ -158,11 +159,20 @@ class RequeryRepository @Inject constructor(
.
and
(
EstateEntity
.
FAVORITE
.
eq
(
true
))
.
get
().
observable
()
override
fun
setArticleReadState
(
id
:
Int
,
state
:
Boolean
)
=
override
fun
setArticleReadState
(
id
:
Int
,
state
:
Boolean
)
:
Completable
=
store
.
update
(
ArticleEntity
::
class
)
.
set
(
ArticleEntity
.
ANNOUNCE
,
""
)
.
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
()
}
app/src/main/java/com/biganto/visual/roompark/domain/contract/DealContract.kt
View file @
667d20b1
...
...
@@ -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.EstateModel
import
com.biganto.visual.roompark.domain.model.PlanPresetModel
import
io.reactivex.Completable
import
io.reactivex.Observable
/**
...
...
@@ -27,4 +28,5 @@ interface DealContract{
fun
getDeals
():
Observable
<
List
<
DealModel
>>
fun
fetchEstate
(
building
:
Int
,
number
:
Int
):
Observable
<
EstateModel
>
fun
setDealRead
(
dealId
:
String
):
Completable
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/domain/interactor/deal.kt
View file @
667d20b1
This diff is collapsed.
Click to expand it.
app/src/main/java/com/biganto/visual/roompark/domain/model/DealPreviewModel.kt
View file @
667d20b1
...
...
@@ -17,6 +17,7 @@ data class DealPreviewModel(
val
dealTourIds
:
List
<
Int
?>?,
val
isViewed
:
Boolean
=
true
,
val
tourPreview
:
String
?,
val
isRead
:
Boolean
,
val
statusList
:
List
<
StatusModel
>
){
constructor
(
data
:
Pair
<
DealModel
,
List
<
StatusModel
>>)
:
this
(
...
...
@@ -36,6 +37,7 @@ data class DealPreviewModel(
arrayListOf
<
Int
?>(
data
.
first
.
estate
.
multitourId
),
false
,
data
.
first
.
estate
.
multitourPreview
,
data
.
first
.
isRead
,
data
.
second
)
}
...
...
app/src/main/java/com/biganto/visual/roompark/domain/model/deals.kt
View file @
667d20b1
...
...
@@ -30,6 +30,7 @@ data class DealModel(
val
amount_pay_sum
:
Int
,
val
statusId
:
Int
,
val
managerName
:
String
,
val
isRead
:
Boolean
,
val
estate
:
EstateModel
)
...
...
@@ -41,6 +42,7 @@ fun fromEntity(entity:DealEntity) = DealModel(
amount_pay_sum
=
entity
.
amountPaySum
,
statusId
=
entity
.
statusId
,
managerName
=
entity
.
managerName
,
isRead
=
entity
.
read
,
estate
=
fromEntity
(
entity
.
estate
as
EstateEntity
)
)
...
...
app/src/main/java/com/biganto/visual/roompark/domain/use_case/dealUseCase.kt
View file @
667d20b1
...
...
@@ -13,5 +13,7 @@ class DealseUseCase @Inject constructor(
fun
getDeals
()
=
contract
.
getDeals
()
fun
setDealRead
(
id
:
String
)
=
contract
.
setDealRead
(
id
)
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/article/ScreenPresenter.kt
View file @
667d20b1
...
...
@@ -3,6 +3,7 @@ package com.biganto.visual.roompark.presentation.screen.article
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.domain.interactor.ArticleInteractor
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
io.reactivex.Observable
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
import
timber.log.Timber
...
...
@@ -29,8 +30,7 @@ class ArticleScreenPresenter @Inject constructor(
.
map
{
ArticleScreenViewState
.
ArticleLoaded
(
it
)
}
val
setRead
=
interactor
.
setArticleRead
(
selectedArticleId
)
.
andThen
({
ArticleScreenViewState
.
Idle
()})
.
andThen
(
Observable
.
just
(
ArticleScreenViewState
.
Idle
()))
val
state
=
restoreStateObservable
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/deal/ScreenPresenter.kt
View file @
667d20b1
...
...
@@ -4,11 +4,11 @@ import android.content.Context
import
androidx.annotation.StringRes
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
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.PlanPresetModel
import
com.biganto.visual.roompark.presentation.screen.estate.InfoShowType
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
io.reactivex.Observable
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
import
timber.log.Timber
...
...
@@ -22,7 +22,6 @@ import javax.inject.Named
class
DealScreenPresenter
@Inject
constructor
(
private
val
interactor
:
DealInteractor
,
private
val
interactor2
:
EstateInteractor
,
private
val
context
:
Context
,
@Named
(
SELECTED_DEAL_ID_KEY
)
private
val
dealId
:
String
)
...
...
@@ -45,8 +44,13 @@ class DealScreenPresenter @Inject constructor(
DealScreenViewState
.
LoadDeal
(
deal
,
interactor
.
getStatusListSync
())
}
val
setRead
=
interactor
.
setDealRead
(
dealId
)
.
andThen
(
Observable
.
just
(
DealScreenViewState
.
Idle
()))
val
state
=
restoreStateObservable
.
mergeWith
(
fetchDeal
)
.
mergeWith
(
setRead
)
.
doOnError
{
Timber
.
e
(
it
)
}
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/deals/util/Adapter.kt
View file @
667d20b1
...
...
@@ -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.presentation.screen.settings.util.CommonRecyclerAdapter
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.view_utils.image_view.RoundedImageView
import
com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressAnimationState
...
...
@@ -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
.
deal_read
)
lateinit
var
dealReadFlag
:
RoundedImageView
val
onStartFlatObs
:
Observable
<
Int
?>
get
()
=
startFlat
.
clicks
().
map
{
bindedModel
.
estateId
}
val
onStartTourObs
:
Observable
<
Int
?>
get
()
=
startTour
.
clicks
().
map
{
bindedModel
.
tourId
}
override
fun
onViewBound
(
model
:
DealPreviewModel
)
{
dealReadFlag
.
setGone
(
model
.
isRead
)
estateTitle
.
text
=
itemView
.
context
.
resources
?.
getString
(
model
.
type
.
typeDoubleString
(),
model
.
name
)
renderCommonInfo
(
model
)
...
...
@@ -93,6 +99,8 @@ class DealViewHolder(itemView: View) : CommonViewHolder<DealPreviewModel>(itemVi
statusLayout
.
invalidate
()
model
.
tourPreview
?.
let
{
Glide
.
with
(
tourScreen
)
.
load
(
it
)
...
...
app/src/main/res/layout/deal_card_viewholder.xml
View file @
667d20b1
...
...
@@ -4,26 +4,25 @@
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:background=
"@color/colorPrimary"
android:layout_height=
"wrap_content"
android:layout_margin=
"
8
dp"
android:layout_margin=
"
4
dp"
>
<FrameLayout
android:elevation=
"10dp"
android:id=
"@+id/
feed
_read"
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=
"
2
dp"
/>
android:layout_margin=
"
6
dp"
/>
<com.google.android.material.card.MaterialCardView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_margin=
"
8
dp"
android:layout_margin=
"
12
dp"
android:layout_marginBottom=
"8dp"
android:orientation=
"vertical"
app:cardElevation=
"6dp"
...
...
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