diff --git a/app/src/main/java/com/example/nemophila/viewmodels/FriendViewModel.java b/app/src/main/java/com/example/nemophila/viewmodels/FriendViewModel.java index a9cfb11..2c79201 100644 --- a/app/src/main/java/com/example/nemophila/viewmodels/FriendViewModel.java +++ b/app/src/main/java/com/example/nemophila/viewmodels/FriendViewModel.java @@ -22,8 +22,8 @@ private final Retrofit retrofit; private final FriendsRest friendsRest; // ライブデータ - private final MutableLiveData friendsLiveData; - private final MutableLiveData requestedLiveData; + private final MutableLiveData> friendsLiveData; + private final MutableLiveData> requestedLiveData; private final MutableLiveData> requestingLiveData; // コンストラクタ @@ -39,10 +39,10 @@ } // ライブデータの取得(ゲッター) - public MutableLiveData getFriendsLiveData() { + public MutableLiveData> getFriendsLiveData() { return friendsLiveData; } - public MutableLiveData getRequestedLiveData() { + public MutableLiveData> getRequestedLiveData() { return requestedLiveData; } public MutableLiveData> getRequestingLiveData() { return requestingLiveData; } @@ -56,8 +56,8 @@ public void onResponse(Call> call, Response> response) { if (response.isSuccessful()) { System.out.println("Successful"); - Collection AccountNameJson = response.body(); -// setFriendsLiveDataFromJson(AccountNameJson); + Collection accountNameJson = response.body(); + friendsLiveData.setValue(accountNameJson); } else { System.out.println("ResponseError"); @@ -141,6 +141,7 @@ } }); } + public void deleteRequesting(String uid,String requesting_id, String token) { Call call = friendsRest.deleteRequesting(uid,requesting_id,token); call.enqueue(new Callback() {