package com.example.demoactivity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.ImageButton;

public class findLockActivity extends Activity
{
	private ImageButton bookButton;
	private ImageButton pinButton;
	private ImageButton inButton;
	
	public void onCreate(Bundle savedInstanceState) 
	{
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		super.onCreate(savedInstanceState);
		setContentView(R.layout.findlock);
		bookButton=(ImageButton)findViewById(R.id.bookbutton);
		pinButton=(ImageButton)findViewById(R.id.pinbutton);
		inButton=(ImageButton)findViewById(R.id.inbutton);
		

        bookButton.setOnTouchListener(new View.OnTouchListener(){        	
            public boolean onTouch(View v, MotionEvent event) {            	
                    if(event.getAction() == MotionEvent.ACTION_DOWN){     
                       ((ImageButton)v).setImageDrawable(getResources().getDrawable(R.drawable.cert1));                            
                    }else if(event.getAction() == MotionEvent.ACTION_UP){     
                    	((ImageButton)v).setImageDrawable(getResources().getDrawable(R.drawable.cert));   
                    }
                    return false;     
            }     
        });
		
        pinButton.setOnTouchListener(new View.OnTouchListener(){        	
            public boolean onTouch(View v, MotionEvent event) {            	
                    if(event.getAction() == MotionEvent.ACTION_DOWN){     
                       ((ImageButton)v).setImageDrawable(getResources().getDrawable(R.drawable.pin1));                            
                    }else if(event.getAction() == MotionEvent.ACTION_UP){     
                    	((ImageButton)v).setImageDrawable(getResources().getDrawable(R.drawable.pin));   
                    }
                    return false;     
            }     
        });
        
        inButton.setOnTouchListener(new View.OnTouchListener(){        	
            public boolean onTouch(View v, MotionEvent event) {            	
                    if(event.getAction() == MotionEvent.ACTION_DOWN){     
                       ((ImageButton)v).setImageDrawable(getResources().getDrawable(R.drawable.devi1));                            
                    }else if(event.getAction() == MotionEvent.ACTION_UP){     
                    	((ImageButton)v).setImageDrawable(getResources().getDrawable(R.drawable.devi));   
                    }
                    return false;     
            }     
        });
		
		
		
		bookButton.setOnClickListener(listener);
		pinButton.setOnClickListener(listener);
		inButton.setOnClickListener(listener);
    }
	
	private OnClickListener listener=new OnClickListener()
	{

		public void onClick(View v) {
			if(v.getId()==R.id.bookbutton)
			{
				Intent intent1=new Intent(findLockActivity.this,BookActivity.class);
				startActivity(intent1);
			}
			if(v.getId()==R.id.pinbutton)
			{
				Intent intent2=new Intent(findLockActivity.this,PinActivity.class);
				startActivity(intent2);
			}
			if(v.getId()==R.id.inbutton)
			{
				Intent intent3=new Intent(findLockActivity.this,inActivity.class);
				startActivity(intent3);
			}
			
		}
		
	};
}