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
75525e6a
Commit
75525e6a
authored
Dec 27, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Plain Diff
merge explication
parents
150c032a
3d3e623a
Changes
21
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
511 additions
and
271 deletions
+511
-271
EstateRepository.kt
...to/visual/roompark/data/data_provider/EstateRepository.kt
+79
-0
UserHolder.kt
...java/com/biganto/visual/roompark/data/local/UserHolder.kt
+1
-0
response.kt
...ual/roompark/data/repository/api/retrofit/raw/response.kt
+4
-5
IDb.kt
...ava/com/biganto/visual/roompark/data/repository/db/IDb.kt
+2
-0
RequeryRepository.kt
.../roompark/data/repository/db/requrey/RequeryRepository.kt
+10
-2
Deal.kt
.../visual/roompark/data/repository/db/requrey/model/Deal.kt
+5
-0
Estate.kt
...isual/roompark/data/repository/db/requrey/model/Estate.kt
+21
-2
Explication.kt
.../roompark/data/repository/db/requrey/model/Explication.kt
+4
-4
PlanPreset.kt
...l/roompark/data/repository/db/requrey/model/PlanPreset.kt
+2
-0
raw2entity.kt
...anto/visual/roompark/data/repository/mapper/raw2entity.kt
+57
-0
AppComponent.kt
...ava/com/biganto/visual/roompark/di/dagger/AppComponent.kt
+3
-0
ContextModule.kt
...va/com/biganto/visual/roompark/di/dagger/ContextModule.kt
+1
-1
DataModule.kt
.../java/com/biganto/visual/roompark/di/dagger/DataModule.kt
+5
-0
DealContract.kt
...m/biganto/visual/roompark/domain/contract/DealContract.kt
+1
-1
deals.kt
...va/com/biganto/visual/roompark/domain/interactor/deals.kt
+139
-139
favorites.kt
...om/biganto/visual/roompark/domain/interactor/favorites.kt
+109
-106
deals.kt
...in/java/com/biganto/visual/roompark/domain/model/deals.kt
+41
-4
estateUseCase.kt
.../biganto/visual/roompark/domain/use_case/estateUseCase.kt
+16
-0
ScreenController.kt
.../roompark/presentation/screen/article/ScreenController.kt
+2
-1
ArticlesPreviewAdapter.kt
...presentation/screen/feeds/utils/ArticlesPreviewAdapter.kt
+2
-5
ext.kt
...n/java/com/biganto/visual/roompark/util/extensions/ext.kt
+7
-1
No files found.
app/src/main/java/com/biganto/visual/roompark/data/data_provider/EstateRepository.kt
0 → 100644
View file @
75525e6a
package
com.biganto.visual.roompark.data.data_provider
import
com.biganto.visual.androidplayer.data.repository.local.ILocalStore
import
com.biganto.visual.roompark.data.local.UserState
import
com.biganto.visual.roompark.data.repository.api.IRoomParkApi
import
com.biganto.visual.roompark.data.repository.db.IDb
import
com.biganto.visual.roompark.data.repository.db.requrey.model.EstateEntity
import
com.biganto.visual.roompark.data.repository.mapper.fromRaw
import
com.biganto.visual.roompark.data.repository.mapper.fromRawList
import
com.biganto.visual.roompark.domain.contract.DealContract
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
timber.log.Timber
import
javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 29.10.2019.
*/
//
class
EstateRepository
@Inject
constructor
(
private
val
local
:
ILocalStore
,
private
val
api
:
IRoomParkApi
,
private
val
db
:
IDb
):
DealContract
{
init
{
Timber
.
d
(
"Estate Repository Created"
)
}
private
val
getFavoritesApi
:
Observable
<
List
<
EstateEntity
>>
=
local
.
recentUser
()
.
flatMap
{
when
(
it
)
{
is
UserState
.
Authenticated
->
db
.
fetchUser
(
it
.
uuid
.
toInt
())
else
->
throw
CustomApiException
.
NotAuthorizedException
()
}
}
.
flatMap
{
user
->
api
.
getFavorites
(
user
.
authToken
)
.
doOnError
(
Timber
::
e
)
.
map
{
fromRawList
(
it
,
::
fromRaw
)
}
.
doOnNext
{
it
.
forEach
{
estate
->
estate
.
setFavorite
(
true
)
estate
.
user
=
user
}
}
.
doOnNext
(
db
::
blockingUpsert
)
}
private
val
getFavoritesDb
:
Observable
<
List
<
EstateEntity
>>
=
local
.
recentUser
()
.
flatMap
{
when
(
it
)
{
is
UserState
.
Authenticated
->
db
.
fetchUser
(
it
.
uuid
.
toInt
()).
take
(
1
)
else
->
throw
CustomApiException
.
NotAuthorizedException
()
}
}
.
flatMap
{
db
.
getUserFavorites
(
it
.
uuid
)
.
doOnError
(
Timber
::
e
)
.
toList
().
toObservable
()
}
override
fun
getFavorites
():
Observable
<
List
<
EstateModel
>>
{
return
Observable
.
mergeDelayError
(
arrayListOf
(
getFavoritesApi
,
getFavoritesDb
)
).
map
{
fromEntity
(
it
,
::
fromEntity
)
}
.
doOnError
(
Timber
::
e
)
}
}
app/src/main/java/com/biganto/visual/roompark/data/local/UserHolder.kt
View file @
75525e6a
...
...
@@ -62,6 +62,7 @@ class UserHolder @Inject constructor(val context : Application) : ILocalStore
.
observe
()
.
map
{
Timber
.
d
(
" AUTH VALUE: $it"
)
Timber
.
d
(
" EMPTY_PREF_VALUE_KEY: $EMPTY_PREF_VALUE_KEY"
)
if
(
it
==
EMPTY_PREF_VALUE_KEY
)
return
@map
UserState
.
NotAuthenticated
()
else
return
@map
UserState
.
Authenticated
(
it
)
}
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/api/retrofit/raw/response.kt
View file @
75525e6a
...
...
@@ -35,8 +35,7 @@ data class EstateRaw(
val
plan_jpg
:
PlanRaw
?,
val
url
:
String
,
val
album_id
:
Int
,
val
multitour_id
:
Int
?,
val
explications
:
List
<
ExplicationRaw
>?
val
multitour_id
:
Int
?
)
data class
PlanRaw
(
...
...
@@ -48,6 +47,7 @@ data class PlanRaw(
data class
CommonInfoRaw
(
val
building
:
Int
,
val
section_begin
:
Int
,
val
section_end
:
Int
?,
val
floor
:
Int
,
val
floor_max
:
Int
,
val
area
:
Float
?,
...
...
@@ -65,8 +65,6 @@ data class CommonInfoRaw(
val
rooms
:
Int
?
)
data class
ExplicationRaw
(
val
plan_id
:
Int
,
val
items
:
List
<
EstateRoomRaw
>)
data class
EstateRoomRaw
(
val
title
:
String
,
val
living
:
Boolean
,
...
...
@@ -138,7 +136,8 @@ data class ResolutionRaw(
data class
PlanTypeRaw
(
val
plan_id
:
Int
,
val
title
:
String
,
val
features
:
List
<
String
>
val
features
:
List
<
String
>,
val
explication
:
List
<
EstateRoomRaw
>?
)
data class
MultiTourRaw
(
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/db/IDb.kt
View file @
75525e6a
...
...
@@ -26,4 +26,6 @@ interface IDb {
fun
getPhotos
(
albumId
:
Int
):
Observable
<
GalleryPhotoEntity
>
fun
getPhoto
(
photoId
:
Int
):
Observable
<
GalleryPhotoEntity
>
fun
getAlbum
(
albumId
:
Int
):
Observable
<
ImageAlbumEntity
>
fun
getUserFavorites
(
uuid
:
Int
):
Observable
<
EstateEntity
>
fun
fetchAllUsers
():
Observable
<
List
<
UserEntity
>>
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/RequeryRepository.kt
View file @
75525e6a
...
...
@@ -33,7 +33,6 @@ class DbModule{
// source.setLoggingEnabled(true)
// source.setWriteAheadLoggingEnabled(true)
source
.
setTableCreationMode
(
TableCreationMode
.
DROP_CREATE
)
val
store
=
KotlinEntityDataStore
<
Persistable
>(
source
.
configuration
)
Timber
.
d
(
"Kotlin store %s"
,
source
)
return
KotlinReactiveEntityStore
(
store
)
...
...
@@ -123,8 +122,12 @@ class RequeryRepository @Inject constructor(
.
firstOrNull
()
override
fun
fetchUser
(
uuid
:
Int
):
Observable
<
UserEntity
>
=
fetchAll
<
UserEntity
>().
where
(
UserEntity
.
UUID
.
eq
(
uuid
)).
get
().
observable
()
store
.
select
(
UserEntity
::
class
).
where
(
UserEntity
.
UUID
.
eq
(
uuid
)).
get
().
observable
()
// fetchAll<UserEntity>().where(UserEntity.UUID.eq(uuid)).get().observable()
override
fun
fetchAllUsers
():
Observable
<
List
<
UserEntity
>>
=
store
.
select
(
UserEntity
::
class
).
get
().
observable
().
toList
().
toObservable
()
fun
upsertFeeds
(
entity
:
List
<
FeedEntity
>)
=
store
.
upsert
(
entity
)
...
...
@@ -134,4 +137,9 @@ class RequeryRepository @Inject constructor(
.
where
(
UserEntity
.
UUID
.
eq
(
uuid
))
.
get
()
.
observableResult
()
override
fun
getUserFavorites
(
uuid
:
Int
):
Observable
<
EstateEntity
>
=
store
.
select
(
EstateEntity
::
class
)
.
where
(
EstateEntity
.
USER_ID
.
eq
(
uuid
))
.
get
().
observable
()
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/model/Deal.kt
View file @
75525e6a
...
...
@@ -20,4 +20,9 @@ interface Deal : Persistable {
@get
:
ForeignKey
(
references
=
Estate
::
class
)
@get
:
OneToOne
(
cascade
=
[
CascadeAction
.
NONE
])
var
estate
:
Estate
@get
:
Nullable
@get
:
Column
(
name
=
"UserContainer"
)
@get
:
ForeignKey
(
references
=
User
::
class
)
@get
:
OneToOne
(
mappedBy
=
"uuid"
,
cascade
=
[
CascadeAction
.
NONE
])
var
user
:
User
?
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/model/Estate.kt
View file @
75525e6a
...
...
@@ -41,8 +41,6 @@ interface Estate : Persistable {
val
info_building
:
Int
val
info_section_begin
:
Int
val
info_floor
:
Int
@get
:
OneToMany
(
mappedBy
=
"id"
)
val
explications
:
Set
<
Explication
>?
val
info_floor_max
:
Int
@get
:
Nullable
val
url
:
String
?
...
...
@@ -56,4 +54,25 @@ interface Estate : Persistable {
val
info_dependent
:
Boolean
?
@get
:
Nullable
val
info_decoration
:
String
?
@get
:
Nullable
val
info_window_face
:
String
?
@get
:
Nullable
val
info_price
:
Int
?
@get
:
Nullable
val
info_price_meter
:
Int
?
@get
:
Nullable
val
info_ceiling
:
Float
?
@get
:
Nullable
val
info_direction
:
String
?
@get
:
OneToMany
(
mappedBy
=
"id"
,
cascade
=
[
CascadeAction
.
SAVE
,
CascadeAction
.
DELETE
])
val
planPreset
:
MutableList
<
PlanPreset
>
val
favorite
:
Boolean
@get
:
Nullable
@get
:
Column
(
name
=
"UserContainer"
)
@get
:
ForeignKey
(
references
=
User
::
class
)
@get
:
OneToOne
(
mappedBy
=
"uuid"
,
cascade
=
[
CascadeAction
.
NONE
])
var
user
:
User
?
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/model/Explication.kt
View file @
75525e6a
package
com.biganto.visual.roompark.data.repository.db.requrey.model
import
io.requery.*
import
io.requery.Entity
import
io.requery.Generated
import
io.requery.Key
import
io.requery.Persistable
/**
* Created by Vladislav Bogdashkin on 24.09.2019.
...
...
@@ -11,9 +14,6 @@ interface Explication : Persistable {
@get
:
Key
@get
:
Generated
val
id
:
Int
@get
:
ForeignKey
(
references
=
PlanPreset
::
class
)
@get
:
ManyToOne
val
planId
:
Int
val
living
:
Boolean
val
area
:
Float
val
title
:
String
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/model/PlanPreset.kt
View file @
75525e6a
...
...
@@ -20,4 +20,6 @@ interface PlanPreset : Persistable {
val
title
:
String
@get
:
Convert
(
StringListConverter
::
class
)
val
features
:
List
<
String
>
@get
:
OneToMany
(
mappedBy
=
"id"
,
cascade
=
[
CascadeAction
.
SAVE
,
CascadeAction
.
DELETE
])
val
explication
:
MutableList
<
Explication
>
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/data/repository/mapper/raw2entity.kt
View file @
75525e6a
...
...
@@ -93,6 +93,63 @@ fun fromRaw(raw:ResolutionRaw) =
fun
fromRaw
(
raw
:
EstateRaw
):
EstateEntity
{
val
entity
=
EstateEntity
()
entity
.
setId
(
raw
.
id
)
entity
.
setType
(
raw
.
type
)
entity
.
setNumber
(
raw
.
number
)
entity
.
setSectionBegin
(
raw
.
common_info
.
section_begin
)
entity
.
setSectionEnd
(
raw
.
common_info
.
section_end
)
entity
.
setPlanJpgUrl
(
raw
.
plan_jpg
?.
url
)
entity
.
setPlanJpgWidth
(
raw
.
plan_jpg
?.
width
)
entity
.
setPlanJpgHeight
(
raw
.
plan_jpg
?.
height
)
entity
.
setPlanPngUrl
(
raw
.
plan_png
?.
url
)
entity
.
setPlanPngWidth
(
raw
.
plan_png
?.
width
)
entity
.
setPlanPngHeight
(
raw
.
plan_png
?.
height
)
entity
.
setRooms
(
raw
.
common_info
.
rooms
)
entity
.
setAlbumId
(
raw
.
album_id
)
entity
.
setMultitourId
(
raw
.
multitour_id
)
entity
.
setUrl
(
raw
.
url
)
entity
.
setInfo_floor_max
(
raw
.
common_info
.
floor_max
)
entity
.
setInfo_area
(
raw
.
common_info
.
area
)
entity
.
setInfo_area_living
(
raw
.
common_info
.
area_living
)
entity
.
setInfo_kind
(
raw
.
common_info
.
kind
)
entity
.
setInfo_dependent
(
raw
.
common_info
.
dependent
)
entity
.
setInfo_decoration
(
raw
.
common_info
.
decoration
)
entity
.
setInfo_building
(
raw
.
common_info
.
building
)
entity
.
setInfo_section_begin
(
raw
.
common_info
.
section_begin
)
entity
.
setInfo_floor
(
raw
.
common_info
.
floor
)
entity
.
setInfo_window_face
(
raw
.
common_info
.
windows_face
)
entity
.
setInfo_price
(
raw
.
common_info
.
price
)
entity
.
setInfo_price_meter
(
raw
.
common_info
.
price_meter
)
entity
.
setInfo_ceiling
(
raw
.
common_info
.
ceiling
)
entity
.
setInfo_direction
(
raw
.
common_info
.
direction
)
entity
.
setFavorite
(
false
)
return
entity
}
fun
fromRaw
(
raw
:
PlanTypeRaw
):
PlanPresetEntity
{
val
entity
=
PlanPresetEntity
()
entity
.
setFeatures
(
raw
.
features
)
entity
.
setPlanId
(
raw
.
plan_id
)
entity
.
setTitle
(
raw
.
title
)
entity
.
explication
.
clear
()
entity
.
explication
.
addAll
(
fromRawList
(
raw
.
explication
!!
,
::
fromRaw
))
return
entity
}
fun
fromRaw
(
raw
:
EstateRoomRaw
):
ExplicationEntity
{
val
entity
=
ExplicationEntity
()
entity
.
setArea
(
raw
.
area
)
entity
.
setLiving
(
raw
.
living
)
entity
.
setTitle
(
raw
.
title
)
return
entity
}
//fun fromRaw(raw: List<FeedRaw>):List<FeedEntity> = List(raw.displaySize) { index-> fromRaw(raw[index]) }
...
...
app/src/main/java/com/biganto/visual/roompark/di/dagger/AppComponent.kt
View file @
75525e6a
...
...
@@ -9,6 +9,7 @@ import com.biganto.visual.roompark.data.repository.api.retrofit.di.RetrofitModul
import
com.biganto.visual.roompark.data.repository.db.IDb
import
com.biganto.visual.roompark.data.repository.db.requrey.DbModule
import
com.biganto.visual.roompark.domain.contract.AuthContract
import
com.biganto.visual.roompark.domain.contract.DealContract
import
com.biganto.visual.roompark.domain.contract.DevProgressContract
import
com.biganto.visual.roompark.domain.contract.FeedsContract
import
com.squareup.picasso.Picasso
...
...
@@ -51,6 +52,8 @@ interface AppComponent : AndroidInjector<RoomParkApplication>{
fun
feedsAlb
():
DevProgressContract
fun
estateRep
():
DealContract
fun
provideLocal
():
ILocalStore
...
...
app/src/main/java/com/biganto/visual/roompark/di/dagger/ContextModule.kt
View file @
75525e6a
...
...
@@ -21,7 +21,7 @@ const val ESTATES_CACHE_LIMIT_SECONDS_INACTIVE = 200L
const
val
FILES_CACHE_LIMIT_SIZE
=
10000
const
val
FILES_CACHE_LIMIT_SECONDS_INACTIVE
=
60L
const
val
DATABASE_VERSION
=
8
const
val
DATABASE_VERSION
=
9
@Module
abstract
class
AppModule
{
...
...
app/src/main/java/com/biganto/visual/roompark/di/dagger/DataModule.kt
View file @
75525e6a
...
...
@@ -2,6 +2,7 @@ package com.biganto.visual.roompark.di.dagger
import
com.biganto.visual.roompark.data.data_provider.AlbumsContractModule
import
com.biganto.visual.roompark.data.data_provider.AuthContractModule
import
com.biganto.visual.roompark.data.data_provider.EstateRepository
import
com.biganto.visual.roompark.data.data_provider.FeedsContractModule
import
com.biganto.visual.roompark.data.local.LocalStorage
import
com.biganto.visual.roompark.data.repository.api.IRoomParkApi
...
...
@@ -11,6 +12,7 @@ import com.biganto.visual.roompark.data.repository.db.IDb
import
com.biganto.visual.roompark.data.repository.db.requrey.DbModule
import
com.biganto.visual.roompark.data.repository.db.requrey.RequeryRepository
import
com.biganto.visual.roompark.domain.contract.AuthContract
import
com.biganto.visual.roompark.domain.contract.DealContract
import
com.biganto.visual.roompark.domain.contract.DevProgressContract
import
com.biganto.visual.roompark.domain.contract.FeedsContract
import
dagger.Binds
...
...
@@ -34,6 +36,9 @@ abstract class ContractRepositoryModule {
@Binds
abstract
fun
provideDevProgressContract
(
impl
:
AlbumsContractModule
):
DevProgressContract
@Binds
abstract
fun
provideEstateContract
(
impl
:
EstateRepository
):
DealContract
}
...
...
app/src/main/java/com/biganto/visual/roompark/domain/contract/DealContract.kt
View file @
75525e6a
...
...
@@ -10,5 +10,5 @@ import io.reactivex.rxjava3.core.Observable
interface
DealContract
{
fun
getFavorites
()
:
Observable
<
List
<
EstateModel
>>
fun
getFavorites
()
:
io
.
reactivex
.
Observable
<
List
<
EstateModel
>>
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/domain/interactor/deals.kt
View file @
75525e6a
This diff is collapsed.
Click to expand it.
app/src/main/java/com/biganto/visual/roompark/domain/interactor/favorites.kt
View file @
75525e6a
This diff is collapsed.
Click to expand it.
app/src/main/java/com/biganto/visual/roompark/domain/model/deals.kt
View file @
75525e6a
package
com.biganto.visual.roompark.domain.model
import
com.biganto.visual.roompark.data.repository.db.requrey.model.EstateEntity
/**
* Created by Vladislav Bogdashkin on 23.09.2019.
*/
...
...
@@ -37,10 +39,45 @@ data class EstateModel(
val
albumId
:
Int
?=
null
,
val
multitourId
:
Int
?=
null
,
val
commonInfo
:
CommonInfoModel
?
=
null
,
val
explications
:
List
<
ExplicationListModel
>?
=
null
,
val
url
:
String
?
)
fun
fromEntity
(
entity
:
EstateEntity
):
EstateModel
{
val
model
=
EstateModel
(
id
=
entity
.
id
,
type
=
entity
.
type
,
number
=
entity
.
number
,
sectionBegin
=
entity
.
sectionBegin
,
sectionEnd
=
entity
.
sectionEnd
,
planPNG
=
null
,
planJPG
=
null
,
rooms
=
entity
.
rooms
,
albumId
=
entity
.
albumId
,
multitourId
=
entity
.
multitourId
,
commonInfo
=
CommonInfoModel
(
building
=
entity
.
info_building
,
section_begin
=
entity
.
sectionBegin
,
floor
=
entity
.
info_floor
,
floor_max
=
entity
.
info_floor_max
,
area
=
entity
.
info_area
,
area_living
=
entity
.
info_area_living
,
kind
=
entity
.
info_kind
,
dependent
=
entity
.
info_dependent
,
decoration
=
entity
.
info_decoration
,
ceiling
=
entity
.
info_ceiling
,
windows_face
=
entity
.
info_window_face
,
direction
=
entity
.
info_direction
,
price_meter
=
entity
.
info_price_meter
,
price
=
entity
.
info_price
,
// discount = entity.di
// discount_amount = entity
rooms
=
entity
.
rooms
),
url
=
entity
.
url
)
return
model
}
data class
PlanModel
(
val
url
:
String
,
val
width
:
Int
,
...
...
@@ -50,7 +87,7 @@ data class PlanModel(
data class
CommonInfoModel
(
val
building
:
Int
,
val
section_begin
:
Int
,
val
section_begin
:
Int
?
,
val
floor
:
Int
,
val
floor_max
:
Int
,
val
area
:
Float
?,
...
...
@@ -63,8 +100,8 @@ data class CommonInfoModel(
val
direction
:
String
?,
val
price_meter
:
Int
?,
val
price
:
Int
?,
val
discount
:
Float
?,
val
discount_amount
:
Int
?,
val
discount
:
Float
?
=
null
,
val
discount_amount
:
Int
?
=
null
,
val
rooms
:
Int
?
)
...
...
app/src/main/java/com/biganto/visual/roompark/domain/use_case/estateUseCase.kt
0 → 100644
View file @
75525e6a
package
com.biganto.visual.roompark.domain.use_case
import
com.biganto.visual.roompark.domain.contract.DealContract
import
javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 24.09.2019.
*/
class
EstateUseCase
@Inject
constructor
(
private
val
contract
:
DealContract
){
fun
fetchFavorites
()
=
contract
.
getFavorites
()
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/article/ScreenController.kt
View file @
75525e6a
...
...
@@ -15,6 +15,7 @@ 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.util.extensions.formatToSimple
import
com.google.android.material.floatingactionbutton.FloatingActionButton
import
com.google.android.material.textview.MaterialTextView
import
com.squareup.picasso.Picasso
...
...
@@ -151,7 +152,7 @@ class ArticleScreenController :
contentView
.
text
=
parsedHtml
articleDate
.
text
=
viewState
.
item
.
published
.
toString
()
articleDate
.
text
=
viewState
.
item
.
published
.
formatToSimple
Picasso
.
get
()
.
load
(
viewState
.
item
.
previewUrl
)
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/utils/ArticlesPreviewAdapter.kt
View file @
75525e6a
...
...
@@ -8,10 +8,9 @@ import com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.domain.model.ArticlePreviewModel
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.formatToSimple
import
com.biganto.visual.roompark.util.extensions.setGone
import
com.squareup.picasso.Picasso
import
java.text.SimpleDateFormat
import
java.util.*
/**
...
...
@@ -28,15 +27,13 @@ class ArticlesPreviewAdapter : CommonRecyclerAdapter<ArticlePreviewViewHolder,Ar
class
ArticlePreviewViewHolder
(
itemView
:
View
)
:
CommonViewHolder
<
ArticlePreviewModel
>(
itemView
)
{
private
val
dateFormatter
=
SimpleDateFormat
(
"dd / MM / yyyy"
,
Locale
.
getDefault
())
@BindView
(
R
.
id
.
imageHolder
)
lateinit
var
preview
:
ImageView
@BindView
(
R
.
id
.
feed_date_text_view
)
lateinit
var
articleDate
:
TextView
@BindView
(
R
.
id
.
feed_title_info_text_view
)
lateinit
var
articleTitle
:
TextView
@BindView
(
R
.
id
.
feed_read
)
lateinit
var
articleIsRead
:
View
override
fun
onViewBound
(
model
:
ArticlePreviewModel
)
{
articleDate
.
text
=
dateFormatter
.
format
(
model
.
published
)
articleDate
.
text
=
model
.
published
.
formatToSimple
articleTitle
.
text
=
model
.
title
articleIsRead
.
setGone
(
model
.
isRead
)
...
...
app/src/main/java/com/biganto/visual/roompark/util/extensions/ext.kt
View file @
75525e6a
...
...
@@ -6,13 +6,19 @@ import android.graphics.RectF
import
android.view.View
import
timber.log.Timber
import
java.text.DecimalFormat
import
java.text.SimpleDateFormat
import
java.util.*
/**
* Created by Vladislav Bogdashkin on 23.10.2019.
*/
private
val
dateFormatter
=
SimpleDateFormat
(
"dd / MM / yyyy"
,
Locale
.
getDefault
())
val
Date
.
formatToSimple
:
String
get
()
=
dateFormatter
.
format
(
this
)
val
Boolean
?.
asInt
get
()
=
if
(
this
!=
null
&&
this
)
1
else
0
...
...
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