diff --git a/app/src/main/java/org/ntlab/irisclient/DrawingActivity.java b/app/src/main/java/org/ntlab/irisclient/DrawingActivity.java index 89c2dea..35b928c 100644 --- a/app/src/main/java/org/ntlab/irisclient/DrawingActivity.java +++ b/app/src/main/java/org/ntlab/irisclient/DrawingActivity.java @@ -27,6 +27,7 @@ private List keywordList; private Integer drawingNum; private Integer drawingNow = 0; + private ToggleButton okToggleButton; @Override protected void onCreate(Bundle savedInstanceState) { @@ -44,7 +45,7 @@ findViewById(R.id.eraserButton).setOnClickListener(this);//消しゴムボタン findViewById(R.id.blackPenButton).setOnClickListener(this);//消しゴムボタン - ToggleButton okToggleButton = (ToggleButton) findViewById(R.id.toggleButton); + okToggleButton = (ToggleButton) findViewById(R.id.toggleButton); okToggleButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { @@ -122,12 +123,14 @@ @Override public void onClick(View v){ - if(v.getId() == R.id.clearButton){//clearButtonが押されたときの処理 - drawingCanvas.clearCanvas(); - }else if(v.getId() == R.id.eraserButton){//eraserButtonが押されたときの処理 - drawingCanvas.setColor(Color.WHITE); - }else if(v.getId() == R.id.blackPenButton){ - drawingCanvas.setColor(Color.BLACK); + if(okToggleButton.isChecked()) {//完了ボタンが押されていないときだけボタンが使える + if (v.getId() == R.id.clearButton) {//clearButtonが押されたときの処理 + drawingCanvas.clearCanvas(); + } else if (v.getId() == R.id.eraserButton) {//eraserButtonが押されたときの処理 + drawingCanvas.setColor(Color.WHITE); + } else if (v.getId() == R.id.blackPenButton) { + drawingCanvas.setColor(Color.BLACK); + } } }