All in 1 picker library for android.

Overview

Lassi

Lassi is simplest way to pick media (either image, video, audio or doc)

Lassi Media picker

image       image

Key features

  • Simple implementation
  • Set your own custom styles
  • Filter by particular media type
  • Filter videos by min and max time
  • Enable/disable camera from LassiOption

Usage

Dependencies

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

    Add it in your root build.gradle at the end of repositories:

        allprojects {
    	    repositories {
    		    ...
    		    maven { url 'https://jitpack.io' }
    	    }
        }
  • Step 2. Add the dependency

    Add it in your app module build.gradle:

        dependencies {
            ...
            implementation 'com.github.Mindinventory:Lassi:0.1.7'
        }

Implementation

  • Step 1. Add Lassi in to your activity class:

            val intent = Lassi(this)
                .with(LassiOption.CAMERA_AND_GALLERY) // choose Option CAMERA, GALLERY or CAMERA_AND_GALLERY
                .setMaxCount(5)
                .setGridSize(3)
                .setMediaType(MediaType.VIDEO) // MediaType : VIDEO IMAGE, AUDIO OR DOC
                .setCompressionRation(10) // compress image for single item selection (can be 0 to 100)
                .setMinTime(15) // for MediaType.VIDEO only
                .setMaxTime(30) // for MediaType.VIDEO only
                .setSupportedFileTypes("mp4", "mkv", "webm", "avi", "flv", "3gp") // Filter by limited media format (Optional)
                .setMinFileSize(100) // Restrict by minimum file size 
                .setMaxFileSize(1024) //  Restrict by maximum file size
                .disableCrop() // to remove crop from the single image selection (crop is enabled by default for single image)
                /*
                 * Configuration for  UI
                 */
                .setStatusBarColor(R.color.colorPrimaryDark)
                .setToolbarResourceColor(R.color.colorPrimary)
                .setProgressBarColor(R.color.colorAccent)
                .setPlaceHolder(R.drawable.ic_image_placeholder)
                .setErrorDrawable(R.drawable.ic_image_placeholder)
                .setCropType(CropImageView.CropShape.RECTANGLE) // choose shape for cropping after capturing an image from camera (for MediaType.IMAGE only)
                .setCropAspectRatio(1, 1) // define crop aspect ratio for cropping after capturing an image from camera (for MediaType.IMAGE only)
                .enableFlip() // Enable flip image option while image cropping (for MediaType.IMAGE only)
                .enableRotate() // Enable rotate image option while image cropping (for MediaType.IMAGE only)
                .enableActualCircleCrop() // Enable actual circular crop (only for MediaType.Image and CropImageView.CropShape.OVAL)
                .build()
            startActivityForResult(intent, MEDIA_REQUEST_CODE)
  • Step 2. override onActivityResult function to get Lassi result.

        override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
            super.onActivityResult(requestCode, resultCode, data)
            if (resultCode == Activity.RESULT_OK && data != null) {
                when (requestCode) {
                    MEDIA_REQUEST_CODE -> {
                        val selectedMedia = data.getSerializableExtra(KeyUtils.SELECTED_MEDIA) as ArrayList<MiMedia>
                        // Do needful with your selectedMedia
                    }
                }
            }
        }

Guideline for contributors

Contribution towards our repository is always welcome, we request contributors to create a pull request to the develop branch only.

Guideline to report an issue/feature request

It would be great for us if the reporter can share the below things to understand the root cause of the issue.

  • Library version
  • Code snippet
  • Logs if applicable
  • Device specification like (Manufacturer, OS version, etc)
  • Screenshot/video with steps to reproduce the issue

Requirements

  • minSdkVersion >= 17
  • Androidx

Library used

ProGaurd rules

-dontwarn com.bumptech.glide.**

LICENSE!

Lassi is MIT-licensed.

Let us know!

We’d be really happy if you send us links to your projects where you use our component. Just send an email to [email protected] And do let us know if you have any questions or suggestion regarding our work.

Comments
  • App rejected by playstore

    App rejected by playstore

    In my app only storage related function is choose file and upload on server ,this library use All storage permission so app rejected on play store cause of android.permission.MANAGE_EXTERNAL_STORAGE this. I sent Google video of where we are using external storage. is there any solution?

    Is there possible if we can use this library without this permission? here is another issue but I didn't get any help #38

    enhancement 
    opened by arsalanImtiaz455 19
  • All Folder Images,Audio,Video,Documents are not displaying. One suggestion to add limit file size option property for gallery.

    All Folder Images,Audio,Video,Documents are not displaying. One suggestion to add limit file size option property for gallery.

    I download one video, audio, image so it's in my downloads folder. When I am opening galley using your library I can't able to find download folder image, audio, video and document.

    I hope it will be resolved as I'm using your library and facing this issue.

    One suggestion to add limit file size option property for gallery.

    Thanks.

    enhancement 
    opened by GrishmaPromact 9
  • Overlapping lassi toolbar with device statusbar

    Overlapping lassi toolbar with device statusbar

    Hi, thanks for this great library. i'm using lassi v-0.4.0 When i call lassi for select images the device status bar overlap the toolbar's library, like as this screen shot: image

    My activity has this flag: android:fitsSystemWindows="false" But i need this for my screen. can i override this flag before opening library?

    opened by javadghane 6
  • App rejected by playstore

    App rejected by playstore

    In my app only storage related function is choose file and upload on server ,this library use All storage permission so app rejected on play store cause of android.permission.MANAGE_EXTERNAL_STORAGE this.

    Is there possible if we can use this library without this permission?

    opened by Ankitsinh-siddhiinfosoft 5
  • Android 12 permission

    Android 12 permission

    First of all excellent library, i have managed to pick a video from gallery but i tap the top camera icon to make the video directly from camera it shows the dialog to have Camera, Audio and/or storage permissions are not granted. Please allow it from setting. [cancel, ok] tapping ok takes you to the app settings. There all the permissions are allowed but still giving showing this dialog

    device name: Samsung a52 Android version : 12 library version : 0.4.0

    opened by mehroshmehboob 4
  • NullPointerException when using LassiOption.GALLERY

    NullPointerException when using LassiOption.GALLERY

    When I try to choose an image from the gallery using LassiOption.CAMERA_AND_GALLERY or LassiOption.GALLERY my app crashes with the following error:

    java.lang.NullPointerException: tvFolderName must not be null at com.lassi.presentation.mediadirectory.adapter.FolderAdapter$FolderViewHolder.bind(FolderAdapter.kt:44

    This is the code used to invoke the intent: val intent = Lassi(a) .with(LassiOption.CAMERA_AND_GALLERY) .setMaxCount(4) .setGridSize(2) .setPlaceHolder(R.drawable.ic_image_placeholder) .setErrorDrawable(R.drawable.ic_image_placeholder) .setStatusBarColor(R.color.colorPrimaryDark) .setToolbarColor(R.color.colorPrimary) .setToolbarResourceColor(android.R.color.white) .setProgressBarColor(R.color.colorAccent) .setCropType(CropImageView.CropShape.OVAL) .setCropAspectRatio(1, 1) .setCompressionRation(10) .setMinFileSize(0) .setMaxFileSize(1000) .enableActualCircleCrop() .setSupportedFileTypes("jpg", "jpeg", "png", "webp", "gif") .enableFlip() .enableRotate() .build() startActivityForResult(intent, 540)

    opened by rossiriccardo21 4
  • ANR dialog is showing and application is crash while fetching folders from your library.

    ANR dialog is showing and application is crash while fetching folders from your library.

    I think ANR and crash is because you are fetching folders in main thread. So, it will throw ANR and application is crashing.

    Device Details :

    Samsung Galaxy Note10+ 5G Android 11 (SDK 30)

    Crash Log:

    at java.io.UnixFileSystem.checkAccess (UnixFileSystem.java:281) at java.io.File.exists (File.java:815) at com.lassi.data.media.MediaRepositoryImpl.fetchFolders (MediaRepositoryImpl.java:58) at com.lassi.presentation.mediadirectory.FolderViewModel.fetchFolders (FolderViewModel.java:18) at com.lassi.presentation.mediadirectory.FolderFragment.fetchFolders (FolderFragment.java:95) at com.lassi.presentation.mediadirectory.FolderFragment.checkPermission (FolderFragment.java:91) at com.lassi.presentation.mediadirectory.FolderFragment.initViews (FolderFragment.java:59) at com.lassi.presentation.common.LassiBaseFragment.onActivityCreated (LassiBaseFragment.java:32) at com.lassi.presentation.common.LassiBaseViewModelFragment.onActivityCreated (LassiBaseViewModelFragment.java:13) at androidx.fragment.app.Fragment.performActivityCreated (Fragment.java:2717) at androidx.fragment.app.FragmentStateManager.activityCreated (FragmentStateManager.java:346) at androidx.fragment.app.FragmentManager.moveToState (FragmentManager.java:1188) at androidx.fragment.app.FragmentManager.moveToState (FragmentManager.java:1356) at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState (FragmentManager.java:1434) at androidx.fragment.app.FragmentManager.moveToState (FragmentManager.java:1497) at androidx.fragment.app.BackStackRecord.executeOps (BackStackRecord.java:447) at androidx.fragment.app.FragmentManager.executeOps (FragmentManager.java:2169) at androidx.fragment.app.FragmentManager.executeOpsTogether (FragmentManager.java:1992) at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute (FragmentManager.java:1947) at androidx.fragment.app.FragmentManager.execPendingActions (FragmentManager.java:1849) at androidx.fragment.app.FragmentManager.dispatchStateChange (FragmentManager.java:2629) at androidx.fragment.app.FragmentManager.dispatchActivityCreated (FragmentManager.java:2577) at androidx.fragment.app.FragmentController.dispatchActivityCreated (FragmentController.java:247) at androidx.fragment.app.FragmentActivity.onStart (FragmentActivity.java:541) at androidx.appcompat.app.AppCompatActivity.onStart (AppCompatActivity.java:210) at android.app.Instrumentation.callActivityOnStart (Instrumentation.java:1435) at android.app.Activity.performStart (Activity.java:8207) at android.app.ActivityThread.handleStartActivity (ActivityThread.java:3788) at android.app.servertransaction.TransactionExecutor.performLifecycleSequence (TransactionExecutor.java:221) at android.app.servertransaction.TransactionExecutor.cycleToPath (TransactionExecutor.java:201) at android.app.servertransaction.TransactionExecutor.executeLifecycleState (TransactionExecutor.java:173) at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:97) at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2277) at android.os.Handler.dispatchMessage (Handler.java:106) at android.os.Looper.loop (Looper.java:246) at android.app.ActivityThread.main (ActivityThread.java:8425) at java.lang.reflect.Method.invoke (Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:596) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1130)

    I hope it will resolve asap. I am using your library in our app.

    Thanks.

    enhancement 
    opened by GrishmaPromact 4
  • Slow gallery loading

    Slow gallery loading

    Got a report from the user about really slow gallery loading, after some time photos appear on the screen

    • used library version: 0.4.0
    • code:
    private fun attachFile(type: MediaType) {
            mFragment?.context?.let {
                val lassIntent = Lassi(it)
                    .with(LassiOption.CAMERA_AND_GALLERY)
                    .setGridSize(3)
                    .disableCrop()
                when (type) {
                    MediaType.VIDEO -> {
                        lassIntent.setMediaType(MediaType.VIDEO)
                    }
                    MediaType.IMAGE -> {
                        lassIntent.setMediaType(MediaType.IMAGE)
                    }
                    else -> {}
                }
                lassIntent.setStatusBarColor(R.color.SecondaryTextColor)
                    .setToolbarColor(R.color.SecondaryTextColor)
                    .setToolbarResourceColor(R.color.TextColor)
                    .setProgressBarColor(R.color.SecondaryTextColor)
                    .setPlaceHolder(R.drawable.ic_image_placeholder)
                    .setErrorDrawable(R.drawable.ic_image_placeholder)
                    .setSelectionDrawable(R.drawable.ic_checked_media)
                val intent = lassIntent.build()
                receiveData?.launch(intent)
            }
        }
    
        private val receiveData =
            mFragment?.registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
                if (it.resultCode == Activity.RESULT_OK) {
                    val selectedMedia =
                        it.data?.getSerializableExtra(KeyUtils.SELECTED_MEDIA) as ArrayList<MiMedia>
                    val result = ArrayList<KIOAttachment>()
                    selectedMedia.forEach { media ->
                        result.add(KIOAttachment(miMedia = media))
                    }
                    completeListener?.invoke(result)
                }
            }
    
    • device: Samsun S21
    • video of the issue

    https://user-images.githubusercontent.com/16311133/162269908-a27df476-f0c6-45ac-b812-db64a21bf8c9.mp4

    Thank you

    enhancement 
    opened by newNadik 3
  • Fetching folder error on android 11 Oneplus Nord 2

    Fetching folder error on android 11 Oneplus Nord 2

    I have found that there is issue on folderViewModel.fetchFolders() function. I am using lates version of the library.

    I have tested on OnePlus Nord 2 (having Android 11 OS) app is crashed. Same I have tested on OnePlust 7 (having Android 11 OS) but app works fine.

    Please let me know if you need more details.

    opened by chetananakum31 3
  • How to change selected image/video drawable

    How to change selected image/video drawable

    currently, it's showing this drawable on image select i wan't to select different selection image how do i change this

    in error and place holder we are passing drawable so is there any way to also pass drawable for select image

    Screenshot_1624537420

    enhancement 
    opened by Miteshmakwana73 3
  • Android resource linking failed error on trying to use this library in my project

    Android resource linking failed error on trying to use this library in my project

    Task :app:processDemoDebugResources FAILED AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"C:\Users\Sam\.gradle\caches\transforms-2\files-2.1\3b9109a8b6ec0a077a300c853b10ac16\Lassi-0.1.5\res\layout\activity_camera.xml","position":{"startLine":7}}],"original":"C:\Users\Sam\.gradle\caches\transforms-2\files-2.1\3b9109a8b6ec0a077a300c853b10ac16\Lassi-0.1.5\res\layout\activity_camera.xml:8: AAPT: error: 'focusWithMarker' is incompatible with attribute cameraGestureTap (attr) enum [autoFocus=1, none=0, takePicture=2] [weak].\n ","tool":"AAPT"}

    FAILURE: Build failed with an exception.

    • What went wrong: Execution failed for task ':app:processDemoDebugResources'.

    A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade Android resource linking failed C:\Users\Sam.gradle\caches\transforms-2\files-2.1\3b9109a8b6ec0a077a300c853b10ac16\Lassi-0.1.5\res\layout\activity_camera.xml:8: AAPT: error: 'focusWithMarker' is incompatible with attribute cameraGestureTap (attr) enum [autoFocus=1, none=0, takePicture=2] [weak].

    opened by sam-androiddev 3
  • Video file in Downloads does not appear in video picker

    Video file in Downloads does not appear in video picker

    Stock app, stock Android emulator, API 31.

    The webm was present in downloads but the stock (unmodified) demo app does not detect it. Google's Photos app can see it just fine.

    opened by or-else 0
  • maxFileSize does not work with crop

    maxFileSize does not work with crop

    Hi,

    I checked your sourcecode. maxFileSize is not taken into consideration when cropping is enabled. I set max file size to 3MB. Image that gets returned is of 5 MB

    opened by rahulr4 0
  • Android resource linking failed error on trying to use this library

    Android resource linking failed error on trying to use this library

    Hi , I was trying to integrate https://developers.sumsub.com/msdk/android/#getting-started - SAMSUB SDK along with this lazzi lib. but after adding this sum sub SDK i am getting an exception. i can able to use this lib without Samsub sdk .kindly pls help me to fix the issue.

    ERROR:C:\Users\mpirs.gradle\caches\transforms-3\4d27c0fe11d0389fa5c2df92896b9055\transformed\jetified-Lassi-1.1.0\res\layout\activity_camera.xml:8: AAPT: error: 'focusWithMarker' is incompatible with attribute cameraGestureTap (attr) enum [none=0, autoFocus=1, takePicture=2, takePictureSnapshot=3].

    Versions: implementation 'com.github.Mindinventory:Lassi:1.1.0' implementation "com.sumsub.sns:idensic-mobile-sdk:1.20.5" minSdk 21 compileSdk 32

    opened by irshadir7 0
Releases(1.1.0)
Owner
MindInventory
MindInventory works with Enterprises, Startups, and Agencies since 2011 providing web, mobile app development, enterprise mobility solutions & DevOps services.
MindInventory
Android Ptrace Inject for all ABIs and all APIs. Help you inject Shared Library on Android.

Android Ptrace Inject 中文可以参考我的注释内容进行理解 我写的注释相对来说比较全面了 How to build Make sure you have CMake and Ninja in your PATH Edit CMakeLists.txt. Set ANDROID_ND

SsageParuders 65 Dec 19, 2022
Add Wheel Date - Time Picker in Android Jetpack Compose.

WheelPickerCompose Add Wheel Date - Time Picker in Android Jetpack Compose. Usage Picker Usage WheelDateTimePicker { snappedDateTime -> } WheelDatePic

Emir Demirli 81 Dec 30, 2022
Klimatic is an android app built using Kotlin. It try to showcase all the latest technologies used in android.

Klimatic Klimatic is an android app built using Kotlin. It try to showcase all the latest technologies used in android. Built using Android Architectu

Shivam Satija 34 Oct 11, 2022
An example for who are all going to start learning Kotlin programming language to develop Android application.

Kotlin Example Here is an example for who are all going to start learning Kotlin programming language to develop Android application. First check this

Prabhakar Thota 56 Sep 16, 2022
An Android app with many challenge modules and SOLID at all

android-super-app An Android app with many challenge modules and SOLID at all. Features Kotlin Coroutines with Flow (State Flow) Kotlin Serialization

Thiago Santos 21 Nov 28, 2022
Dots indicator that shows the current position on a View Pager. It does all the work for you with a few customisations.

Dots What is Dots? Dots is a library that helps in implementing a simple yet effective dots indicator for the View Pagers used in your android code. I

Deepan 23 Feb 16, 2022
The Superhero app keeps track of the near real-time location of all the volunteers.

Superhero The Superhero app keeps track of the near real-time location of all the volunteers. The app sends requests for emergency tasks to nearby vol

CoronaSafe Network 4 May 3, 2022
Automatically empty the trash in all of your Plex libraries

Plex Auto Trash Automatically empty the trash in all of your Plex libraries. If you disable automatic trash emptying (and you probably should) trash s

Jake Wharton 25 Aug 11, 2022
LanServers - A small plugin written in Kotlin that runs on all major Minecraft Servers

LanServers This is a small plugin written in Kotlin that runs on all major Minec

Redstonecrafter0 6 Mar 12, 2022
Mars is an all-in-one plugin for PGM servers

Mars Mars is an all-in-one plugin for PGM servers. Using Mars Contributing to Mars Why? Mars was built to handle everything that PGM isn't supposed to

Warzone 6 Feb 13, 2022
Koin Annotations - help declare Koin definition in a very fast and intuitive way, and generate all underlying Koin DSL for you

The goal of Koin Annotations project is to help declare Koin definition in a very fast and intuitive way, and generate all underlying Koin DSL for you. The goal is to help developer experience to scale and go fast ?? , thanks to Kotlin Compilers.

insert-koin.io 68 Jan 6, 2023
The Klutter CLI tool gives access to all tasks to create and manage a Klutter project.

Klutter CLI The Klutter CLI tool gives access to all tasks to create and manage a Klutter project. Gettings started Download the tool. Unzip the file.

Gillian 2 Mar 31, 2022
A nice weather that helps you get all information including: current weather, hourly weather and also forecasts for 16 days

WeatherForecast This is an ongoing project where I fetch all the weather data using Retrofit and Kotlin Coroutines over two APIs containing both curre

null 2 Jul 26, 2022
Repository of a multi-platform application running the same Compose source code on all platforms

Compose multiplatform demo demo.mov Using the same compose user interface (UI) from android on all principal platforms ?? ?? App Features This is a si

David Coronel 18 Dec 16, 2022
[Android Library] A SharedPreferences helper library to save and fetch the values easily.

Preference Helper A SharedPreferences helper library to save and fetch the values easily. Featured in Use in your project Add this to your module's bu

Naveen T P 13 Apr 4, 2020
Oratio Library for Android Studio helps you simplify your Android TTS codes

Oratio Oratio is a library for Android Studio. This library is useful to a number of developers who are currently making apps using android TTS(Text-T

Jacob Lim 1 Oct 28, 2021
YouTube Player library for Android and Chromecast, stable and customizable.

android-youtube-player android-youtube-player is a stable and customizable open source YouTube player for Android. It provides a simple View that can

Pierfrancesco Soffritti 2.9k Jan 2, 2023
A highly customizable calendar library for Android, powered by RecyclerView.

CalendarView A highly customizable calendar library for Android, powered by RecyclerView. With this library, your calendar will look however you want

Kizito Nwose 3.4k Jan 3, 2023