Fix issue #617 - Update counters

This commit is contained in:
Thomas 2022-12-11 11:53:40 +01:00
parent bd66462968
commit 6da23a9da3
1 changed files with 17 additions and 1 deletions

View File

@ -195,6 +195,20 @@ public class ProfileActivity extends BaseActivity {
binding.accountRole.setText(account.role.name); binding.accountRole.setText(account.role.name);
binding.accountRole.setVisibility(View.VISIBLE); binding.accountRole.setVisibility(View.VISIBLE);
} }
if (binding.accountTabLayout.getTabCount() > 2) {
TabLayout.Tab statusTab = binding.accountTabLayout.getTabAt(0);
TabLayout.Tab followingTab = binding.accountTabLayout.getTabAt(1);
TabLayout.Tab followerTab = binding.accountTabLayout.getTabAt(2);
if (statusTab != null) {
statusTab.setText(getString(R.string.status_cnt, Helper.withSuffix(account.statuses_count)));
}
if (followingTab != null) {
followingTab.setText(getString(R.string.following_cnt, Helper.withSuffix(account.following_count)));
}
if (followerTab != null) {
followerTab.setText(getString(R.string.followers_cnt, Helper.withSuffix(account.followers_count)));
}
}
} }
} }
@ -507,8 +521,10 @@ public class ProfileActivity extends BaseActivity {
}); });
} }
}); });
if (accountInstance != null) { if (accountInstance != null && !accountInstance.equalsIgnoreCase(MainActivity.currentInstance)) {
accountsVM.lookUpAccount(accountInstance, account.username).observe(ProfileActivity.this, this::updateViewWithNewData); accountsVM.lookUpAccount(accountInstance, account.username).observe(ProfileActivity.this, this::updateViewWithNewData);
} else if (accountInstance != null && accountInstance.equalsIgnoreCase(MainActivity.currentInstance)) {
updateViewWithNewData(account);
} }
} }