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
ea5ca6cf
Commit
ea5ca6cf
authored
Jan 21, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
expanded toolbar methods and incapsulate logic
parent
3cf70f8e
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
94 additions
and
22 deletions
+94
-22
RoomParkMainActivity.kt
.../com/biganto/visual/roompark/base/RoomParkMainActivity.kt
+49
-3
TopBar.kt
app/src/main/java/com/biganto/visual/roompark/base/TopBar.kt
+14
-0
ScreenController.kt
...ual/roompark/presentation/screen/deal/ScreenController.kt
+4
-16
ScreenController.kt
...al/roompark/presentation/screen/deals/ScreenController.kt
+8
-1
ScreenController.kt
...al/roompark/presentation/screen/feeds/ScreenController.kt
+3
-1
ext.kt
...n/java/com/biganto/visual/roompark/util/extensions/ext.kt
+0
-1
bell_switch_view.xml
app/src/main/res/layout/bell_switch_view.xml
+1
-0
status_layout_toolbar.xml
app/src/main/res/layout/status_layout_toolbar.xml
+13
-0
strings.xml
app/src/main/res/values/strings.xml
+2
-0
No files found.
app/src/main/java/com/biganto/visual/roompark/base/RoomParkMainActivity.kt
View file @
ea5ca6cf
...
...
@@ -6,11 +6,13 @@ import android.view.ViewGroup
import
android.widget.LinearLayout
import
androidx.appcompat.widget.Toolbar
import
androidx.coordinatorlayout.widget.CoordinatorLayout
import
androidx.core.view.isGone
import
butterknife.BindView
import
butterknife.ButterKnife
import
com.biganto.visual.roompark.BuildConfig
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.presentation.screen.splash.SplashScreenController
import
com.biganto.visual.roompark.util.extensions.setGone
import
com.biganto.visual.roompark.util.view_utils.app_bar.DragControlAppBarLayoutBehaviour
import
com.bluelinelabs.conductor.Conductor
import
com.bluelinelabs.conductor.Router
...
...
@@ -18,8 +20,10 @@ import com.bluelinelabs.conductor.RouterTransaction
import
com.crashlytics.android.Crashlytics
import
com.google.android.material.appbar.AppBarLayout
import
com.google.android.material.bottomnavigation.BottomNavigationView
import
com.google.android.material.textview.MaterialTextView
import
io.fabric.sdk.android.Fabric
import
kotlinx.android.synthetic.main.activity_main.*
import
kotlinx.android.synthetic.main.status_layout_toolbar.view.*
import
timber.log.Timber
class
RoomParkMainActivity
(
...
...
@@ -74,12 +78,53 @@ class RoomParkMainActivity(
conductor_container
.
requestLayout
()
}
override
val
statusToolbar
:
ViewGroup
get
()
=
tbContainer
.
findViewById
<
ViewGroup
>
(
R
.
id
.
status_toolbar_container
)
get
()
=
tbContainer
.
findViewById
(
R
.
id
.
status_toolbar_container
)
override
val
headerToolbar
:
ViewGroup
get
()
=
tbContainer
.
findViewById
<
ViewGroup
>(
R
.
id
.
switch_toolbar_container
)
get
()
=
tbContainer
.
findViewById
(
R
.
id
.
switch_toolbar_container
)
override
val
headerToolbarBack
get
()
=
headerToolbar
.
findViewById
<
MaterialTextView
>(
R
.
id
.
back_button_chevron
)
override
fun
setToolbar
(
header
:
HeaderToolbarModel
?,
status
:
StatusToolbarModel
?){
headerToolbar
.
setGone
(
header
==
null
)
statusToolbar
.
setGone
(
status
==
null
)
header
?.
let
{
headerToolbarBack
.
setGone
(
it
.
backButton
)
headerToolbarBack
.
text
=
it
.
backTitle
?:
""
headerToolbar
.
findViewById
<
MaterialTextView
>(
R
.
id
.
toolbar_title
).
text
=
it
.
title
?:
""
headerToolbar
.
findViewById
<
ViewGroup
>(
R
.
id
.
bell_container
).
setGone
(
it
.
switcher
?:
false
)
}
status
?.
let
{
statusToolbar
.
status_icon
.
setGone
(
it
.
state
==
null
)
statusToolbar
.
status_title
.
setGone
(
it
.
state
==
null
)
it
.
state
?.
let
{
state
->
statusToolbar
.
status_icon
.
isEnabled
=
when
(
state
){
StatusState
.
AVALIABLE
->
true
else
->
false
}
statusToolbar
.
status_title
.
text
=
when
(
state
){
StatusState
.
AVALIABLE
->
resources
.
getString
(
R
.
string
.
estate_avalibale
)
StatusState
.
SOLD_OUT
->
resources
.
getString
(
R
.
string
.
estate_sold_out
)
}
}
statusToolbar
.
status_title
.
setGone
(
it
.
title
==
null
)
it
.
title
?.
let
{
title
->
statusToolbar
.
status_title
.
text
=
title
}
}
headerToolbar
.
requestLayout
()
statusToolbar
.
requestLayout
()
val
params
=
topAppBar
.
layoutParams
as
AppBarLayout
.
LayoutParams
val
toolbarHeight
=
if
(!
headerToolbar
.
isGone
)
headerToolbar
.
height
else
0
+
if
(!
statusToolbar
.
isGone
)
statusToolbar
.
height
else
0
params
.
height
=
toolbarHeight
topAppBar
.
layoutParams
=
params
topAppBar
.
requestLayout
()
}
override
fun
hide
()
{
...
...
@@ -118,3 +163,4 @@ class RoomParkMainActivity(
}
}
}
app/src/main/java/com/biganto/visual/roompark/base/TopBar.kt
View file @
ea5ca6cf
...
...
@@ -5,6 +5,7 @@ import androidx.appcompat.widget.Toolbar
import
androidx.coordinatorlayout.widget.CoordinatorLayout
import
com.google.android.material.appbar.AppBarLayout
import
com.google.android.material.bottomnavigation.BottomNavigationView
import
com.google.android.material.textview.MaterialTextView
/**
* Created by Vladislav Bogdashkin on 26.09.2019.
...
...
@@ -23,6 +24,8 @@ interface ICollapsingToolBar : ISupportActionBar{
fun
appBarScrollable
(
allow
:
Boolean
)
val
statusToolbar
:
ViewGroup
val
headerToolbar
:
ViewGroup
val
headerToolbarBack
:
MaterialTextView
?
fun
setToolbar
(
header
:
HeaderToolbarModel
?
=
null
,
status
:
StatusToolbarModel
?
=
null
)
}
interface
IConductorActivity
{
...
...
@@ -34,3 +37,14 @@ interface IBottomNavigation{
fun
hide
()
fun
show
()
}
data class
HeaderToolbarModel
(
val
backButton
:
Boolean
,
val
backTitle
:
String
?
,
val
title
:
String
?
,
val
switcher
:
Boolean
?
=
null
)
data class
StatusToolbarModel
(
val
state
:
StatusState
?,
val
title
:
String
?)
enum
class
StatusState
{
AVALIABLE
,
SOLD_OUT
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/deal/ScreenController.kt
View file @
ea5ca6cf
...
...
@@ -7,13 +7,13 @@ import android.widget.LinearLayout
import
androidx.core.os.bundleOf
import
butterknife.BindView
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.base.HeaderToolbarModel
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.toRubly
import
com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressAnimationState
import
com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil
import
com.google.android.material.appbar.AppBarLayout
import
com.google.android.material.textview.MaterialTextView
import
timber.log.Timber
import
javax.inject.Inject
...
...
@@ -74,21 +74,9 @@ class DealScreenController :
Timber
.
d
(
"content insets : ${toolBar.topAppBar.contentInsetEnd}"
)
activity
?.
actionBar
?.
setDisplayShowTitleEnabled
(
false
)
toolBar
.
statusToolbar
.
visibility
=
View
.
GONE
toolBar
.
headerToolbar
.
visibility
=
View
.
VISIBLE
toolBar
.
headerToolbar
.
findViewById
<
MaterialTextView
>(
R
.
id
.
toolbar_title
).
text
=
"Кв. 1231\n42342"
val
params
=
toolBar
.
topAppBar
.
layoutParams
as
AppBarLayout
.
LayoutParams
resources
?.
displayMetrics
?.
density
?.
let
{
params
.
height
=
toolBar
.
headerToolbar
.
height
Timber
.
d
(
"density: $it"
)
// params.height = (24f*it).toInt()
Timber
.
d
(
"density: ${params.height}"
)
}
?:
error
(
"resources not available!"
)
toolBar
.
topAppBar
.
layoutParams
=
params
toolBar
.
topAppBar
.
requestLayout
()
toolBar
.
topAppBar
.
invalidate
()
toolBar
.
setToolbar
(
HeaderToolbarModel
(
true
,
"МОИ\nСДЕЛКИ"
,
null
,
null
))
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/deals/ScreenController.kt
View file @
ea5ca6cf
...
...
@@ -5,6 +5,7 @@ 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.HeaderToolbarModel
import
com.biganto.visual.roompark.base.RoomParkApplication
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.conductor.BigantoBaseController
...
...
@@ -51,12 +52,18 @@ class DealsScreenController :
private
fun
setToolbar
(){
toolBar
.
showAll
()
toolBar
.
appBar
.
setExpanded
(
false
,
tru
e
)
toolBar
.
appBar
.
setExpanded
(
false
,
fals
e
)
toolBar
.
topAppBar
.
title
=
"МОИ СДЕЛКИ"
toolBar
.
appBar
.
liftOnScrollTargetViewId
=
R
.
id
.
favorites_cards_recycler_view
toolBar
.
appBar
.
setLiftable
(
true
)
toolBar
.
appBarScrollable
(
false
)
dealsRecyclerView
.
isNestedScrollingEnabled
=
false
toolBar
.
setToolbar
(
HeaderToolbarModel
(
false
,
null
,
"ИЗБРАННОЕ"
,
null
)
)
}
@Inject
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/ScreenController.kt
View file @
ea5ca6cf
...
...
@@ -139,7 +139,9 @@ class FeedsScreenController :
.
map
{
storedFeedsList
[
it
.
position
]
}
override
fun
onViewBound
(
v
:
View
)
{
toolBar
.
hideAll
()
// toolBar.hideAll()
toolBar
.
setToolbar
()
bindRecycler
()
}
...
...
app/src/main/java/com/biganto/visual/roompark/util/extensions/ext.kt
View file @
ea5ca6cf
...
...
@@ -47,7 +47,6 @@ fun Long.bytesToSize():String{
}
}
fun
Float
.
format
(
fracDigits
:
Int
):
String
{
val
df
=
DecimalFormat
()
df
.
maximumFractionDigits
=
fracDigits
...
...
app/src/main/res/layout/bell_switch_view.xml
View file @
ea5ca6cf
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:id=
"@+id/bell_container"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
...
...
app/src/main/res/layout/status_layout_toolbar.xml
View file @
ea5ca6cf
...
...
@@ -34,6 +34,19 @@
app:layout_constraintStart_toEndOf=
"@+id/status_icon"
app:layout_constraintTop_toTopOf=
"@+id/status_icon"
/>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/mean_title"
android:fitsSystemWindows=
"true"
style=
"@style/Accent_Minor_TextView"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"8dp"
android:text=
"СВОБОДНА"
app:layout_constraintBottom_toBottomOf=
"@+id/status_icon"
app:layout_constraintStart_toEndOf=
"@+id/status_icon"
app:layout_constraintTop_toTopOf=
"@+id/status_icon"
/>
<ImageView
android:id=
"@+id/back_cross"
android:layout_width=
"24dp"
...
...
app/src/main/res/values/strings.xml
View file @
ea5ca6cf
...
...
@@ -76,6 +76,8 @@
<string
name=
"feeds_cache"
>
Новости и заметки
</string>
<string
name=
"albums_cache"
>
Фотографии
</string>
<string
name=
"overall_cache"
>
Всего скачано
</string>
<string
name=
"estate_avalibale"
>
СВОБОДНА
</string>
<string
name=
"estate_sold_out"
>
ПРОДАНА
</string>
<!--endregion-->
</resources>
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