diff --git a/app/src/main/java/org/ntlab/irisclient/TestDrawingActivity.java b/app/src/main/java/org/ntlab/irisclient/TestDrawingActivity.java index fa29a07..d66f0aa 100644 --- a/app/src/main/java/org/ntlab/irisclient/TestDrawingActivity.java +++ b/app/src/main/java/org/ntlab/irisclient/TestDrawingActivity.java @@ -8,9 +8,12 @@ import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AppCompatActivity; +import org.ntlab.irisclient.models.Member; import org.ntlab.irisclient.resources.GameRest; import org.ntlab.irisclient.resources.RoomsRest; +import java.util.List; + import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; @@ -41,25 +44,25 @@ Button ownerButton = findViewById(R.id.ownerdraw); ownerButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { - //(ownerのみ)drawtestを更新 : は動かない -/* - Call call = roomsRest.putTestRoom(); - call.enqueue(new Callback() { + ((Iris) getApplication()).setRid("drawtest"); + ((Iris) getApplication()).setNickname("owner"); + ((Iris) getApplication()).setTeam("r"); + ((Iris) getApplication()).setMaster(true); + Call> call = roomsRest.getRoomMember("drawtest"); + call.enqueue(new Callback>() { @Override - public void onResponse(Call call, Response response) { + public void onResponse(Call> call, Response> response) { if (response.isSuccessful()){ System.out.println("通信成功:createDrawTest"); + ((Iris) getApplication()).setMemberList(response.body()); } } @Override - public void onFailure(Call call, Throwable t) { + public void onFailure(Call> call, Throwable t) { System.out.println("通信失敗:createDrawTest"); System.out.println(t); } }); -*/ - ((Iris) getApplication()).setRid("drawtest"); - ((Iris) getApplication()).setNickname("owner"); Intent intent = new Intent(TestDrawingActivity.this,DrawingActivity.class); startActivity(intent); } @@ -71,6 +74,23 @@ public void onClick(View v) { ((Iris) getApplication()).setRid("drawtest"); ((Iris) getApplication()).setNickname("member"); + ((Iris) getApplication()).setTeam("b"); + ((Iris) getApplication()).setMaster(true); + Call> call = roomsRest.getRoomMember("drawtest"); + call.enqueue(new Callback>() { + @Override + public void onResponse(Call> call, Response> response) { + if (response.isSuccessful()){ + System.out.println("通信成功:createDrawTest"); + ((Iris) getApplication()).setMemberList(response.body()); + } + } + @Override + public void onFailure(Call> call, Throwable t) { + System.out.println("通信失敗:createDrawTest"); + System.out.println(t); + } + }); Intent intent = new Intent(TestDrawingActivity.this,DrawingActivity.class); startActivity(intent); }