Android Open Source - AndroidImageViewZoom Image View Zoom Test






From Project

Back to project page AndroidImageViewZoom.

License

The source code is released under:

Copyright (c) 2011 Igor Crevar http://extrafull.com/igorcrevar/ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "...

If you think the Android project AndroidImageViewZoom listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.rogicrew.imagezoom.example;
//from   w  w  w.  ja v a2 s .  co  m
import com.rogicrew.imagezoom.ImageViewZoom;
import com.rogicrew.imagezoom.ImageViewZoomOptions;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Bitmap;
import android.util.AttributeSet;

public class ImageViewZoomTest extends ImageViewZoom {

  public ImageViewZoomTest(Context context, AttributeSet attrs) {
    super(context, attrs);
  }
  
  @Override
  public void setImage(Bitmap bitmap) {
    //Simpsons
    if (bitmap.getWidth() == 260){
      if (mOptions == null){
        setOptions(new ImageViewZoomOptions());
      }
      mOptions.maxWidthMultiplier = 3.0f;
      mOptions.maxZoomSteps = 4;
    }
    super.setImage(bitmap);
  }

  @Override
  protected void onImageClick(float posX, float posY) {
    if ( posX >= 112 && posX <= 147 &&  posY >= 121 && posY <= 149){
      AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
      builder.setMessage("Homer's head!").setCancelable(false);
      builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
             public void onClick(DialogInterface dialog, int id) {  
               dialog.dismiss();
             }
      });
      AlertDialog alert = builder.create();
      alert.show();
    }
  }
}




Java Source Code List

com.rogicrew.imagezoom.ImageViewZoomOptions.java
com.rogicrew.imagezoom.ImageViewZoom.java
com.rogicrew.imagezoom.example.ImageViewZoomExample1Activity.java
com.rogicrew.imagezoom.example.ImageViewZoomTest.java
com.rogicrew.imagezoom.example.UnscaledBitmapOperations.java
com.rogicrew.imagezoom.ontouch.OnTouchInterface.java
com.rogicrew.imagezoom.ontouch.OnTouchMulti.java
com.rogicrew.imagezoom.ontouch.OnTouchSingle.java
com.rogicrew.imagezoom.ontouch.Pointer.java