From 5782fe9da63cf1100594f17ae643b6ee247bbbb3 Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 8 Mar 2023 15:50:05 +0100 Subject: [PATCH] improve media description --- .../mastodon/ui/drawer/ComposeAdapter.java | 25 +------ .../layout/popup_media_description.xml | 67 ++++++++++--------- 2 files changed, 39 insertions(+), 53 deletions(-) diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ComposeAdapter.java b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ComposeAdapter.java index 7aa9c4d4..5a3cc06c 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ComposeAdapter.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ComposeAdapter.java @@ -31,9 +31,7 @@ import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.content.res.Configuration; import android.content.res.Resources; -import android.graphics.Bitmap; import android.graphics.Color; -import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Build; import android.os.Bundle; @@ -58,7 +56,6 @@ import android.widget.LinearLayout; import android.widget.TextView; import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.widget.AppCompatEditText; import androidx.appcompat.widget.LinearLayoutCompat; @@ -72,9 +69,8 @@ import androidx.recyclerview.widget.RecyclerView; import com.bumptech.glide.Glide; import com.bumptech.glide.load.engine.DiskCacheStrategy; +import com.bumptech.glide.load.resource.bitmap.RoundedCorners; import com.bumptech.glide.request.RequestOptions; -import com.bumptech.glide.request.target.CustomTarget; -import com.bumptech.glide.request.transition.Transition; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; @@ -1147,24 +1143,9 @@ public class ComposeAdapter extends RecyclerView.Adapter() { - @Override - public void onResourceReady(@NonNull Bitmap resource, Transition transition) { - popupMediaDescriptionBinding.mediaPicture.setImageBitmap(resource); - } - - @Override - public void onLoadCleared(@Nullable Drawable placeholder) { - - } - - @Override - public void onLoadFailed(@Nullable Drawable errorDrawable) { - super.onLoadFailed(errorDrawable); - } - }); + .apply(new RequestOptions().transform(new RoundedCorners(30))) + .into(popupMediaDescriptionBinding.mediaPicture); builderInner.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss()); if (attachment.description != null) { popupMediaDescriptionBinding.mediaDescription.setText(attachment.description); diff --git a/app/src/main/res/layouts/mastodon/layout/popup_media_description.xml b/app/src/main/res/layouts/mastodon/layout/popup_media_description.xml index 1e04d6ca..c26c06fb 100644 --- a/app/src/main/res/layouts/mastodon/layout/popup_media_description.xml +++ b/app/src/main/res/layouts/mastodon/layout/popup_media_description.xml @@ -14,40 +14,45 @@ You should have received a copy of the GNU General Public License along with Fedilab; if not, see . --> - + xmlns:tools="http://schemas.android.com/tools" + android:layout_height="match_parent"> - + android:layout_height="wrap_content"> - - - - - - + tools:context=".mastodon.activities.ComposeActivity"> + + + + + + +