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

Bugfix aus der Community. Danke!

parent 0f0a0cd7
......@@ -166,8 +166,9 @@ class MastodonFragment : Fragment() {
}
}
private fun showErrorNotification(errorMsg : String) {
Snackbar.make(requireContext(), requireView(), errorMsg, Snackbar.LENGTH_LONG).apply {
private fun showErrorNotification(errorMsg: String) {
view?.let {
Snackbar.make(requireContext(), it, errorMsg, Snackbar.LENGTH_LONG).apply {
val view = this.view
val params = view.layoutParams as FrameLayout.LayoutParams
params.gravity = Gravity.TOP
......@@ -179,23 +180,24 @@ class MastodonFragment : Fragment() {
show()
}
}
}
private fun showNewItemsNotification() {
newItemsSnackBar = Snackbar.make(requireContext(), requireView(), getString(R.string.mastodon_new_entries), Snackbar.LENGTH_INDEFINITE).apply {
newItemsSnackBar = view?.let {
Snackbar.make(requireContext(), it, getString(R.string.mastodon_new_entries), Snackbar.LENGTH_INDEFINITE).apply {
setAction(R.string.mastodon_new_entries_action) {
scrollToPosition(0)
newItemsSnackBar?.dismiss()
newItemsSnackBar = null
}
val view = this.view
val params = view.layoutParams as FrameLayout.LayoutParams
params.gravity = Gravity.TOP
this.view.layoutParams = params
show()
}
}
}
/**
* Scroll to given position.
......
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