Giter VIP home page Giter VIP logo

multiple-media-picker's Introduction

Multiple Media Picker ๐Ÿ’ฅ ๐ŸŒŸ

An android library to pick multiple images and/or videos from built-in gallery. This library is encouraged to use as little memory as possible.

Feel free to ask(or request) me anything about it, just create an issue!

Usage

Include easily in your project adding the dependency to your build.gradle file.

dependencies {
  compile 'com.erikagtierrez.multiple_media_picker:multiple-media-picker:1.0.3'
}

Getting started

In the activity from where you want to call the library, declare

    static final int OPEN_MEDIA_PICKER = 1;  // Request code

and request permissions to read external storage

    Manifest.permission.READ_EXTERNAL_STORAGE

Create the intent

    Intent intent= new Intent(this, Gallery.class);
    // Set the title
    intent.putExtra("title","Select media");
    // Mode 1 for both images and videos selection, 2 for images only and 3 for videos!
    intent.putExtra("mode",1); 
    intent.putExtra("maxSelection",3); // Optional
    startActivityForResult(intent,OPEN_MEDIA_PICKER);

and override onActivityResult

@Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        // Check which request we're responding to
        if (requestCode == OPEN_MEDIA_PICKER) {
            // Make sure the request was successful
            if (resultCode == RESULT_OK && data != null) {
                 ArrayList<String> selectionResult=data.getStringArrayListExtra("result");
            }
        }
    }

Custom styles

The primary colors will be inherited from the project it was called. But you can customize a little more by adding to your colors.xml

Title and back button color

 <color name="titleTextColor">#000000</color>  

Unselected image/video tab title

 <color name="titleTabColor">#000000</color>   

Selected image/video tab title!

<color name="titleSelectedTabColor">#E040FB</color>

Make sure to override the titleTextColor inside your theme in styles.xml

<item name="titleTextColor">@color/titleTextColor</item>

License

Copyright 2016 Erika Gutierrez

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.

multiple-media-picker's People

Contributors

erikagtierrez avatar lunatk avatar gitter-badger avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.