MediaChooser


Source link: https://github.com/learnNcode/MediaChooser

Media Chooser

Library to browse & select videos and images from disk.

Screenshots



Caution!

Eclipse library project structure has been dropped. If you wish to use this library in your eclipse IDE, please checkout MediaChooser-Eclipse. No further development will be done into MediaChooser-Eclipse.

Setup

Add following permission to your applications manifest file.

 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Add following code to the application node of your application's manifest file

<activity
  android:name="com.learnncode.mediachooser.activity.HomeScreenMediaChooser"
  android:screenOrientation="portrait" > </activity>

Caution!


Eclipse library project structure has been dropped. If you wish to use this library in your eclipse IDE, please checkout MediaChooser-Eclipse. No further development will be done.

ChangeLog

Version 2.0

1] Gradle Build

2] Updated UI

3] Bug Fixes

4] Added new developer friendly methods :)

Version 1.0.6

1] Updated UI.

2] Bug fixes.

Version 1.0.5

1] Updated picasso jar.

2] Preview file on item longpress.

3] Removed deprecated code.

Version 1.0.4

1] Fixed tab content issue.

Version 1.0.3

1] Fixed video icon visibility when video tab selected.

Version 1.0.2

1] Fixed blank image tab or video tab issue.

Version 1.0.1

1] Fixed nexus 10 crash.

2] Added helper methods for ease.

What does this library do ?

Useful library for selecting images and videos from sd-card. The library can be used to display images & videos in file view or folder view. File view shows all files whereas Folder view shows files categorized. All items are sorted according to date-time with latest item showing first.

Usage

To display images and videos according to:

1] Folders

HomeScreenMediaChooser.startMediaChooser(MainActivity.this, true);

2] Files

HomeScreenMediaChooser.startMediaChooser(MainActivity.this, false);

To get list of selected images and videos :

1] For images you have to register a broadcast with

MediaChooser.IMAGE_SELECTED_ACTION_FROM_MEDIA_CHOOSERaction.

Example:

IntentFilter imageIntentFilter = new IntentFilter(MediaChooser.IMAGE_SELECTED_ACTION_FROM_MEDIA_CHOOSER);
 registerReceiver(imageBroadcastReceiver, imageIntentFilter);

2] For videos you have to register a broadcast with MediaChooser.VIDEO_SELECTED_ACTION_FROM_MEDIA_CHOOSER action.

Example:

IntentFilter videoIntentFilter = new IntentFilter(MediaChooser.VIDEO_SELECTED_ACTION_FROM_MEDIA_CHOOSER);
 registerReceiver(videoBroadcastReceiver, videoIntentFilter);

Helper methods

1] showCameraVideoView : To hide/show camera button. example:

MediaChooser.showCameraVideoView(false);
 // This will hide the view. By default its visible.

2] setImageSize and setVideoSize : To set file size limit in mb for image/video selection. example:

MediaChooser.setVideoSize(10);
 // Default set to 20mb. MediaChooser.setImageSize(10);
 // Default set to 20mb.

3] setSelectionLimit : To set number of items that can be selected. example:

MediaChooser.setSelectionLimit(10);
  //default set to 100.

4] setSelectedMediaCount / getSelectedMediaCount : To set/retrieve total selected file count. example:

int totalCount = MediaChooser.getSelectedMediaCount();

5] showOnlyImageTab :- To show image tab only. example:

MediaChooser.showOnlyImageTab();

6] showOnlyVideoTab :- To show video tab only. example:

MediaChooser.showOnlyVideoTab();

7] showImageVideoTab : To display both image and video tab. example:

MediaChooser.showImageVideoTab();
 //By default both tabs are visible.

Check the attached demo sample app.

Acknowledgement

androidquery jar

License

Copyright 2015 learnNcode ([email protected])  Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 

Thank You

If you like our work say a Hi :)


Happy Coding Happy Learning.

Resources

Rhythm is a small library for Android that draws grids and guides over views, making it easier to fine tune your layouts according to the principles of beautiful, balanced, rhythmic design.

Sabres is an ORM library that exposes a Parse-like API.

Swipe up or down to close view or activity or anything.

A basic, Gradle-based project template for writing custom Android Lint rules.

Custom media controller view.

Inspired by stock android RatingBar. Simpler, has features that original lacks.

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