aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2017-11-17 21:00:01 +0100
committerDaniel Gultsch <daniel@gultsch.de>2017-11-17 21:00:01 +0100
commite452d5d46d584875ba17623b9d6047ae07a6d522 (patch)
treeaea7e26a5af663e4a5ffff1448fe493045ec6975
parenta2d4ec46ba938da12a6091c34306d524dfacfa72 (diff)
stop scrolling before changing conversations. fixes #2700
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConversationActivity.java6
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConversationFragment.java8
2 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
index 1357cf4..f8f5159 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
@@ -139,6 +139,9 @@ public class ConversationActivity extends XmppActivity
}
public void showConversationsOverview() {
+ if (mConversationFragment != null) {
+ mConversationFragment.stopScrolling();
+ }
if (mContentView instanceof SlidingPaneLayout) {
SlidingPaneLayout mSlidingPaneLayout = (SlidingPaneLayout) mContentView;
mShouldPanelBeOpen.set(true);
@@ -222,6 +225,7 @@ public class ConversationActivity extends XmppActivity
public void onItemClick(AdapterView<?> arg0, View clickedView,
int position, long arg3) {
if (getSelectedConversation() != conversationList.get(position)) {
+ ConversationActivity.this.mConversationFragment.stopScrolling();
setSelectedConversation(conversationList.get(position));
ConversationActivity.this.mConversationFragment.reInit(getSelectedConversation());
conversationWasSelectedByKeyboard = false;
@@ -1110,6 +1114,7 @@ public class ConversationActivity extends XmppActivity
private boolean openConversationByIndex(int index) {
try {
this.conversationWasSelectedByKeyboard = true;
+ this.mConversationFragment.stopScrolling();
setSelectedConversation(this.conversationList.get(index));
this.mConversationFragment.reInit(getSelectedConversation());
if (index > listView.getLastVisiblePosition() - 1 || index < listView.getFirstVisiblePosition() + 1) {
@@ -1328,6 +1333,7 @@ public class ConversationActivity extends XmppActivity
final String text = intent.getStringExtra(TEXT);
final String nick = intent.getStringExtra(NICK);
final boolean pm = intent.getBooleanExtra(PRIVATE_MESSAGE, false);
+ this.mConversationFragment.stopScrolling();
if (selectConversationByUuid(uuid)) {
this.mConversationFragment.reInit(getSelectedConversation());
if (nick != null) {
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
index e8972b9..eec30ff 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
@@ -11,6 +11,7 @@ import android.content.Intent;
import android.content.IntentSender.SendIntentException;
import android.os.Bundle;
import android.os.Handler;
+import android.os.SystemClock;
import android.support.v13.view.inputmethod.InputConnectionCompat;
import android.support.v13.view.inputmethod.InputContentInfoCompat;
import android.text.Editable;
@@ -25,6 +26,7 @@ import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MenuItem;
+import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
@@ -1425,6 +1427,12 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
}
}
+ public void stopScrolling() {
+ long now = SystemClock.uptimeMillis();
+ MotionEvent cancel = MotionEvent.obtain(now, now, MotionEvent.ACTION_CANCEL, 0, 0, 0);
+ messagesView.dispatchTouchEvent(cancel);
+ }
+
private boolean showLoadMoreMessages(final Conversation c) {
final boolean mam = hasMamSupport(c);
final MessageArchiveService service = activity.xmppConnectionService.getMessageArchiveService();