EasyImagePicker


Source link: https://github.com/oswaldo89/EasyImagePicker

EasyImagePicker

Libreria de facil implementacion, para Android nativo, se pueden obtener imagenes desde la galeria y desde la camara.

  • Se pueden agregar hasta 10 imagenes
  • Eliminar imagen despues agregarla
  • Visualizar imagen despues de agregarla
  • Posibilidad de cargar Imagenes desde una Url ( importante para cuando editas )
  • Para subir te devuelve un arreglo de Uri's para que las puedas manejar tu conveniencia.

Instalación

Agregamos las 2 url's del repositorio al build.gradle root

allprojects {

  repositories {

...

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

maven {
 url 'http://dl.bintray.com/raphaelbussa/maven' 
}

  
}
 
}

Agregarmos la url de la dependencia al build.gradle del folder /app

dependencies {

 compile 'com.github.oswaldo89:EasyImagePicker-library:1.0.2' 
}

Agregamos el contenedor principal, las pruebas se hicieron dentro de un padre LinearLayout en orientación vertical.

<com.oswaldogh89.picker.ImagePicker
  android:id="@+id/picker"
  android:layout_width="match_parent"
  android:layout_height="wrap_content">  </com.oswaldogh89.picker.ImagePicker>

Dentro del activity en donde usaremos el control, instanciamos.

ImagePicker picker = (ImagePicker) findViewById(R.id.picker);
 picker.setMainactivity(ExampleUsage.this);

Podemos Agregar un color hexadecimal, para el contorno de las imagenes que se van agregando.

picker.SetBorderImageColor("#075e55");

Podemos Habilitar/Inhabilitar el boton para borrar todas las imagenes.

picker.enableDelateAll(false);

Por ultimo, para visualizar las imagenes hay que cacharlas una vez seleccionada desde la camara o la galeria, se hace con el siguiente codigo a la Activity en donde estamos trabajando.

protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent) {

  super.onActivityResult(requestCode, resultCode, imageReturnedIntent);

  switch (requestCode) {

case 0:

 if (resultCode == RESULT_OK) {

  picker.AddNewImage(imageReturnedIntent);

 
}

 break;

case 1:

 if (resultCode == RESULT_OK) {

  picker.AddNewImage(imageReturnedIntent);

 
}

 break;
  
}
 
}

Si estamos usando el control para una edicion de datos, y necesitamos que al inciar cargue unas urls, agregamos el siguiente codigo.

//Si vas a cargar imagenes en el control desde una URL ArrayList<String> urls = new ArrayList<>();
 urls.add("https://static.independent.co.uk/s3fs-public/styles/article_small/public/thumbnails/image/2017/01/19/15/earth-from-space.jpg");
 urls.add("http://www.slate.com/content/dam/slate/blogs/bad_astronomy/2016/03/09/shutterstock_earthfromhubble.jpg.CROP.original-original.jpg");
 picker.addImagesFromUrl(urls);

Por ultimo , cuando ya quieras enviar las imagenes al servidor o guardarlas. las obtienes de la siguiente manera.

HashMap<Integer, String> images = picker.GetPathImages();
 for (Map.Entry entry : images.entrySet()) {

  Log.v("IMAGENES_AGREGADAS", "TAMAÑO : " + entry.getValue());
 
}
 

Librerias usadas

Resources

Unofficial implementation of medium api for android.

A simple router lib to android.

Groupie helps you display and manage complex RecyclerView layouts.

@BindingAdapter for loading the images with Glide without writing a single line of code using Data Binding Library.

Avatar ImageView with user's name first letter Drawable placeholder.

An Annotation based validation library for use with Android's DataBinding library in an MVVM architecture.

  • Quick and easily add validation rules to ViewModels by annotating the class.
  • Annotation Processing to eliminate reflection and generate boilerplate validation classes.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes