diff --git a/app/src/main/java/org/ntlab/irisclient/TestDrawingActivity.java b/app/src/main/java/org/ntlab/irisclient/TestDrawingActivity.java index d5ce1d4..8cc4463 100644 --- a/app/src/main/java/org/ntlab/irisclient/TestDrawingActivity.java +++ b/app/src/main/java/org/ntlab/irisclient/TestDrawingActivity.java @@ -8,12 +8,29 @@ import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AppCompatActivity; +import org.ntlab.irisclient.resources.GameRest; +import org.ntlab.irisclient.resources.RoomsRest; + +import retrofit2.Call; +import retrofit2.Callback; +import retrofit2.Response; +import retrofit2.Retrofit; +import retrofit2.converter.jackson.JacksonConverterFactory; + public class TestDrawingActivity extends AppCompatActivity { + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.test_activity_draw); + //サーバーとの通信を初期化 + Retrofit retrofit = new Retrofit.Builder() + .baseUrl("http://nitta-lab-www.is.konan-u.ac.jp/iris/") + .addConverterFactory(JacksonConverterFactory.create()) + .build(); + final RoomsRest roomRest = retrofit.create(RoomsRest.class); + //上の表示を削除 ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { @@ -24,6 +41,24 @@ Button ownerButton = findViewById(R.id.ownerdraw); ownerButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { + //(ownerのみ)drawtestを更新 : は動かない + /* + final RoomsRest roomsRest = retrofit.create(RoomsRest.class); + Call call = roomsRest.putTestRoom(); + call.enqueue(new Callback() { + @Override + public void onResponse(Call call, Response response) { + if (response.isSuccessful()){ + System.out.println("通信成功:createDrawTest"); + } + } + @Override + 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);