Commit 2be61372 authored by lfdi-user's avatar lfdi-user
Browse files

Bugfix aus der Community. Danke!

parent 0f0a0cd7
...@@ -166,34 +166,36 @@ class MastodonFragment : Fragment() { ...@@ -166,34 +166,36 @@ class MastodonFragment : Fragment() {
} }
} }
private fun showErrorNotification(errorMsg : String) { private fun showErrorNotification(errorMsg: String) {
Snackbar.make(requireContext(), requireView(), errorMsg, Snackbar.LENGTH_LONG).apply { view?.let {
val view = this.view Snackbar.make(requireContext(), it, errorMsg, Snackbar.LENGTH_LONG).apply {
val params = view.layoutParams as FrameLayout.LayoutParams val view = this.view
params.gravity = Gravity.TOP val params = view.layoutParams as FrameLayout.LayoutParams
this.view.layoutParams = params params.gravity = Gravity.TOP
view.setOnClickListener { this.view.layoutParams = params
scrollToPosition(0) view.setOnClickListener {
this.dismiss() scrollToPosition(0)
this.dismiss()
}
show()
} }
show()
} }
} }
private fun showNewItemsNotification() { private fun showNewItemsNotification() {
newItemsSnackBar = Snackbar.make(requireContext(), requireView(), getString(R.string.mastodon_new_entries), Snackbar.LENGTH_INDEFINITE).apply { newItemsSnackBar = view?.let {
setAction(R.string.mastodon_new_entries_action) { Snackbar.make(requireContext(), it, getString(R.string.mastodon_new_entries), Snackbar.LENGTH_INDEFINITE).apply {
scrollToPosition(0) setAction(R.string.mastodon_new_entries_action) {
newItemsSnackBar?.dismiss() scrollToPosition(0)
newItemsSnackBar = null newItemsSnackBar?.dismiss()
newItemsSnackBar = null
}
val view = this.view
val params = view.layoutParams as FrameLayout.LayoutParams
params.gravity = Gravity.TOP
this.view.layoutParams = params
show()
} }
val view = this.view
val params = view.layoutParams as FrameLayout.LayoutParams
params.gravity = Gravity.TOP
this.view.layoutParams = params
show()
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment