diff options
author | MChen321 <76930316+MChen321@users.noreply.github.com> | 2022-09-21 05:59:09 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-21 05:59:09 +0000 |
commit | a87704b00d8c8bc73292d0993763ecd4dec32356 (patch) | |
tree | e3cab6f6ddc6b51e2f1c9949b53c82be40242b6a /app/src/main | |
parent | 0a182209982c8c5ada1869574634ee0cad48d8a8 (diff) | |
download | infinity-for-reddit-a87704b00d8c8bc73292d0993763ecd4dec32356.tar infinity-for-reddit-a87704b00d8c8bc73292d0993763ecd4dec32356.tar.gz infinity-for-reddit-a87704b00d8c8bc73292d0993763ecd4dec32356.tar.bz2 infinity-for-reddit-a87704b00d8c8bc73292d0993763ecd4dec32356.tar.lz infinity-for-reddit-a87704b00d8c8bc73292d0993763ecd4dec32356.tar.xz infinity-for-reddit-a87704b00d8c8bc73292d0993763ecd4dec32356.tar.zst infinity-for-reddit-a87704b00d8c8bc73292d0993763ecd4dec32356.zip |
Fixed Gray Overlay in Image (#1111)
* Added a clear search bar text button
* Made caption disappear/show when tapping on image and removed gray overlay when no caption.
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryImageOrGifFragment.java | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryImageOrGifFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryImageOrGifFragment.java index db4cfeb0..527dd40d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryImageOrGifFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryImageOrGifFragment.java @@ -215,6 +215,12 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment { loadImage(); + String caption = media.caption; + String captionUrl = media.captionUrl; + boolean captionIsEmpty = TextUtils.isEmpty(caption); + boolean captionUrlIsEmpty = TextUtils.isEmpty(captionUrl); + boolean captionTextOrUrlIsNotEmpty = !captionIsEmpty || !captionUrlIsEmpty; + imageView.setOnClickListener(view -> { if (activity.isActionBarHidden()) { activity.getWindow().getDecorView().setSystemUiVisibility(0); @@ -222,6 +228,9 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment { if (activity.isUseBottomAppBar()) { bottomAppBarMenu.setVisibility(View.VISIBLE); } + if (captionTextOrUrlIsNotEmpty){ + bottomAppBar.setVisibility(View.VISIBLE); + } } else { hideAppBar(); } @@ -263,11 +272,7 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment { }); } - String caption = media.caption; - String captionUrl = media.captionUrl; - boolean captionIsEmpty = TextUtils.isEmpty(caption); - boolean captionUrlIsEmpty = TextUtils.isEmpty(captionUrl); - if (!captionIsEmpty || !captionUrlIsEmpty) { + if (captionTextOrUrlIsNotEmpty) { isUseBottomCaption = true; if (!activity.isUseBottomAppBar()) { @@ -314,6 +319,8 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment { captionUrlTextView.setVisibility(View.VISIBLE); captionUrlTextView.setHighlightColor(Color.TRANSPARENT); } + } else { + bottomAppBar.setVisibility(View.GONE); } return rootView; @@ -331,6 +338,7 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment { if (activity.isUseBottomAppBar()) { bottomAppBarMenu.setVisibility(View.GONE); } + bottomAppBar.setVisibility(View.GONE); } private void loadImage() { |