mirror of
https://github.com/M66B/FairEmail.git
synced 2025-03-04 18:48:31 +00:00
Image editor: double tap
This commit is contained in:
parent
9ba758fdaa
commit
ac21940289
1 changed files with 54 additions and 43 deletions
|
@ -89,6 +89,7 @@ import android.view.MenuInflater;
|
|||
import android.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewConfiguration;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.webkit.MimeTypeMap;
|
||||
|
@ -459,7 +460,6 @@ public class FragmentCompose extends FragmentBase {
|
|||
final boolean suggest_account = prefs.getBoolean("suggest_account", false);
|
||||
final boolean cc_bcc = prefs.getBoolean("cc_bcc", false);
|
||||
final boolean circular = prefs.getBoolean("circular", true);
|
||||
final boolean experiments = prefs.getBoolean("experiments", false);
|
||||
|
||||
final float dp3 = Helper.dp2pixels(getContext(), 3);
|
||||
|
||||
|
@ -822,10 +822,12 @@ public class FragmentCompose extends FragmentBase {
|
|||
}
|
||||
});
|
||||
|
||||
if (experiments)
|
||||
etBody.setOnTouchListener(new View.OnTouchListener() {
|
||||
private final GestureDetector gestureDetector = new GestureDetector(getContext(),
|
||||
new GestureDetector.SimpleOnGestureListener() {
|
||||
private String lastSource = null;
|
||||
private Long lastTime = null;
|
||||
|
||||
@Override
|
||||
public boolean onSingleTapConfirmed(@NonNull MotionEvent event) {
|
||||
try {
|
||||
|
@ -842,6 +844,15 @@ public class FragmentCompose extends FragmentBase {
|
|||
if (source == null || !source.startsWith("cid:"))
|
||||
return false;
|
||||
|
||||
long now = new Date().getTime();
|
||||
long delta = now - (lastTime == null ? now : lastTime);
|
||||
long timeout = ViewConfiguration.getLongPressTimeout(); /* Typically: 400 ms */
|
||||
if (!source.equals(lastSource) || delta < timeout || delta > timeout * 5) {
|
||||
lastSource = source;
|
||||
lastTime = now;
|
||||
return false;
|
||||
}
|
||||
|
||||
long id = Long.parseLong(source.substring(source.lastIndexOf('.') + 1));
|
||||
|
||||
int start = buffer.getSpanStart(image[0]);
|
||||
|
|
Loading…
Add table
Reference in a new issue