skip animations for startup activities

This commit is contained in:
Daniel Gultsch 2018-02-09 22:19:13 +01:00
parent d33fca09cf
commit 97406ecf51
2 changed files with 14 additions and 5 deletions

View file

@ -1207,17 +1207,22 @@ public class ConversationActivity extends XmppActivity
mPostponedActivityResult = null; mPostponedActivityResult = null;
} }
private void redirectToStartConversationActivity() { private void redirectToStartConversationActivity(boolean noAnimation) {
Account pendingAccount = xmppConnectionService.getPendingAccount(); Account pendingAccount = xmppConnectionService.getPendingAccount();
if (pendingAccount == null) { if (pendingAccount == null) {
Intent startConversationActivity = new Intent(this, StartConversationActivity.class); Intent startConversationActivity = new Intent(this, StartConversationActivity.class);
startConversationActivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
if (noAnimation) {
startConversationActivity.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
}
startConversationActivity.putExtra("init", true); startConversationActivity.putExtra("init", true);
startActivity(startConversationActivity); startActivity(startConversationActivity);
if (noAnimation) {
overridePendingTransition(0,0);
}
} else { } else {
switchToAccount(pendingAccount, true); switchToAccount(pendingAccount, true);
return;
} }
finish();
} }
@Override @Override
@ -1241,20 +1246,23 @@ public class ConversationActivity extends XmppActivity
Intent redirectionIntent = new Intent(this, ManageAccountActivity.class); Intent redirectionIntent = new Intent(this, ManageAccountActivity.class);
redirectionIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION); redirectionIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(redirectionIntent); startActivity(redirectionIntent);
overridePendingTransition(0,0);
} else if (Config.MAGIC_CREATE_DOMAIN != null) { } else if (Config.MAGIC_CREATE_DOMAIN != null) {
Intent redirectionIntent =new Intent(this, WelcomeActivity.class); Intent redirectionIntent =new Intent(this, WelcomeActivity.class);
redirectionIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION); redirectionIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(redirectionIntent); startActivity(redirectionIntent);
overridePendingTransition(0,0);
} else { } else {
Intent editAccount = new Intent(this, EditAccountActivity.class); Intent editAccount = new Intent(this, EditAccountActivity.class);
editAccount.putExtra("init",true); editAccount.putExtra("init",true);
editAccount.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION); editAccount.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(editAccount); startActivity(editAccount);
overridePendingTransition(0,0);
} }
} }
} else if (conversationList.size() <= 0) { } else if (conversationList.size() <= 0) {
if (mRedirected.compareAndSet(false, true)) { if (mRedirected.compareAndSet(false, true)) {
redirectToStartConversationActivity(); redirectToStartConversationActivity(true);
} }
} else if (selectConversationByUuid(mOpenConversation)) { } else if (selectConversationByUuid(mOpenConversation)) {
if (mPanelOpen) { if (mPanelOpen) {
@ -1819,7 +1827,7 @@ public class ConversationActivity extends XmppActivity
} }
} else { } else {
if (!isStopping() && mRedirected.compareAndSet(false, true)) { if (!isStopping() && mRedirected.compareAndSet(false, true)) {
redirectToStartConversationActivity(); redirectToStartConversationActivity(false);
} }
Log.d(Config.LOGTAG,"not updating conversations fragment because conversations list size was 0"); Log.d(Config.LOGTAG,"not updating conversations fragment because conversations list size was 0");
} }

View file

@ -526,6 +526,7 @@ public abstract class XmppActivity extends Activity {
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION);
} }
startActivity(intent); startActivity(intent);
overridePendingTransition(0,0);
} }
protected void delegateUriPermissionsToService(Uri uri) { protected void delegateUriPermissionsToService(Uri uri) {