Some small changes

This commit is contained in:
Thomas 2023-02-14 19:07:05 +01:00
parent e00bd1e7c3
commit dfcaed080b
4 changed files with 9 additions and 14 deletions

View File

@ -1482,16 +1482,12 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
holder.binding.media.media3Container.mediaRoot.setVisibility(View.VISIBLE); holder.binding.media.media3Container.mediaRoot.setVisibility(View.VISIBLE);
holder.binding.media.media4Container.mediaRoot.setVisibility(View.VISIBLE); holder.binding.media.media4Container.mediaRoot.setVisibility(View.VISIBLE);
holder.binding.media.moreMedia.setVisibility(View.VISIBLE); holder.binding.media.moreMedia.setVisibility(View.VISIBLE);
holder.binding.media.moreMedia.setText(context.getString(R.string.more_media, "+" + (statusToDeal.media_attachments.size() - 4)));
} }
} }
for (Attachment attachment : statusToDeal.media_attachments) { for (Attachment attachment : statusToDeal.media_attachments) {
if (fullAttachement) {
}
LayoutMediaBinding layoutMediaBinding = null; LayoutMediaBinding layoutMediaBinding = null;
if ((fullAttachement && (!statusToDeal.sensitive || expand_media))) { if ((fullAttachement && (!statusToDeal.sensitive || expand_media))) {
layoutMediaBinding = LayoutMediaBinding.inflate(LayoutInflater.from(context)); layoutMediaBinding = LayoutMediaBinding.inflate(LayoutInflater.from(context));
holder.binding.mediaContainer.addView(layoutMediaBinding.getRoot()); holder.binding.mediaContainer.addView(layoutMediaBinding.getRoot());
@ -1524,13 +1520,9 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
} }
loadAndAddAttachment(context, layoutMediaBinding, holder, adapter, mediaPosition, mediaW, mediaH, ratio, statusToDeal, attachment); loadAndAddAttachment(context, layoutMediaBinding, holder, adapter, mediaPosition, mediaW, mediaH, ratio, statusToDeal, attachment);
} else { } else if (layoutMediaBinding != null) {
if (layoutMediaBinding != null) { loadAndAddAttachment(context, layoutMediaBinding, holder, adapter, mediaPosition, -1.f, -1.f, -1.f, statusToDeal, attachment);
loadAndAddAttachment(context, layoutMediaBinding, holder, adapter, mediaPosition, -1.f, -1.f, -1.f, statusToDeal, attachment);
}
} }
mediaPosition++; mediaPosition++;
} }
if (!fullAttachement || statusToDeal.sensitive) { if (!fullAttachement || statusToDeal.sensitive) {
@ -1622,7 +1614,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
} }
for (Poll.PollItem pollItem : statusToDeal.poll.options) { for (Poll.PollItem pollItem : statusToDeal.poll.options) {
@NonNull LayoutPollItemBinding pollItemBinding = LayoutPollItemBinding.inflate(inflater, holder.binding.poll.rated, true); @NonNull LayoutPollItemBinding pollItemBinding = LayoutPollItemBinding.inflate(inflater, holder.binding.poll.rated, true);
double value = ((double) (pollItem.votes_count * 100) / (double) statusToDeal.poll.voters_count); double value = Math.ceil((pollItem.votes_count * 100) / (double) statusToDeal.poll.voters_count);
pollItemBinding.pollItemPercent.setText(String.format("%s %%", (int) value)); pollItemBinding.pollItemPercent.setText(String.format("%s %%", (int) value));
pollItemBinding.pollItemText.setText( pollItemBinding.pollItemText.setText(
pollItem.getSpanTitle(context, statusToDeal, pollItem.getSpanTitle(context, statusToDeal,

View File

@ -285,7 +285,7 @@ public class StatusDirectMessageAdapter extends RecyclerView.Adapter<RecyclerVie
LayoutInflater inflater = ((Activity) context).getLayoutInflater(); LayoutInflater inflater = ((Activity) context).getLayoutInflater();
for (Poll.PollItem pollItem : status.poll.options) { for (Poll.PollItem pollItem : status.poll.options) {
@NonNull LayoutPollItemBinding pollItemBinding = LayoutPollItemBinding.inflate(inflater, holder.binding.poll.rated, true); @NonNull LayoutPollItemBinding pollItemBinding = LayoutPollItemBinding.inflate(inflater, holder.binding.poll.rated, true);
double value = ((double) (pollItem.votes_count * 100) / (double) status.poll.voters_count); double value = Math.ceil((pollItem.votes_count * 100) / (double) status.poll.voters_count);
pollItemBinding.pollItemPercent.setText(String.format("%s %%", (int) value)); pollItemBinding.pollItemPercent.setText(String.format("%s %%", (int) value));
pollItemBinding.pollItemText.setText( pollItemBinding.pollItemText.setText(
pollItem.getSpanTitle(context, status, pollItem.getSpanTitle(context, status,
@ -471,6 +471,7 @@ public class StatusDirectMessageAdapter extends RecyclerView.Adapter<RecyclerVie
holder.binding.media.media3Container.mediaRoot.setVisibility(View.VISIBLE); holder.binding.media.media3Container.mediaRoot.setVisibility(View.VISIBLE);
holder.binding.media.media4Container.mediaRoot.setVisibility(View.VISIBLE); holder.binding.media.media4Container.mediaRoot.setVisibility(View.VISIBLE);
holder.binding.media.moreMedia.setVisibility(View.VISIBLE); holder.binding.media.moreMedia.setVisibility(View.VISIBLE);
holder.binding.media.moreMedia.setText(context.getString(R.string.more_media, "+" + (status.media_attachments.size() - 4)));
} }
for (Attachment attachment : status.media_attachments) { for (Attachment attachment : status.media_attachments) {
LayoutMediaBinding layoutMediaBinding = null; LayoutMediaBinding layoutMediaBinding = null;

View File

@ -350,6 +350,7 @@
android:layout_marginTop="6dp" android:layout_marginTop="6dp"
android:layout_marginEnd="6dp" android:layout_marginEnd="6dp"
android:visibility="gone" android:visibility="gone"
tools:visibility="visible"
app:cardCornerRadius="8dp" app:cardCornerRadius="8dp"
app:cardElevation="0dp" app:cardElevation="0dp"
app:strokeWidth="1dp"> app:strokeWidth="1dp">
@ -460,7 +461,7 @@
android:id="@+id/media" android:id="@+id/media"
layout="@layout/layout_drawer_attachments" layout="@layout/layout_drawer_attachments"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="300dp"
android:layout_marginStart="48dp" android:layout_marginStart="48dp"
android:layout_marginTop="6dp" android:layout_marginTop="6dp"
android:layout_marginEnd="6dp" android:layout_marginEnd="6dp"

View File

@ -1904,4 +1904,5 @@
<string name="translator_domain">Translator domain</string> <string name="translator_domain">Translator domain</string>
<string name="chat_timeline_for_direct">Chat timeline for direct messages</string> <string name="chat_timeline_for_direct">Chat timeline for direct messages</string>
<string name="more_media">%1$s more media</string>
</resources> </resources>