package com.example.patrice.reservation02;

import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class options extends AppCompatActivity
{
    Button btn_apropos, btn_gps, btn_options_utilisateur, btn_login_admin, btn_statistiques, btn_aide;

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.options_layout);

        getSupportActionBar().setTitle("  Options ");
        getSupportActionBar().setLogo(R.drawable.settingsb);
        getSupportActionBar().setDisplayUseLogoEnabled(true);
        getSupportActionBar().setHomeButtonEnabled(true);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setDisplayShowHomeEnabled(true);

        btn_apropos = (Button) findViewById(R.id.btn_apropos);

        btn_apropos.setOnClickListener(new View.OnClickListener()
        {
            public void onClick(View arg0)
            {
               about();
            }
        });

        btn_gps = (Button) findViewById(R.id.btn_gps);

        btn_gps.setOnClickListener(new View.OnClickListener()
        {
            public void onClick(View arg0)
            {
                Intent i = new Intent(getApplicationContext(), gps_location_02.class);
                startActivity(i);
            }
        });


        btn_options_utilisateur = (Button) findViewById(R.id.btn_options_utilisateur);

        btn_options_utilisateur.setOnClickListener(new View.OnClickListener()
        {
            public void onClick(View arg0)
            {
               // Intent i = new Intent(getApplicationContext(), compte_utilisateur.class);
                Intent i = new Intent(getApplicationContext(), gps_location_03.class);

                startActivity(i);
            }
        });

        btn_login_admin = (Button) findViewById(R.id.btn_login_admin);

        btn_login_admin.setOnClickListener(new View.OnClickListener()
        {
            public void onClick(View arg0)
            {
                Intent i = new Intent(getApplicationContext(), admin_tools.class);
                startActivity(i);
            }
        });

        btn_statistiques = (Button) findViewById(R.id.btn_statistiques);

        btn_statistiques.setOnClickListener(new View.OnClickListener()
        {
            public void onClick(View arg0)
            {
                Intent i = new Intent(getApplicationContext(), statistiques_02.class);
                startActivity(i);
            }
        });

        btn_aide = (Button) findViewById(R.id.btn_aide);

        btn_aide.setOnClickListener(new View.OnClickListener()
        {
            public void onClick(View arg0)
            {
                Intent i = new Intent(getApplicationContext(), aide.class);
                startActivity(i);
            }
        });

    }

    /*************************************************************************/

    // pour le retour - inclus dans l'action bar ( < )
    @Override
    public boolean onOptionsItemSelected(MenuItem item)
    {
        switch (item.getItemId())
        {
            case android.R.id.home:
                this.finish();
                return true;
            default:
                return super.onOptionsItemSelected(item);
        }
    }

    /*************************************************************************/

    public void about()
    {
        final Dialog dialog = new Dialog(options.this);

        dialog.setContentView(R.layout.about_layout);
        dialog.setTitle("A propos de l'appli:");
        dialog.show();

        Button dialogCloseButton = (Button) dialog.findViewById(R.id.close_button);

        dialogCloseButton.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View v)
            {
                dialog.dismiss();
            }
        });

    }

}

