diff --git a/app/src/main/java/com/example/cosmosclient/views/CreateGroupActivity.java b/app/src/main/java/com/example/cosmosclient/views/CreateGroupActivity.java index 14e774e..49e3d17 100644 --- a/app/src/main/java/com/example/cosmosclient/views/CreateGroupActivity.java +++ b/app/src/main/java/com/example/cosmosclient/views/CreateGroupActivity.java @@ -62,21 +62,22 @@ public void onClick(View view){ //ボタン連打防止 createGroupButton.setEnabled(false); + createGroupButton.setBackgroundColor(0xaa808080); new Handler().postDelayed(new Runnable() { public void run() { createGroupButton.setEnabled(true); + createGroupButton.setBackgroundColor(0xaa009688); } }, 1000L); - try { - Call createGroup = createGroupService.createGroup(groupNameText.getText().toString(), uId, token); + Call createGroup = createGroupService.createGroup(groupNameText.getText().toString(), uId, token); - createGroup.enqueue(new Callback() { - @Override - public void onResponse(Call call, Response response) { - if (response.isSuccessful()) { - //成功時 - Group result = response.body(); + createGroup.enqueue(new Callback() { + @Override + public void onResponse(Call call, Response response) { + if (response.isSuccessful()) { + //成功時 + Group result = response.body(); // //確認用 // System.out.println(result.getgId()); @@ -84,28 +85,25 @@ // System.out.println(result.getRequests()); // System.out.println(result.getUri()); - Toast.makeText(CreateGroupActivity.this, - "グループを作成しました", Toast.LENGTH_SHORT).show(); - finish(); - } else { - //onFailureでキャッチできない用のエラー - System.out.println(""); - Toast.makeText(CreateGroupActivity.this, - "通信エラー",Toast.LENGTH_SHORT).show(); - } - } - - @Override - public void onFailure(Call call, Throwable t) { - //失敗時 - t.printStackTrace(); Toast.makeText(CreateGroupActivity.this, - "グループ作成失敗",Toast.LENGTH_SHORT); + "グループを作成しました", Toast.LENGTH_SHORT).show(); + finish(); + } else { + //onFailureでキャッチできない用のエラー + System.out.println(""); + Toast.makeText(CreateGroupActivity.this, + "通信エラー",Toast.LENGTH_SHORT).show(); } - }); - }catch(Exception e){ - e.printStackTrace(); - } + } + + @Override + public void onFailure(Call call, Throwable t) { + //失敗時 + t.printStackTrace(); + Toast.makeText(CreateGroupActivity.this, + "グループ作成失敗",Toast.LENGTH_SHORT).show(); + } + }); } }); }