diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 285e352..8bc1e46 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -27,17 +27,6 @@ - - - - - - - @@ -45,5 +34,19 @@ + + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/java/com/locphamtran/recipescamera/ShareActivity.kt b/android/app/src/main/java/com/locphamtran/recipescamera/ShareActivity.kt new file mode 100644 index 0000000..40e03b3 --- /dev/null +++ b/android/app/src/main/java/com/locphamtran/recipescamera/ShareActivity.kt @@ -0,0 +1,30 @@ +package com.locphamtran.recipescamera + +import android.app.Activity +import android.content.Intent +import android.os.Bundle + +/** + * Share sheet entry point for SEND / SEND_MULTIPLE. + * + * A host app that starts us without FLAG_ACTIVITY_NEW_TASK drops the started + * activity into its own task, so the editor used to show up as a screen of that + * app (it lived in that app's stack, back returned there). MainActivity cannot + * fix that itself: bailing out in onCreate would either boot React twice or skip + * super.onCreate and crash onDestroy. + * + * So the share filters live here. This activity never draws (NoDisplay theme): + * it hands the same intent to MainActivity with NEW_TASK — singleTask then routes + * it to our own task, or re-delivers it to the running instance — and finishes. + * The editor is therefore always a task of its own. + */ +class ShareActivity : Activity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + startActivity( + Intent(intent) + .setClass(this, MainActivity::class.java) + .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)) + finish() + } +}