I'm looking to create a custom menu for text selection. I know it's possible to edit the behaviour of the action bar with setCustomSelectionActionModeCallback, but in my case I don't want that action bar to show at all, I want my own floating custom menu which I have already achieved.
Only thing is that there is no way to not show the action bar menu after selecting the text in the TextView.
The behaviour I need is not the standard cut/copy/paste, the actions I have implemented are for highlighting and saving the highlighted section of text to a database.
I have done some tinkering and the best I could do was a messy reflection idea whereby I returned false in onCreateActionMode and got references to the text selection handles through reflection. It half worked and it's just as well because any form of reflection in this case is very bad practice.
My hope was that the last support library would have included the floating text menu in 6.0, and I though I could implement my own custom view in that menu, but that's wishful thinking.
If anyone has any ideas or libraries that might be of use then I'm all ears.
As you already noticed, using reflection is one of the ways. I'm pretty sure that it's the only one. If you're interested in what I did with that menu, check out Carbon. Its EditText does pretty much what you need, but with reflection as well.
The code snippet is way too long to paste it here, but here are the links:
https://github.com/ZieIony/Carbon/blob/master/carbon/src/main/java/carbon/widget/EditText.java https://plus.google.com/109054799904873578131/posts/BH6r9J5gnw6
Basically I'm hiding the fancy Samsung's menu, disable the standard Action Mode and show my own popup window with options connected to standard copy/paste click handlers.