comment #702 - Improve reactions and quotes

This commit is contained in:
Thomas 2022-12-30 12:10:52 +01:00
parent 23cd690f33
commit d55baa92af
4 changed files with 27 additions and 8 deletions

View file

@ -221,10 +221,10 @@ public class ComposeWorker extends Worker {
if (dataPost.scheduledDate == null) {
if (dataPost.statusEditId == null) {
statusCall = mastodonStatusesService.createStatus(null, dataPost.token, statuses.get(i).text, attachmentIds, poll_options, poll_expire_in,
poll_multiple, poll_hide_totals, in_reply_to_status, statuses.get(i).sensitive, statuses.get(i).spoilerChecked ? statuses.get(i).spoiler_text : null, statuses.get(i).visibility.toLowerCase(), language, statuses.get(i).quote_id);
poll_multiple, poll_hide_totals, statuses.get(i).quote_id == null ? in_reply_to_status : null, statuses.get(i).sensitive, statuses.get(i).spoilerChecked ? statuses.get(i).spoiler_text : null, statuses.get(i).visibility.toLowerCase(), language, statuses.get(i).quote_id);
} else { //Status is edited
statusCall = mastodonStatusesService.updateStatus(null, dataPost.token, dataPost.statusEditId, statuses.get(i).text, attachmentIds, poll_options, poll_expire_in,
poll_multiple, poll_hide_totals, in_reply_to_status, statuses.get(i).sensitive, statuses.get(i).spoilerChecked ? statuses.get(i).spoiler_text : null, statuses.get(i).visibility.toLowerCase(), language);
poll_multiple, poll_hide_totals, statuses.get(i).quote_id == null ? in_reply_to_status : null, statuses.get(i).sensitive, statuses.get(i).spoilerChecked ? statuses.get(i).spoiler_text : null, statuses.get(i).visibility.toLowerCase(), language);
}
try {
Response<Status> statusResponse = statusCall.execute();
@ -285,7 +285,7 @@ public class ComposeWorker extends Worker {
}
} else {
Call<ScheduledStatus> scheduledStatusCall = mastodonStatusesService.createScheduledStatus(null, dataPost.token, statuses.get(i).text, attachmentIds, poll_options, poll_expire_in,
poll_multiple, poll_hide_totals, in_reply_to_status, statuses.get(i).sensitive, statuses.get(i).spoilerChecked ? statuses.get(i).spoiler_text : null, statuses.get(i).visibility.toLowerCase(), dataPost.scheduledDate, statuses.get(i).language);
poll_multiple, poll_hide_totals, statuses.get(i).quote_id == null ? in_reply_to_status : null, statuses.get(i).sensitive, statuses.get(i).spoilerChecked ? statuses.get(i).spoiler_text : null, statuses.get(i).visibility.toLowerCase(), dataPost.scheduledDate, statuses.get(i).language);
try {
Response<ScheduledStatus> statusResponse = scheduledStatusCall.execute();

View file

@ -32,6 +32,7 @@ import app.fedilab.android.R;
import app.fedilab.android.client.entities.api.Reaction;
import app.fedilab.android.databinding.DrawerReactionBinding;
import app.fedilab.android.helper.Helper;
import app.fedilab.android.helper.ThemeHelper;
import app.fedilab.android.viewmodel.mastodon.AnnouncementsVM;
import app.fedilab.android.viewmodel.pleroma.ActionsVM;
@ -74,6 +75,7 @@ public class ReactionAdapter extends RecyclerView.Adapter<ReactionAdapter.Reacti
holder.binding.reactionCount.setText(String.valueOf(reaction.count));
if (reaction.me) {
holder.binding.reactionContainer.setBackgroundResource(R.drawable.reaction_voted);
holder.binding.reactionCount.setTextColor(ThemeHelper.getAttColor(context, R.attr.colorOnPrimary));
} else {
holder.binding.reactionContainer.setBackgroundResource(R.drawable.reaction_border);
}

View file

@ -440,10 +440,26 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
String loadMediaType = sharedpreferences.getString(context.getString(R.string.SET_LOAD_MEDIA_TYPE), "ALWAYS");
if (statusToDeal.quote != null) {
holder.binding.quotedMessage.cardviewContainer.setCardElevation(5);
holder.binding.quotedMessage.cardviewContainer.setCardElevation((int) Helper.convertDpToPixel(5, context));
holder.binding.quotedMessage.dividerCard.setVisibility(View.GONE);
holder.binding.quotedMessage.cardviewContainer.setStrokeWidth(1);
holder.binding.quotedMessage.cardviewContainer.setOnClickListener(v -> {
holder.binding.quotedMessage.cardviewContainer.setStrokeWidth((int) Helper.convertDpToPixel(1, context));
holder.binding.quotedMessage.cardviewContainer.setOnClickListener(v -> holder.binding.quotedMessage.statusContent.callOnClick());
holder.binding.quotedMessage.statusContent.setOnTouchListener((view, motionEvent) -> {
if (motionEvent.getAction() == MotionEvent.ACTION_UP && !view.hasFocus()) {
try {
view.requestFocus();
} catch (Exception ignored) {
}
}
return false;
});
holder.binding.quotedMessage.statusContent.setOnClickListener(v -> {
if (status.isFocused || v.getTag() == SpannableHelper.CLICKABLE_SPAN) {
if (v.getTag() == SpannableHelper.CLICKABLE_SPAN) {
v.setTag(null);
}
return;
}
Intent intent = new Intent(context, ContextActivity.class);
intent.putExtra(Helper.ARG_STATUS, statusToDeal.quote);
context.startActivity(intent);
@ -651,7 +667,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
}
}
if (statusToDeal.card != null && (display_card || statusToDeal.isFocused)) {
if (statusToDeal.card != null && (display_card || statusToDeal.isFocused) && statusToDeal.quote_id == null) {
if (statusToDeal.card.width > statusToDeal.card.height) {
holder.binding.cardImageHorizontal.setVisibility(View.VISIBLE);
holder.binding.cardImageVertical.setVisibility(View.GONE);
@ -1217,7 +1233,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
holder.binding.mediaContainer.setVisibility(View.GONE);
} else {
holder.binding.statusContent.setVisibility(View.VISIBLE);
if (statusToDeal.card != null && (display_card || statusToDeal.isFocused)) {
if (statusToDeal.card != null && statusToDeal.quote_id == null && (display_card || statusToDeal.isFocused)) {
holder.binding.card.setVisibility(View.VISIBLE);
} else {
holder.binding.card.setVisibility(View.GONE);

View file

@ -34,6 +34,7 @@
android:background="?colorOutline" />
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/main_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="6dp"