MultiImageSelector


Source link: https://github.com/lovetuzitong/MultiImageSelector

MultiImageSelector

Image selector for Android device. Support single choice and multi-choice.

????

###ART


###Run Demo

./gradlew installDebug

###Quick Start

  • Step 0 Add module multi-image-selector as your dependence. in your build.gradle :
repositories {

  maven {
 url "https://jitpack.io" 
}
 
}
  dependencies {

  compile 'com.github.lovetuzitong:MultiImageSelector:1.2' 
}
  • Step 1 Set your AndroidManifest.xml as below:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />  <application

...

<!--Image Selector Entry-->
  <activity

android:configChanges="orientation|screenSize"

android:name="me.nereo.multi_image_selector.MultiImageSelectorActivity" /> </application>
  • Step 2 Call image selector simplest in your code, eg. ( From version-1.1 )
// Multi image selector form an Activity MultiImageSelector.create(Context)

.start(Activity, REQUEST_IMAGE);

Detail Api.

MultiImageSelector.create(Context)

.showCamera(boolean) // show camera or not. true by default

.count(int) // max select image size, 9 by default. used width #.multi()

.single() // single mode

.multi() // multi mode, default mode;

.origin(ArrayList<String>) // original select data set, used width #.multi()

.start(Activity/Fragment, REQUEST_IMAGE);

Also support traditional Intent :

Intent intent = new Intent(mContext, MultiImageSelectorActivity.class);
 // whether show camera intent.putExtra(MultiImageSelectorActivity.EXTRA_SHOW_CAMERA, true);
 // max select image amount intent.putExtra(MultiImageSelectorActivity.EXTRA_SELECT_COUNT, 9);
 // select mode (MultiImageSelectorActivity.MODE_SINGLE OR MultiImageSelectorActivity.MODE_MULTI) intent.putExtra(MultiImageSelectorActivity.EXTRA_SELECT_MODE, MultiImageSelectorActivity.MODE_MULTI);
 // default select images (support array list) intent.putStringArrayListExtra(MultiImageSelectorActivity.EXTRA_DEFAULT_SELECTED_LIST, defaultDataArray);
 startActivityForResult(intent, REQUEST_IMAGE);
  • Step 3 Receive result in your onActivityResult Method. eg.
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) {

  super.onActivityResult(requestCode, resultCode, data);

  if(requestCode == REQUEST_IMAGE){

if(resultCode == RESULT_OK){

 // Get the result list of select image paths

 List<String> path = data.getStringArrayListExtra(MultiImageSelectorActivity.EXTRA_RESULT);

 // do your logic ....

}

  
}
 
}
  • Step 4 No more steps, just enjoy. :)

###Custom Activity Style

  • Custome your own Activity
class CustomerActivity extends Activity implements MultiImageSelectorFragment.Callback{
  @Override
  protected void onCreate(Bundle savedInstanceState) {

// customer logic here...
Bundle bundle = new Bundle();

bundle.putInt(MultiImageSelectorFragment.EXTRA_SELECT_COUNT, mDefaultCount);

bundle.putInt(MultiImageSelectorFragment.EXTRA_SELECT_MODE, mode);

bundle.putBoolean(MultiImageSelectorFragment.EXTRA_SHOW_CAMERA, isShow);

// Add fragment to your Activity

getSupportFragmentManager().beginTransaction()

  .add(R.id.image_grid, Fragment.instantiate(this, MultiImageSelectorFragment.class.getName(), bundle))

  .commit();
  
}
  @Override
  public void onSingleImageSelected(String path) {

// When select mode set to MODE_SINGLE, this method will received result from fragment
  
}

@Override
  public void onImageSelected(String path) {

// You can specify your ActionBar behavior here 
  
}

@Override
  public void onImageUnselected(String path) {

// You can specify your ActionBar behavior here 
  
}

@Override
  public void onCameraShot(File imageFile) {

// When user take phone by camera, this method will be called.
  
}
 
}
  • Take a glance of MultiImageSelectorActivity.java

###Change Log

  • 2016-5-18

    1. Added. JitPack support
    2. Added. Convenient way to call image selector. See Step 2
    3. Fixed. Some NPE.
  • 2016-1-19

    1. Fixed. cannot load some 0-size image
    2. Added. When take a new photo, notify media scanner
    3. Fixed. Can't take photo on RED-MI
    4. Fixed. Performance when show Camera-Icon
  • 2015-5-5

    1. Fixed. Can't display some images. (Issue by sd6352051, larry)
    2. Fixed. ListPopupWindow can not fill parent
    3. Added. Add checked mask.
  • 2015-4-16

    1. Fixed. Crack when rotate device. (Issue by @Leminity)
    2. Fixed. PopupListView position error. (Issue by @Slock)
    3. Change. Demo application shortcut.
    4. Change. Readme file.
  • 2015-4-9

    1. Fixed. When set EXTRA_SHOW_CAMERA to true, the first grid item onclick event were messed.
    2. Add. Support initial selected image list.

###Thanks

  • square-picasso A powerful image downloading and caching library for Android

###License

The MIT License (MIT)

Copyright (c) 2015 Nereo

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

Resources

RapidJSON is a JSON parser and generator for C++. It was inspired by RapidXml.

Features:

  • Small but complete. It supports both SAX and DOM style API.
  • Fast. Its performance can be comparable to strlen().
  • Self-contained. It does not depend on external libraries.
  • Memory friendly. Each JSON value occupies exactly 16/20 bytes.
  • Unicode friendly.

EdgeEffectOverride is library designed to help override the blue overscroll_edge and overscroll_glow effects used by the the EdgeEffect class.

Simply import the project into your library, replace existing references to ScrollView, ListView, ExpandableListView, GridView & ViewPager with references to the the classes found in this library.

No need to edit any graphics, simply colorize the edge effect dynamically or via the layout xml, easy!

A Reactive wrapper around Google's YouTube Data API.

material-dialogs library allows you to use a consistently Material themed dialog on all versions of Android, along with specific customizations that make it easier to brand the dialog.

Navigation Drawer Activity with material design style and simplified methods.

Every major open-source project has its own style guide: a set of conventions (sometimes arbitrary) about how to write code for that project. It is much easier to understand a large codebase when all the code in it is in a consistent style.

"Style" covers a lot of ground, from "use camelCase for variable names" to "never use global variables" to "never use exceptions." This project holds the style guidelines we use for Google code. If you are modifying a project that originated at Google, you may be pointed to this page to see the style guides that apply to that project.

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