Skip to content

Commit

Permalink
fix remove record snackbar not anchoring to fab button
Browse files Browse the repository at this point in the history
  • Loading branch information
Razeeman committed Jul 6, 2024
1 parent 30f596e commit 4a6085c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,8 @@ class NotificationResolverImpl @Inject constructor(
maxLines = 5
}

snackBar.view.apply {
post {
setMargins(
top = data.margins.top,
bottom = data.margins.bottom,
start = data.margins.left,
end = data.margins.right,
)
}
if (data.marginBottomDp != null) {
snackBar.view.apply { post { setMargins(bottom = data.marginBottomDp) } }
}

if (anchor is View) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ class SharingInteractor @Inject constructor(
private fun showMessage(stringResId: Int) {
val params = SnackBarParams(
message = resourceRepo.getString(stringResId),
margins = SnackBarParams.Margins(
bottom = resourceRepo.getDimenInDp(R.dimen.button_height),
),
marginBottomDp = resourceRepo.getDimenInDp(R.dimen.button_height),
)
router.show(params)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ class SnackBarMessageNavigationInteractor @Inject constructor(
val params = SnackBarParams(
message = resourceRepo.getString(stringResId),
duration = SnackBarParams.Duration.Short,
margins = SnackBarParams.Margins(
bottom = resourceRepo.getDimenInDp(R.dimen.button_height),
),
marginBottomDp = resourceRepo.getDimenInDp(R.dimen.button_height),
)
router.show(params)
}
Expand All @@ -31,9 +29,7 @@ class SnackBarMessageNavigationInteractor @Inject constructor(
val params = SnackBarParams(
message = message,
duration = SnackBarParams.Duration.Long,
margins = SnackBarParams.Margins(
bottom = resourceRepo.getDimenInDp(R.dimen.button_height),
),
marginBottomDp = resourceRepo.getDimenInDp(R.dimen.button_height),
actionText = resourceRepo.getString(R.string.settings_archive),
actionListener = {
router.navigate(ArchiveParams)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,7 @@ class ArchiveViewModel @Inject constructor(
val params = SnackBarParams(
message = string,
duration = SnackBarParams.Duration.Short,
margins = SnackBarParams.Margins(
bottom = resourceRepo.getDimenInDp(R.dimen.button_height),
),
marginBottomDp = resourceRepo.getDimenInDp(R.dimen.button_height),
)
router.show(params)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ data class SnackBarParams(
val dismissedListener: ((TAG?) -> Unit)? = null,
val actionText: String = "",
val actionListener: ((TAG?) -> Unit)? = null,
val margins: Margins = Margins(),
val marginBottomDp: Int? = null,
val inDialog: Boolean = false,
) : NotificationParams {

Expand All @@ -22,11 +22,4 @@ data class SnackBarParams(
object Long : Duration
object Indefinite : Duration
}

data class Margins(
val left: Int? = null,
val top: Int? = null,
val right: Int? = null,
val bottom: Int? = null,
)
}

0 comments on commit 4a6085c

Please sign in to comment.