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
ea9f64ac
Commit
ea9f64ac
authored
Oct 25, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
articles screen
parent
756f4c7b
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
387 additions
and
4 deletions
+387
-4
articles.kt
...com/biganto/visual/roompark/domain/interactor/articles.kt
+52
-0
feeds.kt
...va/com/biganto/visual/roompark/domain/interactor/feeds.kt
+1
-1
ScreenContract.kt
.../roompark/presentation/screen/feed_list/ScreenContract.kt
+11
-0
ScreenController.kt
...oompark/presentation/screen/feed_list/ScreenController.kt
+98
-0
ScreenDI.kt
...visual/roompark/presentation/screen/feed_list/ScreenDI.kt
+46
-0
ScreenPresenter.kt
...roompark/presentation/screen/feed_list/ScreenPresenter.kt
+38
-0
ScreenViewState.kt
...roompark/presentation/screen/feed_list/ScreenViewState.kt
+14
-0
Adapter.kt
...al/roompark/presentation/screen/feed_list/util/Adapter.kt
+28
-0
ArticlesPreviewAdapter.kt
...presentation/screen/feeds/utils/ArticlesPreviewAdapter.kt
+1
-1
feed_direct_screen.xml
app/src/main/res/layout/feed_direct_screen.xml
+14
-0
feed_direct_viewholder.xml
app/src/main/res/layout/feed_direct_viewholder.xml
+13
-1
feed_preview_viewholder.xml
app/src/main/res/layout/feed_preview_viewholder.xml
+70
-0
feeds_block_view.xml
app/src/main/res/layout/feeds_block_view.xml
+1
-1
No files found.
app/src/main/java/com/biganto/visual/roompark/domain/interactor/articles.kt
0 → 100644
View file @
ea9f64ac
package
com.biganto.visual.roompark.domain.interactor
import
com.biganto.visual.roompark.domain.model.ArticlesPreviewModel
import
io.reactivex.Single
import
javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 09.10.2019.
*/
class
ArticlesInteractor
@Inject
constructor
(
)
{
fun
fetchArticles
(
feedId
:
Int
):
Single
<
ArticlesPreviewModel
>
=
Single
.
just
(
when
(
feedId
)
{
1
->
FeedsInteractor
.
testNewsArticles
2
->
FeedsInteractor
.
testBlogsArticles
3
->
FeedsInteractor
.
testDevArticles
else
->
error
(
"unknown feedId"
)
}
)
}
app/src/main/java/com/biganto/visual/roompark/domain/interactor/feeds.kt
View file @
ea9f64ac
...
...
@@ -28,7 +28,7 @@ class FeedsInteractor @Inject constructor(
fun
fetchCams
():
Single
<
WebCamListModel
>
=
Single
.
just
(
camsList
)
private
companion
object
{
companion
object
{
private
const
val
sampleUrl
:
String
=
"https://room-park.ru/assets/news_articles/preview/00/00/00/109-8c9b72.jpeg"
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feed_list/ScreenContract.kt
0 → 100644
View file @
ea9f64ac
package
com.biganto.visual.roompark.presentation.screen.feed_list
import
com.biganto.visual.roompark.conductor.BigantoBaseContract
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
interface
ArticlesScreen
:
BigantoBaseContract
<
ArticlesScreenViewState
>
{
}
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feed_list/ScreenController.kt
0 → 100644
View file @
ea9f64ac
package
com.biganto.visual.roompark.presentation.screen.feed_list
import
android.view.View
import
androidx.core.os.bundleOf
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
butterknife.BindView
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.feed_list.util.ArticlesAdapter
import
com.biganto.visual.roompark.util.view_utils.grid.CeilsDecoration
import
timber.log.Timber
import
javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
private
const
val
FEED_ID
=
"DIRECT_FEED_ID_KEY"
class
ArticlesScreenController
:
BigantoBaseController
<
ArticlesScreenViewState
,
ArticlesScreen
,
ArticlesScreenPresenter
>
,
ArticlesScreen
{
constructor
()
constructor
(
feedId
:
Int
):
super
(
bundleOf
(
FEED_ID
to
feedId
))
override
fun
injectDependencies
()
{
getComponent
()
}
@Inject
override
lateinit
var
injectedPresenter
:
ArticlesScreenPresenter
@BindView
(
R
.
id
.
articles_recycler_view
)
lateinit
var
articlesRecyclerView
:
RecyclerView
private
fun
setToolbar
(){
toolBar
.
showAll
()
toolBar
.
appBar
.
setExpanded
(
false
,
false
)
toolBar
.
collapsingToolbarLayout
.
title
=
"ИЗБРАННОЕ"
toolBar
.
appBar
.
setLiftable
(
true
)
toolBar
.
appBarScrollable
(
false
)
articlesRecyclerView
.
isNestedScrollingEnabled
=
false
}
private
fun
bindRecycler
()
{
articlesRecyclerView
.
isNestedScrollingEnabled
=
true
articlesRecyclerView
.
layoutManager
=
LinearLayoutManager
(
activity
,
RecyclerView
.
VERTICAL
,
false
)
articlesRecyclerView
.
adapter
=
ArticlesAdapter
()
articlesRecyclerView
.
itemAnimator
=
null
if
(
articlesRecyclerView
.
itemDecorationCount
==
0
)
articlesRecyclerView
.
addItemDecoration
(
CeilsDecoration
(
1
,
resources
?.
getDimensionPixelSize
(
R
.
dimen
.
ceil_grid_padding
))
)
}
override
fun
onViewBound
(
v
:
View
)
{
// setToolbar()
bindRecycler
()
}
override
fun
render
(
viewState
:
ArticlesScreenViewState
)
{
super
.
render
(
viewState
)
Timber
.
d
(
"Render state $viewState"
)
when
(
viewState
){
is
ArticlesScreenViewState
.
Idle
->
render
(
viewState
)
is
ArticlesScreenViewState
.
ArticlesLoaded
->
render
(
viewState
)
}
}
private
fun
render
(
viewState
:
ArticlesScreenViewState
.
Idle
){
}
private
fun
render
(
viewState
:
ArticlesScreenViewState
.
ArticlesLoaded
)
{
(
articlesRecyclerView
.
adapter
as
ArticlesAdapter
).
setItems
(
viewState
.
items
)
}
private
fun
getComponent
()
=
DaggerArticlesScreenComponent
.
factory
()
.
create
(
2
,
RoomParkApplication
.
component
,
activity
as
RoomParkMainActivity
)
.
inject
(
this
)
override
fun
getLayoutId
():
Int
=
R
.
layout
.
feeds_screen
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feed_list/ScreenDI.kt
0 → 100644
View file @
ea9f64ac
package
com.biganto.visual.roompark.presentation.screen.feed_list
import
android.content.Context
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.di.dagger.AppComponent
import
com.biganto.visual.roompark.di.dagger.PerScreen
import
dagger.Binds
import
dagger.BindsInstance
import
dagger.Component
import
dagger.Module
import
javax.inject.Named
@PerScreen
@Component
(
modules
=
[
ArticlesScreenModule
::
class
],
dependencies
=
[
AppComponent
::
class
])
interface
ArticlesScreenComponent
{
@Component
.
Factory
interface
Factory
{
fun
create
(
@Named
(
"FEED_ID_INT"
)
feed
:
Int
,
appComponent
:
AppComponent
,
@BindsInstance
activity
:
RoomParkMainActivity
):
ArticlesScreenComponent
}
val
presenter
:
ArticlesScreenPresenter
fun
inject
(
controller
:
ArticlesScreenController
)
}
@Module
abstract
class
ArticlesScreenModule
{
@PerScreen
@Binds
abstract
fun
provideContext
(
activity
:
RoomParkMainActivity
):
Context
@PerScreen
@Binds
abstract
fun
provideFeedId
(
@Named
(
"FEED_ID_INT"
)
feedId
:
Int
)
:
Int
}
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feed_list/ScreenPresenter.kt
0 → 100644
View file @
ea9f64ac
package
com.biganto.visual.roompark.presentation.screen.feed_list
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.domain.interactor.ArticlesInteractor
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
import
timber.log.Timber
import
javax.inject.Inject
import
javax.inject.Named
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
class
ArticlesScreenPresenter
@Inject
constructor
(
@Named
(
"FEED_ID_INT"
)
private
val
feedId
:
Int
,
private
val
interactor
:
ArticlesInteractor
)
:
BigantoBasePresenter
<
ArticlesScreen
,
ArticlesScreenViewState
>()
{
override
fun
bindIntents
()
{
Timber
.
d
(
"feedId : $feedId"
)
val
prefetchCards
=
interactor
.
fetchArticles
(
1
)
.
map
{
ArticlesScreenViewState
.
ArticlesLoaded
(
it
.
articles
)
}
val
state
=
restoreStateObservable
.
mergeWith
(
prefetchCards
)
.
doOnError
{
Timber
.
e
(
it
)}
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
subscribeViewState
(
state
.
cast
(
ArticlesScreenViewState
::
class
.
java
),
ArticlesScreen
::
render
)
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feed_list/ScreenViewState.kt
0 → 100644
View file @
ea9f64ac
package
com.biganto.visual.roompark.presentation.screen.feed_list
import
com.biganto.visual.roompark.conductor.BigantoBaseViewState
import
com.biganto.visual.roompark.domain.model.ArticlePreviewModel
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
sealed
class
ArticlesScreenViewState
:
BigantoBaseViewState
()
{
class
Idle
:
ArticlesScreenViewState
()
class
ArticlesLoaded
(
val
items
:
List
<
ArticlePreviewModel
>)
:
ArticlesScreenViewState
()
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feed_list/util/Adapter.kt
0 → 100644
View file @
ea9f64ac
package
com.biganto.visual.roompark.presentation.screen.feed_list.util
import
android.view.View
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
/**
* Created by Vladislav Bogdashkin on 16.10.2019.
*/
class
ArticlesAdapter
()
:
CommonRecyclerAdapter
<
ArticleViewHolder
,
ArticlePreviewModel
>()
{
override
val
vhKlazz
=
ArticleViewHolder
::
class
override
fun
getVhLayout
():
Int
{
TODO
(
"not implemented"
)
//To change body of created functions use File | Settings | File Templates.
}
}
class
ArticleViewHolder
(
itemView
:
View
)
:
CommonViewHolder
<
ArticlePreviewModel
>(
itemView
)
{
override
fun
onViewBound
(
model
:
ArticlePreviewModel
)
{
TODO
(
"not implemented"
)
//To change body of created functions use File | Settings | File Templates.
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/utils/ArticlesPreviewAdapter.kt
View file @
ea9f64ac
...
...
@@ -32,7 +32,7 @@ class ArticlesPreviewAdapter : RecyclerView.Adapter<ArticlePreviewViewHolder>()
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
ArticlePreviewViewHolder
=
ArticlePreviewViewHolder
(
LayoutInflater
.
from
(
parent
.
context
)
.
inflate
(
R
.
layout
.
feed_viewholder
,
parent
,
false
)
.
inflate
(
R
.
layout
.
feed_
preview_
viewholder
,
parent
,
false
)
)
override
fun
getItemCount
():
Int
=
list
.
size
...
...
app/src/main/res/layout/feed_direct_screen.xml
0 → 100644
View file @
ea9f64ac
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/colorNoticeBackground"
android:orientation=
"vertical"
>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/articles_recycler_view"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:listitem=
"@layout/feed_direct_viewholder"
/>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/feed_direct_viewholder.xml
View file @
ea9f64ac
...
...
@@ -11,6 +11,7 @@
android:id=
"@+id/imageHolder"
android:layout_width=
"128dp"
android:layout_height=
"128dp"
android:layout_marginStart=
"16dp"
android:layout_marginTop=
"16dp"
android:layout_marginEnd=
"16dp"
android:layout_marginBottom=
"16dp"
...
...
@@ -27,7 +28,7 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
app:layout_constraintGuide_begin=
"1
44
dp"
/>
app:layout_constraintGuide_begin=
"1
60
dp"
/>
<FrameLayout
android:id=
"@+id/feed_read"
...
...
@@ -79,5 +80,16 @@
app:layout_constraintTop_toBottomOf=
"@+id/feed_title_info_text_view"
app:layout_constraintVertical_bias=
"0.0"
/>
<include
layout=
"@layout/horizontal_divider"
android:layout_width=
"0dp"
android:layout_height=
"1dp"
android:layout_marginStart=
"16dp"
android:layout_marginTop=
"16dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/imageHolder"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
app/src/main/res/layout/feed_preview_viewholder.xml
0 → 100644
View file @
ea9f64ac
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/linearLayout3"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@color/colorFeedViewHolderBackground"
>
<com.biganto.visual.roompark.util.view_utils.image_view.RoundedImageView
android:id=
"@+id/imageHolder"
android:layout_width=
"60dp"
android:layout_height=
"60dp"
android:layout_marginTop=
"8dp"
android:layout_marginBottom=
"8dp"
android:background=
"@color/colorAccentSecondary"
app:image_corner_radius=
"4dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:srcCompat=
"@drawable/ic_favorites"
/>
<androidx.constraintlayout.widget.Guideline
android:id=
"@+id/guideline"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
app:layout_constraintGuide_begin=
"76dp"
/>
<FrameLayout
android:id=
"@+id/feed_read"
android:layout_width=
"8dp"
android:layout_height=
"8dp"
android:layout_marginTop=
"10dp"
android:background=
"@drawable/new_feed_icon"
android:visibility=
"visible"
app:layout_constraintStart_toStartOf=
"@+id/guideline"
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:id=
"@+id/feed_date_text_view"
style=
"@style/Feed.Notice"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"16dp"
android:layout_marginTop=
"8dp"
android:includeFontPadding=
"false"
android:text=
"22 / 02 / 2019"
android:visibility=
"visible"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"@+id/guideline"
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:id=
"@+id/feed_title_info_text_view"
style=
"@style/Feed_Title"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:layout_marginBottom=
"4dp"
android:includeFontPadding=
"false"
android:text=
"В «РУМЯНЦЕВО-ПАРК» ПРИСТУПИЛИ К МОНТАЖУ ОКОННЫХ БЛОКОВ"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"@+id/guideline"
app:layout_constraintTop_toBottomOf=
"@+id/feed_date_text_view"
app:layout_constraintVertical_bias=
"0.0"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
app/src/main/res/layout/feeds_block_view.xml
View file @
ea9f64ac
...
...
@@ -29,7 +29,7 @@
app:layout_constraintStart_toStartOf=
"parent"
tools:itemCount=
"3"
app:layout_constraintTop_toBottomOf=
"@+id/feedsTabs"
tools:listitem=
"@layout/feed_
direct
_viewholder"
/>
tools:listitem=
"@layout/feed_
preview
_viewholder"
/>
<include
android:id=
"@+id/feeds_divider"
...
...
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