<commit_before>package org.openaccessbutton.openaccessbutton.intro;

import android.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;

import org.openaccessbutton.openaccessbutton.MainActivity;
import org.openaccessbutton.openaccessbutton.R;

/**
 * Created by harry on 06/08/14.
 */
// Based on google's AnimationsDemo code
public class ScreenSlidePageFragment extends Fragment {
    public static final String ARG_PAGE = "page";
    private int mPageNumber;

    public static ScreenSlidePageFragment create(int pageNumber) {
        ScreenSlidePageFragment fragment = new ScreenSlidePageFragment();
        Bundle args = new Bundle();
        args.putInt(ARG_PAGE, pageNumber);
        fragment.setArguments(args);
        return fragment;
    }

    public static int numberPages(Context context) {
        ViewGroup rootView = (ViewGroup) LayoutInflater.from(context).inflate(
                R.layout.fragment_intro_pages, null);
        return rootView.getChildCount();
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mPageNumber = getArguments().getInt(ARG_PAGE);
    }

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

        View childView = rootView.getChildAt(mPageNumber);
        if (childView.getParent() != null) {
            rootView.removeView(childView);
        }

        // Logic we need to run on a per-view basis
        switch (mPageNumber) {
            case 4:
                Button signupButton = (Button) childView.findViewById(R.id.signupEmailButton);
                signupButton.setOnClickListener(new SignupEmailButtonClickListener(getActivity()));
                TextView signinButton = (TextView) childView.findViewById(R.id.signinButton);
                signinButton.setOnClickListener(new SigninButtonClickListener(getActivity()));

                // Social sign in buttons
                TextView signupGoogleButton = (Button) childView.findViewById(R.id.signupGoogleButton);
                TextView signupTwitterButton = (Button) childView.findViewById(R.id.signupTwitterButton);
                TextView signupFacebookButton = (Button) childView.findViewById(R.id.signupFacebookButton);
                signupGoogleButton.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        Intent k = new Intent(getActivity(), OAuthActivity.class);
                        k.putExtra("provider", "google");
                        startActivity(k);
                        getActivity().finish();
                    }
                });
                signupTwitterButton.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        Intent k = new Intent(getActivity(), OAuthActivity.class);
                        k.putExtra("provider", "twitter");
                        startActivity(k);
                        getActivity().finish();
                    }
                });
                signupFacebookButton.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        Intent k = new Intent(getActivity(), OAuthActivity.class);
                        k.putExtra("provider", "facebook");
                        startActivity(k);
                        getActivity().finish();
                    }
                });

            case 5:
                Button gotoMainButton = (Button) childView.findViewById(R.id.goto_main_button);
                gotoMainButton.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        Intent k = new Intent(getActivity(), MainActivity.class);
                        startActivity(k);
                        getActivity().finish();
                    }
                });
        }

        return childView;
    }
}<commit_msg>Fix crashes<commit_after>package org.openaccessbutton.openaccessbutton.intro;

import android.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;

import org.openaccessbutton.openaccessbutton.MainActivity;
import org.openaccessbutton.openaccessbutton.R;

/**
 * Created by harry on 06/08/14.
 */
// Based on google's AnimationsDemo code
public class ScreenSlidePageFragment extends Fragment {
    public static final String ARG_PAGE = "page";
    private int mPageNumber;

    public static ScreenSlidePageFragment create(int pageNumber) {
        ScreenSlidePageFragment fragment = new ScreenSlidePageFragment();
        Bundle args = new Bundle();
        args.putInt(ARG_PAGE, pageNumber);
        fragment.setArguments(args);
        return fragment;
    }

    public static int numberPages(Context context) {
        ViewGroup rootView = (ViewGroup) LayoutInflater.from(context).inflate(
                R.layout.fragment_intro_pages, null);
        return rootView.getChildCount();
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mPageNumber = getArguments().getInt(ARG_PAGE);
    }

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

        View childView = rootView.getChildAt(mPageNumber);
        if (childView.getParent() != null) {
            rootView.removeView(childView);
        }

        // Logic we need to run on a per-view basis
        switch (mPageNumber) {
            case 4:
                Button signupButton = (Button) childView.findViewById(R.id.signupEmailButton);
                signupButton.setOnClickListener(new SignupEmailButtonClickListener(getActivity()));
                TextView signinButton = (TextView) childView.findViewById(R.id.signinButton);
                signinButton.setOnClickListener(new SigninButtonClickListener(getActivity()));

                // Social sign in buttons
                TextView signupGoogleButton = (Button) childView.findViewById(R.id.signupGoogleButton);
                TextView signupTwitterButton = (Button) childView.findViewById(R.id.signupTwitterButton);
                TextView signupFacebookButton = (Button) childView.findViewById(R.id.signupFacebookButton);
                signupGoogleButton.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        Intent k = new Intent(getActivity(), OAuthActivity.class);
                        k.putExtra("provider", "google");
                        startActivity(k);
                        getActivity().finish();
                    }
                });
                signupTwitterButton.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        Intent k = new Intent(getActivity(), OAuthActivity.class);
                        k.putExtra("provider", "twitter");
                        startActivity(k);
                        getActivity().finish();
                    }
                });
                signupFacebookButton.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        Intent k = new Intent(getActivity(), OAuthActivity.class);
                        k.putExtra("provider", "facebook");
                        startActivity(k);
                        getActivity().finish();
                    }
                });
            break;

            case 5:
                Button gotoMainButton = (Button) childView.findViewById(R.id.goto_main_button);
                gotoMainButton.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        Intent k = new Intent(getActivity(), MainActivity.class);
                        startActivity(k);
                        getActivity().finish();
                    }
                });
            break;
        }

        return childView;
    }
}
{'fraction_non_alphanumeric': 0.08597883597883597, 'fraction_numerical': 0.001763668430335097, 'mean_word_length': 1.9305555555555556, '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': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5741953', 'n_tokens_mistral': 2241, 'n_tokens_neox': 2026, 'n_words': 445}