Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.code-crusher:Image-Zoomer:'
}
dependencies {
implementation("com.github.code-crusher:Image-Zoomer:")
}
<dependency>
<groupId>com.github.code-crusher</groupId>
<artifactId>Image-Zoomer</artifactId>
<version></version>
</dependency>
libraryDependencies += "com.github.code-crusher" % "Image-Zoomer" % ""
:dependencies [[com.github.code-crusher/Image-Zoomer ""]]
<a href="http://www.methodscount.com/?lib=com.vatsal.imagezoomer%3Aimage-zoomer%3A1.0.2"><img src="https://img.shields.io/badge/Methods%20and%20size-core:%20103%20%7C%2026%20KB-e91e63.svg"/></a>
<a href="http://twitter.com/vatsal__bajpai"><img src="https://img.shields.io/badge/Twitter-@vatsal__bajpai-blue.svg?" alt="Twitter" data-canonical-src="https://img.shields.io/badge/Twitter-@vatsal__bajpai-blue.svg?" style="max-width:100%;"></a><br>
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.
<a href="http://android-arsenal.com/details/1/3799"><img src="https://img.shields.io/badge/Android%20Arsenal-ImageZoomer-green.svg"/></a>
###Zoom
compile 'com.vatsal.imagezoomer:image-zoomer:1.0.2'
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" />
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;
imageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ZoomAnimation zoomAnimation = new ZoomAnimation(activity);
zoomAnimation.zoom(v, duration);
}
});
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
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.