Merge "Accessibilty: Cannot click on views in a scrollable container covered by the toolbar." into lmp-mr1-dev

This commit is contained in:
Svetoslav
2015-01-23 22:22:17 +00:00
committed by Android (Google) Code Review
3 changed files with 30 additions and 2 deletions

View File

@@ -829,8 +829,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
// Clip the bounds by our bounds. // Clip the bounds by our bounds.
bounds.left = Math.max(bounds.left, 0); bounds.left = Math.max(bounds.left, 0);
bounds.top = Math.max(bounds.top, 0); bounds.top = Math.max(bounds.top, 0);
bounds.right = Math.min(bounds.right, mRight); bounds.right = Math.min(bounds.right, getWidth());
bounds.bottom = Math.min(bounds.bottom, mBottom); bounds.bottom = Math.min(bounds.bottom, getHeight());
Iterator<View> iterator = obtainOrderedChildIterator(); Iterator<View> iterator = obtainOrderedChildIterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {

View File

@@ -21,6 +21,7 @@ import android.annotation.Nullable;
import android.app.ActionBar; import android.app.ActionBar;
import android.content.Context; import android.content.Context;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.graphics.RectF;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
@@ -1096,6 +1097,18 @@ public class Toolbar extends ViewGroup {
return true; return true;
} }
/**
* @hide
*/
@Override
public void addClickableRectsForAccessibility(List<RectF> outRects) {
// This class always consumes touch events, therefore if it
// covers a view we do not want to send a click over it.
RectF bounds = new RectF();
bounds.set(0, 0, getWidth(), getHeight());
outRects.add(bounds);
}
/** /**
* @hide * @hide
*/ */

View File

@@ -23,6 +23,7 @@ import android.graphics.Canvas;
import android.graphics.ColorFilter; import android.graphics.ColorFilter;
import android.graphics.Outline; import android.graphics.Outline;
import android.graphics.PixelFormat; import android.graphics.PixelFormat;
import android.graphics.RectF;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.ActionMode; import android.view.ActionMode;
@@ -31,6 +32,8 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import java.util.List;
/** /**
* This class acts as a container for the action bar view and action mode context views. * This class acts as a container for the action bar view and action mode context views.
* It applies special styles as needed to help handle animated transitions between them. * It applies special styles as needed to help handle animated transitions between them.
@@ -224,6 +227,18 @@ public class ActionBarContainer extends FrameLayout {
return true; return true;
} }
/**
* @hide
*/
@Override
public void addClickableRectsForAccessibility(List<RectF> outRects) {
// This class always consumes touch events, therefore if it
// covers a view we do not want to send a click over it.
RectF bounds = new RectF();
bounds.set(0, 0, getWidth(), getHeight());
outRects.add(bounds);
}
@Override @Override
public boolean onHoverEvent(MotionEvent ev) { public boolean onHoverEvent(MotionEvent ev) {
super.onHoverEvent(ev); super.onHoverEvent(ev);