Issue with touch delegate
I came into a weird problem in my app. I use a global floating action menu and show hide different floating action buttons across a view pager. The problem is that for some cases the text view title has a wrong click action.
After a little bit research I believe this is a bug. So the code uses mTouchDelegateGroup to store touch delegates, but it's only cleared when the layout is changed:
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
switch (mExpandDirection) {
case EXPAND_UP:
case EXPAND_DOWN:
boolean expandUp = mExpandDirection == EXPAND_UP;
if (changed) {
mTouchDelegateGroup.clearTouchDelegates();
}
...
Therefore, if somehow the size is not changed, the touch delegates are not cleared, which will cause problem. For my case, when the number of buttons remains unchanged after show hide.
Currently I have not come up with a good solution without modifying the source code. A working solution is to force layout plus extend the floating action menu and always set changed to true.
Let me know if there are better solutions or any problems. Thanks.