mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-26 01:28:50 -05:00
ignore gestures during text selection
Fixes issue 662
This commit is contained in:
parent
510e9acc83
commit
91599ae963
@ -19,6 +19,7 @@ import com.fsck.k9.K9;
|
|||||||
public class K9Activity extends Activity
|
public class K9Activity extends Activity
|
||||||
{
|
{
|
||||||
private GestureDetector gestureDetector;
|
private GestureDetector gestureDetector;
|
||||||
|
private boolean mIgnoreGestures = false;
|
||||||
|
|
||||||
protected ScrollView mTopView;
|
protected ScrollView mTopView;
|
||||||
|
|
||||||
@ -104,6 +105,11 @@ public class K9Activity extends Activity
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void setIgnoreGestures(boolean ignoreGestures)
|
||||||
|
{
|
||||||
|
mIgnoreGestures = ignoreGestures;
|
||||||
|
}
|
||||||
|
|
||||||
class MyGestureDetector extends SimpleOnGestureListener
|
class MyGestureDetector extends SimpleOnGestureListener
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -135,7 +141,7 @@ public class K9Activity extends Activity
|
|||||||
@Override
|
@Override
|
||||||
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
|
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
|
||||||
{
|
{
|
||||||
if (K9.gesturesEnabled())
|
if (K9.gesturesEnabled() && !mIgnoreGestures)
|
||||||
{
|
{
|
||||||
// Convert the dips to pixels
|
// Convert the dips to pixels
|
||||||
final float mGestureScale = getResources().getDisplayMetrics().density;
|
final float mGestureScale = getResources().getDisplayMetrics().density;
|
||||||
|
@ -169,8 +169,9 @@ public class MessageView extends K9Activity implements OnClickListener
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Text selection is finished. Allow scrolling again.
|
// Text selection is finished. Allow scrolling and gestures again.
|
||||||
mToggleScrollView.setScrolling(true);
|
mToggleScrollView.setScrolling(true);
|
||||||
|
setIgnoreGestures(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2254,6 +2255,7 @@ public class MessageView extends K9Activity implements OnClickListener
|
|||||||
KeyEvent shiftPressEvent = new KeyEvent(0, 0, KeyEvent.ACTION_DOWN,
|
KeyEvent shiftPressEvent = new KeyEvent(0, 0, KeyEvent.ACTION_DOWN,
|
||||||
KeyEvent.KEYCODE_SHIFT_LEFT, 0, 0);
|
KeyEvent.KEYCODE_SHIFT_LEFT, 0, 0);
|
||||||
shiftPressEvent.dispatch(view);
|
shiftPressEvent.dispatch(view);
|
||||||
|
setIgnoreGestures(true);
|
||||||
Toast.makeText(this, R.string.select_text_now, Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, R.string.select_text_now, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
Loading…
Reference in New Issue
Block a user