Conversation
…yResultLauncher This commit introduces a new way to handle storage permissions by utilizing the ActivityResultLauncher for requesting multiple permissions. The previous implementation using ActivityCompat has been replaced, allowing for a more robust and modern approach to permission management. # GENERATE BY https://aicommit.app
…troduce new permission check functions This commit modifies the way storage permissions are handled in the application. The `isStoragePermissionGrated` function is updated to take a permission string as an argument, allowing for greater flexibility. Additionally, new methods `checkReadingPermission` and `checkWritingPermission` are added to streamline the process of checking and requesting permissions. # GENERATE BY https://aicommit.app
# Conflicts: # app/src/main/java/me/rosuh/easywatermark/utils/ktx/ContextExtension.kt # gradle.properties
- Added `doOnApplyWindowInsets` extension support for consistent inset handling across multiple activities and views. - Updated `LaunchView.kt` to account for system bar insets and refactored child view layout logic to use calculated available height and dynamic margins. - Modified `AboutActivity.kt` and `OpenSourceActivity.kt` to use new inset utility instead of legacy `ViewCompat.setOnApplyWindowInsetsListener`. - Introduced new `WindowInsetsExt.kt` to centralize window inset logic. - Updated imports in `MainActivity.kt` for window inset compatibility utilities. Refs: #366,#361 > GENERATE BY https://aicommit.app
- Added new photo picker intents using `ActivityResultContracts.PickVisualMedia` - Introduced fallback to legacy gallery picker for lower Android versions - Removed custom `PickImageContract` implementation (file deleted) - Updated `AndroidManifest.xml` with permissions for Android 12L–14 - Simplified permissions handling in `ContextExtension.kt` - Updated `MainActivity.kt` to use multiple and single image pickers with improved media handling
- Replaced READ_EXTERNAL_STORAGE with conditional permission logic to support Android 13 (TIRAMISU) and above. - Introduced permission variable for backward compatibility. - Ensured consistent call to preCheckStoragePermission(). - Modified ContextExtension.kt to handle new Android SDK changes.
- Added new `WindowInsetsExt.kt` under `utils.ktx` to handle window insets safely. - Introduced `InitialPadding` data class and `doOnApplyWindowInsets()` extension for `View`.
…tion handling (#363) Co-authored-by: rosuH <15865017+rosuH@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: rosuH <hi@rosuh.me>
- Introduced `pendingPermissionAction` to store actions awaiting permission result - Ensured deferred actions are invoked only after permission granted - Cleared `pendingPermissionAction` to prevent memory leaks and repeated invocation - Updated both read and write permission flows in `MainActivity.kt` > GENERATE BY https://aicommit.app
- renamed job to `Compile (app:assembleDebug)` for clarity - added concurrency control to cancel redundant runs - introduced `paths-ignore` and `permissions` for optimized triggers and security - validated Gradle wrapper for build integrity - switched JDK setup from Zulu to Temurin 17 - added Android SDK setup for better environment preparedness - improved Gradle caching strategy with read-only mode on PRs - removed obsolete `simple_compile` job and duplicate steps - updated workflow display name to “PR Checks” Affected file: `.github/workflows/pr_pre_check.yml` > GENERATE BY https://aicommit.app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several improvements to the app's image picking functionality and enhances system bar inset handling for a more modern and consistent UI experience. The most significant changes are the migration to the Android Photo Picker API, updates to permission handling for newer Android versions, and improved support for system window insets across activities and custom views.
Image Picking & Permissions
MainActivityfrom a customPickImageContractto the Android Photo Picker API (ActivityResultContracts.PickVisualMediaandPickMultipleVisualMedia), with fallback to legacy pickers for older devices. This simplifies code and improves compatibility with Android 13+ privacy requirements. ([[1]](https://github.com/rosuH/EasyWatermark/pull/367/files#diff-a7ebc7e11c0880fadc1c7fbac548ddebdd0038b6238793f6c16b643c78bb69cdL64-R78),[[2]](https://github.com/rosuH/EasyWatermark/pull/367/files#diff-a7ebc7e11c0880fadc1c7fbac548ddebdd0038b6238793f6c16b643c78bb69cdL230-R249),[[3]](https://github.com/rosuH/EasyWatermark/pull/367/files#diff-a7ebc7e11c0880fadc1c7fbac548ddebdd0038b6238793f6c16b643c78bb69cdL686-R722),[[4]](https://github.com/rosuH/EasyWatermark/pull/367/files#diff-bbe19512b5710e18f618d2254087e95caa404e1b514b226902a9edb22f464820L1-L21))AndroidManifest.xmlto support new media access permissions for Android 13 (API 33) and Android 14 (API 34), ensuring proper access to images across different OS versions. ([app/src/main/AndroidManifest.xmlR11-R21](https://github.com/rosuH/EasyWatermark/pull/367/files#diff-7fa6aef292187a049f7a4d6060d8df3ba212d838789c78940bd363344b1c38cdR11-R21))System Window Insets Handling
fixed Fullscreen view prevents use #366
fixed Parts of the app are covering the navigation buttons #361
Refactored
AboutActivityandOpenSourceActivityto use a newdoOnApplyWindowInsetsextension for applying system bar insets via padding, replacing older margin-based logic and improving UI consistency on devices with display cutouts and gesture navigation. ([[1]](https://github.com/rosuH/EasyWatermark/pull/367/files#diff-8324ba88e7d9530e83380480e9a619de95ad655788a99941333ddda7c10e063cL70-R83),[[2]](https://github.com/rosuH/EasyWatermark/pull/367/files#diff-a655789ae95db36f15349affc8d415a888172f6b947cb5235d7d52ad2dc8b223R19-R29))Enhanced
LaunchViewto handle system bar and display cutout insets, dynamically updating its margins to ensure proper layout regardless of device configuration. ([app/src/main/java/me/rosuh/easywatermark/ui/widget/LaunchView.ktR252-R266](https://github.com/rosuH/EasyWatermark/pull/367/files#diff-9d262bf061d53d76143e5503d95d20027b33b1af5643d40a6f0b3920261c9f53R252-R266))General Codebase Clean-up
PickImageContractclass, as all image picking is handled by standard Android APIs. ([app/src/main/java/me/rosuh/easywatermark/utils/PickImageContract.ktL1-L21](https://github.com/rosuH/EasyWatermark/pull/367/files#diff-bbe19512b5710e18f618d2254087e95caa404e1b514b226902a9edb22f464820L1-L21))[[1]](https://github.com/rosuH/EasyWatermark/pull/367/files#diff-a7ebc7e11c0880fadc1c7fbac548ddebdd0038b6238793f6c16b643c78bb69cdL23-R31),[[2]](https://github.com/rosuH/EasyWatermark/pull/367/files#diff-8324ba88e7d9530e83380480e9a619de95ad655788a99941333ddda7c10e063cL11-L22),[[3]](https://github.com/rosuH/EasyWatermark/pull/367/files#diff-9d262bf061d53d76143e5503d95d20027b33b1af5643d40a6f0b3920261c9f53R14-R18),[[4]](https://github.com/rosuH/EasyWatermark/pull/367/files#diff-9d262bf061d53d76143e5503d95d20027b33b1af5643d40a6f0b3920261c9f53R29))Version Update
build.gradle.ktsto reflect these significant changes. ([app/build.gradle.ktsL19-R20](https://github.com/rosuH/EasyWatermark/pull/367/files#diff-8cff73265af19c059547b76aca8882cbaa3209291406f52df1dafbbc78e80c46L19-R20))