Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

Single selection mode checkbox state #45

Closed
csababiro opened this issue Apr 14, 2017 · 6 comments
Closed

Single selection mode checkbox state #45

csababiro opened this issue Apr 14, 2017 · 6 comments

Comments

@csababiro
Copy link

csababiro commented Apr 14, 2017

If I tap only if checkboxes or only on elements everything is ok.

But if I tap first on checkbox and after that I tap on other element, that element is not checked only if tap it once again.

Same thing if I check and element and after that a checkbox from other element.

So in those cases the selected state is interchanged somehow.

@llDavidll
Copy link

Hi,
I'm having the same issue, and also found how to solve it.
Test protocol :
In single selection mode (DialogConfigs.SINGLE_MODE), open a directory with at least two files to select.

  • Select first file : everything is OK
  • Select second file : everything seems OK, but the two items (FileListItem) are marked. The view only show the second one as selected, but in the data both are selected.
  • Select the first file again : nothing seems to happen, in fact you just "unmarked" it since it was already marked.

I found and tested a simple fix : in the file "MarkedItemList", in the function "addSingleFile", unmark all previously marked items :

public static void addSingleFile(FileListItem item)
    {
        for (FileListItem fileListItem : ourInstance.values()) {
            if(!fileListItem.equals(item)) {
                fileListItem.setMarked(false);
            }
        }
        ourInstance.clear();
        ourInstance.put(item.getLocation(),item);
    }

This solves this exact problem by unmarking all previously marked items.

@singhangadin
Copy link
Owner

Hey, I have checked this issue. The behavior of checkboxes is very unpredictable in lists. I think I have to follow a different selection procedure for fixing this bug. Will start working upon that ASAP. I will summarize the bug here: When items are marked using markFiles method, they require a double click to unmark/mark for the first time.

@singhangadin
Copy link
Owner

@llDavidll That may fix the issue with single file mode but this wont work with multiple mode

@llDavidll
Copy link

From what I saw, the only use of addSingleFile is here :

if(properties.selection_mode == DialogConfigs.MULTI_MODE) {
    MarkedItemList.addSelectedItem(item);
}
else {
    MarkedItemList.addSingleFile(item);

}

So it should not interfere with multiple mode. It seems coherent that the function responsible of the single selection unchecks all other items before selecting the new one, since we always want at most one selected item.
If you need me to test anything, feel free to ask.

@singhangadin
Copy link
Owner

Hi, I have made few major changes for checkbox click issue. Will really appreciate if you could see to that and help me with bugs. Thank you.

singhangadin pushed a commit that referenced this issue May 19, 2017
…ble click issues.

Stock Checkbox was having issues in selection of a row. Sometimes it works, sometimes it doesn't. As I fix to that, I made a custom checkbox from scratch. Though it might have few theming issues in the beginning but I believe there won't be any functionality issues in that.

Resolves: #25 #45 #52
@llDavidll
Copy link

Selection works well with the last release, thank you ! No more problems with single selection mode, and other modes seems to work fine too.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants