@Override public void onResume() { super.onResume(); redButton.setClickable(true); greenButton.setClickable(true); blueButton.setClickable(true); localAnim.setStartTime(AnimationUtils.currentAnimationTimeMillis() + 400); onlineAnim.setStartTime(AnimationUtils.currentAnimationTimeMillis() + 800); redButton.startAnimation(soloAnim); greenButton.setAnimation(localAnim); blueButton.setAnimation(onlineAnim); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); verticalLayout = (LinearLayout) findViewById(R.id.verticalLayout); verticalLayout.setClipChildren(false); horizontalLayout = (LinearLayout) findViewById(R.id.horizontalLayout); horizontalLayout.setClipChildren(false); redButton = (GameButton) findViewById(R.id.redButton); greenButton = (GameButton) findViewById(R.id.greenButton); blueButton = (GameButton) findViewById(R.id.blueButton); redButton.setText("Practice Solo"); greenButton.setText("Play Locally"); blueButton.setText("Play Online"); redButton.setBackgroundResource(R.drawable.redcirclebutton); greenButton.setBackgroundResource(R.drawable.greencirclebutton); blueButton.setBackgroundResource(R.drawable.bluecirclebutton); soloAnim = AnimationUtils.loadAnimation(this, R.anim.buttonanimation); localAnim = AnimationUtils.loadAnimation(this, R.anim.buttonanimation); onlineAnim = AnimationUtils.loadAnimation(this, R.anim.buttonanimation); handler = new Handler(); final Intent soloIntent = new Intent(this, SoloActivity.class); redButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { redButton.setClickable(false); greenButton.setClickable(false); blueButton.setClickable(false); handler.postDelayed( new Runnable() { @Override public void run() { GameManager.init(); startActivity(soloIntent); } }, 800); } }); }