Coder Social home page Coder Social logo

commentgallery's Introduction

CommentGallery

This project contains serval librarys for demonstrating image gallery with Fresco's ZoomableDraweeView(Use the optimized version I made), such as image grid and large image viewer which supports zoom-in and zoom-out. Please feel free to let me know if your have any questions.

Gradle Dependency

Add the JitPack repository to your build file:

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

Usage

1. Usage of ZoomableDraweeView

I've optimized some default behaviors to the official ZoomableDraweeView to make it more perfect.

  • Add the dependency

    dependencies {
         compile 'com.github.ibosong.CommentGallery:frescozoomablelib:1.0.1'
        }
    
  • Use ZoomableDraweeView as the Fresco SimpleDraweeView.

2. Usage of LargeImageGallery

  • Add the dependency

    dependencies {
         compile 'com.github.ibosong.CommentGallery:largeimagegallerylib:1.0.1'
        }
    
  • Add LargeImageGallery to your xml file.

    <com.bosong.commentgallerylib.LargeImageGallery
            android:id="@+id/image_gallery"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>
    
  • Set image urls with setData(List<String> urls) method.

    That's all. There are also some listeners your can set:

    mLargeImageGallery.setOnImageSelectedListener(this);
    mLargeImageGallery.setOnItemClickListener(this);
    

3. Usage of CommentImageGrid

  • Add the dependency

    dependencies {
         compile 'com.github.ibosong.CommentGallery:commentgallerylib:1.0.1'
        }
    
  • Add CommentImageGrid to xml layout file

    <com.bosong.commentgallerylib.CommentImageGrid
        android:id="@+id/comment_grid"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:placeholder_image="@drawable/placeholder"
        app:fallback_image="@drawable/placeholder"
        app:vertical_space="7.5dp"
        app:horizontal_space="7.5dp"/>
    
  • Attribures

    Attribure Usage
    placeholder_image set placeholder image
    fallback_image set fallback image
    horizontal_space horizontal space between items
    vertical_space vertical space between items
  • Set image urls with List<String>

    mCommentGrid.setData(urls);
    

    Attentions

    You may do some compress works for the large image before rendering to avoid the error "OpenGLRenderer: Bitmap too large to be uploaded into a texture".

    Last thing

    Enjoy yourself!

commentgallery's People

Contributors

ibosong avatar

Stargazers

Roman avatar

Watchers

James Cloos avatar  avatar

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.