Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to stop user to select images more than limit #8

Closed
ahmadplero opened this issue Sep 21, 2015 · 1 comment
Closed

Is it possible to stop user to select images more than limit #8

ahmadplero opened this issue Sep 21, 2015 · 1 comment

Comments

@ahmadplero
Copy link

Hi darsh,

For now, we have an option to set a limit for user image selection. In this case, user can select no of images more than limit but toast show to user to unselect images that are more than limit but I want to make user unable to select images more than limit. Is it possible?

thanks..

@darsh2
Copy link
Owner

darsh2 commented Sep 24, 2015

Yes it is possible to do so. In the ImageSelectActivity class, in the toggleSelection(int position) make the following changes:

private void toggleSelection(int position) {
    if (!images.get(position).isSelected && countSelected == Constants.limit) {
        Toast.makeText(getApplicationContext(), String.format(getString(R.string.limit_exceeded), Constants.limit), Toast.LENGTH_LONG).show();
        return;
    }

    images.get(position).isSelected = !images.get(position).isSelected;
    if (images.get(position).isSelected) {
        countSelected++;
    } else {
        countSelected--;
    }
    customImageSelectAdapter.notifyDataSetChanged();
}

I'll add this soon. Thanks for this feature suggestion.

darsh2 added a commit that referenced this issue Nov 17, 2015
@darsh2 darsh2 closed this as completed Nov 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants