diff --git a/app/src/main/java/org/ntlab/irisclient/MemberRoomActivity.java b/app/src/main/java/org/ntlab/irisclient/MemberRoomActivity.java index b9c3a37..e319394 100644 --- a/app/src/main/java/org/ntlab/irisclient/MemberRoomActivity.java +++ b/app/src/main/java/org/ntlab/irisclient/MemberRoomActivity.java @@ -48,9 +48,8 @@ String roomId = ((Iris) getApplication()).getRid(); String nickname = ((Iris) getApplication()).getNickname(); - - - //自分のなまえ + //-------------------------------------------------------------------------- + //自分の名前 Intent intentMain = getIntent(); myName = intentMain.getStringExtra("nickname"); @@ -68,49 +67,26 @@ roomViewModel.setRid(roomId); - /*memberList = roomViewModel.getMembersLiveData().getValue(); - - memberList.forEach(m -> members.add(m.getNickname()));*/ - ListView membersList = (ListView) findViewById(R.id.MembersList); BaseAdapter adapter = new MemberListAdapter(this.getApplicationContext(), R.layout.member_list_layout, viewMembers); membersList.setAdapter(adapter); //LiveData(List)への購読 - /*roomViewModel.getMembersLiveData().observe(this, new Observer>() { + roomViewModel.getMembersLiveData().observe(this, new Observer>() { //private List members; @Override public void onChanged(List irisMembers) { - int i = 0; - if(irisMembers.size() == oldMembers.size()) { - do { - if (irisMembers.get(i).getNickname().equals(oldMembers.get(i))) { - i++; - } else { - viewMembers.clear(); - irisMembers.forEach(m -> viewMembers.add(m.getNickname())); - System.arraycopy(viewMembers, 0, oldMembers, 0, viewMembers.size()); + viewMembers.clear(); + irisMembers.forEach(m -> viewMembers.add(m.getNickname())); - BaseAdapter adapter = new MemberListAdapter(getApplicationContext(), R.layout.member_list_layout, viewMembers); - membersList.setAdapter(adapter); + BaseAdapter adapter = new MemberListAdapter(getApplicationContext(), R.layout.member_list_layout, viewMembers); + membersList.setAdapter(adapter); - break; - } - - } while (i < oldMembers.size()); - } else { - viewMembers.clear(); - irisMembers.forEach(m -> viewMembers.add(m.getNickname())); - System.arraycopy(viewMembers, 0, oldMembers, 0, viewMembers.size()); - - BaseAdapter adapter = new MemberListAdapter(getApplicationContext(), R.layout.member_list_layout, viewMembers); - membersList.setAdapter(adapter); } - } - });*/ + }); roomViewModel.getStateLiveData().observe(this, new Observer() { @Override @@ -128,7 +104,6 @@ buttonProcesses(); - //--------------------------------------------------------------- //settings情報 String s = "設定されている内容がここに表示されるはずです"; @@ -144,22 +119,6 @@ } - /* - // 初期化 - private void init() { - setContentView(R.layout.activity_member_room); - startObserve(); - } - - - /*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);