fix account switching when offline/error (#830)
This commit is contained in:
parent
95b1a7c61a
commit
0b3bee0d15
|
@ -420,7 +420,7 @@ public final class MainActivity extends BottomSheetActivity implements ActionBut
|
||||||
|
|
||||||
Intent intent = new Intent(this, MainActivity.class);
|
Intent intent = new Intent(this, MainActivity.class);
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
startActivityWithSlideInAnimation(intent);
|
startActivity(intent);
|
||||||
finishWithoutSlideOutAnimation();
|
finishWithoutSlideOutAnimation();
|
||||||
|
|
||||||
overridePendingTransition(R.anim.explode, R.anim.explode);
|
overridePendingTransition(R.anim.explode, R.anim.explode);
|
||||||
|
@ -510,21 +510,15 @@ public final class MainActivity extends BottomSheetActivity implements ActionBut
|
||||||
|
|
||||||
List<AccountEntity> allAccounts = accountManager.getAllAccountsOrderedByActive();
|
List<AccountEntity> allAccounts = accountManager.getAllAccountsOrderedByActive();
|
||||||
|
|
||||||
// reuse the already existing "add account" item
|
|
||||||
List<IProfile> profiles = new ArrayList<>(allAccounts.size()+1);
|
List<IProfile> profiles = new ArrayList<>(allAccounts.size()+1);
|
||||||
for (IProfile profile: headerResult.getProfiles()) {
|
|
||||||
if (profile.getIdentifier() == DRAWER_ITEM_ADD_ACCOUNT) {
|
|
||||||
profiles.add(profile);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (AccountEntity acc : allAccounts) {
|
for (AccountEntity acc : allAccounts) {
|
||||||
CharSequence emojifiedName = CustomEmojiHelper.emojifyString(acc.getDisplayName(), acc.getEmojis(), headerResult.getView());
|
CharSequence emojifiedName = CustomEmojiHelper.emojifyString(acc.getDisplayName(), acc.getEmojis(), headerResult.getView());
|
||||||
emojifiedName = EmojiCompat.get().process(emojifiedName);
|
emojifiedName = EmojiCompat.get().process(emojifiedName);
|
||||||
|
|
||||||
profiles.add(0,
|
profiles.add(
|
||||||
new ProfileDrawerItem()
|
new ProfileDrawerItem()
|
||||||
|
.withSetSelected(acc.isActive())
|
||||||
.withName(emojifiedName)
|
.withName(emojifiedName)
|
||||||
.withIcon(acc.getProfilePictureUrl())
|
.withIcon(acc.getProfilePictureUrl())
|
||||||
.withNameShown(true)
|
.withNameShown(true)
|
||||||
|
@ -532,6 +526,15 @@ public final class MainActivity extends BottomSheetActivity implements ActionBut
|
||||||
.withEmail(acc.getFullName()));
|
.withEmail(acc.getFullName()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// reuse the already existing "add account" item
|
||||||
|
for (IProfile profile: headerResult.getProfiles()) {
|
||||||
|
if (profile.getIdentifier() == DRAWER_ITEM_ADD_ACCOUNT) {
|
||||||
|
profiles.add(profile);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
headerResult.clear();
|
||||||
headerResult.setProfiles(profiles);
|
headerResult.setProfiles(profiles);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue