Skip to content

Commit

Permalink
[#980] Fix SnackBar (#981)
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafaozhan authored Aug 21, 2022
1 parent 227ae8d commit be65e42
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions android/src/main/kotlin/com/oztechan/ccc/android/util/SnackBar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,29 @@ fun View?.showSnack(
Logger.i { "Snackbar action click" }
action?.invoke()
}
setBackgroundColor(ContextCompat.getColor(context, R.color.color_background_snack_bar))
view.apply {
setBackgroundColor(ContextCompat.getColor(context, R.color.color_background_snack_bar))

findViewById<TextView>(R.id.snackbar_text)?.apply {
gravity = Gravity.CENTER
findViewById<TextView>(R.id.snackbar_text)?.apply {
gravity = Gravity.CENTER

ContextCompat.getDrawable(context, icon ?: R.drawable.ic_dialog_and_snackbar)?.apply {
setBounds(
0,
0,
resources.getDimensionPixelSize(R.dimen.snack_icon_size),
resources.getDimensionPixelSize(R.dimen.snack_icon_size)
)
}?.let { drawable ->
setCompoundDrawables(drawable, null, null, null)
compoundDrawablePadding = resources.getDimensionPixelSize(R.dimen.margin_eight)
ContextCompat.getDrawable(context, icon ?: R.drawable.ic_dialog_and_snackbar)?.apply {
setBounds(
0,
0,
resources.getDimensionPixelSize(R.dimen.snack_icon_size),
resources.getDimensionPixelSize(R.dimen.snack_icon_size)
)
}?.let { drawable ->
setCompoundDrawables(drawable, null, null, null)
compoundDrawablePadding = resources.getDimensionPixelSize(R.dimen.margin_eight)
}
}
}

findViewById<TextView>(R.id.snackbar_action)?.apply {
setTypeface(null, Typeface.BOLD)
setTextColor(ContextCompat.getColor(context, R.color.color_text_action_snack_bar))
findViewById<TextView>(R.id.snackbar_action)?.apply {
setTypeface(null, Typeface.BOLD)
setTextColor(ContextCompat.getColor(context, R.color.color_text_action_snack_bar))
}
}
}.show()
}
Expand Down

0 comments on commit be65e42

Please sign in to comment.