mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-23 12:38:33 +00:00
Fix missing photos in gallery.
This commit is contained in:
@@ -118,13 +118,7 @@ public class AttachmentKeyboard extends FrameLayout implements InputAwareLayout.
|
||||
}
|
||||
|
||||
public void onMediaChanged(@NonNull List<Media> media) {
|
||||
if (StorageUtil.canReadAllFromMediaStore()) {
|
||||
mediaList.setVisibility(VISIBLE);
|
||||
mediaAdapter.setMedia(media, false);
|
||||
permissionButton.setVisibility(GONE);
|
||||
permissionText.setVisibility(GONE);
|
||||
manageButton.setVisibility(GONE);
|
||||
} else if (StorageUtil.canOnlyReadSelectedMediaStore() && media.isEmpty()) {
|
||||
if (StorageUtil.canOnlyReadSelectedMediaStore() && media.isEmpty()) {
|
||||
mediaList.setVisibility(GONE);
|
||||
manageButton.setVisibility(GONE);
|
||||
permissionText.setVisibility(VISIBLE);
|
||||
@@ -142,6 +136,12 @@ public class AttachmentKeyboard extends FrameLayout implements InputAwareLayout.
|
||||
manageButton.setVisibility(VISIBLE);
|
||||
permissionText.setVisibility(GONE);
|
||||
permissionButton.setVisibility(GONE);
|
||||
} else if (StorageUtil.canReadAnyFromMediaStore()) {
|
||||
mediaList.setVisibility(VISIBLE);
|
||||
mediaAdapter.setMedia(media, false);
|
||||
permissionButton.setVisibility(GONE);
|
||||
permissionText.setVisibility(GONE);
|
||||
manageButton.setVisibility(GONE);
|
||||
} else {
|
||||
mediaList.setVisibility(GONE);
|
||||
manageButton.setVisibility(GONE);
|
||||
|
||||
@@ -181,12 +181,7 @@ class MediaGalleryFragment : Fragment(R.layout.v2_media_gallery_fragment) {
|
||||
}
|
||||
|
||||
galleryItemsWithSelection.observe(viewLifecycleOwner) {
|
||||
if (StorageUtil.canReadAllFromMediaStore()) {
|
||||
binding.mediaGalleryMissingPermissions.visible = false
|
||||
binding.mediaGalleryManageContainer.visible = false
|
||||
shouldEnableScrolling = true
|
||||
galleryAdapter.submitList(it)
|
||||
} else if (StorageUtil.canOnlyReadSelectedMediaStore() && it.isEmpty()) {
|
||||
if (StorageUtil.canOnlyReadSelectedMediaStore() && it.isEmpty()) {
|
||||
binding.mediaGalleryMissingPermissions.visible = true
|
||||
binding.mediaGalleryManageContainer.visible = false
|
||||
binding.mediaGalleryPermissionText.text = getString(R.string.MediaGalleryFragment__no_photos_found)
|
||||
@@ -200,6 +195,11 @@ class MediaGalleryFragment : Fragment(R.layout.v2_media_gallery_fragment) {
|
||||
binding.mediaGalleryManageButton.setOnClickListener { v -> showManageContextMenu(v, v.rootView as ViewGroup, false, false) }
|
||||
shouldEnableScrolling = true
|
||||
galleryAdapter.submitList(it)
|
||||
} else if (StorageUtil.canReadAnyFromMediaStore()) {
|
||||
binding.mediaGalleryMissingPermissions.visible = false
|
||||
binding.mediaGalleryManageContainer.visible = false
|
||||
shouldEnableScrolling = true
|
||||
galleryAdapter.submitList(it)
|
||||
} else {
|
||||
binding.mediaGalleryMissingPermissions.visible = true
|
||||
binding.mediaGalleryManageContainer.visible = false
|
||||
|
||||
@@ -145,7 +145,9 @@ public class StorageUtil {
|
||||
}
|
||||
|
||||
public static boolean canOnlyReadSelectedMediaStore() {
|
||||
return Build.VERSION.SDK_INT >= 34 && Permissions.hasAll(AppDependencies.getApplication(), Manifest.permission.READ_MEDIA_VISUAL_USER_SELECTED);
|
||||
return Build.VERSION.SDK_INT >= 34 &&
|
||||
Permissions.hasAll(AppDependencies.getApplication(), Manifest.permission.READ_MEDIA_VISUAL_USER_SELECTED) &&
|
||||
!Permissions.hasAny(AppDependencies.getApplication(), Manifest.permission.READ_MEDIA_IMAGES, Manifest.permission.READ_MEDIA_VIDEO);
|
||||
}
|
||||
|
||||
public static boolean canReadAllFromMediaStore() {
|
||||
|
||||
Reference in New Issue
Block a user