From 8de6d0e3193ad0ba4fd1eb3cd6987fe576f1fc98 Mon Sep 17 00:00:00 2001 From: T8RIN Date: Thu, 4 May 2023 15:30:43 +0300 Subject: [PATCH] fix for #167 --- .../tech/imageresizershrinker/main_screen/MainActivity.kt | 7 +++++++ .../main_screen/components/MainScreen.kt | 3 ++- .../resize_screen/components/SwipeToReveal.kt | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/ru/tech/imageresizershrinker/main_screen/MainActivity.kt b/app/src/main/java/ru/tech/imageresizershrinker/main_screen/MainActivity.kt index 139801c7a9..fc7d0e56d4 100644 --- a/app/src/main/java/ru/tech/imageresizershrinker/main_screen/MainActivity.kt +++ b/app/src/main/java/ru/tech/imageresizershrinker/main_screen/MainActivity.kt @@ -199,6 +199,13 @@ class MainActivity : M3Activity() { currentFolderUri = saveFolderUri, onGetNewFolder = { viewModel.updateSaveFolderUri(it) + it?.let { uri -> + contentResolver.takePersistableUriPermission( + uri, + Intent.FLAG_GRANT_READ_URI_PERMISSION or + Intent.FLAG_GRANT_WRITE_URI_PERMISSION + ) + } }, showConfetti = { showConfetti = true }, viewModel = viewModel diff --git a/app/src/main/java/ru/tech/imageresizershrinker/main_screen/components/MainScreen.kt b/app/src/main/java/ru/tech/imageresizershrinker/main_screen/components/MainScreen.kt index 804cd0b499..e3ab02fc2d 100644 --- a/app/src/main/java/ru/tech/imageresizershrinker/main_screen/components/MainScreen.kt +++ b/app/src/main/java/ru/tech/imageresizershrinker/main_screen/components/MainScreen.kt @@ -234,7 +234,8 @@ fun MainScreen( RevealDirection.EndToStart, ), maxAmountOfOverflow = 1.dp, - state = state + state = state, + enabled = false ) ), windowInsets = WindowInsets(0) diff --git a/app/src/main/java/ru/tech/imageresizershrinker/resize_screen/components/SwipeToReveal.kt b/app/src/main/java/ru/tech/imageresizershrinker/resize_screen/components/SwipeToReveal.kt index 66f6b6c3e0..8c7ca300a6 100644 --- a/app/src/main/java/ru/tech/imageresizershrinker/resize_screen/components/SwipeToReveal.kt +++ b/app/src/main/java/ru/tech/imageresizershrinker/resize_screen/components/SwipeToReveal.kt @@ -106,6 +106,7 @@ fun Modifier.revealSwipeable( maxAmountOfOverflow: Dp, directions: Set, state: RevealState, + enabled: Boolean = true ) = composed { val maxAmountOfOverflowPx = with(LocalDensity.current) { maxAmountOfOverflow.toPx() } @@ -131,7 +132,7 @@ fun Modifier.revealSwipeable( anchors = anchors, thresholds = thresholds, orientation = Orientation.Horizontal, - enabled = true, // state.value == RevealValue.Default, + enabled = enabled, // state.value == RevealValue.Default, reverseDirection = isRtl, resistance = ResistanceConfig( basis = maxAmountOfOverflowPx,