Skip to content

Commit b563dc3

Browse files
authored
fix: handle edit intents without output URI (#77)
* fix: handle edit intents without output uri See: #76 * docs: update changelog
1 parent 47ea04e commit b563dc3

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [Unreleased]
9+
10+
### Fixed
11+
12+
- Editing images from other apps now works as expected ([#76])
13+
814
## [1.1.0] - 2025-05-05
915

1016
### Added
@@ -26,6 +32,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2632

2733
- Initial release.
2834

35+
[#76]: https://github.com/FossifyOrg/Paint/issues/76
36+
2937
[Unreleased]: https://github.com/FossifyOrg/Paint/compare/1.1.0...HEAD
3038

3139
[1.1.0]: https://github.com/FossifyOrg/Paint/compare/1.0.0...1.1.0

app/src/main/kotlin/org/fossify/paint/activities/MainActivity.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,10 +340,12 @@ class MainActivity : SimpleActivity(), CanvasListener {
340340
if (intent?.action == Intent.ACTION_EDIT) {
341341
val data = intent.data
342342
val output = intent.extras?.get(MediaStore.EXTRA_OUTPUT)
343-
if (data != null && output != null && output is Uri) {
343+
if (data != null) {
344344
tryOpenUri(data, intent)
345345
isEditIntent = true
346-
intentUri = output
346+
if (output != null && output is Uri) {
347+
intentUri = output
348+
}
347349
}
348350
}
349351
}
@@ -508,7 +510,7 @@ class MainActivity : SimpleActivity(), CanvasListener {
508510

509511
private fun confirmImage() {
510512
when {
511-
isEditIntent -> {
513+
isEditIntent && intentUri != null -> {
512514
try {
513515
val outputStream = contentResolver.openOutputStream(intentUri!!)
514516
saveToOutputStream(outputStream, defaultPath.getCompressionFormat(), true)
@@ -517,6 +519,8 @@ class MainActivity : SimpleActivity(), CanvasListener {
517519
}
518520
}
519521

522+
isEditIntent -> trySaveImage()
523+
520524
intentUri?.scheme == "content" -> {
521525
val outputStream = contentResolver.openOutputStream(intentUri!!)
522526
saveToOutputStream(outputStream, defaultPath.getCompressionFormat(), true)

0 commit comments

Comments
 (0)