Loading app/src/main/java/app/fedilab/android/jobs/ComposeWorker.java +4 −1 Original line number Diff line number Diff line Loading @@ -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<Attachment> attachmentCall = mastodonStatusesService.postMedia(dataPost.token, fileMultipartBody, null, descriptionBody, attachment.focus); if (attachmentCall != null) { Loading app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java +2 −30 Original line number Diff line number Diff line Loading @@ -728,18 +728,13 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder AccountsVM accountsVM = new ViewModelProvider((ViewModelStoreOwner) context).get(AccountsVM.class); SearchVM searchVM = new ViewModelProvider((ViewModelStoreOwner) context).get(SearchVM.class); textw = new TextWatcher() { private int cPosition; @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { if (count > 2) { holder.binding.addRemoveStatus.setVisibility(View.VISIBLE); } cPosition = start; buttonVisibility(holder); } @Override Loading @@ -752,17 +747,6 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder } else { holder.binding.characterCount.setTextColor(holder.binding.content.getTextColors()); } /*if (currentLength > 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); Loading Loading @@ -1304,18 +1288,13 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder int max_car = MastodonHelper.getInstanceMaxChars(context); holder.binding.characterProgress.setMax(max_car); holder.binding.contentSpoiler.addTextChangedListener(new TextWatcher() { private int cPosition; @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { cPosition = start; if (count > 2) { holder.binding.addRemoveStatus.setVisibility(View.VISIBLE); } buttonVisibility(holder); } @Override Loading @@ -1327,13 +1306,6 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder } else { holder.binding.characterCount.setTextColor(holder.binding.content.getTextColors()); } /*if (currentLength > 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); Loading app/src/main/java/app/fedilab/android/viewmodel/mastodon/StatusesVM.java +4 −1 Original line number Diff line number Diff line Loading @@ -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<Attachment> attachmentCall = mastodonStatusesService.postMedia(token, fileMultipartBody, thumbnailMultipartBody, descriptionBody, focus); Attachment attachment = null; if (attachmentCall != null) { Loading app/src/main/res/layout/drawer_status_compose.xml +1 −0 Original line number Diff line number Diff line Loading @@ -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" Loading Loading
app/src/main/java/app/fedilab/android/jobs/ComposeWorker.java +4 −1 Original line number Diff line number Diff line Loading @@ -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<Attachment> attachmentCall = mastodonStatusesService.postMedia(dataPost.token, fileMultipartBody, null, descriptionBody, attachment.focus); if (attachmentCall != null) { Loading
app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java +2 −30 Original line number Diff line number Diff line Loading @@ -728,18 +728,13 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder AccountsVM accountsVM = new ViewModelProvider((ViewModelStoreOwner) context).get(AccountsVM.class); SearchVM searchVM = new ViewModelProvider((ViewModelStoreOwner) context).get(SearchVM.class); textw = new TextWatcher() { private int cPosition; @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { if (count > 2) { holder.binding.addRemoveStatus.setVisibility(View.VISIBLE); } cPosition = start; buttonVisibility(holder); } @Override Loading @@ -752,17 +747,6 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder } else { holder.binding.characterCount.setTextColor(holder.binding.content.getTextColors()); } /*if (currentLength > 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); Loading Loading @@ -1304,18 +1288,13 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder int max_car = MastodonHelper.getInstanceMaxChars(context); holder.binding.characterProgress.setMax(max_car); holder.binding.contentSpoiler.addTextChangedListener(new TextWatcher() { private int cPosition; @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { cPosition = start; if (count > 2) { holder.binding.addRemoveStatus.setVisibility(View.VISIBLE); } buttonVisibility(holder); } @Override Loading @@ -1327,13 +1306,6 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder } else { holder.binding.characterCount.setTextColor(holder.binding.content.getTextColors()); } /*if (currentLength > 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); Loading
app/src/main/java/app/fedilab/android/viewmodel/mastodon/StatusesVM.java +4 −1 Original line number Diff line number Diff line Loading @@ -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<Attachment> attachmentCall = mastodonStatusesService.postMedia(token, fileMultipartBody, thumbnailMultipartBody, descriptionBody, focus); Attachment attachment = null; if (attachmentCall != null) { Loading
app/src/main/res/layout/drawer_status_compose.xml +1 −0 Original line number Diff line number Diff line Loading @@ -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" Loading