Giter Site home page Giter Site logo

bhavesh-hirpara / multipleimagepick Goto Github PK

View Code? Open in Web Editor NEW
525.0 43.0 182.0 5.14 MB

Smart android gallery with multiple image selection action.

Home Page: http://stackoverflow.com/questions/4722928/intent-for-getting-multiple-images/15029515#15029515

Java 100.00%

multipleimagepick's People

Contributors

bhavesh-hirpara avatar happy15 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

multipleimagepick's Issues

How should I add this library to my eclipse project?

  1. change this as library
  2. add the library as a dependency of my project.
  3. copy universal-image-loader.jar to my project's libs folder.
  4. copy relevant code of MainActivity.java to MyActivity.java

now it compiles fine, but fails to run when the project is run as android application.

Can set android.graphic.Bitmap to display image on GridView?

I would to thank you for this open source project. I know this project allowed us to select image(s) from gallery and showing on GridView with awesome theme, But sometimes it need to showing image from server. So can i set android.graphic.Bitmap to display image on GridView?

Maybe it looks like this (For single image)

        Bitmap ImageFile;
        viewSwitcher.setDisplayedChild(1);
        imageLoader.displayImage(ImageFile, imgSinglePick);

For Multiple image

        ArrayList<BitMap> dataT = new ArrayList<BitMap>();

        // ...

        viewSwitcher.setDisplayedChild(0);
        adapter.addAll(dataT);

Ps. Maybe this is not an issue, maybe it would be better to be a feature request.

Thank you.

Failure delivering result ResultInfo

Hi I am geeting this when i am using in it my own app whatever single or multiple

when select image and tap on ok the app crach with this code

04-10 10:14:19.327: E/AndroidRuntime(5897): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=200, result=-1, data=Intent { (has extras) }} to activity {com.petbuy.petbuy/com.petbuy.petbuy.AdvertPet2}: java.lang.NullPointerException

Ported to Xamarin.Android

Hi,

I've ported your code to Xamarin.Android and woule like to share it with the community - how do you suggest to proceed?

How can I get the File Path

How can I retrieve the path for selected multiple images as well as the path for single image when one button is clicked??

remember the selection order?

Would it be hard to implement an option where you can get images in the order which the user has selected images?

It would be great to show the number badges while user clicks images.

The benefit is, user could upload the images (maybe in a forum posting) in the order they choose.

Permission Denial

Error in marshmallow Version

java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/images/media from pid=4955, uid=10211 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()

view repeats

Hi, 1 serious issue i'm having with your library is checkbox view repeats. when I select multiple images and scroll fast below 5-10 swipes, I see the checkbox as selected over the new loading image.

How to specify image path (sdcard?)

Hello there,

Thank you for providing this as open source! :)

I have downloaded the project and tried on my device. But there are no images displayed.

May I know where in the code do I specify the path to search for the images?

Thank you!

Get the uri

How can I get the uri from activity Results please

Android 4.4 Compatibility

Hey guys,

Great work with this library. It uses a method in the CustomGalleryActivity class that is deprecated though. I have fixed this issue in my project and thought you might like to share. The new code is below:

package com.luminous.pick;

import android.app.Activity;
import android.app.LoaderManager;
import android.content.CursorLoader;
import android.content.Intent;
import android.content.Loader;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.provider.MediaStore;
import android.view.View;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.GridView;
import android.widget.ImageView;

import com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.nostra13.universalimageloader.core.assist.ImageScaleType;

import java.util.ArrayList;

public class CustomGalleryActivity extends Activity implements LoaderManager.LoaderCallbacks<Cursor>{

    GridView gridGallery;
    Handler handler;
    GalleryAdapter adapter;

    ImageView imgNoMedia;
    Button btnGalleryOk;

    String action;
    private ImageLoader imageLoader;

    LoaderManager loaderManager;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.gallery);

        action = getIntent().getAction();
        if (action == null) {
            finish();
        }
        initImageLoader();
        init();
    }

    private void initImageLoader() {
        DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
                .cacheOnDisc().imageScaleType(ImageScaleType.EXACTLY_STRETCHED)
                .bitmapConfig(Bitmap.Config.RGB_565).build();
        ImageLoaderConfiguration.Builder builder = new ImageLoaderConfiguration.Builder(
                this).defaultDisplayImageOptions(defaultOptions).memoryCache(
                new WeakMemoryCache());

        ImageLoaderConfiguration config = builder.build();
        imageLoader = ImageLoader.getInstance();
        imageLoader.init(config);
    }

    private void init() {

        loaderManager = getLoaderManager();
        loaderManager.initLoader(1, null, this);

        handler = new Handler();
        gridGallery = (GridView) findViewById(R.id.gridGallery);
        gridGallery.setFastScrollEnabled(true);
        adapter = new GalleryAdapter(getApplicationContext(), imageLoader);

        if (action.equalsIgnoreCase(Action.ACTION_MULTIPLE_PICK)) {

            findViewById(R.id.llBottomContainer).setVisibility(View.VISIBLE);
            gridGallery.setOnItemClickListener(mItemMulClickListener);
            adapter.setMultiplePick(true);

        } else if (action.equalsIgnoreCase(Action.ACTION_PICK)) {

            findViewById(R.id.llBottomContainer).setVisibility(View.GONE);
            gridGallery.setOnItemClickListener(mItemSingleClickListener);
            adapter.setMultiplePick(false);

        }

        gridGallery.setAdapter(adapter);
        imgNoMedia = (ImageView) findViewById(R.id.imgNoMedia);

        btnGalleryOk = (Button) findViewById(R.id.btnGalleryOk);
        btnGalleryOk.setOnClickListener(mOkClickListener);



    }

    private void checkImageStatus() {
        if (adapter.isEmpty()) {
            imgNoMedia.setVisibility(View.VISIBLE);
        } else {
            imgNoMedia.setVisibility(View.GONE);
        }
    }

    View.OnClickListener mOkClickListener = new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            ArrayList<CustomGallery> selected = adapter.getSelected();

            String[] allPath = new String[selected.size()];
            for (int i = 0; i < allPath.length; i++) {
                allPath[i] = selected.get(i).sdcardPath;
            }

            Intent data = new Intent().putExtra("all_path", allPath);
            setResult(RESULT_OK, data);
            finish();

        }
    };
    AdapterView.OnItemClickListener mItemMulClickListener = new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> l, View v, int position, long id) {
            adapter.changeSelection(v, position);

        }
    };

    AdapterView.OnItemClickListener mItemSingleClickListener = new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> l, View v, int position, long id) {
            CustomGallery item = adapter.getItem(position);
            Intent data = new Intent().putExtra("single_path", item.sdcardPath);
            setResult(RESULT_OK, data);
            finish();
        }
    };


    @Override
    public Loader<Cursor> onCreateLoader(int id, Bundle args) {
        final String[] columns = { MediaStore.Images.Media.DATA, MediaStore.Images.Media._ID };
        final String orderBy = MediaStore.Images.Media._ID;
        return new CursorLoader(this, MediaStore.Images.Media.EXTERNAL_CONTENT_URI, columns, null, null, orderBy);
    }

    @Override
    public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
        final ArrayList<CustomGallery> galleryList = new ArrayList<CustomGallery>();
        try {

            if (data != null && data.getCount() > 0) {
                while (data.moveToNext()) {
                    CustomGallery item = new CustomGallery();

                    int dataColumnIndex = data
                            .getColumnIndex(MediaStore.Images.Media.DATA);

                    item.sdcardPath = data.getString(dataColumnIndex);
                    galleryList.add(item);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        new Thread() {

            @Override
            public void run() {
                Looper.prepare();
                handler.post(new Runnable() {

                    @Override
                    public void run() {
                        adapter.addAll(galleryList);
                        checkImageStatus();
                    }
                });
                Looper.loop();
            };

        }.start();
    }

    @Override
    public void onLoaderReset(Loader<Cursor> loader) {

    }
}

Select Particular folder

Is there any way to display images for a particular folder?
Suppose in my gallery i have created "xyz" named folder and i want to display images which are in that folder.

Null Pointer Exception

gridGallery.setFastScrollEnabled(true);

I am not sure why i am getting this. any clues ?

Return requestCode

Hi!

First of all, thanks for making this great lib, it is a cool lib to work with images.

I' ve a question for you. I am using the single pick with these lines:

Intent i = new Intent(Action.ACTION_PICK);
startActivityForResult(i, 100);

But in the activity result method, the request code has changed and I can't find where is changing. Any idea?

Thanks

reloading the images on scrolling

Right now the images are always reloading when I scroll up and down in my gallery and it's displaying the JPG leaf image before the image displays.

Is there a way to cache the images so that the JPG leaf image is not displayed during scrolling?

Thanks

Unselect image in the custom gallary

Hi,

FIrst of all , good job for this project, its well done. Thanks
Could please tell how i can unselect the image from the gallery ?

in a form, i select image(s) from the custom gallery and display them in first activity. i added a button on each image in order to dynamically remove them from the grid. i do something like this :

holder.imgdelete.setOnClickListener(new View.OnClickListener() {
@OverRide
public void onClick(View v) {
data.get(position).isSeleted = false;
holder.imgQueueMultiSelected.setSelected(false);
// tried other things, didnt work

once the images get deleted from the list and click again on the library button, all the images previously deleted are still selected.

and in another activity using the same custom library, the same images are still selected. I guess it's cached.

How to unselect them once i deleted them from data or dataT.

THanks

License?

Question about Licence agreement

luminousman / MultipleImagePick is very suitable for my project but I cannot find license agreement.

Could you notice the project's license?

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.