use of org.thoughtcrime.securesms.mms.SlideFactory.MediaType in project Signal-Android by signalapp.
the class ConversationParentFragment method initializeDraft.
// /// Initializers
private ListenableFuture<Boolean> initializeDraft(@NonNull ConversationIntents.Args args) {
final SettableFuture<Boolean> result = new SettableFuture<>();
final CharSequence draftText = args.getDraftText();
final Uri draftMedia = requireActivity().getIntent().getData();
final String draftContentType = requireActivity().getIntent().getType();
final MediaType draftMediaType = MediaType.from(draftContentType);
final List<Media> mediaList = args.getMedia();
final StickerLocator stickerLocator = args.getStickerLocator();
final boolean borderless = args.isBorderless();
if (stickerLocator != null && draftMedia != null) {
Log.d(TAG, "Handling shared sticker.");
sendSticker(stickerLocator, Objects.requireNonNull(draftContentType), draftMedia, 0, true);
return new SettableFuture<>(false);
}
if (draftMedia != null && draftContentType != null && borderless) {
SimpleTask.run(getLifecycle(), () -> getKeyboardImageDetails(draftMedia), details -> sendKeyboardImage(draftMedia, draftContentType, details));
return new SettableFuture<>(false);
}
if (!Util.isEmpty(mediaList)) {
Log.d(TAG, "Handling shared Media.");
Intent sendIntent = MediaSelectionActivity.editor(requireContext(), sendButton.getSelectedTransport(), mediaList, recipient.getId(), draftText);
startActivityForResult(sendIntent, MEDIA_SENDER);
return new SettableFuture<>(false);
}
if (draftText != null) {
composeText.setText("");
composeText.append(draftText);
result.set(true);
}
if (draftMedia != null && draftMediaType != null) {
Log.d(TAG, "Handling shared Data.");
return setMedia(draftMedia, draftMediaType);
}
if (draftText == null && draftMedia == null && draftMediaType == null) {
return initializeDraftFromDatabase();
} else {
updateToggleButtonState();
result.set(false);
}
return result;
}
use of org.thoughtcrime.securesms.mms.SlideFactory.MediaType in project Signal-Android by WhisperSystems.
the class ConversationParentFragment method initializeDraft.
// /// Initializers
private ListenableFuture<Boolean> initializeDraft(@NonNull ConversationIntents.Args args) {
final SettableFuture<Boolean> result = new SettableFuture<>();
final CharSequence draftText = args.getDraftText();
final Uri draftMedia = requireActivity().getIntent().getData();
final String draftContentType = requireActivity().getIntent().getType();
final MediaType draftMediaType = MediaType.from(draftContentType);
final List<Media> mediaList = args.getMedia();
final StickerLocator stickerLocator = args.getStickerLocator();
final boolean borderless = args.isBorderless();
if (stickerLocator != null && draftMedia != null) {
Log.d(TAG, "Handling shared sticker.");
sendSticker(stickerLocator, Objects.requireNonNull(draftContentType), draftMedia, 0, true);
return new SettableFuture<>(false);
}
if (draftMedia != null && draftContentType != null && borderless) {
SimpleTask.run(getLifecycle(), () -> getKeyboardImageDetails(draftMedia), details -> sendKeyboardImage(draftMedia, draftContentType, details));
return new SettableFuture<>(false);
}
if (!Util.isEmpty(mediaList)) {
Log.d(TAG, "Handling shared Media.");
Intent sendIntent = MediaSelectionActivity.editor(requireContext(), sendButton.getSelectedTransport(), mediaList, recipient.getId(), draftText);
startActivityForResult(sendIntent, MEDIA_SENDER);
return new SettableFuture<>(false);
}
if (draftText != null) {
composeText.setText("");
composeText.append(draftText);
result.set(true);
}
if (draftMedia != null && draftMediaType != null) {
Log.d(TAG, "Handling shared Data.");
return setMedia(draftMedia, draftMediaType);
}
if (draftText == null && draftMedia == null && draftMediaType == null) {
return initializeDraftFromDatabase();
} else {
updateToggleButtonState();
result.set(false);
}
return result;
}
Aggregations