Skip to content
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

Correctly stops BottomSheet when expanded in PreviewSlider #683

Merged
merged 2 commits into from
Mar 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import kotlinx.android.synthetic.main.view_file_info_actions.view.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import kotlin.math.max

class PreviewSliderFragment : Fragment(), FileInfoActionsView.OnItemClickListener {

Expand Down Expand Up @@ -284,10 +285,10 @@ class PreviewSliderFragment : Fragment(), FileInfoActionsView.OnItemClickListene
with(windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())) {
header?.setMargin(top = top, right = right, left = left)
bottomSheetBehavior.peekHeight = getDefaultPeekHeight() + bottom
bottomSheetBehavior.expandedOffset = top
bottomSheetBehavior.expandedOffset = max(top, height - bottomSheetFileInfos.height)
/* Add padding to the bottom to allow the last element of the list to be displayed right over the
android navigation bar, bottom makes the element half hidden under nav bar so we need top + bottom */
bottomSheetFileInfos.setPadding(0, 0, 0, top + bottom)
bottomSheetFileInfos.setPadding(0, 0, 0, bottom)
}

windowInsets
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_preview_slider.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
android:id="@+id/bottomSheetFileInfos"
style="?attr/bottomSheetStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="@string/bottom_sheet_behavior" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>