From 513795fdf80bd218a1cb687169f4d5daf0bfc4c7 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 10 Nov 2017 20:18:47 +0100 Subject: [PATCH] use view context instead activity to show toast in ConversationFragment --- .../java/eu/siacs/conversations/ui/ConversationFragment.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index ddb70515c..e8972b9f4 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -137,8 +137,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa } @Override - public void onScroll(AbsListView view, int firstVisibleItem, - int visibleItemCount, int totalItemCount) { + public void onScroll(final AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { synchronized (ConversationFragment.this.messageList) { if (firstVisibleItem < 5 && conversation != null && conversation.messagesLoaded.compareAndSet(true,false) && messageList.size() > 0) { long timestamp; @@ -198,7 +197,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa if (ConversationFragment.this.conversation != conversation) { return; } - messageLoaderToast = Toast.makeText(activity, resId, Toast.LENGTH_LONG); + messageLoaderToast = Toast.makeText(view.getContext(), resId, Toast.LENGTH_LONG); messageLoaderToast.show(); } });