mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-20 07:53:37 +02:00
Refactoring
This commit is contained in:
@@ -471,40 +471,6 @@ public class FragmentCompose extends FragmentBase {
|
||||
final float dp3 = Helper.dp2pixels(getContext(), 3);
|
||||
|
||||
// Wire controls
|
||||
|
||||
// https://developer.android.com/develop/ui/views/touch-and-input/drag-drop/multi-window
|
||||
etBody.setOnDragListener(new View.OnDragListener() {
|
||||
@Override
|
||||
public boolean onDrag(View view, DragEvent event) {
|
||||
try {
|
||||
switch (event.getAction()) {
|
||||
case DragEvent.ACTION_DROP:
|
||||
FragmentActivity activity = getActivity();
|
||||
if (activity == null)
|
||||
return false;
|
||||
ClipData data = event.getClipData();
|
||||
if (data == null)
|
||||
return false;
|
||||
ClipData.Item item = data.getItemAt(0);
|
||||
Uri uri = item.getUri();
|
||||
if (uri == null)
|
||||
return false;
|
||||
DragAndDropPermissionsCompat permissions = ActivityCompat.requestDragAndDropPermissions(activity, event);
|
||||
if (permissions == null)
|
||||
return false;
|
||||
UriType uriType = new UriType(uri, event.getClipDescription(), activity);
|
||||
onSharedAttachments(new ArrayList<>(Arrays.asList(uriType)));
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
spIdentity.setOnItemSelectedListener(identitySelected);
|
||||
|
||||
View.OnTouchListener onTouchListener = new View.OnTouchListener() {
|
||||
@@ -701,6 +667,39 @@ public class FragmentCompose extends FragmentBase {
|
||||
}
|
||||
});
|
||||
|
||||
// https://developer.android.com/develop/ui/views/touch-and-input/drag-drop/multi-window
|
||||
etBody.setOnDragListener(new View.OnDragListener() {
|
||||
@Override
|
||||
public boolean onDrag(View view, DragEvent event) {
|
||||
try {
|
||||
switch (event.getAction()) {
|
||||
case DragEvent.ACTION_DROP:
|
||||
FragmentActivity activity = getActivity();
|
||||
if (activity == null)
|
||||
return false;
|
||||
ClipData data = event.getClipData();
|
||||
if (data == null)
|
||||
return false;
|
||||
ClipData.Item item = data.getItemAt(0);
|
||||
Uri uri = item.getUri();
|
||||
if (uri == null)
|
||||
return false;
|
||||
DragAndDropPermissionsCompat permissions = ActivityCompat.requestDragAndDropPermissions(activity, event);
|
||||
if (permissions == null)
|
||||
return false;
|
||||
UriType uriType = new UriType(uri, event.getClipDescription(), activity);
|
||||
onSharedAttachments(new ArrayList<>(Arrays.asList(uriType)));
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
etBody.setSelectionListener(new EditTextCompose.ISelection() {
|
||||
private boolean hasSelection = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user