Merge pull request #5 from ecsoftware/sprint0

package com.example.task;

import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Toast;

public class MainActivity extends Activity {

	@Override
    public void onCreate(Bundle savedInstanceState)
    {
          super.onCreate(savedInstanceState);
          Keypaint view = new Keypaint(this);
          setContentView(view);
    }    
	@Override
	public boolean onTouchEvent(MotionEvent event) {
	    int posX = (int)event.getX();
	    int posY = (int)event.getY();

	    switch (event.getAction()) {
	        case MotionEvent.ACTION_DOWN:
	            float x1 = 220, x2 = 329, y1 = 329, y2 = 353;

	    	    if ((posX >= x1 && posX <= x2) && (posY >= y1 && posY <= y2)) {
	    	    	Toast.makeText(getApplicationContext(), "WOW...",
	    	    			   Toast.LENGTH_LONG).show();
	    	    }
	    }
	return false;
	}
	
    public class Keypaint extends View
    {
    	Paint paint = new Paint();
    	Rect r = new Rect(230, 240, 270, 270);

    	@Override
    	public void onDraw(Canvas canvas) {
    		
    		 Bitmap b1=BitmapFactory.decodeResource(getResources(), R.drawable.direction_board);
             canvas.drawBitmap(b1, 20, 0,paint);

    	    paint.setStyle(Paint.Style.STROKE);
    	    paint.setColor(Color.BLACK);
    	    canvas.drawRect(r, paint);
    	}
          public Keypaint(Context context)
          {
                super(context);
          }
    }
    
}