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
2a2cec7c
Commit
2a2cec7c
authored
3 years ago
by
Adrien Béraud
Committed by
Maxime Callet
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
call: cleanup bottomsheet behavior
Change-Id: I776f67aff5a97591e85c6b488ba810b4dee7a9a3
parent
2fd6c014
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
ring-android/app/src/main/java/cx/ring/fragments/CallFragment.kt
+17
-14
17 additions, 14 deletions
...droid/app/src/main/java/cx/ring/fragments/CallFragment.kt
with
17 additions
and
14 deletions
ring-android/app/src/main/java/cx/ring/fragments/CallFragment.kt
+
17
−
14
View file @
2a2cec7c
...
...
@@ -970,15 +970,14 @@ class CallFragment : BaseSupportFragment<CallPresenter, CallView>(), CallView,
*/
private
fun
setBottomSheet
(
newInset
:
WindowInsetsCompat
?
=
null
)
{
val
binding
=
binding
?:
return
val
bsView
=
binding
.
callOptionsBottomSheet
val
bsHeight
=
binding
.
constraintBsContainer
.
height
if
(
isInPIP
||
!
bsView
.
isVisible
)
return
val
dm
=
resources
.
displayMetrics
val
density
=
dm
.
density
val
heightPixels
=
dm
.
heightPixels
val
screenHeight
=
binding
.
callCoordinatorOptionContainer
.
height
val
gridViewHeight
=
binding
.
callParametersGrid
.
height
val
bsView
=
binding
.
callOptionsBottomSheet
val
bsHeight
=
binding
.
constraintBsContainer
.
height
if
(
isInPIP
||
!
bsView
.
isVisible
)
return
val
land
=
resources
.
configuration
.
orientation
==
Configuration
.
ORIENTATION_LANDSCAPE
// define bottomsheet width based on screen orientation
...
...
@@ -990,18 +989,22 @@ class CallFragment : BaseSupportFragment<CallPresenter, CallView>(), CallView,
val
bottomInsets
=
inset
.
getInsetsIgnoringVisibility
(
WindowInsetsCompat
.
Type
.
navigationBars
()).
bottom
val
topInsets
=
inset
.
getInsetsIgnoringVisibility
(
WindowInsetsCompat
.
Type
.
statusBars
()).
top
val
desiredPeekHeight
=
if
(
land
)
(
10f
*
density
)
+
(
gridViewHeight
/
2
)
else
(
10f
*
density
)
+
(
gridViewHeight
/
2
)
+
bottomInsets
val
halfExpandedRatio
=
((
10f
*
density
)
+
gridViewHeight
+
bottomInsets
)
/
screenHeight
val
fullyExpandedOffset
=
if
(
heightPixels
<=
bsHeight
)
(
50
*
density
).
toInt
()
else
(
screenHeight
-
(
bsHeight
+
bottomInsets
))
val
desiredPeekHeight
=
if
(
land
)
(
10f
*
density
)
+
(
gridViewHeight
/
2f
)
else
(
10f
*
density
)
+
(
gridViewHeight
/
2f
)
+
bottomInsets
val
halfRatio
=
((
10f
*
density
)
+
gridViewHeight
+
bottomInsets
)
/
screenHeight
val
fullyExpandedOffset
=
if
(
screenHeight
<=
bsHeight
+
bottomInsets
)
(
50
*
density
).
toInt
()
else
(
screenHeight
-
bsHeight
-
bottomInsets
)
binding
.
callCoordinatorOptionContainer
.
updatePadding
(
bottom
=
if
(
land
)
0
else
bottomInsets
)
binding
.
callOptionsBottomSheet
.
updatePadding
(
bottom
=
if
(
land
)
(
(
topInsets
-
5
)
*
density
).
toInt
()
else
(
bottomInsets
*
density
).
toInt
()
)
binding
.
callOptionsBottomSheet
.
updatePadding
(
bottom
=
if
(
land
)
(
topInsets
-
(
5
*
density
)
)
.
toInt
()
else
bottomInsets
)
bottomSheetParams
?.
let
{
bs
->
bs
.
expandedOffset
=
fullyExpandedOffset
bs
.
halfExpandedRatio
=
if
(
half
Expanded
Ratio
<
0
||
half
Expanded
Ratio
>
1
)
0.4f
else
half
Expanded
Ratio
bs
.
peekHeight
=
desiredPeekHeight
.
toInt
()
bs
.
saveFlags
=
BottomSheetBehavior
.
SAVE_PEEK_HEIGHT
bottomSheetParams
?.
apply
{
expandedOffset
=
fullyExpandedOffset
halfExpandedRatio
=
if
(
halfRatio
<
=
0
||
halfRatio
>
=
1
)
0.4f
else
halfRatio
peekHeight
=
desiredPeekHeight
.
toInt
()
saveFlags
=
BottomSheetBehavior
.
SAVE_PEEK_HEIGHT
}
}
...
...
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