package jp.gihyo.mitoma.android.p012watchword;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ClickListener listener = new ClickListener();

        Button btQues = findViewById(R.id.btQuestion);
        btQues.setOnClickListener(listener);
        Button btAnsw = findViewById(R.id.btAnswer);
        btAnsw.setOnClickListener(listener);
    }
    private class ClickListener implements View.OnClickListener {
        private WatchwordAction selectAction = null;
        public void onClick(View view) {
            if(this.selectAction == null) {
                selectAction = new WatchwordAction(MainActivity.this);
                //Toast.makeText(getApplicationContext(),"Action生成",Toast.LENGTH_LONG).show();
            }
            selectAction.exec(view);
        }
    }
}