package eecs1022.midterma; import android.graphics.Color; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; /** * The controller of the app. * * @author Franck van Breugel */ public class MainActivity extends AppCompatActivity { private Counter counter; /** * Initializes this controller. * * @param savedInstanceState information needed for re-initialization. */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.activity_main); this.counter = new Counter(); } /** * Keeps track how often either radio button has been pressed and sets the background colour of * both radio buttons to red once the limit has been reached. * * @param view not applicable. */ public void press(View view) { // increments the counter this.counter.increment(); // sets the background colour of both radio buttons to red once the limit has been reached. if (this.counter.reachedLimit()) { View switchView = findViewById(R.id.one); switchView.setBackgroundColor(Color.RED); switchView = findViewById(R.id.two); switchView.setBackgroundColor(Color.RED); } } }