Organize your images in beautiful collage with this library!

Overview

CollageImageView

This app is an example. how to create collages with RecyclerView. See an example, how it's working:

device-2021-04-24-015545.mp4

Installation

1) If you have not added Jitpack to your repositories, add it:

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

2) Then add to your app (or another module, where you will use the lib) this dependency:

implementation 'com.github.GrishinSergey:CollageImageView:<actual-lib-version>'

3) In your layout you should place this:

<com.sagrishin.collageview.CollageView
    android:id="@+id/collageViewId"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />

And in your source you should place next code.

One of major changes between v1 and v2 is that now it is necessary to provide previewer. This is the way, how this lib supports different libraries for previewing images. Look to app module to see details

collageViewId.itemPreviewLoader = GlideItemPreviewLoaderImpl.Builder(context).build()

Now it is possible to set radius for images in collage. Just paste value in dp in collage to make it rounded

val radius = TypedValue.applyDimension(
    TypedValue.COMPLEX_UNIT_DIP,
    4F, // the radius value
    context.resources.displayMetrics
)
collageViewId.itemCornerRadius = radius.toInt()

Here is an example, how to fill list of urls to images. Let's say you have list of images from your API, so you can convert them to CollageItemUrlData

val images = photos.map { singlePhoto ->
    CollageItemUrlData(singlePhoto.url).apply {
        this.width = singlePhoto.width
        this.height = singlePhoto.height
    }
}
collageViewId.setItemDatas(images)

Also it is possible to listen, on which image user clicked:

collageViewId.clickListener = OnCollageClickListener { position ->
    Toast.makeText(context, "clicked position is $position", Toast.LENGTH_SHORT).show()
}

Last, which is necessary, call showCollage method:

collageViewId.showCollage()

What should be upgraded:

  1. Make thumbnail and error holders which will be shown, if image still loading or if an error acquired
  2. Create proguard file
You might also like...
Android pagination library (updated 01.05.2018)
Android pagination library (updated 01.05.2018)

NoPaginate Android pagination library, based on @MarkoMilos repository Paginate Loading Item Error Item Gradle implementation 'ru.alexbykov:nopaginate

Android library for RecyclerView to manage order of items and multiple view types.
Android library for RecyclerView to manage order of items and multiple view types.

recyclerview-binder Android Library for RecyclerView to manage order of items and multiple view types. Features Insert any items to wherever you want

The library that removes all boilerplate code allowing you to display lists with few lines of code.

VsRecyclerView The library that removes all boilerplate code allowing you to display lists with few lines of code. Gradle androidExtensions { expe

An efficient TabLayout library implemented with RecyclerView.
An efficient TabLayout library implemented with RecyclerView.

RecyclerTabLayout An efficient TabLayout library implemented with RecyclerView. Features Efficient when having many tabs Easy setup with ViewPager (sa

Android Library to provide swipe, click and other functionality to RecyclerView

RecyclerViewEnhanced Android Library to provide swipe, click and other functionality to RecyclerView Usage Add this to your build.gradle file dependen

the library is a loop RecyclerView(expression), can show some effects when display
the library is a loop RecyclerView(expression), can show some effects when display

CircleRecyclerView the library is a loop RecyclerView, can show some effects when display screenshot CircularViewMode ScaleXViewMode & ScaleYViewMode

Epoxy is an Android library for building complex screens in a RecyclerView

Epoxy Epoxy is an Android library for building complex screens in a RecyclerView. Models are automatically generated from custom views or databinding

Elegant design and convenient to use RecyclerView adapter library based on Kotlin DSL.
Elegant design and convenient to use RecyclerView adapter library based on Kotlin DSL.

xAdapter: Kotlin DSL 风格的 Adapter 封装 1、简介 该项目是 KotlinDSL 风格的 Adapter 框架封装,用来简化 Adapter 调用,思想是采用工厂和构建者方式获取 Adapter 避免代码中定义大量的 Adapter 类。该项目在 BRVAH 的 Ada

Handy library to integrate pagination, which allow no data layout, refresh layout, recycler view in one view and easy way to bind pagination in app.
Handy library to integrate pagination, which allow no data layout, refresh layout, recycler view in one view and easy way to bind pagination in app.

Pagination View Handy library to integrate pagination, which allow no data layout, refresh layout, recycler view in one view and easy way to bind pagi

Comments
  • The view take a long time to load

    The view take a long time to load

    Hi,

    I implemented this in our iOS and Android Apps and I am facing similar issue in both the Apps.

    After fetching data from the backend and assigning is to the CollageImageView, it take anywhere between 1 to 4 secs for the app to display the view with images. Until this time, I see all the tabs, header, footer and white screen instead of collage view. The API call returns thumbnail URL of the images so I suspect that to download and prepare the view there might be 5 images x 20 items = 100 thumbnail images to download from our server before the view is ready to be visible. Is there a way to enable lazy loading or something similar so that the view becomes visible first and let the images take their time to load?

    We are just about to go live with the CollageView and struggling with the white screen, appreciate your help.

    Thanks & regards, Manish

    question 
    opened by mani-rathore 2
  • Major release v2.0.0.

    Major release v2.0.0.

    In this release:

    • Updated layouts of collage. Now they based on LinearLayout, which is lightweight and simpler than Constraint, so performance became better
    • The library now doesn't depends from any third party libraries expect appcompat and material, just for back capability and material card for single collage item.
    • Now for pass data in CollageView you should use one of children of CollageItemData for pass image url and Uri to local file. For back capability with first version it is possible to pass Bitmap or Drawable.
    • Now view is more customizable - you can extend every part you want and add some custom logic (as an example, you can create your own collages)
    opened by GrishinSergey 0
Releases(v2.0.2)
Owner
Sergey Grishin
Android developer. Education: NTUU "KPI", master's degree.
Sergey Grishin
A RecyclerView Adapter which allows you to have an Infinite scrolling list in your apps

Infinite Recycler View A RecyclerView Adapter which allows you to have an Infinite scrolling list in your apps. This library offers you a custom adapt

IB Sikiru 26 Dec 10, 2019
Beautify your RecyclerViews with a great parallax effect !

BeautifulParallax Beautify your RecyclerViews with a great parallax effect ! Without Carpaccio public class YOURAdapter extends RecyclerView.Adapter<Y

Florent CHAMPIGNY 413 Nov 2, 2022
RecyclerView with DiffUtil is a way to improve the performance of your app

RecylerViewSamples RecyclerView with DiffUtil is a way to improve the performanc

Chhote Lal Pal 0 Dec 20, 2021
SleepTracker - A sample application to track your sleep

Room - SleepQualityTracker app This is the toy app for Lesson 6 of the Android A

null 0 Feb 2, 2022
Affirmations-App - Your Daily Affirmations Android Application

Affirmations-App Your Daily Affirmations Android Application Concepts Used Mater

Atul Sharma 0 Feb 2, 2022
An Android Animation library which easily add itemanimator to RecyclerView items.

RecyclerView Animators RecyclerView Animators is an Android library that allows developers to easily create RecyclerView with animations. Please feel

Daichi Furiya 11.2k Jan 8, 2023
RecyclerView extension library which provides advanced features. (ex. Google's Inbox app like swiping, Play Music app like drag and drop sorting)

Advanced RecyclerView This RecyclerView extension library provides Google's Inbox app like swiping, Play Music app like drag-and-drop sorting and expa

Haruki Hasegawa 5.2k Dec 23, 2022
Android library providing simple way to control divider items (ItemDecoration) of RecyclerView

RecyclerView-FlexibleDivider Android library providing simple way to control divider items of RecyclerView Release Note [Release Note] (https://github

Yoshihito Ikeda 2.4k Dec 18, 2022
Android Library to provide swipe, click and other functionality to RecyclerView

RecyclerViewEnhanced Android Library to provide swipe, click and other functionality to RecyclerView Usage Add this to your build.gradle file dependen

Nikhil Panju 1k Dec 29, 2022
Android library defining adapter classes of RecyclerView to manage multiple view types

RecyclerView-MultipleViewTypeAdapter RecyclerView adapter classes for managing multiple view types Release Note [Release Note] (https://github.com/yqr

Yoshihito Ikeda 414 Nov 21, 2022