diff --git a/app/src/main/java/org/ntlab/irisclient/viewmodels/DrawingStateViewModel.java b/app/src/main/java/org/ntlab/irisclient/viewmodels/DrawingStateViewModel.java index 3d5c62f..9f2b0bd 100644 --- a/app/src/main/java/org/ntlab/irisclient/viewmodels/DrawingStateViewModel.java +++ b/app/src/main/java/org/ntlab/irisclient/viewmodels/DrawingStateViewModel.java @@ -125,33 +125,33 @@ }); } -// public void updateTimer(String rid) { -// -// final DrawingRest drawingRest = retrofit.create(DrawingRest.class); -// Call call = drawingRest.getTime(rid); -// -// call.enqueue(new Callback() { -// @Override -// public void onResponse(Call call, Response response) { -// if (response.isSuccessful()){ -// if(timerPreData == null){ -// timerMutableLiveData.setValue(response.body()); -// timerPreData = response.body(); -// }else if(response.body().equals(timerPreData)){ -// //値が一緒なら書き換えない -// }else{ -// //値が異なるときのみライブデータを上書き -// timerMutableLiveData.setValue(response.body()); -// timerPreData = response.body(); -// } -// } -// } -// -// @Override -// public void onFailure(Call call, Throwable t) { -// } -// }); -// } + public void updateTimer(String rid) { + + final DrawingRest drawingRest = retrofit.create(DrawingRest.class); + Call call = drawingRest.getTime(rid); + + call.enqueue(new Callback() { + @Override + public void onResponse(Call call, Response response) { + if (response.isSuccessful()){ + if(timerPreData == null){ + timerMutableLiveData.setValue(response.body()); + timerPreData = response.body(); + }else if(response.body().equals(timerPreData)){ + //値が一緒なら書き換えない + }else{ + //値が異なるときのみライブデータを上書き + timerMutableLiveData.setValue(response.body()); + timerPreData = response.body(); + } + } + } + + @Override + public void onFailure(Call call, Throwable t) { + } + }); + } // public LiveData> getMembers(String rid){ // RoomViewModel members = new RoomViewModel(); @@ -181,7 +181,7 @@ String nickName = iris.getNickname(); updateState(rid); updateDno(rid, nickName); -// updateTimer(rid); + updateTimer(rid); } public void putDrawing(Bitmap image) {