Commit c41caddc authored by Thomas's avatar Thomas
Browse files

Merge pull request 'Add some content descriptions + update some buttons'...

Merge pull request 'Add some content descriptions + update some buttons' (#1166) from 0xd9a/Fedilab:better_buttons into develop

Reviewed-on: https://codeberg.org/tom79/Fedilab/pulls/1166
parents 8f53e6f5 dc486381
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.database.Cursor;
@@ -99,6 +100,7 @@ import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.load.resource.gif.GifDrawable;
import com.bumptech.glide.request.RequestOptions;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -1461,6 +1463,24 @@ public class Helper {
        imageView.setColorFilter(color);
    }

    /**
     * change color of a drawable
     *
     * @param materialButton {@link MaterialButton}
     * @param hexaColor example 0xffff00
     */
    public static void changeDrawableColor(Context context, MaterialButton materialButton, int hexaColor) {
        if (materialButton == null)
            return;
        int color;
        try {
            color = context.getResources().getColor(hexaColor);
        } catch (Resources.NotFoundException e) {
            color = hexaColor;
        }
        materialButton.setIconTint(ColorStateList.valueOf(color));
    }

    /**
     * change color of a drawable
     *
+2 −0
Original line number Diff line number Diff line
@@ -1697,9 +1697,11 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
                if (holder.binding.contentSpoiler.getVisibility() == View.VISIBLE) {
                    statusDraft.spoilerChecked = false;
                    holder.binding.contentSpoiler.setVisibility(View.GONE);
                    holder.binding.buttonSensitive.setContentDescription(context.getString(R.string.add_content_warning));
                } else {
                    holder.binding.contentSpoiler.setVisibility(View.VISIBLE);
                    statusDraft.spoilerChecked = true;
                    holder.binding.buttonSensitive.setContentDescription(context.getString(R.string.remove_content_warning));
                }
            });
            //Last compose drawer
+2 −4
Original line number Diff line number Diff line
@@ -1279,8 +1279,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
        holder.binding.actionButtonReply.getLayoutParams().height = (int) (normalSize * scaleIcon);
        holder.binding.actionButtonReply.requestLayout();

        holder.binding.actionButtonTranslate.getLayoutParams().width = (int) (normalSize * scaleIcon);
        holder.binding.actionButtonTranslate.getLayoutParams().height = (int) (normalSize * scaleIcon);
        holder.binding.actionButtonTranslate.setIconSize((int) (normalSize * scaleIcon));
        holder.binding.actionButtonTranslate.requestLayout();

        holder.binding.actionButtonBoost.setImageSize((int) (normalSize * scaleIcon));
@@ -1292,8 +1291,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
        holder.binding.statusAddCustomEmoji.getLayoutParams().height = (int) (normalSize * scaleIcon);
        holder.binding.statusAddCustomEmoji.requestLayout();

        holder.binding.actionButtonQuote.getLayoutParams().width = (int) (normalSize * scaleIcon);
        holder.binding.actionButtonQuote.getLayoutParams().height = (int) (normalSize * scaleIcon);
        holder.binding.actionButtonQuote.setIconSize((int) (normalSize * scaleIcon));
        holder.binding.actionButtonQuote.requestLayout();

        holder.binding.statusEmoji.getLayoutParams().width = (int) (normalSize * scaleIcon);
+20 −24
Original line number Diff line number Diff line
@@ -707,7 +707,7 @@
                    android:layout_height="48dp"
                    android:adjustViewBounds="true"
                    android:layout_gravity="center"
                    android:contentDescription="@string/reblog_add"
                    android:contentDescription="@string/action_reblog"
                    app:activeImage="@drawable/ic_round_repeat_active_24"
                    app:iconSize="28dp"
                    app:inactiveImage="@drawable/ic_round_repeat_24"
@@ -726,23 +726,20 @@

            </androidx.appcompat.widget.LinearLayoutCompat>

            <androidx.appcompat.widget.AppCompatImageView
            <com.google.android.material.button.MaterialButton
                android:id="@+id/action_button_quote"
                android:layout_width="28dp"
                android:layout_height="28dp"
                android:layout_gravity="center"
                android:adjustViewBounds="true"
                android:background="@color/transparent"
                android:clickable="true"
                android:contentDescription="@string/translate"
                android:focusable="true"
                android:src="@drawable/ic_baseline_format_quote_24"
                android:visibility="gone"
                style="@style/Widget.Material3.Button.IconButton"
                android:layout_width="48dp"
                android:layout_height="48dp"
                android:contentDescription="@string/action_quote"
                app:icon="@drawable/ic_baseline_format_quote_24"
                app:iconGravity="textStart"
                app:iconSize="28dp"
                app:iconTint="?colorControlNormal"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toStartOf="@+id/action_button_favorite_container"
                app:layout_constraintStart_toEndOf="@+id/action_button_boost_container"
                app:layout_constraintTop_toTopOf="parent"
                tools:visibility="visible" />
                app:layout_constraintTop_toTopOf="parent" />

            <androidx.appcompat.widget.LinearLayoutCompat
                android:id="@+id/action_button_favorite_container"
@@ -760,7 +757,7 @@
                    android:layout_height="48dp"
                    android:layout_gravity="center"
                    android:adjustViewBounds="true"
                    android:contentDescription="@string/favourite_add"
                    android:contentDescription="@string/action_favourite"
                    app:activeImage="@drawable/ic_round_star_24"
                    app:animationSpeed="1.5"
                    app:inactiveImage="@drawable/ic_round_star_border_24"
@@ -797,18 +794,17 @@
                sparkbutton:iconSize="28dp" />


            <androidx.appcompat.widget.AppCompatImageView
            <com.google.android.material.button.MaterialButton
                android:id="@+id/action_button_translate"
                android:layout_width="28dp"
                android:layout_height="28dp"
                android:layout_gravity="center"
                android:adjustViewBounds="true"
                android:background="@color/transparent"
                android:clickable="true"
                style="@style/Widget.Material3.Button.IconButton"
                android:layout_width="48dp"
                android:layout_height="48dp"
                android:contentDescription="@string/translate"
                android:focusable="true"
                android:src="@drawable/ic_baseline_translate_24"
                android:visibility="gone"
                app:icon="@drawable/ic_baseline_translate_24"
                app:iconGravity="textStart"
                app:iconSize="28dp"
                app:iconTint="?colorControlNormal"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toStartOf="@+id/action_button_maths"
                app:layout_constraintStart_toEndOf="@+id/action_button_bookmark"
+11 −0
Original line number Diff line number Diff line
@@ -179,6 +179,7 @@
            android:layout_height="wrap_content"
            android:layout_marginVertical="6dp"
            android:layout_marginStart="6dp"
            android:contentDescription="@string/open_new_attachment_panel"
            app:icon="@drawable/ic_compose_attach"
            app:layout_constraintBottom_toBottomOf="@id/action_buttons_barrier"
            app:layout_constraintStart_toStartOf="parent"
@@ -191,6 +192,7 @@
            android:layout_height="wrap_content"
            android:layout_marginVertical="6dp"
            android:checkable="true"
            android:contentDescription="@string/add_content_warning"
            app:icon="@drawable/ic_compose_sensitive"
            app:layout_constraintBottom_toBottomOf="@id/action_buttons_barrier"
            app:layout_constraintStart_toEndOf="@id/button_attach"
@@ -203,6 +205,7 @@
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginVertical="6dp"
            android:contentDescription="@string/change_visibility"
            app:icon="@drawable/ic_compose_visibility_public"
            app:iconGravity="textStart"
            app:iconPadding="0dp"
@@ -216,6 +219,7 @@
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginVertical="6dp"
            android:contentDescription="@string/set_language"
            android:fontFamily="monospace"
            android:minWidth="72dp"
            app:layout_constraintBottom_toBottomOf="@id/action_buttons_barrier"
@@ -253,6 +257,7 @@
            android:layout_height="wrap_content"
            android:layout_marginVertical="6dp"
            android:layout_marginEnd="6dp"
            android:contentDescription="@string/action_publish"
            app:icon="@drawable/ic_compose_post"
            app:layout_constraintBottom_toBottomOf="@id/action_buttons_barrier"
            app:layout_constraintEnd_toEndOf="parent"
@@ -276,6 +281,7 @@
            style="@style/Widget.Material3.Button.IconButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:contentDescription="@string/attach_images"
            app:icon="@drawable/ic_compose_attach_image" />

        <com.google.android.material.button.MaterialButton
@@ -283,6 +289,7 @@
            style="@style/Widget.Material3.Button.IconButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:contentDescription="@string/attach_audio"
            app:icon="@drawable/ic_compose_attach_audio" />

        <com.google.android.material.button.MaterialButton
@@ -290,6 +297,7 @@
            style="@style/Widget.Material3.Button.IconButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:contentDescription="@string/attach_videos"
            app:icon="@drawable/ic_compose_attach_video" />

        <com.google.android.material.button.MaterialButton
@@ -297,6 +305,7 @@
            style="@style/Widget.Material3.Button.IconButton.Outlined"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:contentDescription="@string/close_new_attachment_panel"
            app:icon="@drawable/ic_baseline_close_24" />

        <com.google.android.material.button.MaterialButton
@@ -304,6 +313,7 @@
            style="@style/Widget.Material3.Button.IconButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:contentDescription="@string/add_poll"
            app:icon="@drawable/ic_compose_poll" />

        <com.google.android.material.button.MaterialButton
@@ -311,6 +321,7 @@
            style="@style/Widget.Material3.Button.IconButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:contentDescription="@string/attach_files"
            app:icon="@drawable/ic_compose_attach_more" />

        <androidx.appcompat.widget.LinearLayoutCompat
Loading