use of android.view.TouchDelegate in project Signal-Android by WhisperSystems.
the class GiphyActivityToolbar method expandTapArea.
private void expandTapArea(final View container, final View child) {
final int padding = getResources().getDimensionPixelSize(R.dimen.contact_selection_actions_tap_area);
container.post(() -> {
Rect rect = new Rect();
child.getHitRect(rect);
rect.top -= padding;
rect.left -= padding;
rect.right += padding;
rect.bottom += padding;
container.setTouchDelegate(new TouchDelegate(rect, child));
});
}
use of android.view.TouchDelegate in project ListViewTipsAndTricks by cyrilmottier.
the class TouchDelegateGroup method onTouchEvent.
@Override
public boolean onTouchEvent(MotionEvent event) {
TouchDelegate delegate = null;
switch(event.getAction()) {
case MotionEvent.ACTION_DOWN:
if (mTouchDelegates != null) {
for (TouchDelegate touchDelegate : mTouchDelegates) {
if (touchDelegate != null) {
if (touchDelegate.onTouchEvent(event)) {
mCurrentTouchDelegate = touchDelegate;
return true;
}
}
}
}
break;
case MotionEvent.ACTION_MOVE:
delegate = mCurrentTouchDelegate;
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
delegate = mCurrentTouchDelegate;
mCurrentTouchDelegate = null;
break;
}
return delegate == null ? false : delegate.onTouchEvent(event);
}
use of android.view.TouchDelegate in project ListViewTipsAndTricks by cyrilmottier.
the class LargeTouchableAreasView method addTouchDelegate.
private void addTouchDelegate(Rect rect, int color, View delegateView) {
mTouchDelegateGroup.addTouchDelegate(new TouchDelegate(rect, delegateView));
mTouchDelegateRecords.add(new TouchDelegateRecord(rect, color));
}
Aggregations