Commit 56a88235 authored by rakam's avatar rakam
Browse files

Improves animations fluency

parent 4651038d
...@@ -546,6 +546,7 @@ public abstract class MatchActivity extends Activity { ...@@ -546,6 +546,7 @@ public abstract class MatchActivity extends Activity {
AnimationSet appearAnimationSet = new AnimationSet(true); AnimationSet appearAnimationSet = new AnimationSet(true);
appearAnimationSet.addAnimation(appearLeft); appearAnimationSet.addAnimation(appearLeft);
appearAnimationSet.addAnimation(appearRight); appearAnimationSet.addAnimation(appearRight);
leftButtons.setAnimation(appearLeft);
playerLeft1Photo.setAnimation(appearLeft); playerLeft1Photo.setAnimation(appearLeft);
playerLeft2Photo.setAnimation(appearLeft); playerLeft2Photo.setAnimation(appearLeft);
playerLeft1Name.setAnimation(appearLeft); playerLeft1Name.setAnimation(appearLeft);
...@@ -554,9 +555,9 @@ public abstract class MatchActivity extends Activity { ...@@ -554,9 +555,9 @@ public abstract class MatchActivity extends Activity {
for (SecureDelayButton button : animatedLeftButtons) { for (SecureDelayButton button : animatedLeftButtons) {
leftListeners.add(button.getOnClickListener()); leftListeners.add(button.getOnClickListener());
button.setOnClickListener(null); button.setOnClickListener(null);
button.setAnimation(appearLeft);
} }
rightButtons.setAnimation(appearRight);
playerRight1Photo.setAnimation(appearRight); playerRight1Photo.setAnimation(appearRight);
playerRight2Photo.setAnimation(appearRight); playerRight2Photo.setAnimation(appearRight);
playerRight1Name.setAnimation(appearRight); playerRight1Name.setAnimation(appearRight);
...@@ -565,7 +566,6 @@ public abstract class MatchActivity extends Activity { ...@@ -565,7 +566,6 @@ public abstract class MatchActivity extends Activity {
for (SecureDelayButton button : animatedRightButtons) { for (SecureDelayButton button : animatedRightButtons) {
rightListeners.add(button.getOnClickListener()); rightListeners.add(button.getOnClickListener());
button.setOnClickListener(null); button.setOnClickListener(null);
button.setAnimation(appearRight);
} }
appearAnimationSet.start(); appearAnimationSet.start();
...@@ -577,9 +577,9 @@ public abstract class MatchActivity extends Activity { ...@@ -577,9 +577,9 @@ public abstract class MatchActivity extends Activity {
playerLeft2Name.setVisibility(View.VISIBLE); playerLeft2Name.setVisibility(View.VISIBLE);
int i = 0; int i = 0;
for (SecureDelayButton button : animatedLeftButtons) { for (SecureDelayButton button : animatedLeftButtons) {
button.setVisibility(View.VISIBLE);
button.setOnClickListener(leftListeners.get(i++)); button.setOnClickListener(leftListeners.get(i++));
} }
leftButtons.setVisibility(View.VISIBLE);
playerRight1Photo.setVisibility(View.VISIBLE); playerRight1Photo.setVisibility(View.VISIBLE);
playerRight2Photo.setVisibility(View.VISIBLE); playerRight2Photo.setVisibility(View.VISIBLE);
...@@ -588,9 +588,9 @@ public abstract class MatchActivity extends Activity { ...@@ -588,9 +588,9 @@ public abstract class MatchActivity extends Activity {
playerRight2Name.setVisibility(View.VISIBLE); playerRight2Name.setVisibility(View.VISIBLE);
i = 0; i = 0;
for (SecureDelayButton button : animatedRightButtons) { for (SecureDelayButton button : animatedRightButtons) {
button.setVisibility(View.VISIBLE);
button.setOnClickListener(rightListeners.get(i++)); button.setOnClickListener(rightListeners.get(i++));
} }
rightButtons.setVisibility(View.VISIBLE);
if (onComplete != null) { if (onComplete != null) {
new Handler().postDelayed(onComplete, appearAnimationSet.getDuration()); new Handler().postDelayed(onComplete, appearAnimationSet.getDuration());
...@@ -600,11 +600,9 @@ public abstract class MatchActivity extends Activity { ...@@ -600,11 +600,9 @@ public abstract class MatchActivity extends Activity {
protected void fadeOut(final Runnable onComplete) { protected void fadeOut(final Runnable onComplete) {
for (SecureDelayButton button : animatedLeftButtons) { for (SecureDelayButton button : animatedLeftButtons) {
button.setOnClickListener(null); button.setOnClickListener(null);
button.clearAnimation();
} }
for (SecureDelayButton button : animatedRightButtons) { for (SecureDelayButton button : animatedRightButtons) {
button.setOnClickListener(null); button.setOnClickListener(null);
button.clearAnimation();
} }
Animation disappearLeft = AnimationUtils.loadAnimation(this, R.anim.disappear_left); Animation disappearLeft = AnimationUtils.loadAnimation(this, R.anim.disappear_left);
Animation disappearRight = AnimationUtils.loadAnimation(this, R.anim.disappear_right); Animation disappearRight = AnimationUtils.loadAnimation(this, R.anim.disappear_right);
...@@ -613,19 +611,21 @@ public abstract class MatchActivity extends Activity { ...@@ -613,19 +611,21 @@ public abstract class MatchActivity extends Activity {
disappearAnimationSet.addAnimation(disappearRight); disappearAnimationSet.addAnimation(disappearRight);
disappearAnimationSet.setRepeatCount(0); disappearAnimationSet.setRepeatCount(0);
leftButtons.clearAnimation();
rightButtons.clearAnimation();
playerLeft1Name.clearAnimation(); playerLeft1Name.clearAnimation();
playerLeft1Name.clearAnimation(); playerLeft1Name.clearAnimation();
playerRight1Name.clearAnimation(); playerRight1Name.clearAnimation();
playerRight2Name.clearAnimation(); playerRight2Name.clearAnimation();
leftButtons.setAnimation(disappearLeft);
playerLeft1Photo.setAnimation(disappearLeft); playerLeft1Photo.setAnimation(disappearLeft);
playerLeft2Photo.setAnimation(disappearLeft); playerLeft2Photo.setAnimation(disappearLeft);
playerLeft1Name.setAnimation(disappearLeft); playerLeft1Name.setAnimation(disappearLeft);
playerLeft2Name.setAnimation(disappearLeft); playerLeft2Name.setAnimation(disappearLeft);
playerLeftNat.setAnimation(disappearLeft); playerLeftNat.setAnimation(disappearLeft);
for (SecureDelayButton button : animatedLeftButtons)
button.setAnimation(disappearLeft);
rightButtons.setAnimation(disappearRight);
playerRight1Photo.setAnimation(disappearRight); playerRight1Photo.setAnimation(disappearRight);
playerRight2Photo.setAnimation(disappearRight); playerRight2Photo.setAnimation(disappearRight);
playerRight1Name.setAnimation(disappearRight); playerRight1Name.setAnimation(disappearRight);
...@@ -638,21 +638,19 @@ public abstract class MatchActivity extends Activity { ...@@ -638,21 +638,19 @@ public abstract class MatchActivity extends Activity {
new Handler().postDelayed(new Runnable() { new Handler().postDelayed(new Runnable() {
@Override @Override
public void run() { public void run() {
leftButtons.setVisibility(View.INVISIBLE);
playerLeft1Photo.setVisibility(View.INVISIBLE); playerLeft1Photo.setVisibility(View.INVISIBLE);
playerLeft2Photo.setVisibility(View.INVISIBLE); playerLeft2Photo.setVisibility(View.INVISIBLE);
playerLeftNat.setVisibility(View.INVISIBLE); playerLeftNat.setVisibility(View.INVISIBLE);
playerLeft1Name.setVisibility(View.INVISIBLE); playerLeft1Name.setVisibility(View.INVISIBLE);
playerLeft2Name.setVisibility(View.INVISIBLE); playerLeft2Name.setVisibility(View.INVISIBLE);
for (SecureDelayButton button : animatedLeftButtons)
button.setVisibility(View.INVISIBLE);
rightButtons.setVisibility(View.INVISIBLE);
playerRight1Photo.setVisibility(View.INVISIBLE); playerRight1Photo.setVisibility(View.INVISIBLE);
playerRight2Photo.setVisibility(View.INVISIBLE); playerRight2Photo.setVisibility(View.INVISIBLE);
playerRightNat.setVisibility(View.INVISIBLE); playerRightNat.setVisibility(View.INVISIBLE);
playerRight1Name.setVisibility(View.INVISIBLE); playerRight1Name.setVisibility(View.INVISIBLE);
playerRight2Name.setVisibility(View.INVISIBLE); playerRight2Name.setVisibility(View.INVISIBLE);
for (SecureDelayButton button : animatedRightButtons)
button.setVisibility(View.INVISIBLE);
if (onComplete != null) if (onComplete != null)
onComplete.run(); onComplete.run();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment