- for calling refreshUI(media, true) would refresh the view pager position, cause mPos to be set back to 0,
so we retain the original behaviour and call refreshUI(media, false)
- when items have been removed up until the last item in the adapter, the ViewPager's OnPageChangeListener.onPageSelected does not get called for the first item
so mPos is never set to zero and deletion fails.
- we add a call in OnPageChangeListener.onPageScrolled to call onPageSelected(0), when the position == 0 to fix this.
- MediaStore crashed on deletion because the ViewPagerActivity got finish before the MediaStore.createDeleteRequest executes
- To fix, we apply the same approach in the MediaActivity and finish explicitly after deletion completes, if the media list is empty
- also, only refresh the UI when the media list is not empty to avoid UI glitches
- fix slideshow bug by resetting mAreSlideShowMediaVisible back to false when the slideshow ends
- on SDK 31+, if the app can manange media, we want to use the MediaStore request way of deleting files
- we use the new method added BaseSimpleActivity.checkManageMediaOrHandleSAFDialogSdk30 that performs the check and determines if we should show the SAF dialog or not
- users should not be able to pick restricted folders in PickDirectoryDialog when copying/moving files on SDK 30+
- show nice error message R.string.system_folder_restriction when user picks a restricted folder on SDK 30+
- restricted folders on SDK 30+ are: Android, Root of Internal and SDCard. The Download directory is writable
- the app has declared the MANAGE_MEDIA permission in the AndroidManifest
- also requesting the ACCESS_MEDIA_LOCATION permission will make the system not to show the user the prompts from MediaStore.createWriteRequest and MediaStore.createDeleteRequest
- when file is on the root of Internal Storage or SD Card, change the destination to the /Pictures folder, we cannot write to the root of any volume on SDK 30+
- call handleSAFDialogSdk30, so users are prompted to allow SAF when restoring, if not previously allowed
- if there are conflicts, handle it as though it's a CONFLICT_KEEP_BOTH by appending some characters to the destination name
- add new string restore_to_path shown when restoring to /Pictures folder on SDK 30+ instead of the root folder