Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-client-android
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-client-android
Commits
21c3d0b3
Commit
21c3d0b3
authored
1 year ago
by
Pierre Nicolas
Browse files
Options
Downloads
Patches
Plain Diff
smartlist: prevent appbar to collapse when no conversation
GitLab:
#1547
Change-Id: Ie7662171250ba5b0f54215351e1f2684e1e53454
parent
c54d304b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
jami-android/app/src/main/java/cx/ring/fragments/HomeFragment.kt
+17
-4
17 additions, 4 deletions
...droid/app/src/main/java/cx/ring/fragments/HomeFragment.kt
with
17 additions
and
4 deletions
jami-android/app/src/main/java/cx/ring/fragments/HomeFragment.kt
+
17
−
4
View file @
21c3d0b3
...
...
@@ -46,6 +46,7 @@ import androidx.transition.Fade
import
androidx.transition.Slide
import
androidx.transition.TransitionManager
import
com.google.android.material.appbar.AppBarLayout
import
com.google.android.material.appbar.AppBarLayout.Behavior.DragCallback
import
com.google.android.material.dialog.MaterialAlertDialogBuilder
import
cx.ring.R
import
cx.ring.account.AccountWizardActivity
...
...
@@ -362,7 +363,8 @@ class HomeFragment: BaseSupportFragment<HomePresenter, HomeView>(),
(
binding
.
invitationCard
.
invitationGroup
.
layoutParams
as
ViewGroup
.
MarginLayoutParams
)
.
setMargins
(
it
,
it
,
it
,
2
*
it
)
}
// Enable to possibility to scroll the invitation pending list.
// Enable invitation pending list scroll (remove side effect with appbar behavior).
(
binding
.
appBar
.
layoutParams
as
CoordinatorLayout
.
LayoutParams
).
behavior
=
null
// Hide everything unneeded.
...
...
@@ -411,9 +413,8 @@ class HomeFragment: BaseSupportFragment<HomePresenter, HomeView>(),
(
binding
.
invitationCard
.
invitationGroup
.
layoutParams
as
ViewGroup
.
MarginLayoutParams
)
.
setMargins
(
it
,
0
,
it
,
0
)
}
// Disable possibility to scroll the invitation pending list.
(
binding
.
appBar
.
layoutParams
as
CoordinatorLayout
.
LayoutParams
).
behavior
=
AppBarLayout
.
Behavior
()
disableAppBarScroll
()
// Show everything needed.
binding
.
donationCard
.
donationCard
.
isVisible
=
presenter
.
donationCardIsVisible
...
...
@@ -447,6 +448,8 @@ class HomeFragment: BaseSupportFragment<HomePresenter, HomeView>(),
super
.
onViewCreated
(
view
,
savedInstanceState
)
pagerContent
=
mBinding
!!
.
fragmentContainer
.
getFragment
()
disableAppBarScroll
()
// Subscribe on fragmentContainer to add scroll listener on the recycler view.
mBinding
!!
.
fragmentContainer
.
getFragment
<
SmartListFragment
>().
viewLifecycleOwnerLiveData
.
observe
(
viewLifecycleOwner
)
{
...
...
@@ -619,6 +622,16 @@ class HomeFragment: BaseSupportFragment<HomePresenter, HomeView>(),
b
.
searchView
.
hide
()
}
/** Prevent appbar to be collapsed by direct scroll. */
private
fun
disableAppBarScroll
()
{
(
mBinding
!!
.
appBar
.
layoutParams
as
CoordinatorLayout
.
LayoutParams
).
behavior
=
AppBarLayout
.
Behavior
().
apply
{
setDragCallback
(
object
:
DragCallback
()
{
override
fun
canDrag
(
appBarLayout
:
AppBarLayout
):
Boolean
=
false
})
}
}
companion
object
{
private
val
TAG
=
HomeFragment
::
class
.
simpleName
!!
const
val
TAB_CONVERSATIONS
=
0
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment