diff --git a/app/src/main/java/com/example/cosmosclient/services/NotificationDone.java b/app/src/main/java/com/example/cosmosclient/services/NotificationDone.java index a1c3cb9..af74a0b 100644 --- a/app/src/main/java/com/example/cosmosclient/services/NotificationDone.java +++ b/app/src/main/java/com/example/cosmosclient/services/NotificationDone.java @@ -1,7 +1,5 @@ package com.example.cosmosclient.services; -import android.os.Handler; - import com.example.cosmosclient.entities.AddRequestsResponse; import com.example.cosmosclient.entities.Group; import com.example.cosmosclient.entities.Request; @@ -24,6 +22,10 @@ //interfaceから実装を取得 final GroupsRest requestsService = retrofit.create(GroupsRest.class); + public NotificationDone(){ + + } + public void onClick(Notification notification){ Group group = notification.getGroup(); @@ -33,21 +35,36 @@ if (request.getDeadline() != null) { deadline = String.format("%d-%02d-%02d %02d:%02d:%02d", request.getDeadline().getYear(), request.getDeadline().getMonth() + 1, request.getDeadline().getDate() + 1, 23, 59, 59); } - + final Call updateRequestCall = requestsService.updateRequest(group.getgId(), request.getrId(), request.getIssuer().getuId(), request.getProduct(), deadline, request.getLocation(), true, "token"); + Response response; try { - final Call updateRequestCall = requestsService.updateRequest(group.getgId(), request.getrId(), request.getIssuer().getuId(), request.getProduct(), deadline, request.getLocation(), true, "token"); - Response response = updateRequestCall.execute(); - if (!response.isSuccessful()) { + response = updateRequestCall.execute(); + if (response.isSuccessful()) { + AddRequestsResponse result = response.body(); +// Toast.makeText(RequestListActivity.this, "RequestListを達成しました", Toast.LENGTH_SHORT).show(); +// requestList.removeRequests(selectedRequestList); +// handler.post(new Runnable() { +// @Override +// public void run() { +// ResetRequestListTable(); +// AddRequestListTable(requestList); +// } +// }); + } else { // onFailure try { System.out.println(response.errorBody().string()); } catch (IOException e) { e.printStackTrace(); } + + //onFailureでキャッチできないエラーの処理 +// Toast.makeText(RequestListActivity.this, "通信エラー", Toast.LENGTH_SHORT).show(); } } catch (IOException e) { e.printStackTrace(); +// Toast.makeText(RequestListActivity.this, "RequestListの達成失敗しました", Toast.LENGTH_SHORT).show(); + } } - }