Don't delay child pressed state in freeform mode

DecorCaptionView is used in app view hierarchy in freeform mode
and it inherits default ViewGroup#shouldDelayChildPressedState
implementation, which returns true by default for compatibility
reasons.
This results in touch not delivered to child views in some cases
until there is movement or up action. E.g. touch on SeekBar will
not change the position of control instantly in freeform, while
it does in other modes.
This CL disables delaying child pressed state for DecorCaptionView.

Bug: 30037893
Change-Id: I4917143610b6c0d404d2395670de9525c10f2a6c
This commit is contained in:
Andrii Kulian
2016-07-26 18:42:46 -07:00
parent 7c731f9e1f
commit a6aea9876e

View File

@@ -244,6 +244,11 @@ public class DecorCaptionView extends ViewGroup implements View.OnTouchListener,
return mTouchDispatchList;
}
@Override
public boolean shouldDelayChildPressedState() {
return false;
}
private boolean passedSlop(int x, int y) {
return Math.abs(x - mTouchDownX) > mDragSlop || Math.abs(y - mTouchDownY) > mDragSlop;
}