diff --git a/app/src/main/java/org/ntlab/irisclient/OwnerRoomActivity.java b/app/src/main/java/org/ntlab/irisclient/OwnerRoomActivity.java index 5043a98..6ea2cb8 100644 --- a/app/src/main/java/org/ntlab/irisclient/OwnerRoomActivity.java +++ b/app/src/main/java/org/ntlab/irisclient/OwnerRoomActivity.java @@ -1,15 +1,26 @@ package org.ntlab.irisclient; +import android.graphics.Color; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; +import android.widget.ImageButton; import android.widget.ListView; import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; +import org.ntlab.irisclient.resources.RoomsRest; + import java.util.ArrayList; +import java.util.Collections; + +import retrofit2.Call; +import retrofit2.Callback; +import retrofit2.Response; +import retrofit2.Retrofit; +import retrofit2.converter.jackson.JacksonConverterFactory; public class OwnerRoomActivity extends AppCompatActivity { @@ -28,6 +39,15 @@ Button redSpyButton = (Button) findViewById(R.id.beRedSpy); Button blueMasterButton = (Button) findViewById(R.id.beBlueMaster); Button blueSpyButton = (Button) findViewById(R.id.beBlueSpy); + Button randomButton = (Button) findViewById(R.id.random); + Button startButton = (Button) findViewById(R.id.start); + ImageButton copyButton = (ImageButton) findViewById(R.id.copyButton); + + //--------------------------------------------------------------------------- + //メンバーリスト + ArrayAdapter adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, members); + ListView listView = (ListView)findViewById(R.id.MembersList); + listView.setAdapter(adapter); redMasterButton.setOnClickListener(new View.OnClickListener() { @@ -36,6 +56,25 @@ r = "部屋ID " + "red"; TextView RoomIdText = findViewById(R.id.roomID); RoomIdText.setText(r); + + members.clear(); + members.add("マスターのRedさん"); + ListView listView = (ListView)findViewById(R.id.MembersList); + + listView.setAdapter(adapter); + } + }); + + redSpyButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + r = "部屋ID " + "red"; + TextView RoomIdText = findViewById(R.id.roomID); + RoomIdText.setText(r); + + members.add("スパイのRedさん"); + ListView listView = (ListView)findViewById(R.id.MembersList); + listView.setAdapter(adapter); } }); @@ -45,27 +84,79 @@ r = "部屋ID " + "blue"; TextView RoomIdText = findViewById(R.id.roomID); RoomIdText.setText(r); + + members.add("マスターのBlueさん"); + listView.setBackgroundColor(Color.parseColor("#e83a48")); + ListView listView = (ListView)findViewById(R.id.MembersList); + listView.setAdapter(adapter); + + } + }); + + blueSpyButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + r = "部屋ID " + "red"; + TextView RoomIdText = findViewById(R.id.roomID); + RoomIdText.setText(r); + + members.add("スパイのBlueさん"); + ListView listView = (ListView)findViewById(R.id.MembersList); + listView.setBackgroundColor(Color.parseColor("#3a5fe8")); + listView.setAdapter(adapter); + } + }); + + randomButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + r = "部屋ID " + "random"; + TextView RoomIdText = findViewById(R.id.roomID); + RoomIdText.setText(r); + + members.add("ランダムさん"); + ListView listView = (ListView)findViewById(R.id.MembersList); + listView.setAdapter(adapter); + + Retrofit retrofit = new Retrofit.Builder() + .baseUrl("http://nitta-lab-www.is.konan-u.ac.jp/iris/") + .addConverterFactory(JacksonConverterFactory.create()) + .build(); + final RoomsRest roomsRest = retrofit.create(RoomsRest.class); + + } + }); + + startButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + r = "部屋ID " + "start"; + TextView RoomIdText = findViewById(R.id.roomID); + RoomIdText.setText(r); + + members.add("スタートさん"); + ListView listView = (ListView)findViewById(R.id.MembersList); + listView.setAdapter(adapter); + } + }); + + copyButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + r = "部屋ID " + "copy"; + TextView RoomIdText = findViewById(R.id.roomID); + RoomIdText.setText(r); + + members.add("コピーしました"); + ListView listView = (ListView)findViewById(R.id.MembersList); + listView.setAdapter(adapter); } }); //-------------------------------------------------------------------------- //メンバー表示 - members.add("1さん"); - members.add("2さん"); - members.add("3さん"); - members.add("4さん"); - members.add("5さん"); - members.add("6さん"); - members.add("7さん"); - members.add("8さん" + "#FF6200EE"); - members.add("9さん"); - members.add("10さん"); - - ArrayAdapter adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, members); - - ListView listView = (ListView)findViewById(R.id.MembersList); - listView.setAdapter(adapter); + //members.add("1さん"); //--------------------------------------------------------------- //settings情報