Pix is a Whatsapp image picker replica. with this, you can integrate an image picker just like WhatsApp.

Overview

Preview image

Pix (WhatsApp Style Image and Video Picker)

Pix is a WhatsApp image picker replica. with this you can integrate a image picker just like WhatsApp.

Codacy Badge Pix Image Picker xscode

Upcoming

  1. Androidx Camera API integration
  2. Scoped storage to support Android Version 30
  3. Minimum SDK from 19 to 21

Demo

Usage

Options options = Options.init()
      .setRequestCode(100)                                           //Request code for activity results
      .setCount(3)                                                   //Number of images to restict selection count
      .setFrontfacing(false)                                         //Front Facing camera on start
      .setPreSelectedUrls(returnValue)                               //Pre selected Image Urls
      .setSpanCount(4)                                               //Span count for gallery min 1 & max 5
      .setMode(Options.Mode.All)                                     //Option to select only pictures or videos or both
      .setVideoDurationLimitinSeconds(30)                            //Duration for video recording
      .setScreenOrientation(Options.SCREEN_ORIENTATION_PORTRAIT)     //Orientaion
      .setPath("/pix/images");                                       //Custom Path For media Storage
    
Pix.start(MainActivity.this, options);

or just use with minimal config

Pix.start(context, Options.init().setRequestCode(100));

for fetching only a single picture.

Use onActivityResult method to get results

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == Activity.RESULT_OK && requestCode == RequestCode) {
        ArrayList<String> returnValue = data.getStringArrayListExtra(Pix.IMAGE_RESULTS);
    }
}

Customise

Theme

include these items in colors.xml with custom color codes

<resources>
    <color name="colorPrimaryPix">#075e54</color>
    <color name="colorPrimaryLightPix">#80075e54</color>
</resources>

Permission Handling

include onRequestPermissionsResult method in your Activity/Fragment for permission selection

@Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
    switch (requestCode) {
        case PermUtil.REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS: {
            // If request is cancelled, the result arrays are empty.
            if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                Pix.start(context, Options.init().setRequestCode(100));
            } else {
                Toast.makeText(MainActivity.this, "Approve permissions to open Pix ImagePicker", Toast.LENGTH_LONG).show();
            }
            return;
        }
    }
}

Thanks to

Backers

Become a backer and help us sustain our activities! 🙏 🙏

Download

Download or grab via Gradle:

include in app level build.gradle

repositories {
  maven { url 'https://jitpack.io' }
}
implementation  'com.fxn769:pix:1.5.6'

or Maven:

<dependency>
  <groupId>com.fxn769</groupId>
  <artifactId>pix</artifactId>
  <version>1.5.6</version>
  <type>pom</type>
</dependency>

or ivy:

<dependency org='com.fxn769' name='pix' rev='1.5.6'>
  <artifact name='pix' ext='pom' ></artifact>
</dependency>

Snapshots of the development version are available in [Sonatype's snapshots repository][snap].

Updates

Pix is using the new Material library with the legacy Support Library. You have to migrate to android.support to androidx in order to use com.google.android.material.

With Android Studio 3.2 and higher, you can quickly migrate an existing project to use AndroidX by selecting Refactor > Migrate to AndroidX from the menu bar.

For more details kindly refer Migrating to AndroidX

for Version 1.2.5 refer here

License

Licensed under the Apache License, Version 2.0, click here for the full license.

Author & support

This project was created by Akshay Sharma.

If you appreciate my work, consider buying me a cup of to keep me recharged 🤘 by PayPal

I love using my work and I'm available for contract work. Freelancing helps to maintain and keep my open source projects up to date!

Comments
  • Bug: App crash on taking photo

    Bug: App crash on taking photo

    Hi, I want to report a bug, which occurs since the version 1.5.4 of your library. I get following error after taking a photo:

    2020-10-03 02:12:57.321 16739-16739/com.mrgames13.jimdo.colorconverter E/AndroidRuntime: FATAL EXCEPTION: main
        Process: com.mrgames13.jimdo.colorconverter, PID: 16739
        java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.io.File.getAbsolutePath()' on a null object reference
            at com.fxn.pix.Pix$8$1.onFileReady(Pix.java:456)
            at com.otaliastudios.cameraview.CameraUtils$1$1.run(CameraUtils.java:124)
            at android.os.Handler.handleCallback(Handler.java:938)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:223)
            at android.app.ActivityThread.main(ActivityThread.java:7656)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
    

    Tested with Pixel 3a phone with Android 11

    wontfix 
    opened by marcauberer 24
  • FATAL EXCEPTION when calling addPixToActivity

    FATAL EXCEPTION when calling addPixToActivity

    java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.Display.getRealMetrics(android.util.DisplayMetrics)' on a null object reference at io.ak1.pix.helpers.CameraXManager.bindCameraUseCases(CameraXManager.kt:62) at io.ak1.pix.helpers.CameraXManager.setUpCamera$lambda-0(CameraXManager.kt:55) at io.ak1.pix.helpers.CameraXManager.lambda$saIgVXdcX8hBqOG6Idaj-FlC7bY(Unknown Source:0)

    wontfix 
    opened by ThinClient 11
  • not working in sdk level 30

    not working in sdk level 30

    Please update the code when capturing image from camera in sdk level 30 app is crashing but working fine when picking images from gallery this line is already added in manifestl̥ file android:requestLegacyExternalStorage="true" thanks in advance

    opened by vishal14321432 9
  • Bad Scroll Performance in recent images list

    Bad Scroll Performance in recent images list

    Hi,

    I experience a lot of stuttering in the recent images list (when pulling the image bar up). In contrast to that the performance when scrolling the horizontal image bar is superb.

    Could this be improved upon?

    opened by sabieber 8
  • Camera freezes after opening gallery

    Camera freezes after opening gallery

    The camera is stuck after swiping up the gallery in Motorolo G4 Naughat device.

    Using it in the app https://play.google.com/store/apps/details?id=com.prasilabs.status

    opened by praslnx8 7
  • "Missing required view with ID" error if using gradle 7.0.2

    I upgrade gradle to 7.0.2. after taht i get this error: java.lang.NullPointerException: Missing required view with ID: com.wisgoon.wismediapicker:id/controls_layout at io.ak1.pix.databinding.ControlsLayoutBinding.bind(ControlsLayoutBinding.java:125) at io.ak1.pix.databinding.GridLayoutBinding.bind(GridLayoutBinding.java:159) at io.ak1.pix.databinding.FragmentPixBinding.bind(FragmentPixBinding.java:76) at io.ak1.pix.databinding.FragmentPixBinding.inflate(FragmentPixBinding.java:62) at io.ak1.pix.PixFragment.onCreateView(PixFragment.kt:105)

    wontfix 
    opened by thawri1 6
  • bottom message wrong for Options.Mode.Picture

    bottom message wrong for Options.Mode.Picture

    Bottom message on camera screen is showing as "Hold for video, tap for photo" when using Options.Mode.Picture, whereas it should actually show only "Tap for photo"

    wontfix 
    opened by nikky76342 6
  • Remove Photo capture Toast

    Remove Photo capture Toast

    really need to remove the toast for photo captured successfully I saw this PR for remove of video capture toast - https://github.com/akshay2211/PixImagePicker/pull/194/files Can we remove a toast for photo capture as well? Thanks

    wontfix 
    opened by pmrzygweb 5
  • setPreSelectedUrls(list) for camera only return single image url?

    setPreSelectedUrls(list) for camera only return single image url?

    When we select multiple images from the gallery with setPreSelectedUrls(imgList) method return old selected image as well as the newly selected image URL.

    But same behavior not working with multiple image capture from camera. It only returns the latest capture single image URL.

    What I expect is it should return a previoously selected image URLs with a new captured image URL using setPreSelectedUrls(imgList).

    opened by pawarn 5
  • Reproducible: CRASH DETECTED

    Reproducible: CRASH DETECTED

    Steps to reproduce

    1. Launch the camera by calling Pix.start(Context, RequestCode);
    2. Double tap the circle camera button to take a picture.
    3. App crashes

    Tested on a Google Pixel 2 XL

    Logs java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Object.toString()' on a null object reference at com.fxn.pix.Pix$8$1.invoke(Pix.java:439) at com.fxn.pix.Pix$8$1.invoke(Pix.java:436) at io.fotoapparat.result.PendingResult$whenAvailable$1.run(PendingResult.kt:81) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) at java.lang.Thread.run(Thread.java:764) 07-26 11:52:20.439 18640-18640/com.neek.tech.superstrikers E/my pick saved: android.graphics.Bitmap@384db81 -> 219

    NOTE
    Crash happens with Rear or Front camera.

    opened by iv47 5
  • If there are more than 100 images, NOT all images are displayed

    If there are more than 100 images, NOT all images are displayed

    Describe the bug If there are more than 100 images on the device, the first 100 images are not displayed. e.g. If from No.1 to No.120 images are on the device, only No.101-120 images are displayed.

    To Reproduce Steps to reproduce the behavior:

    1. Save more than 100 images under external folders for images (Pictures etc.)
    2. Launch PixImagePicker
    3. Swipe up to show the image gallery.

    Expected behavior All images should be displayed.

    Smartphone (please complete the following information):

    • Device: Android
    • OS: Android 12
    • Browser N/A, tested by FragmentSample of this repositry.
    • Version 1.5.2
    wontfix 
    opened by da351hon 4
  • Camera button does nothing

    Camera button does nothing

    Describe the bug Camera button does nothing

    To Reproduce Open PixFragment, click camera button, observe that nothing happens.

    Expected behavior Camera should take a picture, PixFragment should return it as a result.

    Smartphone (please complete the following information): Android stock emulator, API 31

    opened by or-else 0
  • Gray artifacts in PixFragment

    Gray artifacts in PixFragment

    Describe the bug Gray circular artifacts around camera buttons.

    To Reproduce Open PixFragments, observe artifacts.

    Expected behavior No Artifacts.

    Screenshots Screenshot_20230101_143921

    Smartphone (please complete the following information): Android stock emulator, API 31

    opened by or-else 0
  • The first click on the image or video does nothing.

    The first click on the image or video does nothing.

    Describe the bug Picking single image or video. PixFragment shows a horizontal strip with available images and videos in the lower part of the screen. The first click on any image does nothing. The second click actually picks the image.

    To Reproduce Open PixFragment, click, observe that nothing happens.

    Expected behavior The first click should select the image or video.

    Smartphone (please complete the following information): Android stock emulator, API 31

    opened by or-else 0
  • PixImagePicker crashes if the app theme is not inherited from Theme.MaterialComponents

    PixImagePicker crashes if the app theme is not inherited from Theme.MaterialComponents

    Describe the bug PixImagePicker does not work if the app theme is not inherited from Theme.MaterialComponents.

    To Reproduce Have the app theme be anything but inherited from MaterialComponents, launch PixImagePicker and observe the crash while inflating layout/permissions_layout:

    Caused by: java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.MaterialComponents (or a descendant).
    at com.google.android.material.internal.ThemeEnforcement.checkTheme(ThemeEnforcement.java:247)
    at com.google.android.material.internal.ThemeEnforcement.checkMaterialTheme(ThemeEnforcement.java:216)
    at com.google.android.material.internal.ThemeEnforcement.checkCompatibleTheme(ThemeEnforcement.java:144)
    at com.google.android.material.internal.ThemeEnforcement.obtainStyledAttributes(ThemeEnforcement.java:76)
    at com.google.android.material.card.MaterialCardView.<init>(MaterialCardView.java:170)
    at com.google.android.material.card.MaterialCardView.<init>(MaterialCardView.java:160)
    at java.lang.reflect.Constructor.newInstance0(Native Method) 
    at java.lang.reflect.Constructor.newInstance(Constructor.java:343) 
    at android.view.LayoutInflater.createView(LayoutInflater.java:858) 
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1010) 
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965) 
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:1127) 
    at android.view.LayoutInflater.parseInclude(LayoutInflater.java:1235) 
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:1123) 
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:686) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:538) 
    at io.ak1.pix.databinding.FragmentPixBinding.inflate(FragmentPixBinding.java:57) 
    at io.ak1.pix.PixFragment.onCreateView(PixFragment.kt:105) 
    at io.ak1.pix.PixFragment.onCreateView(PixFragment.kt:41) 
    at androidx.fragment.app.Fragment.performCreateView(Fragment.java:3104) 
    

    Expected behavior I expect the library to have no hardcoded dependencies on particular themes.

    I believe this is the same as #215

    opened by or-else 1
  • Issue with android 13 with permission

    Issue with android 13 with permission

    Describe the bug A clear and concise description of what the bug is.

    To Reproduce Steps to reproduce the behavior:

    1. Go to '...'
    2. Click on '....'
    3. Scroll down to '....'
    4. See error

    Expected behavior A clear and concise description of what you expected to happen.

    Screenshots If applicable, add screenshots to help explain your problem.

    Desktop (please complete the following information):

    • OS: [e.g. iOS]
    • Browser [e.g. chrome, safari]
    • Version [e.g. 22]

    Smartphone (please complete the following information):

    • Device: [e.g. iPhone6]
    • OS: [e.g. iOS8.1]
    • Browser [e.g. stock browser, safari]
    • Version [e.g. 22]

    Additional context Add any other context about the problem here.

    opened by GeorgeSamirTechno-politan 0
Releases(1.2.4)
Owner
Akshay sharma
Developer | Freelancer | Inquisitive | Autodidact | Creative
Akshay sharma
Image Picker library for Android

Ronnie-Image-Picker Asks for Camera and storage permission and return uri of the images taken or picked from the gallery. Min Api Level: 16 Build Syst

Ronnie Otieno 33 Nov 19, 2022
Android library to choose image from gallery or camera with option to compress result image

ImagePicker Android library to choose image from gallery or camera with option to compress result image. Download Add this to your project's build.gra

Mayank Nagwanshi 73 May 20, 2022
Camera Folder: "Take a Photo from Camera" everywhere where you can open a photo file

When "Camera Folder" is installed many Android-Apps that can open jpg files can also take a photo from camera.

k3b 18 Dec 20, 2022
Android application to preview, record (MediaRecorder), and fetch each image from both front and rear cameras simultaneously

DuoCamera ?? Overview Android application to preview, record (MediaRecorder) and fetch each image from both front and rear cameras simultaneously. The

Igor Lashkov 5 Nov 28, 2022
An Android App that uses Machine Learning to recognize the objects in an image captured from the phone's camera

Camera App ?? Description An Android App that uses Machine Learning (ML) to recognize the objects in an image captured from the phone's camera. • Allo

Shikeya Anderson 1 Dec 31, 2022
📸 A library that allows you to capture images secretly, in background without alerting users.

HiddenCamera A library that allows you to capture images secretly, in background without alerting users. Gradle Dependency Add the dependency to your

Cotta & Cush Limited 116 Dec 29, 2022
Android Country Picker is a Kotlin-first, flexible and powerful Android library that allows to integrate Country Picker with just a few lines.

1. Add dependency dependencies { implementation 'com.hbb20:android-country-picker:X.Y.Z' } For latest version, 2. Decide your use-case

Harsh B. Bhakta 65 Dec 6, 2022
With the Help of this libray you can pic image from camera, gallery, it's support image cropping as well and you can pic PDF

FilePicker This project aims to provide an ultimate and flexible image picking from Gallery, Camera and cropping experience as well as PDF picking fro

Raj Pratap Singh Jadon 3 Nov 24, 2022
MatrixCompose - Replica of the popular scene from The Matrix

MatrixCompose Grabacion.de.pantalla.2022-01-04.a.la.s.5.46.41.p.m.mov

Heiner Gómez 5 Feb 14, 2022
Elektronika - is a replica of an old Soviet watch - electronics, that might be uses on Android watch now)

Elektronika Elektronika - it's a sample project that shows how to create watch face for Android WearOS. Elektronika based on Google WatchFace Sample,

Ilia Pavlovskii 7 Dec 19, 2022
WhatsApp-Clone - WhatsApp Clone With Kotlin

WhatsApp Clone this App is a follow up of a youtube Video by Btech follow the li

Oyero Abdullahi Surajudeen 0 Jan 27, 2022
Whatsapp based Phone number verification.Verify your phone number easily through whatsapp

Whatsapp Based Login Try this to implement fastest phone number verification system [ ⚡ ] Verify your phone number through whatsapp android LinkedIn B

MorningStar 10 Jun 21, 2022
A hybrid chat android application based on the features of Instagram and Whatsapp having UI just as Telegram.

A hybrid chat android application based on the features of Instagram and Whatsapp having UI just as Telegram.

Ratik Tiwari 1 May 22, 2022
Facebook-Styled-Image-Picker - Facebook Styled Image Picker

Facebook-Styled-Image-Picker Facebook Styled Gallery Files picker. One or multip

Hashim Tahir 11 Sep 27, 2022
Space Navigation is a library allowing easily integrate fully customizable Google Spaces like navigation to your app.

Space-Navigation-View Introduction Space Navigation is a library allowing easily integrate fully customizable Google [Spaces][1] like navigation to yo

Arman 2k Dec 23, 2022
AnimApp is an app that recommends you random anime and you can add it to your favourite if you like it.

papb-team6 AnimApp is an app that recommends you animes and you can add it to your favourite if you like it. Team members: Firdaus Bisma Suryakusuma (

Gilang Adhitama Putra 1 Mar 9, 2022
Quick Text is about send the message on WhatsApp without saving number. You can see the status of other and share and download those status also.

Quick Text is about send the message on WhatsApp without saving number. You can see the status of other and share and download those status also.

Dheeraj Gupta 11 May 25, 2022