-
Notifications
You must be signed in to change notification settings - Fork 731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[New Layout] Adds peek height (min height) to new layout bottom sheets #7103
[New Layout] Adds peek height (min height) to new layout bottom sheets #7103
Conversation
import androidx.annotation.FloatRange | ||
import com.google.android.material.bottomsheet.BottomSheetDialog | ||
|
||
@Suppress("DEPRECATION") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WindowManager. defaultDisplay
and getMetrics
are deprecated in 30. Could you add API 30 implementation? And also, please, use suppress on a line, where it's needed, not on whole function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some non blocking remarks, but that would deserved to be handled at some point.
} else { | ||
setPeekHeightPreApi30(percentage) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather create an extension getScreenheightPx()
to get the Window height, which will be more reusable.
Then just call
val height = window?.getScreenheightPx()
behavior.setPeekHeight((height * percentage).toInt(), true)
here.
We have some equivalent code at this point: https://github.com/vector-im/element-android/blob/main/vector/src/main/java/im/vector/app/features/roomprofile/uploads/media/RoomUploadsMediaFragment.kt#L86
It would deserve a quick refactor to extract useful and reusable and compatible extensions, in the package im.vector.app.core.extensions
. Happy to do it later if you do not have time.
return super.onCreateDialog(savedInstanceState).apply { | ||
(this as BottomSheetDialog).setPeekHeightAsScreenPercentage(0.5f) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All those new BottomSheet should extend VectorBaseBottomSheetDialogFragment
, for analytics support and common behavior. This specific treatment could then be moved to the parent, to avoid code duplication.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to make the changes 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
…ape-bottom-sheet-peek # Conflicts: # vector/src/main/java/im/vector/app/features/home/room/list/home/NewChatBottomSheet.kt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
SonarCloud Quality Gate failed. |
Type of change
Content
Adds peek height to new layout bottom sheets so they don't show at heights smaller than they should be
Motivation and context
Fixes #7027
Screenshots / GIFs
Tests
Tested devices
Checklist