mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-16 06:25:06 -05:00
removed the initiation of "select text" via long press again
Update issue 662 We tried out the long press for a bit and deemed it too sensitive for general usage. It can cause problems with gestures and such, so I removed it again. I hope using the option menu is not too much overhead. If you want to include it in your custom build or anything, then r 1976 and r1977 should be enough.
This commit is contained in:
parent
0a38d9242c
commit
19ca87a2d5
@ -19,7 +19,6 @@ 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;
|
||||||
|
|
||||||
@ -101,14 +100,6 @@ public class K9Activity extends Activity
|
|||||||
protected void onPrevious(boolean animate)
|
protected void onPrevious(boolean animate)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
protected void onLongPressGesture()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setIgnoreGestures(boolean ignoreGestures)
|
|
||||||
{
|
|
||||||
mIgnoreGestures = ignoreGestures;
|
|
||||||
}
|
|
||||||
|
|
||||||
class MyGestureDetector extends SimpleOnGestureListener
|
class MyGestureDetector extends SimpleOnGestureListener
|
||||||
{
|
{
|
||||||
@ -141,7 +132,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() && !mIgnoreGestures)
|
if (K9.gesturesEnabled())
|
||||||
{
|
{
|
||||||
// Convert the dips to pixels
|
// Convert the dips to pixels
|
||||||
final float mGestureScale = getResources().getDisplayMetrics().density;
|
final float mGestureScale = getResources().getDisplayMetrics().density;
|
||||||
@ -171,12 +162,6 @@ public class K9Activity extends Activity
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onLongPress(MotionEvent e)
|
|
||||||
{
|
|
||||||
onLongPressGesture();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -140,8 +140,6 @@ public class MessageView extends K9Activity implements OnClickListener
|
|||||||
|
|
||||||
private FontSizes mFontSizes = K9.getFontSizes();
|
private FontSizes mFontSizes = K9.getFontSizes();
|
||||||
|
|
||||||
private boolean mIgnoreNextUpEvent = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pair class is only available since API Level 5, so we need
|
* Pair class is only available since API Level 5, so we need
|
||||||
* this helper class unfortunately
|
* this helper class unfortunately
|
||||||
@ -163,16 +161,8 @@ public class MessageView extends K9Activity implements OnClickListener
|
|||||||
{
|
{
|
||||||
if (ev.getAction() == MotionEvent.ACTION_UP)
|
if (ev.getAction() == MotionEvent.ACTION_UP)
|
||||||
{
|
{
|
||||||
if (mIgnoreNextUpEvent)
|
// Text selection is finished. Allow scrolling again.
|
||||||
{
|
|
||||||
mIgnoreNextUpEvent = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Text selection is finished. Allow scrolling and gestures again.
|
|
||||||
mToggleScrollView.setScrolling(true);
|
mToggleScrollView.setScrolling(true);
|
||||||
setIgnoreGestures(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.dispatchTouchEvent(ev);
|
return super.dispatchTouchEvent(ev);
|
||||||
@ -2234,14 +2224,6 @@ public class MessageView extends K9Activity implements OnClickListener
|
|||||||
return slide;
|
return slide;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onLongPressGesture()
|
|
||||||
{
|
|
||||||
mMessageContentView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
|
|
||||||
mIgnoreNextUpEvent = true;
|
|
||||||
emulateShiftHeld(mMessageContentView);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emulate the shift key being pressed to trigger the text selection mode
|
* Emulate the shift key being pressed to trigger the text selection mode
|
||||||
* of a WebView.
|
* of a WebView.
|
||||||
@ -2255,7 +2237,6 @@ 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