Bug 1102836 - Make close button hit area a bit taller (r=mhaigh)

This commit is contained in:
Lucas Rocha 2014-11-24 13:59:57 +00:00
Родитель 1e2dcc837c
Коммит ce9855e1b3
1 изменённых файлов: 2 добавлений и 6 удалений

Просмотреть файл

@ -101,19 +101,15 @@ public class TabsLayoutItemView extends LinearLayout
public boolean onPreDraw() {
getViewTreeObserver().removeOnPreDrawListener(this);
final Rect hitRect = new Rect();
mCloseButton.getHitRect(hitRect);
// Ideally we want the close button hit area to be 40x40dp but we are constrained by the height of the parent, so
// we make it as tall as the parent view and 40dp across.
final int targetHitArea = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 40, getResources().getDisplayMetrics());;
final View parent = ((View) mCloseButton.getParent());
final Rect hitRect = new Rect();
hitRect.top = 0;
hitRect.right = getWidth();
hitRect.left = getWidth() - targetHitArea;
hitRect.bottom = parent.getHeight();
hitRect.bottom = targetHitArea;
setTouchDelegate(new TouchDelegate(hitRect, mCloseButton));