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
f6587b74
Commit
f6587b74
authored
Oct 25, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
back stack issue.. will try to refactor
parent
afbb9bd1
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
113 additions
and
18 deletions
+113
-18
RoomParkMainActivity.kt
.../com/biganto/visual/roompark/base/RoomParkMainActivity.kt
+1
-0
ScreenController.kt
...oompark/presentation/screen/feed_list/ScreenController.kt
+14
-4
ScreenDI.kt
...visual/roompark/presentation/screen/feed_list/ScreenDI.kt
+1
-1
ScreenPresenter.kt
...roompark/presentation/screen/feed_list/ScreenPresenter.kt
+1
-1
Adapter.kt
...al/roompark/presentation/screen/feed_list/util/Adapter.kt
+26
-5
ScreenController.kt
...al/roompark/presentation/screen/feeds/ScreenController.kt
+36
-1
ArticlesPreviewAdapter.kt
...presentation/screen/feeds/utils/ArticlesPreviewAdapter.kt
+1
-4
HomeController.kt
...isual/roompark/presentation/screen/home/HomeController.kt
+26
-0
ext.kt
...n/java/com/biganto/visual/roompark/util/extensions/ext.kt
+6
-0
feed_direct_viewholder.xml
app/src/main/res/layout/feed_direct_viewholder.xml
+1
-2
No files found.
app/src/main/java/com/biganto/visual/roompark/base/RoomParkMainActivity.kt
View file @
f6587b74
...
...
@@ -77,6 +77,7 @@ class RoomParkMainActivity(
conductor_container
.
requestLayout
()
}
override
fun
showAll
()
{
appBar
.
setExpanded
(
true
,
false
)
collapsingToolbarLayout
.
visibility
=
View
.
VISIBLE
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feed_list/ScreenController.kt
View file @
f6587b74
package
com.biganto.visual.roompark.presentation.screen.feed_list
import
android.view.View
import
androidx.appcompat.widget.Toolbar
import
androidx.core.os.bundleOf
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
...
...
@@ -44,8 +45,10 @@ class ArticlesScreenController :
private
fun
setToolbar
(){
toolBar
.
showAll
()
toolBar
.
appBar
.
visibility
=
Toolbar
.
VISIBLE
toolBar
.
appBar
.
setExpanded
(
false
,
false
)
toolBar
.
collapsingToolbarLayout
.
title
=
"
ИЗБРАННОЕ
"
toolBar
.
collapsingToolbarLayout
.
title
=
"
НОВОСТь
"
toolBar
.
appBar
.
setLiftable
(
true
)
toolBar
.
appBarScrollable
(
false
)
articlesRecyclerView
.
isNestedScrollingEnabled
=
false
...
...
@@ -66,7 +69,7 @@ class ArticlesScreenController :
}
override
fun
onViewBound
(
v
:
View
)
{
//
setToolbar()
setToolbar
()
bindRecycler
()
}
...
...
@@ -89,10 +92,17 @@ class ArticlesScreenController :
}
private
fun
getComponent
()
=
DaggerArticlesScreenComponent
.
factory
()
.
create
(
2
,
RoomParkApplication
.
component
,
activity
as
RoomParkMainActivity
)
.
create
(
args
.
getInt
(
FEED_ID
)
,
RoomParkApplication
.
component
,
activity
as
RoomParkMainActivity
)
.
inject
(
this
)
override
fun
getLayoutId
():
Int
=
R
.
layout
.
feeds_screen
override
fun
getLayoutId
():
Int
=
R
.
layout
.
feed_direct_screen
override
fun
handleBack
():
Boolean
{
Timber
.
d
(
"handle back in class "
)
router
.
popController
(
this
)
return
super
.
handleBack
()
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feed_list/ScreenDI.kt
View file @
f6587b74
...
...
@@ -20,7 +20,7 @@ interface ArticlesScreenComponent {
@Component
.
Factory
interface
Factory
{
fun
create
(
@Named
(
"FEED_ID_INT"
)
feed
:
Int
@
BindsInstance
@
Named
(
"FEED_ID_INT"
)
feed
:
Int
,
appComponent
:
AppComponent
,
@BindsInstance
activity
:
RoomParkMainActivity
):
ArticlesScreenComponent
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feed_list/ScreenPresenter.kt
View file @
f6587b74
...
...
@@ -23,7 +23,7 @@ class ArticlesScreenPresenter @Inject constructor(
override
fun
bindIntents
()
{
Timber
.
d
(
"feedId : $feedId"
)
val
prefetchCards
=
interactor
.
fetchArticles
(
1
)
val
prefetchCards
=
interactor
.
fetchArticles
(
feedId
)
.
map
{
ArticlesScreenViewState
.
ArticlesLoaded
(
it
.
articles
)
}
val
state
=
restoreStateObservable
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feed_list/util/Adapter.kt
View file @
f6587b74
package
com.biganto.visual.roompark.presentation.screen.feed_list.util
import
android.view.View
import
android.widget.ImageView
import
android.widget.TextView
import
butterknife.BindView
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.setGone
import
com.squareup.picasso.Picasso
import
java.text.SimpleDateFormat
import
java.util.*
/**
* Created by Vladislav Bogdashkin on 16.10.2019.
*/
class
ArticlesAdapter
()
:
CommonRecyclerAdapter
<
ArticleViewHolder
,
ArticlePreviewModel
>()
{
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.
}
override
fun
getVhLayout
():
Int
=
R
.
layout
.
feed_direct_viewholder
}
class
ArticleViewHolder
(
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
)
{
TODO
(
"not implemented"
)
//To change body of created functions use File | Settings | File Templates.
articleDate
.
text
=
dateFormatter
.
format
(
model
.
published
)
articleTitle
.
text
=
model
.
title
articleIsRead
.
setGone
(
model
.
isRead
)
Picasso
.
get
()
.
load
(
model
.
previewUrl
)
.
into
(
preview
)
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/ScreenController.kt
View file @
f6587b74
package
com.biganto.visual.roompark.presentation.screen.feeds
import
android.annotation.SuppressLint
import
android.view.View
import
android.view.ViewGroup
import
android.widget.TextView
...
...
@@ -11,12 +12,19 @@ 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.domain.model.FeedModel
import
com.biganto.visual.roompark.presentation.screen.feed_list.ArticlesScreenController
import
com.biganto.visual.roompark.presentation.screen.feeds.utils.AlbumsPreviewAdapter
import
com.biganto.visual.roompark.presentation.screen.feeds.utils.ArticlesPreviewAdapter
import
com.biganto.visual.roompark.presentation.screen.feeds.utils.CamsListAdapter
import
com.bluelinelabs.conductor.RouterTransaction
import
com.bluelinelabs.conductor.changehandler.FadeChangeHandler
import
com.google.android.material.button.MaterialButton
import
com.google.android.material.tabs.TabLayout
import
com.google.android.material.textview.MaterialTextView
import
com.jakewharton.rxbinding3.material.selections
import
com.jakewharton.rxbinding3.view.clicks
import
io.reactivex.Observable
import
io.reactivex.android.schedulers.AndroidSchedulers
import
timber.log.Timber
import
java.util.concurrent.TimeUnit
import
javax.inject.Inject
...
...
@@ -32,9 +40,14 @@ class FeedsScreenController :
,
FeedsScreen
{
override
fun
feedsTabSelected
():
Observable
<
Int
>
=
feedsTabs
.
selections
()
.
map
{
it
.
position
}
=
feedsTabs
.
selections
()
.
debounce
(
200L
,
TimeUnit
.
MILLISECONDS
)
.
map
{
it
.
position
}
.
map
{
storedFeedsList
[
it
].
feedId
}
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
doOnNext
{
feedsBlockView
.
findViewById
<
MaterialButton
>(
R
.
id
.
to_feed_articles
)
.
text
=
"ВСЕ ${allFeedName(it)}"
}
override
fun
injectDependencies
()
{
...
...
@@ -85,6 +98,18 @@ class FeedsScreenController :
override
fun
onViewBound
(
v
:
View
)
{
bindRecycler
()
feedsBlockView
.
findViewById
<
MaterialTextView
>(
R
.
id
.
to_feed_articles
).
clicks
()
.
map
{
feedsTabs
.
getTabAt
(
feedsTabs
.
selectedTabPosition
)}
.
map
{
it
.
tag
as
?
Int
}
.
subscribe
{
it
?.
let
{
router
.
pushController
(
RouterTransaction
.
with
(
ArticlesScreenController
(
it
))
.
popChangeHandler
(
FadeChangeHandler
())
.
pushChangeHandler
(
FadeChangeHandler
())
)
}
}
}
override
fun
render
(
viewState
:
FeedsScreenViewState
)
{
...
...
@@ -103,12 +128,16 @@ class FeedsScreenController :
}
private
fun
allFeedName
(
feedId
:
Int
)
=
if
(
feedId
==
1
)
"НОВОСТИ"
else
"БЛОГИ"
@SuppressLint
(
"SetTextI18n"
)
private
fun
render
(
viewState
:
FeedsScreenViewState
.
FeedsPages
){
feedsTabs
.
removeAllTabs
()
viewState
.
items
.
forEach
{
feed
->
val
tab
=
feedsTabs
.
newTab
()
.
setCustomView
(
R
.
layout
.
feeds_tab_view
)
.
setTag
(
feed
.
feedId
)
tab
.
customView
?.
let
{
it
.
findViewById
<
TextView
>(
R
.
id
.
tab_title
)
?.
text
=
feed
.
title
...
...
@@ -141,4 +170,10 @@ class FeedsScreenController :
override
fun
getLayoutId
():
Int
=
R
.
layout
.
feeds_screen
override
fun
handleBack
():
Boolean
{
Timber
.
d
(
"handle back in class "
)
router
.
popController
(
this
)
return
super
.
handleBack
()
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/utils/ArticlesPreviewAdapter.kt
View file @
f6587b74
...
...
@@ -8,6 +8,7 @@ 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.setGone
import
com.squareup.picasso.Picasso
import
java.text.SimpleDateFormat
import
java.util.*
...
...
@@ -44,7 +45,3 @@ class ArticlePreviewViewHolder(itemView: View) : CommonViewHolder<ArticlePreview
.
into
(
preview
)
}
}
private
fun
View
.
setGone
(
isGone
:
Boolean
){
this
.
visibility
=
if
(
isGone
)
View
.
GONE
else
View
.
VISIBLE
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/home/HomeController.kt
View file @
f6587b74
package
com.biganto.visual.roompark.presentation.screen.home
import
android.content.ContentValues.TAG
import
android.util.Log
import
android.view.View
import
androidx.viewpager.widget.ViewPager
import
butterknife.BindView
...
...
@@ -15,6 +17,7 @@ import com.biganto.visual.roompark.presentation.screen.feeds.FeedsScreenControll
import
com.biganto.visual.roompark.presentation.screen.settings.SettingsScreenController
import
com.biganto.visual.roompark.presentation.screen.to_flat.FindFlatScreenController
import
com.google.android.material.bottomnavigation.BottomNavigationView
import
timber.log.Timber
import
javax.inject.Inject
/**
...
...
@@ -96,5 +99,28 @@ class HomeController :
override
fun
getLayoutId
():
Int
=
R
.
layout
.
home_screen_viewpager
override
fun
handleBack
():
Boolean
{
Timber
.
d
(
"handle back in class "
)
val
childRouter
=
pageAdapter
.
currentPrimaryRouter
if
(
childRouter
!=
null
)
{
val
backStackSizeCondition
=
childRouter
.
backstackSize
<
2
val
backStackResult
=
childRouter
.
handleBack
()
if
(
backStackResult
&&
backStackSizeCondition
)
return
backStackResult
}
else
{
Log
.
e
(
TAG
,
"handleBack called with getChildRouter(currentlySelectedItemId) == null."
,
IllegalStateException
(
"handleBack called with getChildRouter(currentlySelectedItemId) == null."
))
}
return
false
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/util/extensions/ext.kt
View file @
f6587b74
package
com.biganto.visual.roompark.util.extensions
import
android.view.View
import
java.text.DecimalFormat
/**
...
...
@@ -37,3 +38,8 @@ fun Float.format(fracDigits: Int): String {
df
.
maximumFractionDigits
=
fracDigits
return
df
.
format
(
this
)
}
fun
View
.
setGone
(
isGone
:
Boolean
){
this
.
visibility
=
if
(
isGone
)
View
.
GONE
else
View
.
VISIBLE
}
\ No newline at end of file
app/src/main/res/layout/feed_direct_viewholder.xml
View file @
f6587b74
...
...
@@ -4,8 +4,7 @@
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"
>
android:layout_height=
"wrap_content"
>
<com.biganto.visual.roompark.util.view_utils.image_view.RoundedImageView
android:id=
"@+id/imageHolder"
...
...
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