-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
Add batch mode to contextual action bar #1601
Add batch mode to contextual action bar #1601
Conversation
|
||
} | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is too long, please try breaking it up.
It's way shorter now (both ocurrences). I know that
are almost the same, but I don't see how to merge them, because Menu (from ABS) and android.view.Menu are completely different classes. If you have any hints how to do that, let me know. |
Seems like it'd be better to make this work under GB than to have two context mode implementations in this class? |
Allright, I'm working on it. |
@moxie0 Here you go, should work on older devices now as well. I tested it for quite some minutes and did not find any problems. My emulator is currently messed up, so I could only test on my actual device running 4.4.2 though. Some more testing by someone else would be appreciated. Also, getMessageRecord is not used any more. Shall I remove it? /Edit: Ok, it seems like single clicking items while not in batch mode will also select them. Not intended, will fix. |
Fixed, using the hackish solution of just calling "setItemChecked(position, false)" on every click, unchecking the item the instant it is checked. I tested this and it seems to work well. The "new Runnable" method from method from http://stackoverflow.com/questions/9754170/listview-selection-remains-persistent-after-exiting-choice-mode only works sometimes, unpredictable. Also see https://groups.google.com/forum/#!topic/android-developers/qeJ-bnGUugg for further details. I would prefer a clean solution, but can't find any, unfortunately. Maybe a more experienced Android developers has an ide on how to do this the best possible way? |
short test on GB Emu (argh! sooo slooow!)
Didn't get error logs. 👍 What about copying or forwarding a multiselect? Would be a nice to have :) |
|
Thanks for the testing, McLoo! On KK everythings works fine, so I didn't expect that many problems with GB. Seems like I will have to fix my emulator setup to do some more testing and repairing on my own :-\ Regarding the open url issue: That one isn't new, it has been a problem with the old context menu and also the previous CAB. There is an issue somewhere here and also a pull request that has been closed because it didn't fix all problems correctly and moxie didn't want a half baked solution. Copying or forwarding a multiselect can be added once the basics work :-) |
Ok, Emulator is running again. API 10 Phone emulated. Checking your findings now:
Verified, same problem here.
I can not see this happening here, neither with touch nor with dpad navigation. Can you describe it in more detail please? How do you select the message? When does it scroll?
Could not confirm, but will be easier to test once selected messages have background :-)
Oops, fixed.
This was intended behaviour, but changing it might be better. I'll have a look at it.
Which checkmark? The one on the top left? Yes, that is for deselecting and the same behaviour as in every other application that uses the CAB. |
i.e. click delete -> click no -> actionbar stays
Seems to be an Android 2.3 problem. I tried following the first solution here: http://stackoverflow.com/questions/15799021/android-listview-selected-background-doesnt-work-in-2-3 but got lost because our Adapter class looks different. Another approach (which apparently works) would be to do a setBackgroundResource on the view
But I have two problems there:
Changed that. Now the CAB stays until an action has been done. |
|
@phenx-de any progress on this? just wanted to batch select, noticing it's not in yet :/ |
@McLoo Unfortunately not yet. I don't have too much free time for this right now. I hope this will change in the next few weeks, so I can finish this pull request. |
I'm also interested in this feature -- is this still the right place to watch for any new developments? Thanks for the hard work you guys. |
Sorry, I won't be able to work on this any further in the next few month. 7cbdf61 could still be merged, though, making it work for newer android devices. |
Follow-up to #1008. CAB = Contextual Action Bar.
The implementation works only on API 11+, so I left the "old" CAB for API 9-10.
If only one item is selected, the new CAB works exactly as the old one did. As soon as a second item is tapped, all menu items but delete get removed/hidden and the title is set to "batch mode" with a subtitle telling how many items are currently selected. The delete action works exactly like the deletion of conversations in the ConversationListFragment, which means it uses an AsyncTask. In fact, I took the code for most of the multiple-delete method from there, so credits to whoever implemented this ;-)
When the selected items are reduced to one, the classic CAB is shown again.