Fix accounts displaying (#1064)

Clear the accounts list before adding new ones.

Hopefully closes #1058 but I couldn't really test it because I don't have this issue without the patch.

Co-authored-by: qwerty287 <ndev@web.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1064
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
This commit is contained in:
qwerty287 2022-03-04 14:44:39 +01:00 committed by M M Arif
parent f7897041e4
commit 2a46c68d3d
1 changed files with 2 additions and 3 deletions

View File

@ -204,12 +204,11 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
userAccountsApi = BaseApi.getInstance(ctx, UserAccountsApi.class);
RecyclerView navRecyclerViewUserAccounts = hView.findViewById(R.id.userAccounts);
UserAccountsNavAdapter adapterUserAccounts;
adapterUserAccounts = new UserAccountsNavAdapter(ctx, userAccountsList, drawer);
UserAccountsNavAdapter adapterUserAccounts = new UserAccountsNavAdapter(ctx, userAccountsList, drawer);
userAccountsApi.getAllAccounts().observe((AppCompatActivity) ctx, userAccounts -> {
if(userAccounts.size() > 0) {
userAccountsList.clear();
userAccountsList.addAll(userAccounts);
navRecyclerViewUserAccounts.setAdapter(adapterUserAccounts);
navRecyclerViewFrame.setVisibility(View.VISIBLE);