<commit_before>package org.opendroidphp.app.tasks;

import android.app.Dialog;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Handler;
import android.os.Looper;
import android.view.LayoutInflater;
import android.widget.TextView;

import org.opendroidphp.R;


abstract public class ProgressDialogTask extends AsyncTask<String, String, String> {

    protected Handler handler = new Handler(Looper.getMainLooper());

    private Dialog progress;
    private Context context;

    private TextView tv_title;
    private TextView tv_message;

    private String title;
    private String message;

    public ProgressDialogTask(Context context) {
        this.context = context;
        handler.post(new Runnable() {
            @Override
            public void run() {
                createDialog().show();
            }
        });
    }

    public ProgressDialogTask(Context context, String title, String message) {
        this(context);
        this.title = title;
        this.message = message;
    }

    protected Dialog createDialog() {

        LayoutInflater inflater = LayoutInflater.from(context);

        progress = new Dialog(context, R.style.Theme_DroidPHP_Dialog);
        progress.setContentView(inflater.inflate(R.layout.dialog_progress_holo, null));

        title = title != null ? title : context.getString(R.string.core_apps);
        message = message != null ? message : context.getString(R.string.installing_core_apps);

        //Title View
        tv_title = (TextView) progress.findViewById(R.id.title);
        tv_title.setText(title);

        //Message View
        tv_message = (TextView) progress.findViewById(R.id.message);
        tv_message.setText(message);

        return progress;
    }

    public ProgressDialogTask setTitle(String title) {
        this.title = title;
        tv_title.setText(title);
        return this;
    }

    public ProgressDialogTask setMessage(String message) {
        this.message = message;
        tv_message.setText(message);
        return this;
    }

    /**
     * Dismiss the Dialog
     */
    protected void dismissProgress() {
        if (progress != null && progress.isShowing()) {
            progress.dismiss();
        }
    }

    public Context getContext() {
        return context;
    }

    protected Dialog getDialog() {
        return progress;
    }
}
<commit_msg>Improved ProgressDialogTask to support generics<commit_after>package org.opendroidphp.app.tasks;

import android.app.Dialog;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Handler;
import android.os.Looper;
import android.view.LayoutInflater;
import android.widget.TextView;

import org.opendroidphp.R;


abstract public class ProgressDialogTask<ParameterT, ProgressT, ReturnT> extends AsyncTask<ParameterT, ProgressT, ReturnT> {

    protected Handler handler = new Handler(Looper.getMainLooper());

    private Dialog progress;
    private Context context;

    private TextView tv_title;
    private TextView tv_message;
    //private ProgressBar progressBar;

    private String title;
    private String message;

    public ProgressDialogTask() {

    }

    public ProgressDialogTask(Context context) {
        this.context = context;
        handler.post(new Runnable() {
            @Override
            public void run() {
                createDialog().show();
            }
        });
    }

    public ProgressDialogTask(Context context, String title, String message) {
        this(context);
        this.title = title;
        this.message = message;
    }

    public ProgressDialogTask(Context context, int titleResId, int messageResId) {
        this(context, context.getString(titleResId), context.getString(messageResId));
    }

    protected Dialog createDialog() {

        LayoutInflater inflater = LayoutInflater.from(context);

        progress = new Dialog(context, R.style.Theme_DroidPHP_Dialog);
        progress.setContentView(inflater.inflate(R.layout.dialog_progress_holo, null));

        title = title != null ? title : context.getString(R.string.core_apps);
        message = message != null ? message : context.getString(R.string.installing_core_apps);

        //Title View
        tv_title = (TextView) progress.findViewById(R.id.title);
        tv_title.setText(title);

        //Message View
        tv_message = (TextView) progress.findViewById(R.id.message);
        tv_message.setText(message);

        //progressBar = (ProgressBar) progress.findViewById(R.id.pb_progress);
        return progress;
    }

    public ProgressDialogTask setTitle(String title) {
        this.title = title;
        tv_title.setText(title);
        return this;
    }

    public ProgressDialogTask setMessage(String message) {
        this.message = message;
        tv_message.setText(message);
        return this;
    }

    /**
     * Dismiss the Dialog
     */
    protected void dismissProgress() {
        if (progress != null && progress.isShowing()) {
            progress.dismiss();
        }
    }

    public Context getContext() {
        return context;
    }

    protected Dialog getDialog() {
        return progress;
    }
}

{'fraction_non_alphanumeric': 0.09563209543967674, 'fraction_numerical': 0.0, 'mean_word_length': 2.67090395480226, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '4149566', 'n_tokens_mistral': 1423, 'n_tokens_neox': 1353, 'n_words': 320}