diff --git a/app/src/main/java/app/fedilab/android/helper/Helper.java b/app/src/main/java/app/fedilab/android/helper/Helper.java index 99be394d..b8351169 100644 --- a/app/src/main/java/app/fedilab/android/helper/Helper.java +++ b/app/src/main/java/app/fedilab/android/helper/Helper.java @@ -1748,4 +1748,5 @@ public class Helper { } return null; } + } diff --git a/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java b/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java index 3559fa5c..2a45f7c8 100644 --- a/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java +++ b/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java @@ -128,6 +128,7 @@ import app.fedilab.android.helper.GlideFocus; import app.fedilab.android.helper.Helper; import app.fedilab.android.helper.LongClickLinkMovementMethod; import app.fedilab.android.helper.MastodonHelper; +import app.fedilab.android.helper.MediaHelper; import app.fedilab.android.helper.SpannableHelper; import app.fedilab.android.helper.ThemeHelper; import app.fedilab.android.ui.fragment.timeline.FragmentMastodonContext; @@ -323,6 +324,7 @@ public class StatusAdapter extends RecyclerView.Adapter boolean confirmBoost = sharedpreferences.getBoolean(context.getString(R.string.SET_NOTIF_VALIDATION), true); boolean fullAttachement = sharedpreferences.getBoolean(context.getString(R.string.SET_FULL_PREVIEW), false); boolean displayBookmark = sharedpreferences.getBoolean(context.getString(R.string.SET_DISPLAY_BOOKMARK), false); + boolean long_press_media = sharedpreferences.getBoolean(context.getString(R.string.SET_LONG_PRESS_STORE_MEDIA), false); if (MainActivity.currentAccount != null && MainActivity.currentAccount.api == Account.API.PLEROMA) { holder.binding.layoutReactions.getRoot().setVisibility(View.VISIBLE); @@ -1120,6 +1122,19 @@ public class StatusAdapter extends RecyclerView.Adapter } else { layoutMediaBinding.playMusic.setVisibility(View.GONE); } + String finalUrl; + if (statusToDeal.media_attachments.get(0).url == null) { + finalUrl = statusToDeal.media_attachments.get(0).remote_url; + } else { + finalUrl = statusToDeal.media_attachments.get(0).url; + } + layoutMediaBinding.media.setOnLongClickListener(v -> { + if (long_press_media) { + MediaHelper.manageMove(context, finalUrl, false); + } + return true; + }); + float focusX = 0.f; float focusY = 0.f; if (statusToDeal.media_attachments.get(0).meta != null && statusToDeal.media_attachments.get(0).meta.focus != null) { @@ -1162,6 +1177,18 @@ public class StatusAdapter extends RecyclerView.Adapter focusY = statusToDeal.media_attachments.get(0).meta.focus.y; } + String finalUrl; + if (attachment.url == null) { + finalUrl = attachment.remote_url; + } else { + finalUrl = attachment.url; + } + layoutMediaBinding.media.setOnLongClickListener(v -> { + if (long_press_media) { + MediaHelper.manageMove(context, finalUrl, false); + } + return true; + }); if (fullAttachement) { lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); layoutMediaBinding.media.setScaleType(ImageView.ScaleType.FIT_CENTER); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 32a3f6d8..05a4af2d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -848,7 +848,7 @@ - SET_LONG_PRESS_MEDIA + SET_LONG_PRESS_STORE_MEDIA SET_UNFOLLOW_VALIDATION SET_DISPLAY_ADMIN_STATUSES SET_LED_COLOUR_VAL diff --git a/app/src/main/res/xml/pref_timelines.xml b/app/src/main/res/xml/pref_timelines.xml index 1b9a9c73..bf408875 100644 --- a/app/src/main/res/xml/pref_timelines.xml +++ b/app/src/main/res/xml/pref_timelines.xml @@ -43,7 +43,7 @@ app:iconSpaceReserved="false" android:defaultValue="false" app:singleLineTitle="false" - app:key="@string/SET_LONG_PRESS_MEDIA" + app:key="@string/SET_LONG_PRESS_STORE_MEDIA" app:title="@string/set_long_press_media" />