package com.example.image13;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.ZoomControls;

import android.view.View;
import android.view.View.OnClickListener;

public class MainActivity extends Activity {

			private ZoomControls zoom;
			
			private final static String IMAGE_URL = "http://i.imgur.com/4b3eT1d.jpg";
			String imagefile ="/sdcard/aaaadownloadedfile.jpg";

 			@Override
 			protected void onCreate(Bundle savedInstanceState)
 			{
 					super.onCreate(savedInstanceState);
 					setContentView(R.layout.activity_main);
  
 					zoom = (ZoomControls) findViewById(R.id.zoom);
  
 					final ImageView imageid = (ImageView)findViewById(R.id.image);
 					Bitmap bm = BitmapFactory.decodeFile(imagefile);
 					imageid.setImageBitmap(bm);
  
 					
 					zoom.setOnZoomInClickListener(new OnClickListener() {
 						
 						@Override
 						public void onClick(View v) {
 							// TODO Auto-generated method stub
 							
 							float x = imageid.getScaleX();
 							float y = imageid.getScaleY();
 							
 							imageid.setScaleX((float) (x+1));
 							imageid.setScaleY((float) (y+1));
 						}
 					});
 				 
 				        zoom.setOnZoomOutClickListener(new View.OnClickListener() {
 							
 						@Override
 						public void onClick(View v) {
 							// TODO Auto-generated method stub
 							
 				 
 							float x = imageid.getScaleX();
 							float y = imageid.getScaleY();
 							
 							imageid.setScaleX((float) (x-1));
 							imageid.setScaleY((float) (y-1));
 						}
 					});
 					
  //image = (ImageView) findViewById(R.id.img_large);
  
  //call asynctask to get image from url
  //new DownloadImageTask(image).execute(IMAGE_URL);
 }

}


