<commit_before>package com.blstream.studybox.components;

import android.app.Activity;
import android.content.Context;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;

import com.blstream.studybox.R;
import com.blstream.studybox.RandomTestDialog;
import com.blstream.studybox.activities.BaseExamActivity;
import com.blstream.studybox.events.ImproveAllEvent;

import org.greenrobot.eventbus.EventBus;

import cn.pedant.SweetAlert.SweetAlertDialog;

public class Dialogs extends SweetAlertDialog {

    private Context context;

    public Dialogs(Context context) {
        super(context);
        this.context = context;
    }

    public void modeDialogInit(final String deckId, final String deckName, final int cardsAmount) {
        this.setTitleText(getString(R.string.choose_mode))
                .setCancelText(getString(R.string.study))
                .setConfirmText(getString(R.string.exam))
                .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() {
                    @Override
                    public void onClick(SweetAlertDialog sweetAlertDialog) {
                        dismissWithAnimation();
                        BaseExamActivity.start(getContext(), false, deckId, deckName, false);
                    }
                })
                .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
                    @Override
                    public void onClick(SweetAlertDialog sweetAlertDialog) {
                        dismissWithAnimation();
                        RandomTestDialog randomTestDialog = RandomTestDialog.newInstance(deckId, deckName, cardsAmount);
                        FragmentManager fragmentManager = ((FragmentActivity) getContext()).getSupportFragmentManager();
                        randomTestDialog.show(fragmentManager, "RandomTestDialog");
                    }
                });
    }

    public void studyEndDialogInit() {
        this.setTitleText(getString(R.string.repeat_study_info))
                .setContentText(getString(R.string.repeat_study_question))
                .setConfirmText(getString(R.string.yes))
                        .setCancelText(getString(R.string.no))
                        .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() {
                            @Override<commit_msg>Fix bus with wrong context<commit_after>package com.blstream.studybox.components;

import android.app.Activity;
import android.content.Context;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;

import com.blstream.studybox.R;
import com.blstream.studybox.RandomTestDialog;
import com.blstream.studybox.activities.BaseExamActivity;
import com.blstream.studybox.events.ImproveAllEvent;

import org.greenrobot.eventbus.EventBus;

import cn.pedant.SweetAlert.SweetAlertDialog;

public class Dialogs extends SweetAlertDialog {

    private Context context;

    public Dialogs(Context context) {
        super(context);
        this.context = context;
    }

    public void modeDialogInit(final String deckId, final String deckName, final int cardsAmount) {
        this.setTitleText(getString(R.string.choose_mode))
                .setCancelText(getString(R.string.study))
                .setConfirmText(getString(R.string.exam))
                .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() {
                    @Override
                    public void onClick(SweetAlertDialog sweetAlertDialog) {
                        dismiss();
                        BaseExamActivity.start(context, false, deckId, deckName, false);
                    }
                })
                .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
                    @Override
                    public void onClick(SweetAlertDialog sweetAlertDialog) {
                        dismissWithAnimation();
                        RandomTestDialog randomTestDialog = RandomTestDialog.newInstance(deckId, deckName, cardsAmount);
                        FragmentManager fragmentManager = ((FragmentActivity) context).getSupportFragmentManager();
                        randomTestDialog.show(fragmentManager, "RandomTestDialog");
                    }
                });
    }

    public void studyEndDialogInit() {
        this.setTitleText(getString(R.string.repeat_study_info))
                .setContentText(getString(R.string.repeat_study_question))
                .setConfirmText(getString(R.string.yes))
                        .setCancelText(getString(R.string.no))
                        .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() {
                            @Override
{'fraction_non_alphanumeric': 0.08067226890756303, 'fraction_numerical': 0.0008403361344537816, 'mean_word_length': 2.3457484188334505, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5999443', 'n_tokens_mistral': 1196, 'n_tokens_neox': 1108, 'n_words': 187}