
/**
 * Clase main de la aplicacion
 * @author Carlos Fernandez, Sergio Castro, Javier Ortiz
 */


package com.example.calendaryapp;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

    @Override

	/** 
	* Inicia la actividad  
	* @param id 	Account number
	* @param amt 	Initial balance amount
	* @param ss  	Social security number as string
 	*/

    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Button SecondActivityBtn = (Button)findViewById(R.id.SecondActivitybtn);
        SecondActivityBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent startIntent;
                startIntent = new Intent(getApplicationContext(),Main2Activity.class);

                startActivity(startIntent);
            }
        });
        Button sigaButton  = (Button)findViewById(R.id.ThirdActivitybtn);
        sigaButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String siga = "https://siga.usm.cl/pag/";
                Uri webaddress1=Uri.parse(siga);
                Intent gotoSiga = new Intent(Intent.ACTION_VIEW, webaddress1); //intento de ver una direccion fuera de la main activity
                if(gotoSiga.resolveActivity(getPackageManager())!=null){
                    startActivity(gotoSiga);
                }

            }
        });
        Button aulaButton  = (Button)findViewById(R.id.FourthActivitybtn);
        aulaButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String aula = "https://aula.usm.cl";
                Uri webaddress2=Uri.parse(aula);
                Intent gotoAula = new Intent(Intent.ACTION_VIEW, webaddress2); //intento de ver una direccion fuera de la main activity
                if(gotoAula.resolveActivity(getPackageManager())!=null){
                    startActivity(gotoAula);
                }

            }
        });
        Button minutaButton  = (Button)findViewById(R.id.MinutaActivitybtn);
        minutaButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent startIntent2;
                startIntent2 = new Intent(getApplicationContext(),MinutaActivity.class);

                startActivity(startIntent2);

            }
        });

        Button biblioButton  = (Button)findViewById(R.id.BiblioActivitybtn);
        biblioButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent startIntent3;
                startIntent3 = new Intent(getApplicationContext(),Prebiblio.class);
                startActivity(startIntent3);

            }
        });



    }
}
