aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-06-16 23:29:52 +0200
committerChristian Schneppe <christian@pix-art.de>2018-06-16 23:29:52 +0200
commit1d86e28360c26984d1d329919dcf9d4be8f0523a (patch)
treea32f3f084d778cadedbe903d1b9ad3b1a9bdf607
parent85545cdd1f88f10b344dc85c2bdf0d96ee8c117b (diff)
attach editor content as file
-rw-r--r--src/main/java/de/pixart/messenger/persistance/FileBackend.java11
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java8
-rw-r--r--src/main/java/de/pixart/messenger/ui/widget/EditMessage.java8
3 files changed, 6 insertions, 21 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/FileBackend.java b/src/main/java/de/pixart/messenger/persistance/FileBackend.java
index 4d9e09d00..e893ea129 100644
--- a/src/main/java/de/pixart/messenger/persistance/FileBackend.java
+++ b/src/main/java/de/pixart/messenger/persistance/FileBackend.java
@@ -595,15 +595,6 @@ public class FileBackend {
return context.getPackageName() + FILE_PROVIDER;
}
- public static Uri getIndexableTakePhotoUri(Uri original) {
- if ("file".equals(original.getScheme())) {
- return original;
- } else {
- List<String> segments = original.getPathSegments();
- return Uri.parse("file://" + getTakeFromCameraPath() + segments.get(segments.size() - 1));
- }
- }
-
public Uri getTakeVideoUri() {
File file = new File(getTakeFromCameraPath() + "VID_" + this.fileDateFormat.format(new Date()) + ".mp4");
file.getParentFile().mkdirs();
@@ -877,7 +868,7 @@ public class FileBackend {
return calcSampleSize(options, size);
}
- public static int calcSampleSize(BitmapFactory.Options options, int size) {
+ private static int calcSampleSize(BitmapFactory.Options options, int size) {
int height = options.outHeight;
int width = options.outWidth;
int inSampleSize = 1;
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
index e966ad109..59098f541 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
@@ -313,7 +313,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
}
}
if (hasPermissions(REQUEST_ADD_EDITOR_CONTENT, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
- attachImageToConversation(inputContentInfo.getContentUri());
+ attachEditorContentToConversation(inputContentInfo.getContentUri());
} else {
mPendingEditorContent = inputContentInfo.getContentUri();
}
@@ -785,8 +785,8 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
});
}
- public void attachImageToConversation(Uri uri) {
- this.attachImageToConversation(conversation, uri, true);
+ public void attachEditorContentToConversation(Uri uri) {
+ this.attachFileToConversation(conversation, uri, null);
}
private void attachImageToConversation(Conversation conversation, Uri uri, boolean sendAsIs) {
@@ -1607,7 +1607,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
}
} else if (requestCode == REQUEST_ADD_EDITOR_CONTENT) {
if (this.mPendingEditorContent != null) {
- attachImageToConversation(this.mPendingEditorContent);
+ attachEditorContentToConversation(this.mPendingEditorContent);
}
} else {
attachFile(requestCode);
diff --git a/src/main/java/de/pixart/messenger/ui/widget/EditMessage.java b/src/main/java/de/pixart/messenger/ui/widget/EditMessage.java
index d9d7abfde..6a34c1540 100644
--- a/src/main/java/de/pixart/messenger/ui/widget/EditMessage.java
+++ b/src/main/java/de/pixart/messenger/ui/widget/EditMessage.java
@@ -135,13 +135,7 @@ public class EditMessage extends EmojiAppCompatEditText {
if (mimeTypes != null && mCommitContentListener != null) {
EditorInfoCompat.setContentMimeTypes(editorInfo, mimeTypes);
- return InputConnectionCompat.createWrapper(ic, editorInfo, new InputConnectionCompat.OnCommitContentListener() {
-
- @Override
- public boolean onCommitContent(InputContentInfoCompat inputContentInfo, int flags, Bundle opts) {
- return EditMessage.this.mCommitContentListener.onCommitContent(inputContentInfo, flags, opts, mimeTypes);
- }
- });
+ return InputConnectionCompat.createWrapper(ic, editorInfo, (inputContentInfo, flags, opts) -> EditMessage.this.mCommitContentListener.onCommitContent(inputContentInfo, flags, opts, mimeTypes));
} else {
return ic;
}