mirror of
https://github.com/moparisthebest/k-9
synced 2025-02-17 07:30:16 -05:00
Make sure swipe gestures only work on the message list
This commit is contained in:
parent
a00626264f
commit
957042a0d0
@ -978,14 +978,14 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
|
||||
|
||||
@Override
|
||||
public void onSwipeRightToLeft(MotionEvent e1, MotionEvent e2) {
|
||||
if (mMessageListFragment != null) {
|
||||
if (mMessageListFragment != null && mDisplayMode != DisplayMode.MESSAGE_VIEW) {
|
||||
mMessageListFragment.onSwipeRightToLeft(e1, e2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSwipeLeftToRight(MotionEvent e1, MotionEvent e2) {
|
||||
if (mMessageListFragment != null) {
|
||||
if (mMessageListFragment != null && mDisplayMode != DisplayMode.MESSAGE_VIEW) {
|
||||
mMessageListFragment.onSwipeLeftToRight(e1, e2);
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ import android.content.Intent;
|
||||
import android.content.SharedPreferences.Editor;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.ConnectivityManager;
|
||||
@ -1495,15 +1496,24 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
||||
* {@code true} if this was an attempt to select (i.e. left to right).
|
||||
*/
|
||||
private void handleSwipe(final MotionEvent downMotion, final boolean selected) {
|
||||
int[] listPosition = new int[2];
|
||||
mListView.getLocationOnScreen(listPosition);
|
||||
int x = (int) downMotion.getRawX();
|
||||
int y = (int) downMotion.getRawY();
|
||||
|
||||
int listX = (int) downMotion.getRawX() - listPosition[0];
|
||||
int listY = (int) downMotion.getRawY() - listPosition[1];
|
||||
Rect headerRect = new Rect();
|
||||
mListView.getGlobalVisibleRect(headerRect);
|
||||
|
||||
int listViewPosition = mListView.pointToPosition(listX, listY);
|
||||
// Only handle swipes in the visible area of the message list
|
||||
if (headerRect.contains(x, y)) {
|
||||
int[] listPosition = new int[2];
|
||||
mListView.getLocationOnScreen(listPosition);
|
||||
|
||||
toggleMessageSelect(listViewPosition);
|
||||
int listX = x - listPosition[0];
|
||||
int listY = y - listPosition[1];
|
||||
|
||||
int listViewPosition = mListView.pointToPosition(listX, listY);
|
||||
|
||||
toggleMessageSelect(listViewPosition);
|
||||
}
|
||||
}
|
||||
|
||||
private int listViewToAdapterPosition(int position) {
|
||||
|
Loading…
Reference in New Issue
Block a user