|
|
|
@ -44,9 +44,36 @@ public class ActivityCompose extends ActivityBase implements FragmentManager.OnB
|
|
|
|
|
|
|
|
|
|
getSupportFragmentManager().addOnBackStackChangedListener(this);
|
|
|
|
|
|
|
|
|
|
if (getSupportFragmentManager().getFragments().size() == 0) {
|
|
|
|
|
handle(getIntent());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onNewIntent(Intent intent) {
|
|
|
|
|
super.onNewIntent(intent);
|
|
|
|
|
setIntent(intent);
|
|
|
|
|
handle(intent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onBackStackChanged() {
|
|
|
|
|
if (getSupportFragmentManager().getBackStackEntryCount() == 0) {
|
|
|
|
|
Intent parent = getParentActivityIntent();
|
|
|
|
|
if (parent != null)
|
|
|
|
|
if (shouldUpRecreateTask(parent))
|
|
|
|
|
TaskStackBuilder.create(this)
|
|
|
|
|
.addNextIntentWithParentStack(parent)
|
|
|
|
|
.startActivities();
|
|
|
|
|
else {
|
|
|
|
|
parent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
|
|
|
startActivity(parent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
finishAndRemoveTask();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void handle(Intent intent) {
|
|
|
|
|
Bundle args;
|
|
|
|
|
Intent intent = getIntent();
|
|
|
|
|
String action = intent.getAction();
|
|
|
|
|
if (Intent.ACTION_VIEW.equals(action) ||
|
|
|
|
|
Intent.ACTION_SENDTO.equals(action) ||
|
|
|
|
@ -156,22 +183,3 @@ public class ActivityCompose extends ActivityBase implements FragmentManager.OnB
|
|
|
|
|
fragmentTransaction.commit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onBackStackChanged() {
|
|
|
|
|
if (getSupportFragmentManager().getBackStackEntryCount() == 0) {
|
|
|
|
|
Intent parent = getParentActivityIntent();
|
|
|
|
|
if (parent != null)
|
|
|
|
|
if (shouldUpRecreateTask(parent))
|
|
|
|
|
TaskStackBuilder.create(this)
|
|
|
|
|
.addNextIntentWithParentStack(parent)
|
|
|
|
|
.startActivities();
|
|
|
|
|
else {
|
|
|
|
|
parent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
|
|
|
startActivity(parent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
finishAndRemoveTask();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|