diff --git a/app/src/main/java/org/ntlab/irisclient/DrawingActivity.java b/app/src/main/java/org/ntlab/irisclient/DrawingActivity.java index 1d1fd44..7057807 100644 --- a/app/src/main/java/org/ntlab/irisclient/DrawingActivity.java +++ b/app/src/main/java/org/ntlab/irisclient/DrawingActivity.java @@ -10,8 +10,10 @@ import android.view.View; import android.widget.TextView; +import org.ntlab.irisclient.models.Member; import org.ntlab.irisclient.viewmodels.DrawingStateViewModel; +import java.io.ByteArrayOutputStream; import java.util.List; public class DrawingActivity extends AppCompatActivity implements View.OnClickListener { @@ -20,6 +22,8 @@ private DrawingStateViewModel drawingStateViewModel; private List keywordList; + private Integer drawingNum; + private Integer drawingNow = 0; @Override protected void onCreate(Bundle savedInstanceState) { @@ -31,6 +35,7 @@ String rid = iris.getRid(); String nickName = iris.getNickname(); Boolean bMaster = iris.isMaster(); + List memberList = iris.getMemberList(); drawingStateViewModel= new ViewModelProvider(this).get(DrawingStateViewModel.class); //viewModelに必用な情報をセット @@ -42,10 +47,15 @@ findViewById(R.id.eraserButton).setOnClickListener(this);//消しゴムボタン TextView textKeyword =(TextView)findViewById(R.id.textKeyword);//keywordのTextView + TextView textMemberNum = (TextView)findViewById(R.id.drawingNowText);//残りのイラスト枚数のTextView drawingCanvas = (DrawingCanvas) findViewById(R.id.drawingCanvas); - //getKeywords + //残りのイラスト枚数の表示 + drawingNum = 16 / 2; // 一人あたりが描く枚数(テスト部屋用,部屋作成からスタートする場合はこの行をコメントアウトして ↓ ふたつのコメントを解除) + //drawingNum = 16 / memberList.size(); // 一人あたりが描く枚数 + //if (16 % memberList.size() != 0) drawingNum++; // 余りが出た場合プラス1枚 + //getKeywords drawingStateViewModel.getKeywords().observe(this, new Observer>(){ @Override public void onChanged(List keywords) { @@ -59,6 +69,8 @@ public void onChanged(Integer dno) { String keyword = keywordList.get(dno); textKeyword.setText("Dno: " + dno + ", Keyword: " + keyword); + drawingNow++; + textMemberNum.setText(""+drawingNow+"/"+drawingNum); } }); @@ -80,7 +92,7 @@ //getKeywordの呼び出し drawingStateViewModel.init(); //タイマースタート呼び出し - drawingStateViewModel.start(500,iris); + drawingStateViewModel.start(500,(Iris)getApplication()); } @Override