mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-01-15 04:37:12 +01:00
Fix caption shown under the navbar in ViewRedditGalleryImageOrGifFragment.
This commit is contained in:
parent
a12e65aa0e
commit
e3f9d31a34
@ -76,6 +76,7 @@ public class ViewRedditGalleryActivity extends AppCompatActivity implements SetA
|
|||||||
private String subredditName;
|
private String subredditName;
|
||||||
private boolean isNsfw;
|
private boolean isNsfw;
|
||||||
private boolean useBottomAppBar;
|
private boolean useBottomAppBar;
|
||||||
|
private boolean isActionBarHidden = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@ -279,6 +280,14 @@ public class ViewRedditGalleryActivity extends AppCompatActivity implements SetA
|
|||||||
this.typeface = typeface;
|
this.typeface = typeface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isActionBarHidden() {
|
||||||
|
return isActionBarHidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActionBarHidden(boolean isActionBarHidden) {
|
||||||
|
this.isActionBarHidden = isActionBarHidden;
|
||||||
|
}
|
||||||
|
|
||||||
private class SectionsPagerAdapter extends FragmentStatePagerAdapter {
|
private class SectionsPagerAdapter extends FragmentStatePagerAdapter {
|
||||||
|
|
||||||
SectionsPagerAdapter(@NonNull FragmentManager fm) {
|
SectionsPagerAdapter(@NonNull FragmentManager fm) {
|
||||||
|
@ -25,7 +25,7 @@ public class AspectRatioGifImageView extends GifImageView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final void setRatio(float var1) {
|
public final void setRatio(float var1) {
|
||||||
if (this.ratio != var1) {
|
if (Math.abs(this.ratio - var1) > 0.0001) {
|
||||||
this.ratio = var1;
|
this.ratio = var1;
|
||||||
|
|
||||||
requestLayout();
|
requestLayout();
|
||||||
|
@ -112,7 +112,6 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment {
|
|||||||
private String subredditName;
|
private String subredditName;
|
||||||
private boolean isNsfw;
|
private boolean isNsfw;
|
||||||
private boolean isDownloading = false;
|
private boolean isDownloading = false;
|
||||||
private boolean isActionBarHidden = false;
|
|
||||||
private boolean isUseBottomCaption = false;
|
private boolean isUseBottomCaption = false;
|
||||||
private boolean isFallback = false;
|
private boolean isFallback = false;
|
||||||
|
|
||||||
@ -215,20 +214,13 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment {
|
|||||||
});
|
});
|
||||||
|
|
||||||
loadImage();
|
loadImage();
|
||||||
activity.getWindow().getDecorView().setSystemUiVisibility(
|
|
||||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
|
||||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
|
||||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
|
||||||
|
|
||||||
imageView.setOnClickListener(view -> {
|
imageView.setOnClickListener(view -> {
|
||||||
if (isActionBarHidden) {
|
if (activity.isActionBarHidden()) {
|
||||||
activity.getWindow().getDecorView().setSystemUiVisibility(
|
activity.getWindow().getDecorView().setSystemUiVisibility(0);
|
||||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
activity.setActionBarHidden(false);
|
||||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
if (activity.isUseBottomAppBar()) {
|
||||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
bottomAppBarMenu.setVisibility(View.VISIBLE);
|
||||||
isActionBarHidden = false;
|
|
||||||
if (activity.isUseBottomAppBar() || isUseBottomCaption) {
|
|
||||||
bottomAppBar.setVisibility(View.VISIBLE);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
hideAppBar();
|
hideAppBar();
|
||||||
@ -244,7 +236,7 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (activity.isUseBottomAppBar()) {
|
if (activity.isUseBottomAppBar()) {
|
||||||
bottomAppBar.setVisibility(View.VISIBLE);
|
bottomAppBarMenu.setVisibility(View.VISIBLE);
|
||||||
if (media.mediaType == Post.Gallery.TYPE_GIF) {
|
if (media.mediaType == Post.Gallery.TYPE_GIF) {
|
||||||
titleTextView.setText(getString(R.string.view_reddit_gallery_activity_gif_label,
|
titleTextView.setText(getString(R.string.view_reddit_gallery_activity_gif_label,
|
||||||
getArguments().getInt(EXTRA_INDEX) + 1, getArguments().getInt(EXTRA_MEDIA_COUNT)));
|
getArguments().getInt(EXTRA_INDEX) + 1, getArguments().getInt(EXTRA_MEDIA_COUNT)));
|
||||||
@ -279,7 +271,6 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment {
|
|||||||
isUseBottomCaption = true;
|
isUseBottomCaption = true;
|
||||||
|
|
||||||
if (!activity.isUseBottomAppBar()) {
|
if (!activity.isUseBottomAppBar()) {
|
||||||
bottomAppBar.setVisibility(View.VISIBLE);
|
|
||||||
bottomAppBarMenu.setVisibility(View.GONE);
|
bottomAppBarMenu.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -339,9 +330,9 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment {
|
|||||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||||
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||||
| View.SYSTEM_UI_FLAG_IMMERSIVE);
|
| View.SYSTEM_UI_FLAG_IMMERSIVE);
|
||||||
isActionBarHidden = true;
|
activity.setActionBarHidden(true);
|
||||||
if (activity.isUseBottomAppBar() || isUseBottomCaption) {
|
if (activity.isUseBottomAppBar()) {
|
||||||
bottomAppBar.setVisibility(View.GONE);
|
bottomAppBarMenu.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -382,7 +373,8 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else if (itemId == R.id.action_set_wallpaper_view_reddit_gallery_image_or_gif_fragment) {
|
} else if (itemId == R.id.action_set_wallpaper_view_reddit_gallery_image_or_gif_fragment) {
|
||||||
setWallpaper();
|
//setWallpaper();
|
||||||
|
Toast.makeText(activity, Integer.toString(activity.getWindow().getDecorView().getSystemUiVisibility()), Toast.LENGTH_SHORT).show();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -542,6 +534,18 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment {
|
|||||||
if (ssiv == null || !ssiv.hasImage()) {
|
if (ssiv == null || !ssiv.hasImage()) {
|
||||||
loadImage();
|
loadImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (activity.isActionBarHidden()) {
|
||||||
|
activity.getWindow().getDecorView().setSystemUiVisibility(
|
||||||
|
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||||
|
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||||
|
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||||
|
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||||
|
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||||
|
| View.SYSTEM_UI_FLAG_IMMERSIVE);
|
||||||
|
} else {
|
||||||
|
activity.getWindow().getDecorView().setSystemUiVisibility(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -45,8 +45,8 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
android:backgroundTint="#80000000"
|
app:paddingBottomSystemWindowInsets="false"
|
||||||
android:visibility="gone">
|
android:backgroundTint="#80000000">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -93,7 +93,8 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/bottom_app_bar_menu_view_reddit_gallery_image_or_gif_fragment"
|
android:id="@+id/bottom_app_bar_menu_view_reddit_gallery_image_or_gif_fragment"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/title_text_view_view_reddit_gallery_image_or_gif_fragment"
|
android:id="@+id/title_text_view_view_reddit_gallery_image_or_gif_fragment"
|
||||||
|
Loading…
Reference in New Issue
Block a user