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
4c2572e7
Commit
4c2572e7
authored
Sep 26, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement top app bar default activity behaviour
parent
c9b24789
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
105 additions
and
9 deletions
+105
-9
RoomParkMainActivity.kt
.../com/biganto/visual/roompark/base/RoomParkMainActivity.kt
+71
-5
TopBar.kt
app/src/main/java/com/biganto/visual/roompark/base/TopBar.kt
+34
-0
BigantoBaseController.kt
...iganto/visual/roompark/conductor/BigantoBaseController.kt
+0
-4
No files found.
app/src/main/java/com/biganto/visual/roompark/base/RoomParkMainActivity.kt
View file @
4c2572e7
package
com.biganto.visual.roompark.base
import
android.os.Bundle
import
android.widget.TextView
import
android.view.View
import
android.view.ViewGroup
import
androidx.appcompat.app.AppCompatActivity
import
androidx.appcompat.widget.Toolbar
import
androidx.coordinatorlayout.widget.CoordinatorLayout
import
butterknife.BindView
import
com.biganto.visual.roompark.BuildConfig
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.di.koin.StartUpData
import
com.biganto.visual.roompark.view_utils.app_bar.DragControlAppBarLayoutBehaviour
import
com.biganto.visual.roompark.view_utils.snackbar.ISnackBarProvider
import
com.bluelinelabs.conductor.Conductor
import
com.bluelinelabs.conductor.Router
import
com.crashlytics.android.Crashlytics
import
com.google.android.material.appbar.AppBarLayout
import
com.google.android.material.appbar.CollapsingToolbarLayout
import
com.google.android.material.bottomnavigation.BottomNavigationView
import
io.fabric.sdk.android.Fabric
import
org.koin.android.scope.currentScope
class
RoomParkMainActivity
:
AppCompatActivity
()
{
class
RoomParkMainActivity
(
)
:
AppCompatActivity
()
,
ICollapsingToolBar
,
IConductorActivity
,
IBottomNavigation
{
lateinit
var
entryText
:
TextView
private
val
entryDate
:
StartUpData
by
currentScope
.
inject
()
private
val
snackbarProvider
:
ISnackBarProvider
by
currentScope
.
inject
()
private
lateinit
var
router
:
Router
@BindView
(
R
.
id
.
top_toolbar
)
override
lateinit
var
topAppBar
:
Toolbar
@BindView
(
R
.
id
.
app_bar
)
override
lateinit
var
appBar
:
AppBarLayout
@BindView
(
R
.
id
.
topToolbarHolder
)
override
lateinit
var
coordinatorLayout
:
CoordinatorLayout
@BindView
(
R
.
id
.
collapsingToolbarLayout
)
override
lateinit
var
collapsingToolbarLayout
:
CollapsingToolbarLayout
@BindView
(
R
.
id
.
conductor_container
)
override
lateinit
var
conductorContainer
:
ViewGroup
@BindView
(
R
.
id
.
bottom_navigation_view
)
override
lateinit
var
bottomNavigation
:
BottomNavigationView
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
setTheme
(
R
.
style
.
AppTheme
)
super
.
onCreate
(
savedInstanceState
)
if
(!
BuildConfig
.
DEBUG
)
Fabric
.
with
(
this
,
Crashlytics
())
setContentView
(
R
.
layout
.
activity_main
)
setSupportActionBar
(
topAppBar
)
router
=
Conductor
.
attachRouter
(
this
,
conductorContainer
,
savedInstanceState
)
snackbarProvider
.
bindRootView
(
rootView
=
coordinatorLayout
)
}
override
fun
displayBackButton
(
show
:
Boolean
)
{
supportActionBar
?.
setDisplayHomeAsUpEnabled
(
show
)
}
override
fun
hideAll
()
{
appBar
.
visibility
=
Toolbar
.
INVISIBLE
bottomNavigation
.
visibility
=
Toolbar
.
GONE
val
params
=
coordinatorLayout
.
layoutParams
as
CoordinatorLayout
.
LayoutParams
params
.
behavior
=
null
coordinatorLayout
.
requestLayout
()
}
override
fun
showAll
()
{
appBar
.
setExpanded
(
false
,
false
)
collapsingToolbarLayout
.
visibility
=
View
.
VISIBLE
bottomNavigation
.
visibility
=
Toolbar
.
VISIBLE
appBar
.
visibility
=
View
.
VISIBLE
topAppBar
.
visibility
=
View
.
VISIBLE
val
params
=
coordinatorLayout
.
layoutParams
as
CoordinatorLayout
.
LayoutParams
params
.
behavior
=
AppBarLayout
.
ScrollingViewBehavior
()
coordinatorLayout
.
requestLayout
()
}
override
fun
appBarScrollable
(
allow
:
Boolean
)
{
val
params
=
appBar
.
layoutParams
as
CoordinatorLayout
.
LayoutParams
val
behavior
=
params
.
behavior
as
DragControlAppBarLayoutBehaviour
behavior
.
allowDrag
=
allow
}
}
app/src/main/java/com/biganto/visual/roompark/base/TopBar.kt
0 → 100644
View file @
4c2572e7
package
com.biganto.visual.roompark.base
import
android.view.ViewGroup
import
androidx.appcompat.widget.Toolbar
import
androidx.coordinatorlayout.widget.CoordinatorLayout
import
com.google.android.material.appbar.AppBarLayout
import
com.google.android.material.appbar.CollapsingToolbarLayout
import
com.google.android.material.bottomnavigation.BottomNavigationView
/**
* Created by Vladislav Bogdashkin on 26.09.2019.
*/
interface
ISupportActionBar
{
val
topAppBar
:
Toolbar
fun
displayBackButton
(
show
:
Boolean
)
fun
hideAll
()
fun
showAll
()
}
interface
ICollapsingToolBar
:
ISupportActionBar
{
val
appBar
:
AppBarLayout
val
coordinatorLayout
:
CoordinatorLayout
val
collapsingToolbarLayout
:
CollapsingToolbarLayout
fun
appBarScrollable
(
allow
:
Boolean
)
}
interface
IConductorActivity
{
val
conductorContainer
:
ViewGroup
}
interface
IBottomNavigation
{
val
bottomNavigation
:
BottomNavigationView
}
app/src/main/java/com/biganto/visual/roompark/conductor/BigantoBaseController.kt
View file @
4c2572e7
...
...
@@ -24,7 +24,6 @@ import io.reactivex.disposables.CompositeDisposable
abstract
class
BigantoBaseController
<
VS
:
BigantoBaseViewState
,
V
:
BigantoBaseContract
<
VS
>,
P
:
MviBasePresenter
<
V
,
VS
>>
:
BigantoMviController
<
V
,
P
>
{
constructor
():
super
()
constructor
(
args
:
Bundle
):
super
(
args
)
...
...
@@ -81,7 +80,6 @@ abstract class BigantoBaseController<VS : BigantoBaseViewState,V: BigantoBaseCon
inputMethodManager
.
hideSoftInputFromWindow
(
this
.
windowToken
,
0
)
}
protected
fun
View
.
showKeyboard
()
{
val
inputMethodManager
=
applicationContext
?.
getSystemService
(
Context
.
INPUT_METHOD_SERVICE
)
as
InputMethodManager
inputMethodManager
.
showSoftInput
(
this
,
0
)
...
...
@@ -98,8 +96,6 @@ abstract class BigantoBaseController<VS : BigantoBaseViewState,V: BigantoBaseCon
protected
val
isTablet
get
()
=
resources
?.
getBoolean
(
R
.
bool
.
isTablet
)
?:
false
protected
val
catalogSpansCount
get
()
=
resources
?.
getInteger
(
R
.
integer
.
catalogSpans
)
?:
1
...
...
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