@Override public void onClick(View v) { Animation anim = AnimationUtils.loadAnimation(MainActivity.this, R.anim.left_to_right); switch (v.getId()) { case R.id.btnPush: clickEvent.getOnPush(); if (clickEvent.getCount() == Constants.TWENTY_PRESSES) { viewHolder.getBtnReload().startAnimation(anim); viewHolder.getBtnReload().setVisibility(View.VISIBLE); } break; case R.id.btnReload: clickEvent.reload(); break; default: break; } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); clickEvent = new ClickEvent(); viewHolder = ViewHolder.getInstance(); viewHolder.setTvOut((TextView) findViewById(R.id.tvOut)); viewHolder.setBtnPush((Button) findViewById(R.id.btnPush)); viewHolder.setBtnReload((Button) findViewById(R.id.btnReload)); viewHolder.getBtnPush().setOnClickListener(this); viewHolder.getBtnReload().setOnClickListener(this); }