Loading core/java/com/android/internal/widget/AbsActionBarView.java +55 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ import com.android.internal.R; import android.util.TypedValue; import android.view.ContextThemeWrapper; import android.view.MotionEvent; import android.widget.ActionMenuPresenter; import android.widget.ActionMenuView; Loading Loading @@ -53,6 +54,9 @@ public abstract class AbsActionBarView extends ViewGroup { protected Animator mVisibilityAnim; private boolean mEatingTouch; private boolean mEatingHover; public AbsActionBarView(Context context) { this(context, null); } Loading Loading @@ -97,6 +101,57 @@ public abstract class AbsActionBarView extends ViewGroup { } } @Override public boolean onTouchEvent(MotionEvent ev) { // ActionBarViews always eat touch events, but should still respect the touch event dispatch // contract. If the normal View implementation doesn't want the events, we'll just silently // eat the rest of the gesture without reporting the events to the default implementation // since that's what it expects. final int action = ev.getActionMasked(); if (action == MotionEvent.ACTION_DOWN) { mEatingTouch = false; } if (!mEatingTouch) { final boolean handled = super.onTouchEvent(ev); if (action == MotionEvent.ACTION_DOWN && !handled) { mEatingTouch = true; } } if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) { mEatingTouch = false; } return true; } @Override public boolean onHoverEvent(MotionEvent ev) { // Same deal as onTouchEvent() above. Eat all hover events, but still // respect the touch event dispatch contract. final int action = ev.getActionMasked(); if (action == MotionEvent.ACTION_HOVER_ENTER) { mEatingHover = false; } if (!mEatingHover) { final boolean handled = super.onHoverEvent(ev); if (action == MotionEvent.ACTION_HOVER_ENTER && !handled) { mEatingHover = true; } } if (action == MotionEvent.ACTION_HOVER_EXIT || action == MotionEvent.ACTION_CANCEL) { mEatingHover = false; } return true; } /** * Sets whether the bar should be split right now, no questions asked. * @param split true if the bar should split Loading Loading
core/java/com/android/internal/widget/AbsActionBarView.java +55 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ import com.android.internal.R; import android.util.TypedValue; import android.view.ContextThemeWrapper; import android.view.MotionEvent; import android.widget.ActionMenuPresenter; import android.widget.ActionMenuView; Loading Loading @@ -53,6 +54,9 @@ public abstract class AbsActionBarView extends ViewGroup { protected Animator mVisibilityAnim; private boolean mEatingTouch; private boolean mEatingHover; public AbsActionBarView(Context context) { this(context, null); } Loading Loading @@ -97,6 +101,57 @@ public abstract class AbsActionBarView extends ViewGroup { } } @Override public boolean onTouchEvent(MotionEvent ev) { // ActionBarViews always eat touch events, but should still respect the touch event dispatch // contract. If the normal View implementation doesn't want the events, we'll just silently // eat the rest of the gesture without reporting the events to the default implementation // since that's what it expects. final int action = ev.getActionMasked(); if (action == MotionEvent.ACTION_DOWN) { mEatingTouch = false; } if (!mEatingTouch) { final boolean handled = super.onTouchEvent(ev); if (action == MotionEvent.ACTION_DOWN && !handled) { mEatingTouch = true; } } if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) { mEatingTouch = false; } return true; } @Override public boolean onHoverEvent(MotionEvent ev) { // Same deal as onTouchEvent() above. Eat all hover events, but still // respect the touch event dispatch contract. final int action = ev.getActionMasked(); if (action == MotionEvent.ACTION_HOVER_ENTER) { mEatingHover = false; } if (!mEatingHover) { final boolean handled = super.onHoverEvent(ev); if (action == MotionEvent.ACTION_HOVER_ENTER && !handled) { mEatingHover = true; } } if (action == MotionEvent.ACTION_HOVER_EXIT || action == MotionEvent.ACTION_CANCEL) { mEatingHover = false; } return true; } /** * Sets whether the bar should be split right now, no questions asked. * @param split true if the bar should split Loading