Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to detect if actionmode already present

I have several widgets in a view, each needing its own ActionMode. I see that the ActionMode does not dismiss automatically when the user taps outside the action bar. Thus, it is easily possible for the user to start an ActionMode for one control, then tap (longclick in my case) another control and stack a second ActionBar on top of the first. This causes programming logic havoc.

I can keep track of the current ActionMode with an activity-level member variable and dismiss the current one if a new one is needed. Howewver, this is making my code messy to read and maintain. And further, I'd prefer to dismiss it immediately when the user taps anything outside the action bar.

Any suggestions on a good way to handle this?

like image 254
Peri Hartman Avatar asked Oct 03 '12 14:10

Peri Hartman


1 Answers

I was looking for a solution of this problem some time ago and as I know you couldn't track it without saving current action-mode state in a global variable. However I don't think that one variable with proper name would make your code messy.

like image 185
user1049280 Avatar answered Nov 07 '22 20:11

user1049280