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
...
@@ -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.EstateModel
import
com.biganto.visual.roompark.domain.model.fromEntity
import
com.biganto.visual.roompark.domain.model.fromEntity
import
io.reactivex.Observable
import
io.reactivex.Observable
import
io.reactivex.schedulers.Schedulers
import
timber.log.Timber
import
timber.log.Timber
import
javax.inject.Inject
import
javax.inject.Inject
...
@@ -26,6 +27,8 @@ class EstateRepository @Inject constructor(
...
@@ -26,6 +27,8 @@ class EstateRepository @Inject constructor(
private
val
api
:
IRoomParkApi
,
private
val
api
:
IRoomParkApi
,
private
val
db
:
IDb
private
val
db
:
IDb
):
DealContract
{
):
DealContract
{
init
{
init
{
Timber
.
d
(
"Estate Repository Created"
)
Timber
.
d
(
"Estate Repository Created"
)
}
}
...
@@ -76,11 +79,32 @@ class EstateRepository @Inject constructor(
...
@@ -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
>
{
override
fun
getEstate
(
estateId
:
Int
):
Observable
<
EstateModel
>
{
return
fetchEstateDb
(
estateId
).
map
(
::
fromEntity
)
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 {
...
@@ -65,9 +65,6 @@ interface Estate : Persistable {
@get
:
Nullable
@get
:
Nullable
val
info_direction
:
String
?
val
info_direction
:
String
?
@get
:
OneToMany
(
mappedBy
=
"id"
,
cascade
=
[
CascadeAction
.
SAVE
,
CascadeAction
.
DELETE
])
val
planPreset
:
MutableList
<
PlanPreset
>
val
favorite
:
Boolean
val
favorite
:
Boolean
@get
:
Nullable
@get
:
Nullable
...
...
app/src/main/java/com/biganto/visual/roompark/domain/contract/DealContract.kt
View file @
d5e2c26e
package
com.biganto.visual.roompark.domain.contract
package
com.biganto.visual.roompark.domain.contract
import
com.biganto.visual.roompark.domain.model.EstateModel
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.
* Created by Vladislav Bogdashkin on 24.09.2019.
...
@@ -10,6 +11,7 @@ import io.reactivex.rxjava3.core.Observable
...
@@ -10,6 +11,7 @@ import io.reactivex.rxjava3.core.Observable
interface
DealContract
{
interface
DealContract
{
fun
getFavorites
()
:
io
.
reactivex
.
Observable
<
List
<
EstateModel
>>
fun
getFavorites
()
:
Observable
<
List
<
EstateModel
>>
fun
getEstate
(
estateId
:
Int
):
io
.
reactivex
.
Observable
<
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(
...
@@ -13,4 +13,6 @@ class EstateInteractor @Inject constructor(
fun
getEstate
(
estateId
:
Int
)
=
useCase
.
getEstate
(
estateId
)
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
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.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.
* Created by Vladislav Bogdashkin on 23.09.2019.
...
@@ -105,16 +107,31 @@ data class CommonInfoModel(
...
@@ -105,16 +107,31 @@ data class CommonInfoModel(
val
rooms
:
Int
?
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
planId
:
Int
,
val
items
:
List
<
ExplicationModel
>
val
explication
:
List
<
ExplicationModel
>,
var
estateId
:
Int
,
val
title
:
String
,
val
features
:
List
<
String
>
)
)
data class
ExplicationModel
(
data class
ExplicationModel
(
val
living
:
Boolean
,
val
living
:
Boolean
,
val
area
:
Float
,
val
area
:
Float
,
val
title
:
String
val
title
:
String
)
){
constructor
(
entity
:
ExplicationEntity
):
this
(
entity
.
living
,
entity
.
area
,
entity
.
title
)
}
/*
/*
data class CommonEstateInfoModel(
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(
...
@@ -13,6 +13,6 @@ class EstateUseCase @Inject constructor(
fun
fetchFavorites
()
=
contract
.
getFavorites
()
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
package
com.biganto.visual.roompark.presentation.screen.estate
import
android.os.Bundle
import
android.view.View
import
android.view.View
import
androidx.
recyclerview.widget.RecyclerView
import
androidx.
core.os.bundleOf
import
butterknife.BindView
import
butterknife.BindView
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.base.RoomParkApplication
import
com.biganto.visual.roompark.base.RoomParkApplication
...
@@ -22,9 +23,14 @@ const val SELECTED_ESTATE_ID_KEY = "SELECTED_ESTATE_INDEX"
...
@@ -22,9 +23,14 @@ const val SELECTED_ESTATE_ID_KEY = "SELECTED_ESTATE_INDEX"
class
EstateScreenController
:
class
EstateScreenController
:
BigantoBaseController
<
EstateScreenViewState
BigantoBaseController
<
EstateScreenViewState
,
EstateScreen
,
EstateScreen
,
EstateScreenPresenter
>
()
,
EstateScreenPresenter
>
,
EstateScreen
{
,
EstateScreen
{
constructor
(
args
:
Bundle
):
super
(
args
)
constructor
(
id
:
Int
)
:
super
(
bundleOf
(
SELECTED_ESTATE_ID_KEY
to
id
))
override
fun
injectDependencies
()
{
override
fun
injectDependencies
()
{
getComponent
()
getComponent
()
}
}
...
@@ -32,9 +38,6 @@ class EstateScreenController :
...
@@ -32,9 +38,6 @@ class EstateScreenController :
@Inject
@Inject
override
lateinit
var
injectedPresenter
:
EstateScreenPresenter
override
lateinit
var
injectedPresenter
:
EstateScreenPresenter
@BindView
(
R
.
id
.
favorites_cards_recycler_view
)
lateinit
var
favoritesRecyclerView
:
RecyclerView
@BindView
(
R
.
id
.
planTypesTabs
)
@BindView
(
R
.
id
.
planTypesTabs
)
lateinit
var
planTypesTabLayout
:
TabLayout
lateinit
var
planTypesTabLayout
:
TabLayout
...
@@ -46,7 +49,6 @@ class EstateScreenController :
...
@@ -46,7 +49,6 @@ class EstateScreenController :
toolBar
.
appBar
.
liftOnScrollTargetViewId
=
R
.
id
.
favorites_cards_recycler_view
toolBar
.
appBar
.
liftOnScrollTargetViewId
=
R
.
id
.
favorites_cards_recycler_view
toolBar
.
appBar
.
setLiftable
(
true
)
toolBar
.
appBar
.
setLiftable
(
true
)
toolBar
.
appBarScrollable
(
false
)
toolBar
.
appBarScrollable
(
false
)
favoritesRecyclerView
.
isNestedScrollingEnabled
=
false
// planTypesTabLayout.
// planTypesTabLayout.
}
}
...
@@ -95,7 +97,8 @@ class EstateScreenController :
...
@@ -95,7 +97,8 @@ class EstateScreenController :
}
}
private
fun
getComponent
()
=
DaggerEstateScreenComponent
.
factory
()
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
)
.
inject
(
this
)
override
fun
getLayoutId
():
Int
=
R
.
layout
.
flat_full_card_screen
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
...
@@ -8,8 +8,11 @@ import com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.base.RoomParkApplication
import
com.biganto.visual.roompark.base.RoomParkApplication
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.conductor.BigantoBaseController
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.presentation.screen.favorites.util.FavoritesListAdapter
import
com.biganto.visual.roompark.util.view_utils.grid.CeilsDecoration
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
timber.log.Timber
import
javax.inject.Inject
import
javax.inject.Inject
...
@@ -34,6 +37,7 @@ class FavoritesScreenController :
...
@@ -34,6 +37,7 @@ class FavoritesScreenController :
lateinit
var
favoritesRecyclerView
:
RecyclerView
lateinit
var
favoritesRecyclerView
:
RecyclerView
private
fun
setToolbar
(){
private
fun
setToolbar
(){
toolBar
.
showAll
()
toolBar
.
showAll
()
toolBar
.
appBar
.
setExpanded
(
false
,
false
)
toolBar
.
appBar
.
setExpanded
(
false
,
false
)
...
@@ -62,6 +66,15 @@ class FavoritesScreenController :
...
@@ -62,6 +66,15 @@ class FavoritesScreenController :
override
fun
onViewBound
(
v
:
View
)
{
override
fun
onViewBound
(
v
:
View
)
{
setToolbar
()
setToolbar
()
bindRecycler
()
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
)
{
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
package
com.biganto.visual.roompark.presentation.screen.favorites.util
import
android.view.LayoutInflater
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.widget.TextView
import
android.widget.TextView
import
androidx.recyclerview.widget.RecyclerView
import
butterknife.BindView
import
butterknife.BindView
import
butterknife.ButterKnife
import
butterknife.ButterKnife
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.domain.model.CommonInfoModel
import
com.biganto.visual.roompark.domain.model.CommonInfoModel
import
com.biganto.visual.roompark.domain.model.EstateModel
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.
* Created by Vladislav Bogdashkin on 16.10.2019.
*/
*/
class
FavoritesListAdapter
:
RecyclerView
.
Adapter
<
FavoriteViewHolder
>()
{
class
FavoritesListAdapter
:
CommonRecyclerAdapter
<
FavoriteViewHolder
,
EstateModel
>()
{
override
val
vhKlazz
=
FavoriteViewHolder
::
class
private
var
list
:
MutableList
<
EstateModel
>
=
mutableListOf
()
override
fun
getVhLayout
():
Int
=
R
.
layout
.
favorite_card_viewholder
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
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
.
object_card_title
)
lateinit
var
estateTitle
:
TextView
@BindView
(
R
.
id
.
common_info_block
)
lateinit
var
commonInfo
:
View
@BindView
(
R
.
id
.
common_info_block
)
lateinit
var
commonInfo
:
View
...
@@ -65,7 +46,7 @@ class FavoriteViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
...
@@ -65,7 +46,7 @@ class FavoriteViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
ButterKnife
.
bind
(
this
,
itemView
)
ButterKnife
.
bind
(
this
,
itemView
)
}
}
fun
bindModel
(
model
:
EstateModel
)
{
override
fun
onViewBound
(
model
:
EstateModel
)
{
val
fullObjName
=
"${typeName(model.type)}\n${model.number}"
val
fullObjName
=
"${typeName(model.type)}\n${model.number}"
estateTitle
.
text
=
fullObjName
estateTitle
.
text
=
fullObjName
if
(
model
.
commonInfo
==
null
)
commonInfo
.
visibility
=
View
.
GONE
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