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
9c0ec0ce
Commit
9c0ec0ce
authored
Dec 02, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into feature/article_screen_impl
parents
87390083
6bc7f456
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
43 additions
and
34 deletions
+43
-34
BigantoBasePresenter.kt
...biganto/visual/roompark/conductor/BigantoBasePresenter.kt
+2
-2
AlbumsRepository.kt
...to/visual/roompark/data/data_provider/AlbumsRepository.kt
+1
-1
FeedsRepository.kt
...nto/visual/roompark/data/data_provider/FeedsRepository.kt
+4
-4
RetrofitRepository.kt
...ompark/data/repository/api/retrofit/RetrofitRepository.kt
+4
-0
AppComponent.kt
...ava/com/biganto/visual/roompark/di/dagger/AppComponent.kt
+8
-5
DataModule.kt
.../java/com/biganto/visual/roompark/di/dagger/DataModule.kt
+3
-0
feeds.kt
...va/com/biganto/visual/roompark/domain/interactor/feeds.kt
+4
-4
albums.kt
...n/java/com/biganto/visual/roompark/domain/model/albums.kt
+7
-2
ScreenDI.kt
...nto/visual/roompark/presentation/screen/feeds/ScreenDI.kt
+7
-11
ScreenPresenter.kt
...ual/roompark/presentation/screen/feeds/ScreenPresenter.kt
+1
-0
DevProgressPreviewAdapter.kt
...sentation/screen/feeds/utils/DevProgressPreviewAdapter.kt
+2
-5
No files found.
app/src/main/java/com/biganto/visual/roompark/conductor/BigantoBasePresenter.kt
View file @
9c0ec0ce
...
@@ -31,12 +31,12 @@ abstract class BigantoBasePresenter<V : MvpView, VS>
...
@@ -31,12 +31,12 @@ abstract class BigantoBasePresenter<V : MvpView, VS>
open
fun
parseError
(
t
:
Throwable
)
:
VS
=
open
fun
parseError
(
t
:
Throwable
)
:
VS
=
when
(
t
)
{
when
(
t
)
{
is
CustomApiException
->{
is
CustomApiException
->{
Timber
.
d
(
"CustomApiException ${t.messageStringId} / ${t.customMessage}"
)
Timber
.
e
(
"CustomApiException ${t.messageStringId} / ${t.customMessage}"
)
parse
(
t
)
parse
(
t
)
}
}
is
NoNetworkException
->
parse
(
t
)
is
NoNetworkException
->
parse
(
t
)
else
->
parse
(
t
)
else
->
{
Timber
.
e
(
t
);
parse
(
t
)}
}
}
private
fun
parse
(
e
:
CustomApiException
)
=
onCodeReturn
(
e
)
private
fun
parse
(
e
:
CustomApiException
)
=
onCodeReturn
(
e
)
...
...
app/src/main/java/com/biganto/visual/roompark/data/data_provider/AlbumsRepository.kt
View file @
9c0ec0ce
...
@@ -62,7 +62,7 @@ class AlbumsContractModule @Inject constructor(
...
@@ -62,7 +62,7 @@ class AlbumsContractModule @Inject constructor(
private
fun
fetchTopLevelAlbums
():
Observable
<
List
<
AlbumPreviewModel
>>
=
private
fun
fetchTopLevelAlbums
():
Observable
<
List
<
AlbumPreviewModel
>>
=
Observable
.
mergeDelayError
(
Observable
.
mergeDelayError
(
arrayListOf
(
fetchTopLevelAlbumsApi
,
fetchTopLevelAlbumsDb
)
arrayListOf
(
fetchTopLevelAlbumsApi
,
fetchTopLevelAlbumsDb
)
).
map
{
fromEntity
(
it
,
::
fromEntity
)
}
).
doOnNext
{
Timber
.
d
(
"got entity $it"
)
}.
map
{
fromEntity
(
it
,
::
fromEntity
)
}
private
fun
fetchAlbumsApi
(
parentAlbumId
:
Int
)
=
private
fun
fetchAlbumsApi
(
parentAlbumId
:
Int
)
=
...
...
app/src/main/java/com/biganto/visual/roompark/data/data_provider/FeedsRepository.kt
View file @
9c0ec0ce
...
@@ -52,10 +52,10 @@ class FeedsContractModule @Inject constructor(
...
@@ -52,10 +52,10 @@ class FeedsContractModule @Inject constructor(
throw
CustomApiException
.
UnknownCustomApiException
(-
1
,
null
,
"Unknown Feed!"
)
throw
CustomApiException
.
UnknownCustomApiException
(-
1
,
null
,
"Unknown Feed!"
)
}
}
else
{
else
{
Timber
.
d
(
"page index: "
+
return
api
.
getArticlesPage
(
"${startIndex.toDouble()/pageSize.toDouble()} -- -"
+
feed
.
alias
"${floor(startIndex.toDouble()/pageSize.toDouble()).toInt()+1}"
)
,
pageSize
return
api
.
getArticlesPage
(
feed
.
alias
,
pageSize
,
floor
(
startIndex
.
toDouble
()/
pageSize
.
toDouble
()).
toInt
()+
1
)
,
floor
(
startIndex
.
toDouble
()/
pageSize
.
toDouble
()).
toInt
()+
1
)
.
doOnNext
{
Timber
.
d
(
"raw0 $it"
)
}
.
doOnNext
{
Timber
.
d
(
"raw0 $it"
)
}
.
map
{
it
.
items
}
.
map
{
it
.
items
}
.
map
{
fromRaw
(
it
,
feedId
)
}
.
map
{
fromRaw
(
it
,
feedId
)
}
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/api/retrofit/RetrofitRepository.kt
View file @
9c0ec0ce
...
@@ -59,6 +59,7 @@ class RetrofitRepository @Inject constructor(retrofit: Retrofit) : IRoomParkApi
...
@@ -59,6 +59,7 @@ class RetrofitRepository @Inject constructor(retrofit: Retrofit) : IRoomParkApi
override
fun
getFeeds
():
Observable
<
List
<
FeedRaw
>>
=
override
fun
getFeeds
():
Observable
<
List
<
FeedRaw
>>
=
api
.
getFeeds
()
api
.
getFeeds
()
.
subscribeOn
(
Schedulers
.
io
())
.
compose
(
RetrofitResponseValidation
())
.
compose
(
RetrofitResponseValidation
())
override
fun
getArticlesPage
(
override
fun
getArticlesPage
(
...
@@ -71,14 +72,17 @@ class RetrofitRepository @Inject constructor(retrofit: Retrofit) : IRoomParkApi
...
@@ -71,14 +72,17 @@ class RetrofitRepository @Inject constructor(retrofit: Retrofit) : IRoomParkApi
override
fun
getArticle
(
id
:
Int
):
Observable
<
ArticleRaw
>
=
override
fun
getArticle
(
id
:
Int
):
Observable
<
ArticleRaw
>
=
api
.
getArticle
(
id
=
id
)
api
.
getArticle
(
id
=
id
)
.
subscribeOn
(
Schedulers
.
io
())
.
compose
(
RetrofitResponseValidation
())
.
compose
(
RetrofitResponseValidation
())
override
fun
getAlbums
(
parentId
:
Int
?):
Observable
<
List
<
ImageAlbumRaw
>>
=
override
fun
getAlbums
(
parentId
:
Int
?):
Observable
<
List
<
ImageAlbumRaw
>>
=
api
.
getAlbums
(
id
=
parentId
)
api
.
getAlbums
(
id
=
parentId
)
.
subscribeOn
(
Schedulers
.
io
())
.
compose
(
RetrofitResponseValidation
())
.
compose
(
RetrofitResponseValidation
())
override
fun
getPhotos
(
parentId
:
Int
):
Observable
<
List
<
NewsPhotoRaw
>>
=
override
fun
getPhotos
(
parentId
:
Int
):
Observable
<
List
<
NewsPhotoRaw
>>
=
api
.
getPhotos
(
id
=
parentId
)
api
.
getPhotos
(
id
=
parentId
)
.
subscribeOn
(
Schedulers
.
io
())
.
compose
(
RetrofitResponseValidation
())
.
compose
(
RetrofitResponseValidation
())
override
fun
getEstatePlanTypes
(
estateId
:
Int
):
Observable
<
List
<
PlanTypeRaw
>>
=
override
fun
getEstatePlanTypes
(
estateId
:
Int
):
Observable
<
List
<
PlanTypeRaw
>>
=
...
...
app/src/main/java/com/biganto/visual/roompark/di/dagger/AppComponent.kt
View file @
9c0ec0ce
...
@@ -7,6 +7,9 @@ import com.biganto.visual.roompark.data.repository.api.IRoomParkApi
...
@@ -7,6 +7,9 @@ import com.biganto.visual.roompark.data.repository.api.IRoomParkApi
import
com.biganto.visual.roompark.data.repository.api.retrofit.di.RetrofitModule
import
com.biganto.visual.roompark.data.repository.api.retrofit.di.RetrofitModule
import
com.biganto.visual.roompark.data.repository.db.IDb
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.DbModule
import
com.biganto.visual.roompark.domain.contract.AuthContract
import
com.biganto.visual.roompark.domain.contract.DevProgressContract
import
com.biganto.visual.roompark.domain.contract.FeedsContract
import
dagger.BindsInstance
import
dagger.BindsInstance
import
dagger.Component
import
dagger.Component
import
dagger.android.AndroidInjectionModule
import
dagger.android.AndroidInjectionModule
...
@@ -35,16 +38,16 @@ import javax.inject.Singleton
...
@@ -35,16 +38,16 @@ import javax.inject.Singleton
AndroidSupportInjectionModule
::
class
,
AndroidSupportInjectionModule
::
class
,
// MappingProvider::class,
// MappingProvider::class,
ActivityModule
::
class
,
ActivityModule
::
class
,
//
ContractRepositoryModule::class,
ContractRepositoryModule
::
class
,
AppActivityModule
::
class
])
AppActivityModule
::
class
])
interface
AppComponent
:
AndroidInjector
<
RoomParkApplication
>{
interface
AppComponent
:
AndroidInjector
<
RoomParkApplication
>{
// fun authC():
AuthContract
fun
authC
():
AuthContract
//
// fun feedsC():
FeedsContract
fun
feedsC
():
FeedsContract
//
fun feedsAlb(): DevProgressContract
fun
feedsAlb
():
DevProgressContract
...
...
app/src/main/java/com/biganto/visual/roompark/di/dagger/DataModule.kt
View file @
9c0ec0ce
...
@@ -26,12 +26,15 @@ interface DataComponent{
...
@@ -26,12 +26,15 @@ interface DataComponent{
@Module
(
includes
=
[
DataModule
::
class
,
RetrofitModule
::
class
,
DbModule
::
class
,
LocalStorage
::
class
])
@Module
(
includes
=
[
DataModule
::
class
,
RetrofitModule
::
class
,
DbModule
::
class
,
LocalStorage
::
class
])
abstract
class
ContractRepositoryModule
{
abstract
class
ContractRepositoryModule
{
@Singleton
@Binds
@Binds
abstract
fun
provideAuth
(
contract
:
AuthContractModule
):
AuthContract
abstract
fun
provideAuth
(
contract
:
AuthContractModule
):
AuthContract
@Singleton
@Binds
@Binds
abstract
fun
provideFeedsContract
(
impl
:
FeedsContractModule
):
FeedsContract
abstract
fun
provideFeedsContract
(
impl
:
FeedsContractModule
):
FeedsContract
@Singleton
@Binds
@Binds
abstract
fun
provideDevProgressContract
(
impl
:
AlbumsContractModule
):
DevProgressContract
abstract
fun
provideDevProgressContract
(
impl
:
AlbumsContractModule
):
DevProgressContract
}
}
...
...
app/src/main/java/com/biganto/visual/roompark/domain/interactor/feeds.kt
View file @
9c0ec0ce
...
@@ -146,8 +146,8 @@ class FeedsInteractor @Inject constructor(
...
@@ -146,8 +146,8 @@ class FeedsInteractor @Inject constructor(
)
)
)
)
val
albumsPreviews
=
listOf
<
AlbumPreviewModel
>(
val
albumsPreviews
=
listOf
<
AlbumP
hotoP
reviewModel
>(
AlbumPreviewModel
(
AlbumP
hotoP
reviewModel
(
1
,
1
,
2
,
2
,
Date
(
3131231L
),
Date
(
3131231L
),
...
@@ -155,7 +155,7 @@ class FeedsInteractor @Inject constructor(
...
@@ -155,7 +155,7 @@ class FeedsInteractor @Inject constructor(
"https://room-park.ru/assets/gallery_images/image_2600/00/00/02/764-1d9795.png"
,
"https://room-park.ru/assets/gallery_images/image_2600/00/00/02/764-1d9795.png"
,
false
false
),
),
AlbumPreviewModel
(
AlbumP
hotoP
reviewModel
(
1
,
1
,
2
,
2
,
Date
(
31312323421L
),
Date
(
31312323421L
),
...
@@ -163,7 +163,7 @@ class FeedsInteractor @Inject constructor(
...
@@ -163,7 +163,7 @@ class FeedsInteractor @Inject constructor(
"https://room-park.ru/assets/gallery_images/image_2600/00/00/02/626-8afd4a.jpeg"
,
"https://room-park.ru/assets/gallery_images/image_2600/00/00/02/626-8afd4a.jpeg"
,
false
false
),
),
AlbumPreviewModel
(
AlbumP
hotoP
reviewModel
(
1
,
1
,
2
,
2
,
Date
(
3131232131L
),
Date
(
3131232131L
),
...
...
app/src/main/java/com/biganto/visual/roompark/domain/model/albums.kt
View file @
9c0ec0ce
...
@@ -9,6 +9,13 @@ import java.util.*
...
@@ -9,6 +9,13 @@ import java.util.*
data class
AlbumPreviewModel
(
data class
AlbumPreviewModel
(
val
albumId
:
Int
,
val
parentId
:
Int
,
val
title
:
String
,
val
isRead
:
Boolean
)
data class
AlbumPhotoPreviewModel
(
val
albumId
:
Int
,
val
albumId
:
Int
,
val
parentId
:
Int
,
val
parentId
:
Int
,
val
published
:
Date
,
val
published
:
Date
,
...
@@ -40,8 +47,6 @@ fun fromEntity(entity: ImageAlbumEntity):AlbumPreviewModel =
...
@@ -40,8 +47,6 @@ fun fromEntity(entity: ImageAlbumEntity):AlbumPreviewModel =
AlbumPreviewModel
(
AlbumPreviewModel
(
albumId
=
entity
.
id
,
albumId
=
entity
.
id
,
parentId
=
-
1
,
parentId
=
-
1
,
published
=
entity
.
published
,
title
=
entity
.
title
,
title
=
entity
.
title
,
previewUrl
=
""
,
// SHOULD BE FIRST AVALIABLE IMAGE FROM ALBUM PHOTOS
isRead
=
false
isRead
=
false
)
)
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/ScreenDI.kt
View file @
9c0ec0ce
...
@@ -2,14 +2,10 @@ package com.biganto.visual.roompark.presentation.screen.feeds
...
@@ -2,14 +2,10 @@ package com.biganto.visual.roompark.presentation.screen.feeds
import
android.content.Context
import
android.content.Context
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.data.data_provider.AlbumsContractModule
import
com.biganto.visual.roompark.data.data_provider.FeedsContractModule
import
com.biganto.visual.roompark.data.service.user_session.IUserSession
import
com.biganto.visual.roompark.data.service.user_session.IUserSession
import
com.biganto.visual.roompark.data.service.user_session.UserSessionService
import
com.biganto.visual.roompark.data.service.user_session.UserSessionService
import
com.biganto.visual.roompark.di.dagger.AppComponent
import
com.biganto.visual.roompark.di.dagger.AppComponent
import
com.biganto.visual.roompark.di.dagger.PerScreen
import
com.biganto.visual.roompark.di.dagger.PerScreen
import
com.biganto.visual.roompark.domain.contract.DevProgressContract
import
com.biganto.visual.roompark.domain.contract.FeedsContract
import
dagger.Binds
import
dagger.Binds
import
dagger.BindsInstance
import
dagger.BindsInstance
import
dagger.Component
import
dagger.Component
...
@@ -41,13 +37,13 @@ abstract class FeedsScreenModule{
...
@@ -41,13 +37,13 @@ abstract class FeedsScreenModule{
@Binds
@Binds
abstract
fun
provideContext
(
activity
:
RoomParkMainActivity
):
Context
abstract
fun
provideContext
(
activity
:
RoomParkMainActivity
):
Context
@PerScreen
//
@PerScreen
@Binds
//
@Binds
abstract
fun
provideContract
(
impl
:
FeedsContractModule
):
FeedsContract
//
abstract fun provideContract(impl: FeedsContractModule): FeedsContract
//
@PerScreen
//
@PerScreen
@Binds
//
@Binds
abstract
fun
provideDevContract
(
impl
:
AlbumsContractModule
):
DevProgressContract
//
abstract fun provideDevContract(impl: AlbumsContractModule): DevProgressContract
@PerScreen
@PerScreen
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/ScreenPresenter.kt
View file @
9c0ec0ce
...
@@ -47,6 +47,7 @@ class FeedsScreenPresenter @Inject constructor(
...
@@ -47,6 +47,7 @@ class FeedsScreenPresenter @Inject constructor(
val
fetchAlbums
=
interactor
.
fetchAlbums
()
val
fetchAlbums
=
interactor
.
fetchAlbums
()
.
map
<
FeedsScreenViewState
>{
.
map
<
FeedsScreenViewState
>{
Timber
.
d
(
"got albums: $it"
)
restoreModel
.
albums
=
it
restoreModel
.
albums
=
it
FeedsScreenViewState
.
AlbumsPages
(
it
)
FeedsScreenViewState
.
AlbumsPages
(
it
)
}
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/utils/DevProgressPreviewAdapter.kt
View file @
9c0ec0ce
...
@@ -8,7 +8,6 @@ import com.biganto.visual.roompark.R
...
@@ -8,7 +8,6 @@ import com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.domain.model.AlbumPreviewModel
import
com.biganto.visual.roompark.domain.model.AlbumPreviewModel
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.squareup.picasso.Picasso
import
java.text.SimpleDateFormat
import
java.text.SimpleDateFormat
import
java.util.*
import
java.util.*
...
@@ -35,11 +34,9 @@ class AlbumCardViewHolder(itemView: View) : CommonViewHolder<AlbumPreviewModel>(
...
@@ -35,11 +34,9 @@ class AlbumCardViewHolder(itemView: View) : CommonViewHolder<AlbumPreviewModel>(
@BindView
(
R
.
id
.
card_updated
)
lateinit
var
articleDate
:
TextView
@BindView
(
R
.
id
.
card_updated
)
lateinit
var
articleDate
:
TextView
override
fun
onViewBound
(
model
:
AlbumPreviewModel
)
{
override
fun
onViewBound
(
model
:
AlbumPreviewModel
)
{
articleDate
.
text
=
dateFormatter
.
format
(
model
.
published
)
//
articleDate.text = dateFormatter.format(model.published)
articleTitle
.
text
=
model
.
title
articleTitle
.
text
=
model
.
title
Picasso
.
get
()
// Picasso.ge1preview)
.
load
(
model
.
previewUrl
)
.
into
(
preview
)
}
}
}
}
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