use view context instead activity to show toast in ConversationFragment

This commit is contained in:
Daniel Gultsch 2017-11-10 20:18:47 +01:00
parent d6eb08e0ed
commit 513795fdf8

View file

@ -137,8 +137,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
} }
@Override @Override
public void onScroll(AbsListView view, int firstVisibleItem, public void onScroll(final AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
int visibleItemCount, int totalItemCount) {
synchronized (ConversationFragment.this.messageList) { synchronized (ConversationFragment.this.messageList) {
if (firstVisibleItem < 5 && conversation != null && conversation.messagesLoaded.compareAndSet(true,false) && messageList.size() > 0) { if (firstVisibleItem < 5 && conversation != null && conversation.messagesLoaded.compareAndSet(true,false) && messageList.size() > 0) {
long timestamp; long timestamp;
@ -198,7 +197,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
if (ConversationFragment.this.conversation != conversation) { if (ConversationFragment.this.conversation != conversation) {
return; return;
} }
messageLoaderToast = Toast.makeText(activity, resId, Toast.LENGTH_LONG); messageLoaderToast = Toast.makeText(view.getContext(), resId, Toast.LENGTH_LONG);
messageLoaderToast.show(); messageLoaderToast.show();
} }
}); });