// Bandit Manchot, by Seb Luca, UNamur, June 2018

package com.projet.sluca.banditmanchot;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class RulesActivity extends Activity implements View.OnClickListener
{
    private static int REQUEST_CODE = 1;
    private Button button;
    private Context context;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_rules);
        context = this; // Actualise les informations inhérentes à l'application.

        // Ecoute des clics sur le bouton "btnBack".
        button = findViewById(R.id.btnBack);
        button.setOnClickListener(this);
    }

    @Override
    public void onClick(View paramView) // En cas de clic sur le bouton "btnBack".
    {
        // Bruitage.
        MediaPlayer sound = MediaPlayer.create(RulesActivity.this,R.raw.buttonstart);
        sound.start();

        Intent intent = new Intent(context, MainActivity.class); // pointe vers MainActivity.
        startActivityForResult(intent, REQUEST_CODE);            // changement d'activity.
    }
}
