@Test(expected = NullPointerException.class) public void selectImageUp() { for (int i = 0; i < 1000; i++) { mA.selectImageUp(); assert MainActivity.sCurrentImage > -1 & MainActivity.sCurrentImage < 6; } }
public void selectImageUp() { Animation animation = new RotateAnimation(0, 360); animation.setDuration(1000); animation.setRepeatCount(0); animation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { mMoodImageView.setImageResource(mMoodsArrayL.get(sCurrentImage)); mMoodImageView.setTag(mMoodsArrayL.get(sCurrentImage)); selectColour(sCurrentImage); } }, 500); } @Override public void onAnimationEnd(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); if (sCurrentImage == 4) { RotateAnimation rotate = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); rotate.setDuration(1000); rotate.setInterpolator(new LinearInterpolator()); mMoodImageView.startAnimation(rotate); Toast.makeText(this, "You couldn't be more happier!", Toast.LENGTH_LONG).show(); } else { sCurrentImage += 1; mMoodImageView.startAnimation(animation); } }
MainActivity extends AppCompatActivity implements GestureDetector.OnGestureListener { public void selectImageUp() { Animation animation = new RotateAnimation(0, 360); animation.setDuration(1000); animation.setRepeatCount(0); animation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { mMoodImageView.setImageResource(mMoodsArrayL.get(sCurrentImage)); mMoodImageView.setTag(mMoodsArrayL.get(sCurrentImage)); selectColour(sCurrentImage); } }, 500); } @Override public void onAnimationEnd(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); if (sCurrentImage == 4) { RotateAnimation rotate = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); rotate.setDuration(1000); rotate.setInterpolator(new LinearInterpolator()); mMoodImageView.startAnimation(rotate); Toast.makeText(this, "You couldn't be more happier!", Toast.LENGTH_LONG).show(); } else { sCurrentImage += 1; mMoodImageView.startAnimation(animation); } } }
MainActivity extends AppCompatActivity implements GestureDetector.OnGestureListener { public void selectImageUp() { Animation animation = new RotateAnimation(0, 360); animation.setDuration(1000); animation.setRepeatCount(0); animation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { mMoodImageView.setImageResource(mMoodsArrayL.get(sCurrentImage)); mMoodImageView.setTag(mMoodsArrayL.get(sCurrentImage)); selectColour(sCurrentImage); } }, 500); } @Override public void onAnimationEnd(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); if (sCurrentImage == 4) { RotateAnimation rotate = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); rotate.setDuration(1000); rotate.setInterpolator(new LinearInterpolator()); mMoodImageView.startAnimation(rotate); Toast.makeText(this, "You couldn't be more happier!", Toast.LENGTH_LONG).show(); } else { sCurrentImage += 1; mMoodImageView.startAnimation(animation); } }  }
MainActivity extends AppCompatActivity implements GestureDetector.OnGestureListener { public void selectImageUp() { Animation animation = new RotateAnimation(0, 360); animation.setDuration(1000); animation.setRepeatCount(0); animation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { mMoodImageView.setImageResource(mMoodsArrayL.get(sCurrentImage)); mMoodImageView.setTag(mMoodsArrayL.get(sCurrentImage)); selectColour(sCurrentImage); } }, 500); } @Override public void onAnimationEnd(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); if (sCurrentImage == 4) { RotateAnimation rotate = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); rotate.setDuration(1000); rotate.setInterpolator(new LinearInterpolator()); mMoodImageView.startAnimation(rotate); Toast.makeText(this, "You couldn't be more happier!", Toast.LENGTH_LONG).show(); } else { sCurrentImage += 1; mMoodImageView.startAnimation(animation); } }  void selectImageUp(); void selectImageDown(); @Override boolean onCreateOptionsMenu(Menu menu); @Override boolean onOptionsItemSelected(MenuItem item); @Override //detects a touch even and returns as a gesture detected to detect swipes boolean onTouchEvent(MotionEvent event); @Override boolean onDown(MotionEvent e); @Override void onShowPress(MotionEvent e); @Override boolean onSingleTapUp(MotionEvent e); @Override boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY); @Override void onLongPress(MotionEvent e); @Override boolean onFling(MotionEvent motionEvent1, MotionEvent motionEvent2, float X, float Y); void selectColour(int colorIdentifier); static void clear(); }
MainActivity extends AppCompatActivity implements GestureDetector.OnGestureListener { public void selectImageUp() { Animation animation = new RotateAnimation(0, 360); animation.setDuration(1000); animation.setRepeatCount(0); animation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { mMoodImageView.setImageResource(mMoodsArrayL.get(sCurrentImage)); mMoodImageView.setTag(mMoodsArrayL.get(sCurrentImage)); selectColour(sCurrentImage); } }, 500); } @Override public void onAnimationEnd(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); if (sCurrentImage == 4) { RotateAnimation rotate = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); rotate.setDuration(1000); rotate.setInterpolator(new LinearInterpolator()); mMoodImageView.startAnimation(rotate); Toast.makeText(this, "You couldn't be more happier!", Toast.LENGTH_LONG).show(); } else { sCurrentImage += 1; mMoodImageView.startAnimation(animation); } }  void selectImageUp(); void selectImageDown(); @Override boolean onCreateOptionsMenu(Menu menu); @Override boolean onOptionsItemSelected(MenuItem item); @Override //detects a touch even and returns as a gesture detected to detect swipes boolean onTouchEvent(MotionEvent event); @Override boolean onDown(MotionEvent e); @Override void onShowPress(MotionEvent e); @Override boolean onSingleTapUp(MotionEvent e); @Override boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY); @Override void onLongPress(MotionEvent e); @Override boolean onFling(MotionEvent motionEvent1, MotionEvent motionEvent2, float X, float Y); void selectColour(int colorIdentifier); static void clear();  }