<commit_before>
package com.mattprecious.notisync.wizardpager.ui;

import static com.nineoldandroids.view.ViewPropertyAnimator.animate;

import android.annotation.TargetApi;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;

import com.mattprecious.notisync.R;
import com.nineoldandroids.animation.Animator;
import com.nineoldandroids.animation.AnimatorListenerAdapter;
import com.nineoldandroids.view.ViewHelper;

import org.holoeverywhere.LayoutInflater;
import org.holoeverywhere.app.Fragment;
import org.holoeverywhere.widget.TextView;

public class WelcomeFragment extends Fragment {
    public static final String STATE_PLAY_ANIMATION = "playAnimation";

    ViewTreeObserver viewObserver;

    private TextView titleText;
    private TextView contentText;

    private boolean playAnimation = true;

    public static WelcomeFragment create() {
        return new WelcomeFragment();
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        if (savedInstanceState != null && savedInstanceState.containsKey(STATE_PLAY_ANIMATION)) {
            playAnimation = savedInstanceState.getBoolean(STATE_PLAY_ANIMATION);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.wizard_welcome, container, false);

        titleText = (TextView) rootView.findViewById(android.R.id.title);
        contentText = (TextView) rootView.findViewById(R.id.content);

        viewObserver = rootView.getViewTreeObserver();
        viewObserver.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {

            @Override
            public void onGlobalLayout() {
                playAnimation();
                removeOnGlobalLayoutListener(this);
            }
        });

        return rootView;
    }

    @Override
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);

        outState.putBoolean(STATE_PLAY_ANIMATION, playAnimation);
    }

    private synchronized void playAnimation() {
        if (!playAnimation) {
            return;
        }

        playAnimation = false;

        final int yShift = titleText.getHeight() * 3;
        ViewHelper.setAlpha(contentText, 0);
        animate(titleText)
                .alpha(0)
                .yBy(yShift)
                .setDuration(0)
                .setListener(new AnimatorListenerAdapter() {

                    @Override
                    public void onAnimationEnd(Animator animation) {
                        titleText.setVisibility(View.VISIBLE);
                        animate(titleText)
                                .alpha(1)
                                .yBy(-yShift)
                                .setDuration(1000)
                                .setListener(new AnimatorListenerAdapter() {

                                    @Override
                                    public void onAnimationEnd(Animator animation) {
                                        animate(contentText)
                                                .alpha(1)
                                                .setDuration(1000)
                                                .setListener(new AnimatorListenerAdapter() {

                                                    @Override
                                                    public void onAnimationEnd(Animator animation) {
                                                        contentText.setVisibility(View.VISIBLE);
                                                    }
                                                });
                                    }
                                });
                    }
                });

    }<commit_msg>Fix animation on GNex<commit_after>
package com.mattprecious.notisync.wizardpager.ui;

import static com.nineoldandroids.view.ViewPropertyAnimator.animate;

import android.annotation.TargetApi;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;

import com.mattprecious.notisync.R;
import com.nineoldandroids.animation.Animator;
import com.nineoldandroids.animation.AnimatorListenerAdapter;
import com.nineoldandroids.view.ViewHelper;

import org.holoeverywhere.LayoutInflater;
import org.holoeverywhere.app.Fragment;
import org.holoeverywhere.widget.TextView;

public class WelcomeFragment extends Fragment {
    public static final String STATE_PLAY_ANIMATION = "playAnimation";

    ViewTreeObserver viewObserver;

    private TextView titleText;
    private TextView contentText;

    private boolean playAnimation = true;

    public static WelcomeFragment create() {
        return new WelcomeFragment();
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        if (savedInstanceState != null && savedInstanceState.containsKey(STATE_PLAY_ANIMATION)) {
            playAnimation = savedInstanceState.getBoolean(STATE_PLAY_ANIMATION);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.wizard_welcome, container, false);

        titleText = (TextView) rootView.findViewById(android.R.id.title);
        contentText = (TextView) rootView.findViewById(R.id.content);

        viewObserver = rootView.getViewTreeObserver();
        viewObserver.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {

            @Override
            public void onGlobalLayout() {
                playAnimation();
                removeOnGlobalLayoutListener(this);
            }
        });

        return rootView;
    }

    @Override
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);

        outState.putBoolean(STATE_PLAY_ANIMATION, playAnimation);
    }

    private synchronized void playAnimation() {
        if (!playAnimation) {
            return;
        }

        playAnimation = false;

        final int yShift = titleText.getHeight() * 3;
        ViewHelper.setAlpha(contentText, 0);
        animate(titleText)
                .alpha(0)
                .yBy(yShift)
                .setDuration(0)
                .setListener(new AnimatorListenerAdapter() {

                    @Override
                    public void onAnimationEnd(Animator animation) {
                        titleText.setVisibility(View.VISIBLE);
                        animate(titleText)
                                .alpha(1)
                                .yBy(-yShift)
                                .setDuration(1000)
                                .setListener(new AnimatorListenerAdapter() {
                                    @Override
                                    public void onAnimationEnd(Animator animation) {
                                        animate(contentText)
                                                .alpha(1)
                                                .setDuration(1000)
                                                .setListener(new AnimatorListenerAdapter() {

                                                    @Override
                                                    public void onAnimationEnd(Animator animation) {
                                                        contentText.setVisibility(View.VISIBLE);
                                                    }
                                                });

                                    }
                                })
                                .start();
                    }
                });

    }
{'fraction_non_alphanumeric': 0.07033486866674966, 'fraction_numerical': 0.0034856218100336113, 'mean_word_length': 1.5983182406209573, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 40, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5109735', 'n_tokens_mistral': 1893, 'n_tokens_neox': 1741, 'n_words': 336}