Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-194
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2021–194
2021-194
Commits
651093dc
Commit
651093dc
authored
Sep 11, 2021
by
it17166348@my.sliit.lk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add BottomNavigationBehavior
parent
eb17b1df
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
0 deletions
+50
-0
app/src/main/java/com/sliit/smartserviceassistant/BottomNavigationBehavior.java
...sliit/smartserviceassistant/BottomNavigationBehavior.java
+50
-0
No files found.
app/src/main/java/com/sliit/smartserviceassistant/BottomNavigationBehavior.java
0 → 100644
View file @
651093dc
package
com.sliit
;
import
android.content.Context
;
import
com.google.android.material.bottomnavigation.BottomNavigationView
;
import
androidx.coordinatorlayout.widget.CoordinatorLayout
;
import
androidx.core.view.ViewCompat
;
import
android.util.AttributeSet
;
import
android.view.View
;
import
android.widget.FrameLayout
;
public
class
BottomNavigationBehavior
extends
CoordinatorLayout
.
Behavior
<
BottomNavigationView
>
{
public
BottomNavigationBehavior
()
{
super
();
}
public
BottomNavigationBehavior
(
Context
context
,
AttributeSet
attrs
)
{
super
(
context
,
attrs
);
}
@Override
public
boolean
layoutDependsOn
(
CoordinatorLayout
parent
,
BottomNavigationView
child
,
View
dependency
)
{
boolean
dependsOn
=
dependency
instanceof
FrameLayout
;
return
dependsOn
;
}
@Override
public
boolean
onStartNestedScroll
(
CoordinatorLayout
coordinatorLayout
,
BottomNavigationView
child
,
View
directTargetChild
,
View
target
,
int
nestedScrollAxes
)
{
return
nestedScrollAxes
==
ViewCompat
.
SCROLL_AXIS_VERTICAL
;
}
@Override
public
void
onNestedPreScroll
(
CoordinatorLayout
coordinatorLayout
,
BottomNavigationView
child
,
View
target
,
int
dx
,
int
dy
,
int
[]
consumed
)
{
if
(
dy
<
0
)
{
showBottomNavigationView
(
child
);
}
else
if
(
dy
>
0
)
{
hideBottomNavigationView
(
child
);
}
}
private
void
hideBottomNavigationView
(
BottomNavigationView
view
)
{
view
.
animate
().
translationY
(
view
.
getHeight
());
}
private
void
showBottomNavigationView
(
BottomNavigationView
view
)
{
view
.
animate
().
translationY
(
0
);
}
}
\ No newline at end of file
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