Some improvements
This commit is contained in:
parent
7576dc8bee
commit
27120026c2
|
@ -82,6 +82,7 @@ import org.jsoup.nodes.Element;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -645,7 +646,10 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
|||
if (currentAccount.mastodon_account.display_name == null || currentAccount.mastodon_account.display_name.isEmpty()) {
|
||||
currentAccount.mastodon_account.display_name = currentAccount.mastodon_account.acct;
|
||||
}
|
||||
headerMainBinding.accountName.setText(currentAccount.mastodon_account.display_name);
|
||||
headerMainBinding.accountName.setText(
|
||||
currentAccount.mastodon_account.getSpanDisplayName(BaseMainActivity.this,
|
||||
new WeakReference<>(headerMainBinding.accountName)),
|
||||
TextView.BufferType.SPANNABLE);
|
||||
float scale = sharedpreferences.getFloat(getString(R.string.SET_FONT_SCALE), 1.1f);
|
||||
headerMainBinding.accountName.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18 * 1.1f / scale);
|
||||
headerMainBinding.accountAcc.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18 * 1.1f / scale);
|
||||
|
|
|
@ -57,6 +57,7 @@ import android.view.inputmethod.InputMethodManager;
|
|||
import android.widget.CheckBox;
|
||||
import android.widget.GridView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
@ -1118,12 +1119,12 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
|||
holder.binding.mediaContainer.setVisibility(View.VISIBLE);
|
||||
holder.binding.displayMedia.setVisibility(View.GONE);
|
||||
LayoutMediaBinding layoutMediaBinding = LayoutMediaBinding.inflate(LayoutInflater.from(context), holder.binding.attachmentsList, false);
|
||||
RelativeLayout.LayoutParams lp;
|
||||
LinearLayout.LayoutParams lp;
|
||||
if (fullAttachement) {
|
||||
lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, MediaHelper.returnMaxHeightForPreviews(context, statusToDeal.media_attachments));
|
||||
lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
layoutMediaBinding.media.setScaleType(ImageView.ScaleType.FIT_CENTER);
|
||||
} else {
|
||||
lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, (int) Helper.convertDpToPixel(200, context));
|
||||
lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, (int) Helper.convertDpToPixel(200, context));
|
||||
layoutMediaBinding.media.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
}
|
||||
if (statusToDeal.sensitive) {
|
||||
|
@ -1232,14 +1233,17 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
|||
int mediaPosition = 1;
|
||||
for (Attachment attachment : statusToDeal.media_attachments) {
|
||||
LayoutMediaBinding layoutMediaBinding = LayoutMediaBinding.inflate(LayoutInflater.from(context), holder.binding.attachmentsList, false);
|
||||
RelativeLayout.LayoutParams lp;
|
||||
LinearLayout.LayoutParams lp;
|
||||
float focusX = 0.f;
|
||||
float focusY = 0.f;
|
||||
if (statusToDeal.media_attachments.get(0).meta != null && statusToDeal.media_attachments.get(0).meta.focus != null) {
|
||||
focusX = statusToDeal.media_attachments.get(0).meta.focus.x;
|
||||
focusY = statusToDeal.media_attachments.get(0).meta.focus.y;
|
||||
}
|
||||
|
||||
layoutMediaBinding.count.setVisibility(View.VISIBLE);
|
||||
if (!fullAttachement) {
|
||||
layoutMediaBinding.count.setText(String.format(Locale.getDefault(), "%d/%d", mediaPosition, statusToDeal.media_attachments.size()));
|
||||
}
|
||||
String finalUrl;
|
||||
if (attachment.url == null) {
|
||||
finalUrl = attachment.remote_url;
|
||||
|
@ -1253,10 +1257,10 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
|||
return true;
|
||||
});
|
||||
if (fullAttachement) {
|
||||
lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, MediaHelper.returnMaxHeightForPreviews(context, statusToDeal.media_attachments));
|
||||
lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
layoutMediaBinding.media.setScaleType(ImageView.ScaleType.FIT_CENTER);
|
||||
} else {
|
||||
lp = new RelativeLayout.LayoutParams((int) Helper.convertDpToPixel(200, context), (int) Helper.convertDpToPixel(200, context));
|
||||
lp = new LinearLayout.LayoutParams((int) Helper.convertDpToPixel(200, context), (int) Helper.convertDpToPixel(200, context));
|
||||
layoutMediaBinding.media.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
}
|
||||
if (attachment.type != null && (attachment.type.equalsIgnoreCase("video") || attachment.type.equalsIgnoreCase("gifv"))) {
|
||||
|
@ -1274,7 +1278,6 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
|||
} else {
|
||||
layoutMediaBinding.viewDescription.setVisibility(View.GONE);
|
||||
}
|
||||
lp.setMargins(0, 0, (int) Helper.convertDpToPixel(5, context), 0);
|
||||
if (!mediaObfuscated(statusToDeal) || expand_media) {
|
||||
layoutMediaBinding.viewHide.setImageResource(R.drawable.ic_baseline_visibility_24);
|
||||
RequestBuilder<Drawable> requestBuilder = Glide.with(layoutMediaBinding.media.getContext())
|
||||
|
@ -1313,11 +1316,23 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
|||
statusToDeal.sensitive = !statusToDeal.sensitive;
|
||||
adapter.notifyItemChanged(holder.getBindingAdapterPosition());
|
||||
});
|
||||
holder.binding.attachmentsList.addView(layoutMediaBinding.getRoot());
|
||||
if (fullAttachement) {
|
||||
layoutMediaBinding.getRoot().setPadding(0, 0, 0, 10);
|
||||
holder.binding.mediaContainer.addView(layoutMediaBinding.getRoot());
|
||||
} else {
|
||||
layoutMediaBinding.getRoot().setPadding(0, 0, 10, 0);
|
||||
holder.binding.attachmentsList.addView(layoutMediaBinding.getRoot());
|
||||
}
|
||||
|
||||
mediaPosition++;
|
||||
}
|
||||
holder.binding.mediaContainer.setVisibility(View.GONE);
|
||||
holder.binding.attachmentsListContainer.setVisibility(View.VISIBLE);
|
||||
if (!fullAttachement) {
|
||||
holder.binding.mediaContainer.setVisibility(View.GONE);
|
||||
holder.binding.attachmentsListContainer.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.binding.mediaContainer.setVisibility(View.VISIBLE);
|
||||
holder.binding.attachmentsListContainer.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
android:padding="@dimen/fab_margin"
|
||||
android:fitsSystemWindows="true"
|
||||
android:orientation="vertical"
|
||||
tools:context=".activities.ProxyActivity">
|
||||
|
|
|
@ -212,18 +212,16 @@
|
|||
android:layout_marginEnd="6dp"
|
||||
tools:text="Warning: Lorem Ipsum below" />
|
||||
|
||||
<app.fedilab.android.helper.CustomTextView
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/spoiler_expand"
|
||||
style="@style/Widget.Material3.Button.OutlinedButton.Icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="48dp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:text="@string/show_content"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
|
||||
android:textSize="16sp" />
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body2" />
|
||||
|
||||
<app.fedilab.android.helper.CustomTextView
|
||||
android:id="@+id/status_content"
|
||||
|
@ -406,6 +404,7 @@
|
|||
android:layout_marginStart="48dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone" />
|
||||
|
||||
<HorizontalScrollView
|
||||
|
|
|
@ -238,7 +238,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="6dp"
|
||||
android:elevation="2dp"
|
||||
android:background="?colorSurfaceVariant"
|
||||
android:background="?colorSurface"
|
||||
android:visibility="gone"
|
||||
app:constraint_referenced_ids="button_attach_image,button_attach_audio,button_attach_video,button_close_attachment_panel,button_poll,button_attach_manual"
|
||||
app:flow_maxElementsWrap="3"
|
||||
|
@ -298,7 +298,7 @@
|
|||
android:orientation="vertical"
|
||||
android:padding="6dp"
|
||||
android:visibility="gone"
|
||||
android:background="?colorSurfaceVariant"
|
||||
android:background="?colorSurface"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="1">
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/media_root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:id="@+id/media"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
||||
|
@ -13,8 +17,13 @@
|
|||
tools:ignore="ContentDescription" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
app:layout_constraintBottom_toBottomOf="@+id/media"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/media"
|
||||
android:id="@+id/play_video"
|
||||
android:layout_width="wrap_content"
|
||||
tools:visibility="visible"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/ic_baseline_play_circle_filled_24"
|
||||
|
@ -22,6 +31,10 @@
|
|||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/play_music"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/media"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/media"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
|
@ -30,6 +43,8 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/view_hide"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/media"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_alignParentStart="true"
|
||||
|
@ -40,12 +55,31 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/view_description"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/media"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
tools:visibility="visible"
|
||||
android:layout_margin="5dp"
|
||||
android:contentDescription="@string/description"
|
||||
android:src="@drawable/ic_outline_note_alt_24"
|
||||
android:visibility="gone" />
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/media"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
tools:text="2/4"
|
||||
tools:visibility="visible" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
Reference in New Issue