Skip to content

Commit

Permalink
Start animation on focus.
Browse files Browse the repository at this point in the history
  • Loading branch information
vprus committed Feb 26, 2016
1 parent fe2c876 commit 5037424
Showing 1 changed file with 16 additions and 0 deletions.
Expand Up @@ -17,13 +17,29 @@ public class OnboardingWithCenterAnimationActivity extends AppCompatActivity {
public static final int ANIM_ITEM_DURATION = 1000;
public static final int ITEM_DELAY = 300;

private boolean animationStarted = false;

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
setTheme(R.style.AppTheme);
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_onboarding_center);
}

@Override
public void onWindowFocusChanged(boolean hasFocus) {

if (!hasFocus || animationStarted) {
return;
}

animate();

super.onWindowFocusChanged(hasFocus);
}

private void animate() {
ImageView logoImageView = (ImageView) findViewById(R.id.img_logo);
ViewGroup container = (ViewGroup) findViewById(R.id.container);

Expand Down

0 comments on commit 5037424

Please sign in to comment.