package com.example.distmeasapp;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.MenuItem;

public class MainActivity extends Activity {

	private static final int M_CAMERA = 0;
	private static final int M_SHORTMEAS = 1;
	private static final int M_LONGMEAS = 2;
	private static final int M_HELP = 3;
	private static final int M_EXIT = 4;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		super.onCreateOptionsMenu(menu);
		menu.add(0, M_CAMERA,0, R.string.menu0);
		menu.add(0, M_SHORTMEAS,0, R.string.menu1);
		menu.add(0, M_LONGMEAS,0, R.string.menu2);
		menu.add(0, M_HELP,0, R.string.menu3);
		menu.add(0, M_EXIT,0, R.string.menu4);
		return true;
	}

	@Override
    public boolean onMenuItemSelected(int featureId, MenuItem item) {
    	switch(item.getItemId()) {
        case M_CAMERA:
        	startActivity(new Intent(this, CameraMeas.class));
        	return true;
        case M_SHORTMEAS:
        	startActivity(new Intent(this, ShortMeas.class));
        	return true;
        case M_LONGMEAS:
        	startActivity(new Intent(this, LongMeas.class));
        	return true;
        case M_HELP:
        	startActivity(new Intent(this, Help.class));
        	return true;
        case M_EXIT:
        	finish();
        	return true;
        default:
            return super.onOptionsItemSelected(item);
	    }
    }
}
