diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-11-22 19:27:37 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-11-22 19:27:37 +0100 |
commit | 822bfe40481803b2dbe6f874788afbe0c9380145 (patch) | |
tree | 853cf14f71bf165d80f4125898ee8b9567880059 | |
parent | 53b5dfbe16676a314d5929592a118169a61b4085 (diff) |
stop scrolling before changing conversations
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationActivity.java | 6 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationFragment.java | 8 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java index 2e20b6bc4..3205b1439 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java @@ -162,6 +162,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); @@ -253,6 +256,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; @@ -1236,6 +1240,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) { @@ -1503,6 +1508,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/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index 011b0aaf4..7cfaa5b02 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/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; @@ -23,6 +24,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; @@ -1381,6 +1383,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(); |