本文整理汇总了Java中org.chromium.chrome.browser.compositor.bottombar.OverlayPanel.PanelState.PEEKED属性的典型用法代码示例。如果您正苦于以下问题:Java PanelState.PEEKED属性的具体用法?Java PanelState.PEEKED怎么用?Java PanelState.PEEKED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.chromium.chrome.browser.compositor.bottombar.OverlayPanel.PanelState
的用法示例。
在下文中一共展示了PanelState.PEEKED属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updatePanelForHeight
/**
* Updates the UI state for a given |height|.
*
* @param height The Overlay Panel height.
*/
private void updatePanelForHeight(float height) {
PanelState endState = findLargestPanelStateFromHeight(height);
PanelState startState = getPreviousPanelState(endState);
float percentage = getStateCompletion(height, startState, endState);
updatePanelSize(height);
if (endState == PanelState.CLOSED || endState == PanelState.PEEKED) {
updatePanelForCloseOrPeek(percentage);
} else if (endState == PanelState.EXPANDED) {
updatePanelForExpansion(percentage);
} else if (endState == PanelState.MAXIMIZED) {
updatePanelForMaximization(percentage);
}
}
示例2: handleScroll
/**
* Handles the scroll event, determining the gesture orientation and event target,
* when appropriate.
* @param e1 The first down {@link MotionEvent} that started the scrolling.
* @param e2 The move {@link MotionEvent} that triggered the current scroll.
* @param distanceY The distance along the Y axis that has been scrolled since the last call
* to handleScroll.
* @return Whether the event has been consumed.
*/
protected boolean handleScroll(MotionEvent e1, MotionEvent e2, float distanceY) {
// If the panel is peeking then the swipe recognizer will handle the scroll event.
if (mPanel.getPanelState() == PanelState.PEEKED) return false;
// Only determines the gesture orientation if it hasn't been determined yet,
// affectively "locking" the orientation once the gesture has started.
if (!mHasDeterminedGestureOrientation && isDistanceGreaterThanTouchSlop(e1, e2)) {
determineGestureOrientation(e1, e2);
}
// Only determines the event target after determining the gesture orientation and
// if it hasn't been determined yet or if changing the event target during the
// middle of the gesture is supported. This will allow a smooth transition from
// swiping the Panel and scrolling the Content View.
final boolean mayChangeEventTarget = mMayChangeEventTarget && e2.getPointerCount() == 1;
if (mHasDeterminedGestureOrientation
&& (!mHasDeterminedEventTarget || mayChangeEventTarget)) {
determineEventTarget(distanceY);
}
return false;
}
示例3: handleSingleTapUp
/**
* Handles the tap event, determining the event target.
* @param e The tap {@link MotionEvent}.
* @return Whether the event has been consumed.
*/
protected boolean handleSingleTapUp(MotionEvent e) {
// If the panel is peeking then the panel was already notified in #onTouchEventInternal().
if (mPanel.getPanelState() == PanelState.PEEKED) return false;
setEventTarget(mPanel.isCoordinateInsideContent(
e.getX() * mPxToDp, e.getY() * mPxToDp)
? EventTarget.CONTENT_VIEW : EventTarget.PANEL);
return false;
}
示例4: handleScroll
/**
* Handles the scroll event, determining the gesture orientation and event target,
* when appropriate.
* @param e1 The first down {@link MotionEvent} that started the scrolling.
* @param e2 The move {@link MotionEvent} that triggered the current scroll.
* @param distanceY The distance along the Y axis that has been scrolled since the last call
* to handleScroll.
* @return Whether the event has been consumed.
*/
protected boolean handleScroll(MotionEvent e1, MotionEvent e2, float distanceY) {
// TODO(mdjones): It seems impossible that either of the two MotionEvents passed into this
// function would be null provided the InternalGestureDetector checks them. However, it
// still seems to be possible...
if (e1 == null || e2 == null) return false;
// If the panel is peeking then the swipe recognizer will handle the scroll event.
if (mPanel.getPanelState() == PanelState.PEEKED) return false;
// Only determines the gesture orientation if it hasn't been determined yet,
// affectively "locking" the orientation once the gesture has started.
if (!mHasDeterminedGestureOrientation && isDistanceGreaterThanTouchSlop(e1, e2)) {
determineGestureOrientation(e1, e2);
}
// Only determines the event target after determining the gesture orientation and
// if it hasn't been determined yet or if changing the event target during the
// middle of the gesture is supported. This will allow a smooth transition from
// swiping the Panel and scrolling the Content View.
final boolean mayChangeEventTarget = mMayChangeEventTarget && e2.getPointerCount() == 1;
if (mHasDeterminedGestureOrientation
&& (!mHasDeterminedEventTarget || mayChangeEventTarget)) {
determineEventTarget(distanceY);
}
return false;
}
示例5: getMaximumSupportedState
/**
* @return The maximum state supported by the panel.
*/
private PanelState getMaximumSupportedState() {
if (isSupportedState(PanelState.MAXIMIZED)) {
return PanelState.MAXIMIZED;
} else if (isSupportedState(PanelState.EXPANDED)) {
return PanelState.EXPANDED;
} else {
return PanelState.PEEKED;
}
}
示例6: getPanelHeightFromState
/**
* Gets the height of the Overlay Panel in dps for a given |state|.
*
* @param state The state whose height will be calculated.
* @return The height of the Overlay Panel in dps for a given |state|.
*/
public float getPanelHeightFromState(PanelState state) {
if (state == PanelState.PEEKED) {
return getPeekedHeight();
} else if (state == PanelState.EXPANDED) {
return getExpandedHeight();
} else if (state == PanelState.MAXIMIZED) {
return getMaximizedHeight();
}
return 0;
}
示例7: onTouchEventInternal
@Override
public boolean onTouchEventInternal(MotionEvent e) {
final int action = e.getActionMasked();
if (mPanel.getPanelState() == PanelState.PEEKED) {
if (action == MotionEvent.ACTION_DOWN) {
// To avoid a gray flash of empty content, show the search content
// view immediately on tap rather than waiting for panel expansion.
// TODO(pedrosimonetti): Once we implement "side-swipe to dismiss"
// we'll have to revisit this because we don't want to set the
// Content View visibility to true when the side-swipe is detected.
mPanel.notifyBarTouched(e.getX() * mPxToDp);
}
mSwipeRecognizer.onTouchEvent(e);
mGestureDetector.onTouchEvent(e);
return true;
}
if (!mIsDeterminingEventTarget && action == MotionEvent.ACTION_DOWN) {
mInitialEventY = e.getY();
if (mPanel.isCoordinateInsideContent(e.getX() * mPxToDp, mInitialEventY * mPxToDp)) {
// If the DOWN event happened inside the Content View, we'll need
// to wait until the user has moved the finger beyond a certain threshold,
// so we can determine the gesture's orientation and consequently be able
// to tell if the Content View will accept the gesture.
mIsDeterminingEventTarget = true;
mMayChangeEventTarget = true;
} else {
// If the DOWN event happened outside the Content View, then we know
// that the Panel will start handling the event right away.
setEventTarget(EventTarget.PANEL);
mMayChangeEventTarget = false;
}
}
// Send the event to the GestureDetector so we can distinguish between scroll and tap.
mGestureDetector.onTouchEvent(e);
if (mHasDeterminedEventTarget) {
// If the event target has been determined, resume pending events, then propagate
// the current event to the appropriate target.
resumeAndPropagateEvent(e);
} else {
// If the event target has not been determined, we need to record a copy of the event
// until we are able to determine the event target.
MotionEvent event = MotionEvent.obtain(e);
mRecordedEvents.add(event);
mIsRecordingEvents = true;
}
if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) {
reset();
}
return true;
}
示例8: isStartingNewContextualSearch
/**
* Determine whether a new contextual search is starting.
* @param toState The contextual search state that will be transitioned to.
* @param reason The reason for the search state transition.
* @return Whether a new contextual search is starting.
*/
private boolean isStartingNewContextualSearch(PanelState toState, StateChangeReason reason) {
return toState == PanelState.PEEKED
&& (reason == StateChangeReason.TEXT_SELECT_TAP
|| reason == StateChangeReason.TEXT_SELECT_LONG_PRESS);
}
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:11,代码来源:ContextualSearchPanelMetrics.java