/*      Copyright (C) 2015  David Ross

        This program is free software: you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation, either version 3 of the License, or
        (at your option) any later version.

        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.

        You should have received a copy of the GNU General Public License
        along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
package com.example.davidross.djr1_reflex;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;


/**
 * Created by davidross on 2015-10-03.
 */
public class PromptController {
    private Activity parent;

    public PromptController(Activity parent){
        this.parent = parent;
    }

    public void displayReactionTimerPrompt(String title, String message, String positiveMessage, final ReflexTimer timer){
        // developer.android.com/intl/ja/guide/topics/ui/dialogs.html
        AlertDialog.Builder promptDialogSetup = new AlertDialog.Builder(parent);

        promptDialogSetup.setMessage(message);
        promptDialogSetup.setTitle(title);

        promptDialogSetup.setPositiveButton(positiveMessage, new Dialog.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                // relay to stats controller
                timer.setReactionTime(0);
                timer.delayRandom();
            }
        });
        promptDialogSetup.create().show();
    }

    public void MultiplayerBuzzerPrompt(String title, String message, String positiveMessage){
        AlertDialog.Builder promptDialogSetup = new AlertDialog.Builder(parent);

        promptDialogSetup.setMessage(message);
        promptDialogSetup.setTitle(title);
        promptDialogSetup.setPositiveButton(positiveMessage, new Dialog.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                //relay to stats controller
            }
        });
        promptDialogSetup.create().show();
    }
}
