Newer
Older
IrisClient / app / src / main / java / org / ntlab / irisclient / MemberRoomActivity.java
package org.ntlab.irisclient;

import androidx.appcompat.app.AppCompatActivity;

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 java.util.ArrayList;

public class MemberRoomActivity extends AppCompatActivity {

    //フィールド
    ArrayList<String> members = new ArrayList<>();
    String r = "部屋IDがここに表示されるはずです";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_member_room);

        //--------------------------------------------------------------------------
        //各ボタン処理
        buttonProcesses();


        //--------------------------------------------------------------------------
        //メンバー表示

        members.add("1さん");
        members.add("2");
        ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, members);
        ListView listView = (ListView)findViewById(R.id.MembersList);
        listView.setAdapter(adapter);

        //---------------------------------------------------------------
        //settings情報
        String s = "設定されている内容がここに表示されるはずです";
        TextView settingsText = findViewById(R.id.settings);
        settingsText.setText(s);

        //---------------------------------------------------------------
        //部屋ID情報
        TextView RoomIdText = findViewById(R.id.roomID);
        RoomIdText.setText(r);
    }

    /*private getMemberInformation(){

    }*/

    /*private void addMemberToMemberList(String m){
        members.add(m);
    }*/

    public void buttonProcesses(){
        Button redMasterButton = (Button) findViewById(R.id.beRedMaster);
        Button redSpyButton = (Button) findViewById(R.id.beRedSpy);
        Button blueMasterButton = (Button) findViewById(R.id.beBlueMaster);
        Button blueSpyButton = (Button) findViewById(R.id.beBlueSpy);
        ImageButton copyButton = (ImageButton) findViewById(R.id.copyButton);
        ImageButton homeButton = (ImageButton) findViewById(R.id.homeButton);

        redMasterButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                r = "赤マスターボタン検知しました";
                TextView RoomIdText = findViewById(R.id.roomID);
                RoomIdText.setText(r);
            }
        });

        redSpyButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                r = "赤諜報員ボタン検知しました";
                TextView RoomIdText = findViewById(R.id.roomID);
                RoomIdText.setText(r);
            }
        });

        blueMasterButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                r = "青マスターボタン検知しました";
                TextView RoomIdText = findViewById(R.id.roomID);
                RoomIdText.setText(r);
            }
        });

        blueSpyButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                r = "青諜報員ボタン検知しました";
                TextView RoomIdText = findViewById(R.id.roomID);
                RoomIdText.setText(r);
            }
        });

        homeButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                r = "ホームボタン検知しました";
                TextView RoomIdText = findViewById(R.id.roomID);
                RoomIdText.setText(r);
            }
        });

        copyButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                r = "コピーボタン検知しました";
                TextView RoomIdText = findViewById(R.id.roomID);
                RoomIdText.setText(r);
            }
        });
    }
}