Home

Awesome

ImagePickerWithCrop

A library designated for selecting an image via gallery or camera, with cropping abilities, in an easy way.

Alt Text

Simple sample usage -

  new PickerBuilder(MainActivity.this, PickerBuilder.SELECT_FROM_CAMERA)
          .setOnImageReceivedListener(new PickerBuilder.onImageReceivedListener() {
              @Override
              public void onImageReceived(Uri imageUri) {
                  Toast.makeText(MainActivity.this,"Got image - " + imageUri,Toast.LENGTH_LONG).show();
                  imageView.setImageURI(imageUri);
              }
          })
          .start();

A slighly more customized example -

  new PickerBuilder(MainActivity.this, PickerBuilder.SELECT_FROM_CAMERA)
          .setOnImageReceivedListener(new PickerBuilder.onImageReceivedListener() {
              @Override
              public void onImageReceived(Uri imageUri) {
                  Toast.makeText(MainActivity.this,"Got image - " + imageUri,Toast.LENGTH_LONG).show();
                  imageView.setImageURI(imageUri);
              }
          })
          .setImageName("testImage")
          .setImageFolderName("testFolder")
          .withTimeStamp(false)
          .setCropScreenColor(Color.CYAN)
          .start();

##How to install Import the following in your app's Gradle file - compile 'com.yalantis:ucrop:2.2.0'

Copy the following files to your project -

CameraPickerManager.java
GlobalHolder.java
ImagePickerManager.java
PickerBuilder.java
PickerManager.java
TempActivity.java

Next, add the following two Activities to your Manifest file -

  <activity
      android:name=".TempActivity"
      android:screenOrientation="portrait"
      android:theme="@style/Theme.AppCompat.Translucent"/>
  <activity
      android:name="com.yalantis.ucrop.UCropActivity"
      android:screenOrientation="portrait"
      android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>

Finally, add the following to your styles.xml file -

    <style name="Theme.AppCompat.Translucent" parent="Theme.AppCompat.NoActionBar">
        <item name="android:background">#33000000</item> <!-- Or any transparency or color you need -->
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:colorBackgroundCacheHint">@null</item>
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:windowAnimationStyle">@android:style/Animation</item>
    </style>

##How to use

##Customization The library offers several customization options -

##Credits The library uses the great cropping library <a href="https://github.com/Yalantis/uCrop">Ucrop</a>.