package com.dome.pokiiez;

import com.dome.pokiiez.MainActivity;
import com.dome.pokiiez.R;

import android.app.Activity;
import android.app.AlertDialog;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.content.DialogInterface;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;



public class MainActivity extends Activity implements OnClickListener{
	@Override
    public void onBackPressed() {
    	// Builder
    	AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
    	builder.setTitle(" Alert  Dialog")
    	.setIcon(getResources().getDrawable(R.drawable.ic_launcher))
    	.setMessage("Are you sure you want to exit ?")
    	.setPositiveButton("Not Now", new DialogInterface.OnClickListener() {
			
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
				
				
			}
		})
		.setNegativeButton("YES", new DialogInterface.OnClickListener() {
			
			@Override
			public void onClick(DialogInterface dialog, int which) {
				MainActivity.this.finish();
				
			}
		});
    	// Alert Dialog
    	AlertDialog alert = builder.create();
    	alert.show();
    }
	//link button to data
	@Override
	
	protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
		setContentView(R.layout.mm);
		Bitmap bitmap = BitmapFactory.decodeResource(this.getResources(), R.drawable.basic);
		Bitmap circularBitmap = ImageConverter.getRoundedCornerBitmap(bitmap, 100);
		Bitmap bitmap1 = BitmapFactory.decodeResource(this.getResources(), R.drawable.rules);
		Bitmap circularBitmap1 = ImageConverter.getRoundedCornerBitmap(bitmap, 100);
		Bitmap bitmap2 = BitmapFactory.decodeResource(this.getResources(), R.drawable.practice);
		Bitmap circularBitmap2 = ImageConverter.getRoundedCornerBitmap(bitmap, 100);
		Bitmap bitmap3 = BitmapFactory.decodeResource(this.getResources(), R.drawable.plan);
		Bitmap circularBitmap3 = ImageConverter.getRoundedCornerBitmap(bitmap, 100);
		Bitmap bitmap4 = BitmapFactory.decodeResource(this.getResources(), R.drawable.map);
		Bitmap circularBitmap4 = ImageConverter.getRoundedCornerBitmap(bitmap, 100);

		View btnbasic = findViewById(R.id.circleView);
		btnbasic.setOnClickListener((OnClickListener) this);

		View btnRule = findViewById(R.id.circleView1);
		btnRule.setOnClickListener((OnClickListener) this);

		View btnCheckbox = findViewById(R.id.circleView2);
		btnCheckbox.setOnClickListener((OnClickListener) this);

		View btnplan = findViewById(R.id.circleView3);
		btnplan.setOnClickListener((OnClickListener) this);

		View btnMapsActivity = findViewById(R.id.circleView4);
		btnMapsActivity.setOnClickListener((OnClickListener) this);
	}
	public void onClick(View v) {
		switch (v.getId()) {

			case R.id.circleView:
			Intent i1111 = new Intent(this, Mainbasic.class);
			startActivity(i1111);
			break;

			case R.id.circleView1:
				Intent i11 = new Intent(this, Mainrule.class);
				startActivity(i11);
				break;

			case R.id.circleView2:
			Intent i = new Intent(this, Checkbox.class);
			startActivity(i);
			break;

			case R.id.circleView3:
			Intent i111 = new Intent(this, plan.class);
			startActivity(i111);
			break;

			case R.id.circleView4:
				Intent i11111 = new Intent(this, MapsActivity.class);
				startActivity(i11111);
				break;

}
	}
}
