mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Fixed back button issue
This commit is contained in:
parent
37857a82e9
commit
d4011b25f4
1 changed files with 25 additions and 18 deletions
|
|
@ -362,9 +362,12 @@ class ContributionController @Inject constructor(@param:Named("default_preferenc
|
||||||
|
|
||||||
override fun onImagesPicked(
|
override fun onImagesPicked(
|
||||||
imagesFiles: List<UploadableFile>,
|
imagesFiles: List<UploadableFile>,
|
||||||
source: FilePicker.ImageSource, type: Int
|
source: FilePicker.ImageSource,
|
||||||
|
type: Int
|
||||||
) {
|
) {
|
||||||
val intent = handleImagesPicked(activity, imagesFiles)
|
val intent = handleImagesPicked(activity, imagesFiles).apply {
|
||||||
|
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
||||||
|
}
|
||||||
activity.startActivity(intent)
|
activity.startActivity(intent)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -385,27 +388,31 @@ class ContributionController @Inject constructor(@param:Named("default_preferenc
|
||||||
context: Context,
|
context: Context,
|
||||||
imagesFiles: List<UploadableFile>
|
imagesFiles: List<UploadableFile>
|
||||||
): Intent {
|
): Intent {
|
||||||
val shareIntent = Intent(context, UploadActivity::class.java)
|
val shareIntent = Intent(context, UploadActivity::class.java).apply {
|
||||||
shareIntent.setAction(ACTION_INTERNAL_UPLOADS)
|
action = ACTION_INTERNAL_UPLOADS
|
||||||
shareIntent
|
putParcelableArrayListExtra(UploadActivity.EXTRA_FILES, ArrayList(imagesFiles))
|
||||||
.putParcelableArrayListExtra(UploadActivity.EXTRA_FILES, ArrayList(imagesFiles))
|
|
||||||
val place = defaultKvStore.getJson<Place>(PLACE_OBJECT, Place::class.java)
|
|
||||||
|
|
||||||
if (place != null) {
|
val place = defaultKvStore.getJson<Place>(PLACE_OBJECT, Place::class.java)
|
||||||
shareIntent.putExtra(PLACE_OBJECT, place)
|
if (place != null) {
|
||||||
}
|
putExtra(PLACE_OBJECT, place)
|
||||||
|
}
|
||||||
|
|
||||||
if (locationBeforeImageCapture != null) {
|
if (locationBeforeImageCapture != null) {
|
||||||
shareIntent.putExtra(
|
putExtra(
|
||||||
UploadActivity.LOCATION_BEFORE_IMAGE_CAPTURE,
|
UploadActivity.LOCATION_BEFORE_IMAGE_CAPTURE,
|
||||||
locationBeforeImageCapture
|
locationBeforeImageCapture
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
putExtra(
|
||||||
|
UploadActivity.IN_APP_CAMERA_UPLOAD,
|
||||||
|
isInAppCameraUpload
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// ✅ Prevent multiple UploadActivity instances on backstack
|
||||||
|
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
||||||
}
|
}
|
||||||
|
|
||||||
shareIntent.putExtra(
|
|
||||||
UploadActivity.IN_APP_CAMERA_UPLOAD,
|
|
||||||
isInAppCameraUpload
|
|
||||||
)
|
|
||||||
isInAppCameraUpload = false // reset the flag for next use
|
isInAppCameraUpload = false // reset the flag for next use
|
||||||
return shareIntent
|
return shareIntent
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue