From 74921e6d16ccc2290a7c77219b858b82a994b356 Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 26 Jul 2022 19:08:10 +0200 Subject: [PATCH] Fix issue #279 - Improve behavior --- .../android/activities/MediaActivity.java | 19 +++++++++++++------ .../main/res/layout/activity_media_pager.xml | 3 ++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/app/fedilab/android/activities/MediaActivity.java b/app/src/main/java/app/fedilab/android/activities/MediaActivity.java index 4d5f7662..02ee94a1 100644 --- a/app/src/main/java/app/fedilab/android/activities/MediaActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/MediaActivity.java @@ -239,12 +239,17 @@ public class MediaActivity extends BaseActivity implements OnDownloadInterface { } }); }); - if (attachments.get(position).translation != null) { - binding.mediaDescription.setVisibility(View.GONE); - binding.mediaDescriptionTranslated.setText(attachments.get(position).translation); - binding.mediaDescriptionTranslated.setVisibility(View.VISIBLE); + if (!fullscreen) { + if (attachments.get(position).translation != null) { + binding.mediaDescription.setVisibility(View.GONE); + binding.mediaDescriptionTranslated.setText(attachments.get(position).translation); + binding.mediaDescriptionTranslated.setVisibility(View.VISIBLE); + } else { + binding.mediaDescription.setVisibility(View.VISIBLE); + binding.mediaDescriptionTranslated.setVisibility(View.GONE); + } } else { - binding.mediaDescription.setVisibility(View.VISIBLE); + binding.mediaDescription.setVisibility(View.GONE); binding.mediaDescriptionTranslated.setVisibility(View.GONE); } } @@ -362,7 +367,7 @@ public class MediaActivity extends BaseActivity implements OnDownloadInterface { handler = new Handler(); if (description != null && description.trim().length() > 0 && description.trim().compareTo("null") != 0) { binding.mediaDescription.setText(description); - if (attachments.get(mediaPosition - 1).translation != null) { + if (attachments.get(binding.mediaViewpager.getCurrentItem()).translation != null) { binding.mediaDescription.setVisibility(View.GONE); binding.mediaDescriptionTranslated.setText(attachments.get(binding.mediaViewpager.getCurrentItem()).translation); binding.mediaDescriptionTranslated.setVisibility(View.VISIBLE); @@ -372,6 +377,8 @@ public class MediaActivity extends BaseActivity implements OnDownloadInterface { } } else { binding.translate.setVisibility(View.GONE); + binding.mediaDescriptionTranslated.setVisibility(View.GONE); + binding.mediaDescription.setVisibility(View.GONE); } } else { binding.translate.setVisibility(View.GONE); diff --git a/app/src/main/res/layout/activity_media_pager.xml b/app/src/main/res/layout/activity_media_pager.xml index 3083aa76..ea6c321c 100644 --- a/app/src/main/res/layout/activity_media_pager.xml +++ b/app/src/main/res/layout/activity_media_pager.xml @@ -77,7 +77,8 @@ style="@style/Widget.App.Button.IconOnly.Outline" android:layout_width="wrap_content" android:layout_height="wrap_content" - + android:visibility="gone" + tools:visibility="visible" android:contentDescription="@string/translate" app:icon="@drawable/ic_baseline_translate_24" app:iconPadding="0dp"