diff --git a/app/src/main/java/org/ntlab/acanthus_client/views/userpage/UserPageActivity.java b/app/src/main/java/org/ntlab/acanthus_client/views/userpage/UserPageActivity.java index c936254..2a09b47 100644 --- a/app/src/main/java/org/ntlab/acanthus_client/views/userpage/UserPageActivity.java +++ b/app/src/main/java/org/ntlab/acanthus_client/views/userpage/UserPageActivity.java @@ -50,8 +50,10 @@ userNameText.setText(uname); TextView profileText = findViewById(R.id.profileText); + TextView followsSize = findViewById(R.id.followsSizeText); TextView followersSize = findViewById(R.id.followersSizeText); + Integer[] followersSizeInt = {0}; // Button returnButton = findViewById(R.id.returnButton); @@ -94,10 +96,14 @@ userPageViewModel.addFollow(loginUid, loginToken, uid); followsUidList.add(uid); followUserButton.setText("フォロー解除"); + followersSizeInt[0]++; + followersSize.setText(followersSizeInt[0].toString()); }else{ userPageViewModel.releaseFollow(loginUid, loginToken, uid); followsUidList.remove(uid); followUserButton.setText("フォローする"); + followersSizeInt[0]--; + followersSize.setText(followersSizeInt[0].toString()); } } }); @@ -107,8 +113,8 @@ userPageViewModel.getUserFollowJson().observe(this, new Observer() { @Override public void onChanged(FollowJson followJson) { - Integer size = followJson.getFollowUids().size(); - followsSize.setText(size.toString()); + Integer followsSizeInt = followJson.getFollowUids().size(); + followsSize.setText(followsSizeInt.toString()); } }); @@ -116,8 +122,8 @@ userPageViewModel.getFollowerJson().observe(this, new Observer() { @Override public void onChanged(FollowerJson followerJson) { - Integer size = followerJson.getFollowerUids().size(); - followersSize.setText(size.toString()); + followersSizeInt[0] = followerJson.getFollowerUids().size(); + followersSize.setText(followersSizeInt[0].toString()); } });