Commit 27120026 authored by Thomas's avatar Thomas
Browse files

Some improvements

parent 7576dc8b
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -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);
+26 −11
Original line number Diff line number Diff line
@@ -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());
                        });
                        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++;
                    }
                    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 {
+1 −1
Original line number Diff line number Diff line
@@ -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">
+4 −5
Original line number Diff line number Diff line
@@ -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
+2 −2
Original line number Diff line number Diff line
@@ -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">
Loading