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
d5e2c26e
Commit
d5e2c26e
authored
Dec 30, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
plan preset providing
parent
cf0ad03d
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
85 additions
and
46 deletions
+85
-46
EstateRepository.kt
...to/visual/roompark/data/data_provider/EstateRepository.kt
+27
-3
Estate.kt
...isual/roompark/data/repository/db/requrey/model/Estate.kt
+0
-3
DealContract.kt
...m/biganto/visual/roompark/domain/contract/DealContract.kt
+5
-3
estate.kt
...a/com/biganto/visual/roompark/domain/interactor/estate.kt
+2
-0
deals.kt
...in/java/com/biganto/visual/roompark/domain/model/deals.kt
+20
-3
estateUseCase.kt
.../biganto/visual/roompark/domain/use_case/estateUseCase.kt
+1
-1
ScreenController.kt
...l/roompark/presentation/screen/estate/ScreenController.kt
+10
-7
ScreenController.kt
...oompark/presentation/screen/favorites/ScreenController.kt
+13
-0
FavoritesAdapter.kt
...rk/presentation/screen/favorites/util/FavoritesAdapter.kt
+7
-26
No files found.
app/src/main/java/com/biganto/visual/roompark/data/data_provider/EstateRepository.kt
View file @
d5e2c26e
...
...
@@ -12,6 +12,7 @@ import com.biganto.visual.roompark.domain.custom_exception.CustomApiException
import
com.biganto.visual.roompark.domain.model.EstateModel
import
com.biganto.visual.roompark.domain.model.fromEntity
import
io.reactivex.Observable
import
io.reactivex.schedulers.Schedulers
import
timber.log.Timber
import
javax.inject.Inject
...
...
@@ -26,6 +27,8 @@ class EstateRepository @Inject constructor(
private
val
api
:
IRoomParkApi
,
private
val
db
:
IDb
):
DealContract
{
init
{
Timber
.
d
(
"Estate Repository Created"
)
}
...
...
@@ -76,11 +79,32 @@ class EstateRepository @Inject constructor(
}
private
fun
fetchEstateDb
(
id
:
Int
)
=
db
.
getEstate
(
id
)
private
fun
fetchEstateDb
(
id
:
Int
)
=
db
.
getEstate
(
id
)
override
fun
getEstate
(
estateId
:
Int
)
:
Observable
<
EstateModel
>
{
return
fetchEstateDb
(
estateId
).
map
(
::
fromEntity
)
override
fun
getEstate
(
estateId
:
Int
):
Observable
<
EstateModel
>
{
return
fetchEstateDb
(
estateId
).
map
(
::
fromEntity
)
}
fun
getPlanTypesApi
(
estateId
:
Int
)
=
api
.
getEstatePlanTypes
(
estateId
)
.
doOnNext
{
Timber
.
d
(
"raw0 $it"
)
}
.
map
{
fromRawList
(
it
,
::
fromRaw
)
}
.
map
{
it
.
onEach
{
plan
->
val
e
=
EstateEntity
()
e
.
setId
(
estateId
)
plan
.
estateId
=
e
}.
toList
()
}
.
doOnNext
(
db
::
blockingUpsert
)
.
subscribeOn
(
Schedulers
.
io
())
override
fun
getPlanTypes
(
estateId
:
Int
)
=
Observable
.
mergeDelayError
(
arrayListOf
(
getPlanTypesApi
(
estateId
))
)
.
map
{
l
->
List
(
l
.
size
)
{
fromEntity
(
l
[
it
])
}
}
}
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/model/Estate.kt
View file @
d5e2c26e
...
...
@@ -65,9 +65,6 @@ interface Estate : Persistable {
@get
:
Nullable
val
info_direction
:
String
?
@get
:
OneToMany
(
mappedBy
=
"id"
,
cascade
=
[
CascadeAction
.
SAVE
,
CascadeAction
.
DELETE
])
val
planPreset
:
MutableList
<
PlanPreset
>
val
favorite
:
Boolean
@get
:
Nullable
...
...
app/src/main/java/com/biganto/visual/roompark/domain/contract/DealContract.kt
View file @
d5e2c26e
package
com.biganto.visual.roompark.domain.contract
import
com.biganto.visual.roompark.domain.model.EstateModel
import
io.reactivex.rxjava3.core.Observable
import
com.biganto.visual.roompark.domain.model.PlanPresetModel
import
io.reactivex.Observable
/**
* Created by Vladislav Bogdashkin on 24.09.2019.
...
...
@@ -10,6 +11,7 @@ import io.reactivex.rxjava3.core.Observable
interface
DealContract
{
fun
getFavorites
()
:
io
.
reactivex
.
Observable
<
List
<
EstateModel
>>
fun
getEstate
(
estateId
:
Int
):
io
.
reactivex
.
Observable
<
EstateModel
>
fun
getFavorites
()
:
Observable
<
List
<
EstateModel
>>
fun
getEstate
(
estateId
:
Int
):
Observable
<
EstateModel
>
fun
getPlanTypes
(
estateId
:
Int
):
Observable
<
List
<
PlanPresetModel
>>
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/domain/interactor/estate.kt
View file @
d5e2c26e
...
...
@@ -13,4 +13,6 @@ class EstateInteractor @Inject constructor(
fun
getEstate
(
estateId
:
Int
)
=
useCase
.
getEstate
(
estateId
)
// fun getPlanTypes() =
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/domain/model/deals.kt
View file @
d5e2c26e
package
com.biganto.visual.roompark.domain.model
import
com.biganto.visual.roompark.data.repository.db.requrey.model.EstateEntity
import
com.biganto.visual.roompark.data.repository.db.requrey.model.ExplicationEntity
import
com.biganto.visual.roompark.data.repository.db.requrey.model.PlanPreset
/**
* Created by Vladislav Bogdashkin on 23.09.2019.
...
...
@@ -105,16 +107,31 @@ data class CommonInfoModel(
val
rooms
:
Int
?
)
data class
ExplicationListModel
(
fun
fromEntity
(
entity
:
PlanPreset
)
=
PlanPresetModel
(
planId
=
entity
.
planId
,
estateId
=
entity
.
estateId
.
id
,
title
=
entity
.
title
,
features
=
entity
.
features
.
toList
(),
explication
=
List
(
entity
.
explication
.
size
){
ExplicationModel
((
entity
.
explication
[
it
]
as
ExplicationEntity
))}
)
data class
PlanPresetModel
(
val
planId
:
Int
,
val
items
:
List
<
ExplicationModel
>
val
explication
:
List
<
ExplicationModel
>,
var
estateId
:
Int
,
val
title
:
String
,
val
features
:
List
<
String
>
)
data class
ExplicationModel
(
val
living
:
Boolean
,
val
area
:
Float
,
val
title
:
String
)
){
constructor
(
entity
:
ExplicationEntity
):
this
(
entity
.
living
,
entity
.
area
,
entity
.
title
)
}
/*
data class CommonEstateInfoModel(
...
...
app/src/main/java/com/biganto/visual/roompark/domain/use_case/estateUseCase.kt
View file @
d5e2c26e
...
...
@@ -13,6 +13,6 @@ class EstateUseCase @Inject constructor(
fun
fetchFavorites
()
=
contract
.
getFavorites
()
fun
getEstate
(
estateId
:
Int
)
=
contract
.
getEstate
(
estateId
)
fun
getEstate
(
estateId
:
Int
)
=
contract
.
getEstate
(
estateId
)
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/estate/ScreenController.kt
View file @
d5e2c26e
package
com.biganto.visual.roompark.presentation.screen.estate
import
android.os.Bundle
import
android.view.View
import
androidx.
recyclerview.widget.RecyclerView
import
androidx.
core.os.bundleOf
import
butterknife.BindView
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.base.RoomParkApplication
...
...
@@ -22,9 +23,14 @@ const val SELECTED_ESTATE_ID_KEY = "SELECTED_ESTATE_INDEX"
class
EstateScreenController
:
BigantoBaseController
<
EstateScreenViewState
,
EstateScreen
,
EstateScreenPresenter
>
()
,
EstateScreenPresenter
>
,
EstateScreen
{
constructor
(
args
:
Bundle
):
super
(
args
)
constructor
(
id
:
Int
)
:
super
(
bundleOf
(
SELECTED_ESTATE_ID_KEY
to
id
))
override
fun
injectDependencies
()
{
getComponent
()
}
...
...
@@ -32,9 +38,6 @@ class EstateScreenController :
@Inject
override
lateinit
var
injectedPresenter
:
EstateScreenPresenter
@BindView
(
R
.
id
.
favorites_cards_recycler_view
)
lateinit
var
favoritesRecyclerView
:
RecyclerView
@BindView
(
R
.
id
.
planTypesTabs
)
lateinit
var
planTypesTabLayout
:
TabLayout
...
...
@@ -46,7 +49,6 @@ class EstateScreenController :
toolBar
.
appBar
.
liftOnScrollTargetViewId
=
R
.
id
.
favorites_cards_recycler_view
toolBar
.
appBar
.
setLiftable
(
true
)
toolBar
.
appBarScrollable
(
false
)
favoritesRecyclerView
.
isNestedScrollingEnabled
=
false
// planTypesTabLayout.
}
...
...
@@ -95,7 +97,8 @@ class EstateScreenController :
}
private
fun
getComponent
()
=
DaggerEstateScreenComponent
.
factory
()
.
create
(
RoomParkApplication
.
component
,
activity
as
RoomParkMainActivity
)
.
create
(
RoomParkApplication
.
component
,
activity
as
RoomParkMainActivity
,
args
.
getInt
(
SELECTED_ESTATE_ID_KEY
))
.
inject
(
this
)
override
fun
getLayoutId
():
Int
=
R
.
layout
.
flat_full_card_screen
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/favorites/ScreenController.kt
View file @
d5e2c26e
...
...
@@ -8,8 +8,11 @@ import com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.base.RoomParkApplication
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.conductor.BigantoBaseController
import
com.biganto.visual.roompark.presentation.screen.estate.EstateScreenController
import
com.biganto.visual.roompark.presentation.screen.favorites.util.FavoritesListAdapter
import
com.biganto.visual.roompark.util.view_utils.grid.CeilsDecoration
import
com.bluelinelabs.conductor.RouterTransaction
import
io.reactivex.android.schedulers.AndroidSchedulers
import
timber.log.Timber
import
javax.inject.Inject
...
...
@@ -34,6 +37,7 @@ class FavoritesScreenController :
lateinit
var
favoritesRecyclerView
:
RecyclerView
private
fun
setToolbar
(){
toolBar
.
showAll
()
toolBar
.
appBar
.
setExpanded
(
false
,
false
)
...
...
@@ -62,6 +66,15 @@ class FavoritesScreenController :
override
fun
onViewBound
(
v
:
View
)
{
setToolbar
()
bindRecycler
()
detachDisposable
.
addAll
(
(
favoritesRecyclerView
.
adapter
as
FavoritesListAdapter
)
.
onItemClicked
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
{
Timber
.
d
(
"got card clicked $it"
)
router
.
pushController
(
RouterTransaction
.
with
(
EstateScreenController
(
it
.
id
)))
}
)
}
override
fun
render
(
viewState
:
FavoritesScreenViewState
)
{
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/favorites/util/FavoritesAdapter.kt
View file @
d5e2c26e
package
com.biganto.visual.roompark.presentation.screen.favorites.util
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.CommonInfoModel
import
com.biganto.visual.roompark.domain.model.EstateModel
import
com.biganto.visual.roompark.presentation.screen.settings.util.CommonRecyclerAdapter
import
com.biganto.visual.roompark.presentation.screen.settings.util.CommonViewHolder
/**
* Created by Vladislav Bogdashkin on 16.10.2019.
*/
class
FavoritesListAdapter
:
RecyclerView
.
Adapter
<
FavoriteViewHolder
>()
{
private
var
list
:
MutableList
<
EstateModel
>
=
mutableListOf
()
fun
addItems
(
list
:
List
<
EstateModel
>){
this
.
list
.
clear
()
this
.
list
.
addAll
(
list
)
notifyDataSetChanged
()
}
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
FavoriteViewHolder
=
FavoriteViewHolder
(
LayoutInflater
.
from
(
parent
.
context
)
.
inflate
(
R
.
layout
.
favorite_card_viewholder
,
parent
,
false
)
)
override
fun
getItemCount
():
Int
=
list
.
size
override
fun
onBindViewHolder
(
holder
:
FavoriteViewHolder
,
position
:
Int
)
{
holder
.
bindModel
(
list
[
position
])
}
class
FavoritesListAdapter
:
CommonRecyclerAdapter
<
FavoriteViewHolder
,
EstateModel
>()
{
override
val
vhKlazz
=
FavoriteViewHolder
::
class
override
fun
getVhLayout
():
Int
=
R
.
layout
.
favorite_card_viewholder
}
class
FavoriteViewHolder
(
itemView
:
View
)
:
RecyclerView
.
ViewHolder
(
itemView
)
{
class
FavoriteViewHolder
(
itemView
:
View
)
:
CommonViewHolder
<
EstateModel
>
(
itemView
)
{
@BindView
(
R
.
id
.
object_card_title
)
lateinit
var
estateTitle
:
TextView
@BindView
(
R
.
id
.
common_info_block
)
lateinit
var
commonInfo
:
View
...
...
@@ -65,7 +46,7 @@ class FavoriteViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
ButterKnife
.
bind
(
this
,
itemView
)
}
fun
bindModel
(
model
:
EstateModel
)
{
override
fun
onViewBound
(
model
:
EstateModel
)
{
val
fullObjName
=
"${typeName(model.type)}\n${model.number}"
estateTitle
.
text
=
fullObjName
if
(
model
.
commonInfo
==
null
)
commonInfo
.
visibility
=
View
.
GONE
...
...
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