diff --git a/app/src/main/java/app/fedilab/android/jobs/ComposeWorker.java b/app/src/main/java/app/fedilab/android/jobs/ComposeWorker.java index 34b9c637c..0efb06b0b 100644 --- a/app/src/main/java/app/fedilab/android/jobs/ComposeWorker.java +++ b/app/src/main/java/app/fedilab/android/jobs/ComposeWorker.java @@ -327,7 +327,10 @@ public class ComposeWorker extends Worker { private static String postAttachment(MastodonStatusesService mastodonStatusesService, DataPost dataPost, MultipartBody.Part fileMultipartBody, Attachment attachment) { - RequestBody descriptionBody = RequestBody.create(MediaType.parse("text/plain"), attachment.description); + RequestBody descriptionBody = null; + if (attachment.description != null && attachment.description.trim().length() > 0) { + descriptionBody = RequestBody.create(MediaType.parse("text/plain"), attachment.description); + } Call attachmentCall = mastodonStatusesService.postMedia(dataPost.token, fileMultipartBody, null, descriptionBody, attachment.focus); if (attachmentCall != null) { diff --git a/app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java b/app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java index 9adfd75b0..af2f3fb5a 100644 --- a/app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java +++ b/app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java @@ -728,18 +728,13 @@ public class ComposeAdapter extends RecyclerView.Adapter 2) { - holder.binding.addRemoveStatus.setVisibility(View.VISIBLE); - } - cPosition = start; + buttonVisibility(holder); } @Override @@ -752,17 +747,6 @@ public class ComposeAdapter extends RecyclerView.Adapter max_car + 1) { - int from = max_car - holder.binding.contentSpoiler.getText().length(); - int to = (currentLength - holder.binding.contentSpoiler.getText().length()); - if (to <= s.length()) { - holder.binding.content.setText(s.delete(from, to)); - } - } else if (currentLength > max_car) { - if (cPosition + 1 <= s.length()) { - holder.binding.content.setText(s.delete(cPosition, cPosition + 1)); - } - }*/ statusList.get(holder.getBindingAdapterPosition()).text = s.toString(); if (s.toString().trim().length() < 2) { buttonVisibility(holder); @@ -1304,18 +1288,13 @@ public class ComposeAdapter extends RecyclerView.Adapter 2) { - holder.binding.addRemoveStatus.setVisibility(View.VISIBLE); - } + buttonVisibility(holder); } @Override @@ -1327,13 +1306,6 @@ public class ComposeAdapter extends RecyclerView.Adapter max_car + 1) { - holder.binding.contentSpoiler.setText(s.delete(max_car - holder.binding.content.getText().length(), (currentLength - holder.binding.content.getText().length()))); - buttonVisibility(holder); - } else if (currentLength > max_car) { - buttonVisibility(holder); - holder.binding.contentSpoiler.setText(s.delete(cPosition, cPosition + 1)); - }*/ statusList.get(holder.getBindingAdapterPosition()).spoiler_text = s.toString(); if (s.toString().trim().length() < 2) { buttonVisibility(holder); diff --git a/app/src/main/java/app/fedilab/android/viewmodel/mastodon/StatusesVM.java b/app/src/main/java/app/fedilab/android/viewmodel/mastodon/StatusesVM.java index c9d0bf3de..50913b424 100644 --- a/app/src/main/java/app/fedilab/android/viewmodel/mastodon/StatusesVM.java +++ b/app/src/main/java/app/fedilab/android/viewmodel/mastodon/StatusesVM.java @@ -120,7 +120,10 @@ public class StatusesVM extends AndroidViewModel { MultipartBody.Part thumbnailMultipartBody; fileMultipartBody = Helper.getMultipartBody(getApplication(), "file", file); thumbnailMultipartBody = Helper.getMultipartBody(getApplication(), "file", thumbnail); - RequestBody descriptionBody = RequestBody.create(MediaType.parse("text/plain"), description); + RequestBody descriptionBody = null; + if (description != null && description.trim().length() > 0) { + descriptionBody = RequestBody.create(MediaType.parse("text/plain"), description); + } Call attachmentCall = mastodonStatusesService.postMedia(token, fileMultipartBody, thumbnailMultipartBody, descriptionBody, focus); Attachment attachment = null; if (attachmentCall != null) { diff --git a/app/src/main/res/layout/drawer_status_compose.xml b/app/src/main/res/layout/drawer_status_compose.xml index 96c7d7f9b..f7f819c80 100644 --- a/app/src/main/res/layout/drawer_status_compose.xml +++ b/app/src/main/res/layout/drawer_status_compose.xml @@ -60,6 +60,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginHorizontal="6dp" + android:focusable="true" android:gravity="top|start" android:inputType="textMultiLine|textCapSentences" android:minLines="6"