From 681511379f85b3b01cf548bfb7493c8283e2072d Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Thu, 12 Apr 2018 20:11:16 +0200 Subject: fix jump to first unread message --- .../pixart/messenger/ui/ConversationFragment.java | 77 +++++++++++----------- 1 file changed, 38 insertions(+), 39 deletions(-) (limited to 'src/main/java/de/pixart') diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index e34bebcec..2c8d72aa0 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -2052,11 +2052,11 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke if (this.reInit(conversation, extras != null)) { if (extras != null) { processExtras(extras); - this.reInitRequiredOnStart = false; - } else { - this.reInitRequiredOnStart = true; - pendingExtras.push(extras); } + this.reInitRequiredOnStart = false; + } else { + this.reInitRequiredOnStart = true; + pendingExtras.push(extras); } } @@ -2103,7 +2103,6 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke final int bottom = Math.max(0, this.messageList.size() - 1); final int pos; if (first == null) { - Log.d(Config.LOGTAG, "first unread message was null"); pos = bottom; } else { int i = getIndexOf(first.getUuid(), this.messageList); @@ -2113,48 +2112,48 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke } } + activity.onConversationRead(this.conversation); + //TODO if we only do this when this fragment is running on main it won't *bing* in tablet layout which might be unnecessary since we can *see* it + activity.xmppConnectionService.getNotificationService().setOpenConversation(this.conversation); + gesturesDetector.setOnFingerGestureListener(new SimpleFingerGestures.OnFingerGestureListener() { - @Override - public boolean onSwipeUp(int fingers, long gestureDuration, double gestureDistance) { - return false; - } + @Override + public boolean onSwipeUp(int fingers, long gestureDuration, double gestureDistance) { + return false; + } - @Override - public boolean onSwipeDown(int fingers, long gestureDuration, double gestureDistance) { - return false; - } + @Override + public boolean onSwipeDown(int fingers, long gestureDuration, double gestureDistance) { + return false; + } - @Override - public boolean onSwipeLeft(int fingers, long gestureDuration, double gestureDistance) { - return false; - } + @Override + public boolean onSwipeLeft(int fingers, long gestureDuration, double gestureDistance) { + return false; + } - @Override - public boolean onSwipeRight(int fingers, long gestureDuration, double gestureDistance) { - activity.onBackPressed(); - return false; - } + @Override + public boolean onSwipeRight(int fingers, long gestureDuration, double gestureDistance) { + activity.onBackPressed(); + return false; + } - @Override - public boolean onPinch(int fingers, long gestureDuration, double gestureDistance) { - return false; - } + @Override + public boolean onPinch(int fingers, long gestureDuration, double gestureDistance) { + return false; + } - @Override - public boolean onUnpinch(int fingers, long gestureDuration, double gestureDistance) { - return false; - } + @Override + public boolean onUnpinch(int fingers, long gestureDuration, double gestureDistance) { + return false; + } - @Override - public boolean onDoubleTap(int fingers) { - return false; - } - }); + @Override + public boolean onDoubleTap(int fingers) { + return false; + } + }); this.binding.messagesView.setOnTouchListener(gesturesDetector); - - activity.onConversationRead(this.conversation); - //TODO if we only do this when this fragment is running on main it won't *bing* in tablet layout which might be unnecessary since we can *see* it - activity.xmppConnectionService.getNotificationService().setOpenConversation(this.conversation); return true; } -- cgit v1.2.3