package dowan.opencv_skeleton;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;

public class Description extends Activity {
    private float x, y;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_description);
        Bundle extras = getIntent().getExtras();
        x = extras.getFloat("x");
        y = extras.getFloat("y");
        TextView desc = (TextView) findViewById(R.id.desc);
        if (x > 200 && x < 360 && y > 500 && y < 650) {
            desc.setText("Professor Nilsen's office");
        } else if (x > 0 && x < 200 && y > 500 && y < 650) {
            desc.setText("Professor office i have to check the name on the door");
        } else if (x > 360 && x < 600 && y > 500 && y < 700) {
            desc.setText("Professor office i have to check the name on the door");
        } else if (x > 600 && x < 820 && y > 500 && y < 760) {
            desc.setText("work room/lecturing room");
        } else if (x > 820 && x < 1050 && y > 500 && y < 1080) {
            desc.setText("work room/lecturing room");
        } else if (x > 820 && x < 1050 && y > 1080 && y < 1500) {
            desc.setText("Vizual lab");
        } else if (x > 0 && x < 150 && y > 650 && y < 1500) {
            desc.setText("Professor office i have to check the name on the door");
        } else if (x > 150 && x < 500 && y > 1200 && y < 1500) {
            desc.setText("Professor office i have to check the name on the door");
        } else if (x > 150 && x < 800 && y > 750 && y < 1000) {
            desc.setText("work room");
        } else if (x > 450 && x < 800 && y > 1000 && y < 1500) {
            desc.setText("work room");
        } else if (x > 150 && x < 450 && y > 1000 && y < 1200) {
            desc.setText("room n°5");
        }else {
            desc.setText("Sorry, no descrpition for this place.");
        }

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_description, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}
