1

I'm trying to extend the text selection contexual action bar with further actions.

So I added an ActionCallback via setCustomSelectionActionModeCallback method. It works fine, BUT: I'm addind several icons, so they don't fit in the actionbar on phones and they go to the overflow menu. The problem is: as soon as I click on the overflow button, it seems that the EditText looses the focus and so the ActionMode is closed and destroyed. So you are not able to click any of the items in the overflow menu.

I'm using ActionBarSherlock 4.3.1.

Is this a bug? Should I file it on b.android.com? Is there a workaround? One possible workaround may be the split action bar. But currently I don't need / want the split bar for the whole activity and switching programmatically is not possible as far as I know.

Maniac
  • 774
  • 2
  • 7
  • 11

1 Answers1

0

Is this a bug?

I think so.

Should I file it on b.android.com?

Beat you to it by a year and a half. :-)

Is there a workaround?

None that I have found so far, in terms of a strict workaround. I did work out a sorta-solution: basically create your own "overflow" item in the action mode, which when clicking brings up a "nested" action mode of your own, giving you more room. I haven't looked at my code for this in a while, and I recall it was fairly nasty.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Ok, because if the user wants to get to my additional options, the selection isn't as important anymore. So an own actionbar item that starts my REAL additional options (in an own cab) would be an idea. I have to try that. Thank you for the hint. Also I'm interested in your solution anyways. – Maniac Jul 16 '13 at 10:38
  • "if the user wants to get to my additional options, the selection isn't as important anymore" -- then why are you trying to show them based on text selection in the first place? Isn't there a better spot to show those options? – CommonsWare Jul 16 '13 at 10:40
  • I want to offer some "insert" options (like current date). So it kind of belongs to text selection / position. So at the best it would integrate flawlessly with the usual text selection CAB (because maybe I want to replace some selected text with the insertion). But there are two problems: 1. the above mentioned overflow problem, 2. if there is no text or it is not possible to select text (at the end of the edittext), the text selection CAB would not open. – Maniac Jul 16 '13 at 14:20
  • That's why I added a "insert" button to the default CAB and if it is pressed, it starts another custom ActionMode with my insert options. Hope this would work on all devices / versions... I guess comments are not the best way to discuss because they don't allow line breaks and are limited in characters... – Maniac Jul 16 '13 at 14:23
  • @Maniac: "I want to offer some "insert" options (like current date)" -- ahhhhh. That's reasonable. – CommonsWare Jul 16 '13 at 14:32
  • Is this also why my animation stops? – Diego Nov 22 '13 at 23:26