Coder Social home page Coder Social logo

androidimagepopup's Introduction

Android Image Popup Android Arsenal

Show image as a popup on a click event or any event. Simply set the image as drawable and thats it!!!. And also you can set width, height & background color as you want.

Preview

Demo Preview

Usage

Step 1. Add the JitPack repository to your build file:

allprojects {
	repositories {
		...
		maven { url "https://jitpack.io" }
	}
}

Step 2. Add the dependency

dependencies {
       compile 'com.github.chathuralakmal:AndroidImagePopup:1.2.1'
}

Implementation

Create instance of the popup class and thats all !!

ImagePopup imagePopup = new ImagePopup(this); 

Example

 /** Set popup height, width & background color as you need or just leave default settings **/

    final ImagePopup imagePopup = new ImagePopup(this);
    imagePopup.setWindowHeight(800); // Optional
    imagePopup.setWindowWidth(800); // Optional
    imagePopup.setBackgroundColor(Color.BLACK);  // Optional
    imagePopup.setFullScreen(true); // Optional
    imagePopup.setHideCloseIcon(true);  // Optional
    imagePopup.setImageOnClickClose(true);  // Optional

    ImageView imageView = (ImageView) findViewById(R.id.imageView);
    imagePopup.initiatePopup(imageView.getDrawable());

    imageView.setOnClickListener(new View.OnClickListener() {
	@Override
	public void onClick(View view) {
	    /** Initiate Popup view **/
	 imagePopup.viewPopup();

	}
    });

Support using Picasso

// supprot string url for image 
initiatePopupWithPicasso(imageUrl);

// supprot Uri for image 
initiatePopupWithPicasso(imageUri);

// supprot File for image 
initiatePopupWithPicasso(imageFile);

Support using Glide

// supprot string url for image 
initiatePopupWithGlide(imageUrl);

Credits

Stack Overflow

Contribute

Let's make this grow. Contributions are always welcome!

License

The MIT License

2017

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.