Skip to content

Commit

Permalink
Removing animateLayoutChanges since it's breaking the BottomSheet (kn…
Browse files Browse the repository at this point in the history
…own BottomSheet bug)
  • Loading branch information
tevincent committed Oct 4, 2024
1 parent a5fb4b7 commit 91170b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.view.isVisible
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.infomaniak.drive.BuildConfig
import com.infomaniak.drive.data.models.UiSettings
Expand All @@ -39,6 +41,8 @@ class BackgroundSyncPermissionsBottomSheetDialog : BottomSheetDialogFragment() {
private var hasDoneNecessary = false
private var hadBatteryLifePermission = false

private val bottomSheetBehavior by lazy { (dialog as BottomSheetDialog).behavior }

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
return FragmentBottomSheetBackgroundSyncBinding.inflate(inflater, container, false).also { binding = it }.root
}
Expand Down Expand Up @@ -78,6 +82,8 @@ class BackgroundSyncPermissionsBottomSheetDialog : BottomSheetDialogFragment() {
private fun onHasBatteryPermission(hasBatteryPermission: Boolean) {
hadBatteryLifePermission = hasBatteryPermission
showManufacturerWarning(hasBatteryPermission)

if (hasBatteryPermission) bottomSheetBehavior.state = BottomSheetBehavior.STATE_EXPANDED
}

private fun showManufacturerWarning(hasBatteryPermission: Boolean) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.bottomSheetDialogs.CategoryInfoActionsBottomSheetDialog">
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"
tools:context=".ui.bottomSheetDialogs.BackgroundSyncPermissionsBottomSheetDialog">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:paddingHorizontal="@dimen/marginStandard"
tools:background="@color/appBar">

Expand Down

0 comments on commit 91170b9

Please sign in to comment.