<commit_before>package ca.allanwang.capsule.library.activities;

import android.os.Bundle;
import android.support.annotation.AnimRes;
import android.support.annotation.CallSuper;
import android.support.v4.app.Fragment;

import ca.allanwang.capsule.library.interfaces.CFragmentCore;

/**
 * Created by <NAME> on 2016-08-19.
 * <p>
 * The activity that holds everything, with a few extra helper methods
 */
public abstract class CapsuleActivity extends EventActivity {

    @Override
    @CallSuper
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        capsuleOnCreate(savedInstanceState);
    }

    /**
     * Changes fragment in base view to new fragment
     *
     * @param fragment new fragment to switch to
     */
    protected void switchFragment(Fragment fragment) {
        String tag = null;
        if (fragment instanceof CFragmentCore && ((CFragmentCore) fragment).getTitleId() > 0) {
            tag = s(((CFragmentCore) fragment).getTitleId());
        }
        getSupportFragmentManager()
                .beginTransaction().replace(getFragmentId(), fragment, tag).commit();
        setTitle(tag);
    }

    /**
     * Switch fragment.
     *
     * @param fragment fragment to switch to
     * @param enter    animation
     * @param exit     animation
     * @see #switchFragment(Fragment) #switchFragment(Fragment)
     */
    protected void switchFragment(Fragment fragment, @AnimRes int enter,
                                  @AnimRes int exit) {
        String tag = null;
        if (fragment instanceof CFragmentCore && ((CFragmentCore) fragment).getTitleId() > 0) {
            tag = s(((CFragmentCore) fragment).getTitleId());
        }
        getSupportFragmentManager()
                .beginTransaction().setCustomAnimations(enter, exit)
                .replace(getFragmentId(), fragment, tag).commit();
        setTitle(tag);
    }

    /**
     * Switch fragment.
     *
     * @param fragment fragment to switch to
     * @param enter    capsule_enter animation
     * @param exit     capsule_exit animation
     * @param popEnter pop capsule_enter animation
     * @param popExit  pop exist animation
     * @see #switchFragment(Fragment) #switchFragment(Fragment)
     */
    protected void switchFragment(Fragment fragment, @AnimRes int enter,
                                  @AnimRes int exit, @AnimRes int popEnter, @AnimRes int popExit) {

        String tag = null;
        if (fragment instanceof CFragmentCore && ((CFragmentCore) fragment).getTitleId() > 0) {
            tag = s(((CFragmentCore) fragment).getTitleId());
        }
        getSupportFragmentManager()
                .beginTransaction().setCustomAnimations(enter, exit, popEnter, popExit)
                .replace(getFragmentId(), fragment, tag).commit();
        setTitle(tag);
    }

}<commit_msg>make switchFrag public<commit_after>package ca.allanwang.capsule.library.activities;

import android.os.Bundle;
import android.support.annotation.AnimRes;
import android.support.annotation.CallSuper;
import android.support.v4.app.Fragment;

import ca.allanwang.capsule.library.interfaces.CFragmentCore;

/**
 * Created by <NAME> on 2016-08-19.
 * <p>
 * The activity that holds everything, with a few extra helper methods
 */
public abstract class CapsuleActivity extends EventActivity {

    @Override
    @CallSuper
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        capsuleOnCreate(savedInstanceState);
    }

    /**
     * Changes fragment in base view to new fragment
     *
     * @param fragment new fragment to switch to
     */
    public void switchFragment(Fragment fragment) {
        String tag = null;
        if (fragment instanceof CFragmentCore && ((CFragmentCore) fragment).getTitleId() > 0) {
            tag = s(((CFragmentCore) fragment).getTitleId());
        }
        getSupportFragmentManager()
                .beginTransaction().replace(getFragmentId(), fragment, tag).commit();
        setTitle(tag);
    }

    /**
     * Switch fragment.
     *
     * @param fragment fragment to switch to
     * @param enter    animation
     * @param exit     animation
     * @see #switchFragment(Fragment) #switchFragment(Fragment)
     */
    public void switchFragment(Fragment fragment, @AnimRes int enter,
                                  @AnimRes int exit) {
        String tag = null;
        if (fragment instanceof CFragmentCore && ((CFragmentCore) fragment).getTitleId() > 0) {
            tag = s(((CFragmentCore) fragment).getTitleId());
        }
        getSupportFragmentManager()
                .beginTransaction().setCustomAnimations(enter, exit)
                .replace(getFragmentId(), fragment, tag).commit();
        setTitle(tag);
    }

    /**
     * Switch fragment.
     *
     * @param fragment fragment to switch to
     * @param enter    capsule_enter animation
     * @param exit     capsule_exit animation
     * @param popEnter pop capsule_enter animation
     * @param popExit  pop exist animation
     * @see #switchFragment(Fragment) #switchFragment(Fragment)
     */
    public void switchFragment(Fragment fragment, @AnimRes int enter,
                                  @AnimRes int exit, @AnimRes int popEnter, @AnimRes int popExit) {

        String tag = null;
        if (fragment instanceof CFragmentCore && ((CFragmentCore) fragment).getTitleId() > 0) {
            tag = s(((CFragmentCore) fragment).getTitleId());
        }
        getSupportFragmentManager()
                .beginTransaction().setCustomAnimations(enter, exit, popEnter, popExit)
                .replace(getFragmentId(), fragment, tag).commit();
        setTitle(tag);
    }

}
{'fraction_non_alphanumeric': 0.10104529616724739, 'fraction_numerical': 0.004181184668989547, 'mean_word_length': 2.5769470404984425, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4048328', 'n_tokens_mistral': 1515, 'n_tokens_neox': 1457, 'n_words': 390}