A small customizable library useful to handle an gallery image pick action built-in your app. :sunrise_over_mountains::stars:

Overview

Icon

Louvre

A small customizable image picker. Useful to handle an gallery image pick action built-in your app.


License Apache 2.0 minSdkVersion 19 compileSdkVersion 25 Download

Android Arsenal Louvre MaterialUp Louvre

Sample
*Images from Google Image Search

Installation

Add this in your root build.gradle file (not your app module build.gradle file):

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

Then, add the library in your app module build.gradle

dependencies{
    compile 'com.github.andremion:louvre:[LATEST VERSION]'
}

Usage

Choose one of the Louvre themes to use in GalleryActivity and override it to define your app color palette.

<style name="AppTheme.Louvre.Light.DarkActionBar" parent="Louvre.Theme.Light.DarkActionBar">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.Louvre.Dark" parent="Louvre.Theme.Dark">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.Louvre.Light" parent="Louvre.Theme.Light">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

For PreviewActivity you just need to define the accent color.

<style name="AppTheme.Louvre.Preview" parent="Louvre.Theme.Preview">
    <item name="colorAccent">@color/colorAccent</item>
</style>

Declare the Louvre activities in AndroidManifest.xml file using your new app themes.

<activity
    android:name="com.andremion.louvre.home.GalleryActivity"
    android:theme="@style/AppTheme.Louvre.Light.DarkActionBar" />
<activity
    android:name="com.andremion.louvre.preview.PreviewActivity"
    android:theme="@style/AppTheme.Louvre.Preview" />

Add READ_EXTERNAL_STORAGE permission in your AndroidManifest.xml file.

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

In your Activity you just need the below lines of code to open the Louvre.

Louvre.init(myActivity)
        .setRequestCode(LOUVRE_REQUEST_CODE)
        .open();

You can also use a Fragment to open the Louvre. In this case, the Fragment will get the onActivityResult callback.

Louvre.init(myFragment)
        .setRequestCode(LOUVRE_REQUEST_CODE)
        .open();

But you can customize the picker:

######Setting the max images allowed to pick

louvre.setMaxSelection(10)

######Setting the current selected items

List<Uri> selection;
...
louvre.setSelection(selection)

######Setting the media type to filter the query with a combination of one of these types: Louvre.IMAGE_TYPE_BMP, Louvre.IMAGE_TYPE_JPEG, Louvre.IMAGE_TYPE_PNG

louvre.setMediaTypeFilter(Louvre.IMAGE_TYPE_JPEG, Louvre.IMAGE_TYPE_PNG)

See more at the sample

Libraries and tools used in the project

  • Design Support Library The Design package provides APIs to support adding material design components and patterns to your apps.
  • CounterFab A FloatingActionButton subclass that shows a counter badge on right top corner.
  • Glide An image loading and caching library for Android focused on smooth scrolling
  • PhotoView Implementation of ImageView for Android that supports zooming, by various touch gestures.

Contributing

Contributions are always welcome!

Issues: Fell free to open a new issue. Follow the ISSUE_TEMPLATE.MD

Follow the "fork-and-pull" Git workflow.

  1. Fork the repo on GitHub
  2. Clone the project to your own machine
  3. Commit changes to your own branch
  4. Merge with current development branch
  5. Push your work back up to your fork
  6. Submit a Pull request your changes can be reviewed (please refere the issue if reported)

Prevent code-style related changes. Format the code before commiting.

License

Copyright 2017 André Mion

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.
Comments
  • Get Crash When Click on Single Image

    Get Crash When Click on Single Image

    hi @andremion , Thanks for create that wonderful photo picker library, Really appreciate.

    I get one crash when I click on single image for preview. Here is crash log:

    java.lang.RuntimeException: Unable to start activity ComponentInfo{promanager.com.promanagerandroid/com.andremion.louvre.preview.PreviewActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.app.ActionBar.setDisplayHomeAsUpEnabled(boolean)' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2756) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2825) at android.app.ActivityThread.-wrap12(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1557) at android.os.Handler.dispatchMessage(Handler.java:110) at android.os.Looper.loop(Looper.java:203) at android.app.ActivityThread.main(ActivityThread.java:6339) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1084) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:945) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.app.ActionBar.setDisplayHomeAsUpEnabled(boolean)' on a null object reference at com.andremion.louvre.preview.PreviewActivity.onCreate(PreviewActivity.java:129) at android.app.Activity.performCreate(Activity.java:6689) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1140) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2709) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2825)  at android.app.ActivityThread.-wrap12(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1557)  at android.os.Handler.dispatchMessage(Handler.java:110)  at android.os.Looper.loop(Looper.java:203)  at android.app.ActivityThread.main(ActivityThread.java:6339)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1084)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:945) 

    Here my configuration detail:

    
        androidBuildToolsVersion = "27.0.2"
        androidMinSdkVersion = 19
        androidTargetSdkVersion = 27
        androidCompileSdkVersion = 27
    
        SUPPORT_LIB_VERSION = "27.0.2"
    

    get null in PreviewActivity screen line number 127 ( getSupportActionBar().setDisplayHomeAsUpEnabled(true);)

    Please give update on this, Don't have any idea why this exception occur. In demo it's work perfect. Thanks :)

    can't reproduce 
    opened by jays95jp 11
  • Crash in android 10

    Crash in android 10

    when click to openGallery app is crash .

    Caused by: android.database.sqlite.SQLiteException: near "GROUP": syntax error (code 1 SQLITE_ERROR[1]): , while compiling: SELECT bucket_id, bucket_display_name, _data FROM images WHERE ((is_pending=0) AND (is_trashed=0) AND (volume_name IN ( 'external_primary' )) AND (_data>'')) AND ((1 AND 1) GROUP BY (1)) ORDER BY MAX(datetaken) DESC
            at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:184)
            at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:140)
            at android.content.ContentProviderProxy.query(ContentProviderNative.java:423)
            at android.content.ContentResolver.query(ContentResolver.java:951)
            at android.content.ContentResolver.query(ContentResolver.java:887)
            at androidx.core.content.ContentResolverCompat.query(ContentResolverCompat.java:81)
            at androidx.loader.content.CursorLoader.loadInBackground(CursorLoader.java:63)
            at androidx.loader.content.CursorLoader.loadInBackground(CursorLoader.java:41)
            at androidx.loader.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:307)
            at androidx.loader.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:60)
            at androidx.loader.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:48)
            at androidx.loader.content.ModernAsyncTask$2.call(ModernAsyncTask.java:141)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
            at java.lang.Thread.run(Thread.java:919) 
    2020-06-15 23:51:51.346 2943-2943/com.dpmuae.aklaClient E/GraphicExt: GraphicExtModuleLoader::CreateGraphicExtInstance false
    2020-06-15 23:51:51.635 2943-2943/com.dpmuae.aklaClient E/GraphicExt: GraphicExtModuleLoader::CreateGraphicExtInstance false
    
    bug 
    opened by hosnyDev 4
  • The app is crashing with a runtime exception

    The app is crashing with a runtime exception

    Te gallery activity is not starting and is throwing this error. Im not able to figure it out. This is not due to proguard as I'm on the debug mode. The parceable I guess is not working properly Here is the stacktrace

    Exception java.lang.RuntimeException: Unable to start activity ComponentInfo{com.madcode.dslrphoto/com.andremion.louvre.home.GalleryActivity}: java.lang.RuntimeException: Parcel android.os.Parcel@60fcb0b: Unmarshalling unknown type code 7209057 at offset 1228 android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3320) android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3416) android.app.ActivityThread.access$1100 (ActivityThread.java:230) android.app.ActivityThread$H.handleMessage (ActivityThread.java:1822) android.os.Handler.dispatchMessage (Handler.java:102) android.os.Looper.loop (Looper.java:148) android.app.ActivityThread.main (ActivityThread.java:7409) java.lang.reflect.Method.invoke (Method.java) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230) com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120) arrow_drop_down Caused by java.lang.RuntimeException: Parcel android.os.Parcel@60fcb0b: Unmarshalling unknown type code 7209057 at offset 1228 android.os.Parcel.readValue (Parcel.java:2341) android.os.Parcel.readArrayMapInternal (Parcel.java:2620) android.os.BaseBundle.unparcel (BaseBundle.java:221) android.os.Bundle.getSparseParcelableArray (Bundle.java:856) com.android.internal.policy.PhoneWindow.restoreHierarchyState (PhoneWindow.java:2334) android.app.Activity.onRestoreInstanceState (Activity.java:1177) android.app.Activity.performRestoreInstanceState (Activity.java:1122) android.app.Instrumentation.callActivityOnRestoreInstanceState (Instrumentation.java:1192) android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3287) android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3416) android.app.ActivityThread.access$1100 (ActivityThread.java:230) android.app.ActivityThread$H.handleMessage (ActivityThread.java:1822) android.os.Handler.dispatchMessage (Handler.java:102) android.os.Looper.loop (Looper.java:148) android.app.ActivityThread.main (ActivityThread.java:7409) java.lang.reflect.Method.invoke (Method.java) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230) com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)

    can't reproduce 
    opened by madhavbansal23 3
  • The done FAB disappears

    The done FAB disappears

    The done FAB disappears.

    Context

    The user is choosing an image and taps the image to see it larger. Once they go back to the grid view the fab is gone, making it impossible to finish the selection.

    This is occurring in Android Nougat devices.

    Process

    1. User taps on some image to view in fullscreen mode
    2. User taps on back button

    Expected result

    The done FAB is shown

    Current result

    The done FAB is not shown

    bug 
    opened by JailbirdInteractive 3
  • App crashes when i try calling louvre to pick images

    App crashes when i try calling louvre to pick images

    Process: com.example.kelvin.m_nyumbabeta, PID: 10436
                                                                                     java.lang.NoSuchFieldError: No field recycler_view of type I in class Lcom/andremion/louvre/R$id; or its superclasses (declaration of 'com.andremion.louvre.R$id' appears in /data/app/com.example.kelvin.m_nyumbabeta-1/split_lib_slice_2_apk.apk)
                                                                                         at com.andremion.louvre.home.GalleryFragment.onCreateView(GalleryFragment.java:169)
                                                                                         at android.support.v4.app.Fragment.performCreateView(Fragment.java:2261)
                                                                                         at android.support.v4.app.FragmentManagerImpl.ensureInflatedFragmentView(FragmentManager.java:1655)
                                                                                         at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1390)
                                                                                         at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1650)
                                                                                         at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1906)
                                                                                         at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:3698)
                                                                                         at android.support.v4.app.FragmentController.onCreateView(FragmentController.java:111)
                                                                                         at android.support.v4.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:350)
                                                                                         at android.support.v4.app.BaseFragmentActivityApi14.onCreateView(BaseFragmentActivityApi14.java:39)
                                                                                         at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:67)
                                                                                         at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:784)
                                                                                         at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734)
                                                                                         at android.view.LayoutInflater.rInflate(LayoutInflater.java:865)
                                                                                         at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
                                                                                         at android.view.LayoutInflater.inflate(LayoutInflater.java:525)
                                                                                         at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
                                                                                         at android.view.LayoutInflater.inflate(LayoutInflater.java:378)
                                                                                         at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
                                                                                         at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
                                                                                         at com.andremion.louvre.home.GalleryActivity.onCreate(GalleryActivity.java:115)
                                                                                         at android.app.Activity.performCreate(Activity.java:6955)
                                                                                         at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
                                                                                         at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2931)
                                                                                         at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3049)
                                                                                         at android.app.ActivityThread.-wrap14(ActivityThread.java)
                                                                                         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1646)
                                                                                         at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                         at android.os.Looper.loop(Looper.java:154)
                                                                                         at android.app.ActivityThread.main(ActivityThread.java:6836)
                                                                                         at java.lang.reflect.Method.invoke(Native Method)
                                                                                         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
                                                                                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
    
    opened by KelvinPac 2
  • Keep selection

    Keep selection

    Great library, thank you for sharing. Would be great to choose if Louvre must keep last selection or not. This way users are able to know if an images was already selected or not. Some ideas to implement it?

    enhancement 
    opened by dariob 2
  • The crash connected with PhotoView library

    The crash connected with PhotoView library

    Thank you for the great library!

    Context

    I don't use PhotoView separately but received following crash report:

    Fatal Exception: java.lang.IllegalArgumentException: pointerIndex out of range
           at android.view.MotionEvent.nativeGetAxisValue(MotionEvent.java)
           at android.view.MotionEvent.getX(MotionEvent.java:2372)
           at android.support.v4.view.ViewPager.onInterceptTouchEvent(ViewPager.java:2064)
    

    I found following resolved issues of PhotoView library that are connected with the crash above #31 and #293. The author of PhotoView described the solution of this problem.

    Possible Fix

    Replace android.support.v4.view.ViewPager in activity_preview.xml with HackyViewPager.

    Thank you!

    bug 
    opened by cryser29 1
  • how about proguard

    how about proguard

    how to write proguard rules? if dont wirite anythiing,when generated signed apk it will failed.jump out some warinings such as Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkHttpClient

    question 
    opened by drogbababa 1
  • [Enhancement] Ability to hide buttons

    [Enhancement] Ability to hide buttons

    Hi,

    Thanks for creating this library! I'm wondering if it would be possible to give us the ability to hide the select all and remove all buttons in the top right.

    Thanks.

    opened by DanSangiamo 0
  • [Enhancement] Ability to view videos media

    [Enhancement] Ability to view videos media

    Hi, How much effort would it take to add also video support? At least viewing the thumbnails of the video for Step 1? (Maybe ability to play them as well in the future)

    enhancement 
    opened by idish 2
Releases(v1.3.0)
  • v1.3.0(Apr 27, 2021)

  • v1.2.3(Nov 16, 2017)

    • Upgrade Glide
    • Upgrade android-maven-gradle-plugin for gradle 4.1 in order to avoid error while reading api or implementation dependencies
    Source code(tar.gz)
    Source code(zip)
  • v1.2.1(Nov 15, 2017)

    • Fixing of issue #16 - IllegalArgumentException: pointerIndex out of range
    • Upgrade android tools build gradle to 3.0.0 version
    • Upgrade build tools to 26.0.2 version
    • Upgrade support library to 26.1.0 version
    • Upgrade CounterFab to 1.0.2 version
    Source code(tar.gz)
    Source code(zip)
  • v1.2.0(Jul 3, 2017)

    • Add UI empty state in gallery screen
    • Add option to set the current selection
    • Add Spanish strings
    • Use Glide instead Picasso
    • Decrease min SDK version to 16
    • Allow start Louvre from a Fragment
    • Compile and target to SDK version 26
    • Minor bugfixes
    Source code(tar.gz)
    Source code(zip)
  • v1.0.1(Feb 10, 2017)

Owner
André Mion
🇧🇷 Android Engineer living in 🇵🇹 • Full time Husband and Dad • Occasionally Drummer and Inline Skater… I build mostly Android stuffs…
André Mion
Photo picker library for android. Let's you pick photos directly from files, or navigate to camera or gallery.

ChiliPhotoPicker Made with ❤️ by Chili Labs. Library made without DataBinding, RxJava and image loading libraries, to give you opportunity to use it w

Chili Labs 394 Nov 29, 2022
Image Cropping Library for Android, optimised for Camera / Gallery.

Image Cropping Library for Android, optimised for Camera / Gallery.

CanHub 812 Dec 30, 2022
Customizable Android full screen image viewer for Fresco library supporting "pinch to zoom" and "swipe to dismiss" gestures. Made by Stfalcon

This project is no longer supported. If you're able to switch from Fresco to any other library that works with the Android's ImageView, please migrate

Stfalcon LLC 1.8k Dec 19, 2022
This is an Image slider with swipes, Here we used Volley to Image load URL's from JSON! Here we make it very easy way to load images from Internet and We customized the description font style(OpenSans).

ImageSliderWithSwipes This is an Image slider with swipes, Here we used Volley to load URL's from JSON! Here we make it very easy way to load images f

Prabhakar Thota 44 May 31, 2021
Screenshot Composables and convert to Bitmap on user action or periodically

Compose ScreenshotBox Screenshot Composables and convert to Bitmap on user action or periodically. Single Shot Periodic Gradle Setup To get a Git proj

Smart Tool Factory 37 Dec 7, 2022
An android image compression library.

Compressor Compressor is a lightweight and powerful android image compression library. Compressor will allow you to compress large photos into smaller

Zetra 6.7k Dec 31, 2022
A simple image cropping library for Android.

SimpleCropView The SimpleCropView is an image cropping library for Android. It simplifies your code for cropping image and provides an easily customiz

Issei Aoki 2.5k Dec 28, 2022
Dali is an image blur library for Android. It contains several modules for static blurring, live blurring and animations.

Dali Dali is an image blur library for Android. It is easy to use, fast and extensible. Dali contains several modules for either static blurring, live

Patrick Favre-Bulle 1k Dec 1, 2022
An image resizing library for Android

Resizer Inspired by zetbaitsu's Compressor, Resizer is a lightweight and easy-to-use Android library for image scaling. It allows you to resize an ima

Kakit Ho 426 Dec 22, 2022
Simple android image popup Library

Android Image Popup 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,

Chathura Lakmal 64 Nov 15, 2022
Library to save image locally and shows options to open and share !

Image Save and Share Library to save image locally and shows options to open and share ! Download Demo APK from HERE Kindly use the following links to

Prabhakar Thota 27 Apr 18, 2022
Image loading library for Android

Image Loader Image loader library for Android. Deprecated. See Glide. Features Image transformations Automatic memory and storage caching Ability to l

Yuriy Budiyev 19 May 28, 2022
RoundedImageView-Library 0.9 0.0 Java To set single or multiple corners on Image Views.

RoundedImageView-Library Rounded ImageView Android Library, to set single or multiple corners on imageview. Screenshot Usage Step 1. Add the JitPack r

Dushyant Mainwal 15 Sep 2, 2020
A library for image manipulation with power of renderScript which is faster than other ordinary solutions.

Pixl is a library for image manipulation with power of renderScript which is faster than other ordinary solutions, currently it includes three basic scripts, brightness, contrast, saturation.

Jibran Iqbal 20 Jan 23, 2022
An image loading library for android.

Bilder Download Add following to your project's build.gradle allprojects { repositories { ... maven { url 'https://jitpack.io' } } }

Kshitij Sharma 4 Jan 1, 2022
An Android transformation library providing a variety of image transformations for Coil, Glide, Picasso, and Fresco.

An Android transformation library providing a variety of image transformations for Coil, Glide, Picasso, and Fresco.

Daichi Furiya 257 Jan 2, 2023
🎨 Modern image loading library for Android. Simple by design, powerful under the hood.

Simple Image Loader Modern image loading library for Android. Simple by design, powerful under the hood. Kotlin: Simple Image Loader is Kotlin-native

Igor Solkin 8 Nov 21, 2022
Image cropping library written with Jetpack Compose with other Composables such as ImageWithConstraints scales Bitmap

Image cropping library written with Jetpack Compose with other Composables such as ImageWithConstraints scales Bitmap it displays and returns position and bounds of Bitmap and ImageWithThumbnail to display thumbnail of the image on selected corner.

Smart Tool Factory 9 Jul 27, 2022
Image Cropping Library for Android

Image Cropping Library for Android

Lyrebird Studio 1.1k Dec 30, 2022