diff --git a/app/src/main/java/org/ntlab/acanthus_client/resources/accounts/FollowsRest.java b/app/src/main/java/org/ntlab/acanthus_client/resources/accounts/FollowsRest.java index fec40ed..79d6bab 100644 --- a/app/src/main/java/org/ntlab/acanthus_client/resources/accounts/FollowsRest.java +++ b/app/src/main/java/org/ntlab/acanthus_client/resources/accounts/FollowsRest.java @@ -33,9 +33,8 @@ //ユーザーのフォローを解除するメソッド - @DELETE("accounts/{uid}/follows") - Call releaseFollows( + Call releaseFollows( @Path("uid") Integer uid, @Query("token") String token, @Query("followUid") Integer followUid 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 0b64c81..5838808 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 @@ -36,7 +36,9 @@ userPageViewModel = new ViewModelProvider(this).get(UserPageViewModel.class); acanthus = (Acanthus) getApplication(); Integer uid = 1; +// Integer uid = acanthus.getPreferenceUid(); String token = "abc0"; +// String token = acanthus.getPreferenceToken(); Integer uid2 = 2; TextView userNameText = findViewById(R.id.userNameText); @@ -55,6 +57,7 @@ }); Button followUserButton = findViewById(R.id.followUserButton); + //ログインしているユーザーがフォローしているかの有無で画面表示時のボタンの文字を変更する userPageViewModel.getFollows(uid); userPageViewModel.getFollowUidJson().observe(this, new Observer() { @@ -71,21 +74,17 @@ } }); - if (followsList.contains(uid2)) { - followUserButton.setText("フォロー解除"); - }else{ - followUserButton.setText("フォローする"); - } - //ユーザーのフォロー及びフォロー解除の処理 followUserButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (!followsList.contains(uid2)) { userPageViewModel.addFollow(uid, token, uid2); + followsList.add(uid2); followUserButton.setText("フォロー解除"); }else{ userPageViewModel.releaseFollow(uid, token, uid2); + followsList.remove(uid2); followUserButton.setText("フォローする"); } } @@ -97,6 +96,7 @@ @Override public void onClick(View v) { Intent intent = new Intent(getApplication(), FollowListActivity.class); + intent.putExtra("uid", uid2); startActivity(intent); } }); @@ -107,6 +107,7 @@ @Override public void onClick(View v) { Intent intent = new Intent(getApplication(), FollowerListActivity.class); + intent.putExtra("uid", uid2); startActivity(intent); } }); @@ -117,6 +118,7 @@ @Override public void onClick(View v) { Intent intent = new Intent(getApplication(), WorkListActivity.class); + intent.putExtra("uid", uid2); startActivity(intent); } }); diff --git a/app/src/main/java/org/ntlab/acanthus_client/views/userpage/UserPageViewModel.java b/app/src/main/java/org/ntlab/acanthus_client/views/userpage/UserPageViewModel.java index 1ddc2b6..c3264b3 100644 --- a/app/src/main/java/org/ntlab/acanthus_client/views/userpage/UserPageViewModel.java +++ b/app/src/main/java/org/ntlab/acanthus_client/views/userpage/UserPageViewModel.java @@ -100,15 +100,15 @@ final FollowsRest followsRest = retrofit.create(FollowsRest.class); //フォローの解除 - Call call = followsRest.releaseFollows(uid, token, followUid); - call.enqueue(new Callback() { + Call call = followsRest.releaseFollows(uid, token, followUid); + call.enqueue(new Callback() { @Override - public void onResponse(Call call, Response response) { + public void onResponse(Call call, Response response) { } @Override - public void onFailure(Call call, Throwable t) { + public void onFailure(Call call, Throwable t) { } });