Skip to content

code-crusher/Image-Zoomer

Repository files navigation

Image-Zoomer


Specs

Bintray Twitter

Image zoomer provides easy way to add zoom animations to you ImageButton. You can set the animation duration and reverse mode to reverse the animation.

Featured in

Screenshots

###Zoom Screenshot

Zoom Reverse

Screenshot

Integration


  • ImageZoomer is available in the MavenCentral, so getting it as simple as adding it as a dependency
compile 'com.vatsal.imagezoomer:image-zoomer:1.0.2'

Usage

Method 1 : XML

In your activity_main.xml file use this code instead of ImageButton:

<com.vatsal.imagezoomer.ImageZoomButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@mipmap/ic_launcher" />

Attributes

    • To set the duration use:
```xml app:duration="200" ```
    • To use the reverse mode:
```xml app:modeReverse="true" ```

Method 2 : Java

In your MainActivity.class use this code in OnClick() of ImageButton:

Activity activity = getActivity();
ImageButton imageButton = (ImageButton) findViewById(R.id.image_button);
long duration = 500;
  • For simple zoom:
imageButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ZoomAnimation zoomAnimation = new ZoomAnimation(activity);
                zoomAnimation.zoom(v, duration);
            }
        });
  • For Reverse zoom:
imageButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ZoomAnimation zoomAnimation = new ZoomAnimation(activity);
                zoomAnimation.zoomReverse(v, duration);
            }
        });
Variable Type
image_button ImageButton
activity Activity
duration(ms) long

License

Copyright 2016 Vatsal Bajpai

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

📱 Image zoom animations library for Android.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages