Loading app/src/main/java/app/fedilab/android/activities/ComposeActivity.java +10 −12 Original line number Diff line number Diff line Loading @@ -676,20 +676,18 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana } if (sharedUriList != null && sharedUriList.size() > 0) { Handler handler = new Handler(); handler.postDelayed(() -> { List<Uri> uris = new ArrayList<>(sharedUriList); composeAdapter.addAttachment(-1, uris); }, 1000); Helper.createAttachmentFromUri(ComposeActivity.this, uris, attachment -> { composeAdapter.addAttachment(-1, attachment); }); } else if (sharedUri != null && !sharedUri.toString().startsWith("http")) { Handler handler = new Handler(); handler.postDelayed(() -> { List<Uri> uris = new ArrayList<>(); uris.add(sharedUri); composeAdapter.addAttachment(-1, uris); }, 1000); Helper.createAttachmentFromUri(ComposeActivity.this, uris, attachment -> { composeAdapter.addAttachment(-1, attachment); }); } else if (shareURL != null) { Helper.download(ComposeActivity.this, sharedUrlMedia, new OnDownloadInterface() { @Override public void onDownloaded(String saveFilePath, String downloadUrl, Error error) { Loading app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java +24 −0 Original line number Diff line number Diff line Loading @@ -178,6 +178,30 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder }); } /** * Add an attachment from ComposeActivity * * @param position int - position of the drawer that added a media * @param attachment Attachment - media attachment */ public void addAttachment(int position, Attachment attachment) { if (position == -1) { position = statusList.size() - 1; } // position = statusCount-1+position; if (statusList.get(position).media_attachments == null) { statusList.get(position).media_attachments = new ArrayList<>(); } if (promptDraftListener != null) { promptDraftListener.promptDraft(); } int finalPosition = position; statusList.get(finalPosition).media_attachments.add(attachment); notifyItemChanged(finalPosition); } private static void updateCharacterCount(ComposeViewHolder composeViewHolder) { int charCount = MastodonHelper.countLength(composeViewHolder); composeViewHolder.binding.characterCount.setText(String.valueOf(charCount)); Loading Loading
app/src/main/java/app/fedilab/android/activities/ComposeActivity.java +10 −12 Original line number Diff line number Diff line Loading @@ -676,20 +676,18 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana } if (sharedUriList != null && sharedUriList.size() > 0) { Handler handler = new Handler(); handler.postDelayed(() -> { List<Uri> uris = new ArrayList<>(sharedUriList); composeAdapter.addAttachment(-1, uris); }, 1000); Helper.createAttachmentFromUri(ComposeActivity.this, uris, attachment -> { composeAdapter.addAttachment(-1, attachment); }); } else if (sharedUri != null && !sharedUri.toString().startsWith("http")) { Handler handler = new Handler(); handler.postDelayed(() -> { List<Uri> uris = new ArrayList<>(); uris.add(sharedUri); composeAdapter.addAttachment(-1, uris); }, 1000); Helper.createAttachmentFromUri(ComposeActivity.this, uris, attachment -> { composeAdapter.addAttachment(-1, attachment); }); } else if (shareURL != null) { Helper.download(ComposeActivity.this, sharedUrlMedia, new OnDownloadInterface() { @Override public void onDownloaded(String saveFilePath, String downloadUrl, Error error) { Loading
app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java +24 −0 Original line number Diff line number Diff line Loading @@ -178,6 +178,30 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder }); } /** * Add an attachment from ComposeActivity * * @param position int - position of the drawer that added a media * @param attachment Attachment - media attachment */ public void addAttachment(int position, Attachment attachment) { if (position == -1) { position = statusList.size() - 1; } // position = statusCount-1+position; if (statusList.get(position).media_attachments == null) { statusList.get(position).media_attachments = new ArrayList<>(); } if (promptDraftListener != null) { promptDraftListener.promptDraft(); } int finalPosition = position; statusList.get(finalPosition).media_attachments.add(attachment); notifyItemChanged(finalPosition); } private static void updateCharacterCount(ComposeViewHolder composeViewHolder) { int charCount = MastodonHelper.countLength(composeViewHolder); composeViewHolder.binding.characterCount.setText(String.valueOf(charCount)); Loading