Finish affinity

pull/194/head
M66B 4 years ago
parent f9c46946c5
commit a4cb6d8b40

@ -60,6 +60,12 @@ public class ActivityCompose extends ActivityBase implements FragmentManager.OnB
@Override
public void onBackStackChanged() {
if (getSupportFragmentManager().getBackStackEntryCount() == 0) {
Intent intent = getIntent();
if (intent != null && isShared(intent.getAction())) {
finishAffinity();
return;
}
Intent parent = getParentActivityIntent();
if (parent != null)
if (shouldUpRecreateTask(parent))
@ -78,11 +84,7 @@ public class ActivityCompose extends ActivityBase implements FragmentManager.OnB
private void handle(Intent intent) {
Bundle args;
String action = intent.getAction();
if (Intent.ACTION_VIEW.equals(action) ||
Intent.ACTION_SENDTO.equals(action) ||
Intent.ACTION_SEND.equals(action) ||
Intent.ACTION_SEND_MULTIPLE.equals(action)) {
if (isShared(action)) {
args = new Bundle();
args.putString("action", "new");
args.putLong("account", -1);
@ -199,4 +201,11 @@ public class ActivityCompose extends ActivityBase implements FragmentManager.OnB
fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("compose");
fragmentTransaction.commit();
}
private static boolean isShared(String action) {
return (Intent.ACTION_VIEW.equals(action) ||
Intent.ACTION_SENDTO.equals(action) ||
Intent.ACTION_SEND.equals(action) ||
Intent.ACTION_SEND_MULTIPLE.equals(action));
}
}

Loading…
Cancel
Save