Merge "Fix user education placement" into sc-v2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
bd74e73b97
@@ -530,9 +530,10 @@ public class BubbleStackView extends FrameLayout
|
|||||||
// Otherwise, we either tapped the stack (which means we're collapsed
|
// Otherwise, we either tapped the stack (which means we're collapsed
|
||||||
// and should expand) or the currently selected bubble (we're expanded
|
// and should expand) or the currently selected bubble (we're expanded
|
||||||
// and should collapse).
|
// and should collapse).
|
||||||
if (!maybeShowStackEdu()) {
|
if (!maybeShowStackEdu() && !mShowedUserEducationInTouchListenerActive) {
|
||||||
mBubbleData.setExpanded(!mBubbleData.isExpanded());
|
mBubbleData.setExpanded(!mBubbleData.isExpanded());
|
||||||
}
|
}
|
||||||
|
mShowedUserEducationInTouchListenerActive = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -550,6 +551,14 @@ public class BubbleStackView extends FrameLayout
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mShowedUserEducationInTouchListenerActive = false;
|
||||||
|
if (maybeShowStackEdu()) {
|
||||||
|
mShowedUserEducationInTouchListenerActive = true;
|
||||||
|
return true;
|
||||||
|
} else if (isStackEduShowing()) {
|
||||||
|
mStackEduView.hide(false /* fromExpansion */);
|
||||||
|
}
|
||||||
|
|
||||||
// If the manage menu is visible, just hide it.
|
// If the manage menu is visible, just hide it.
|
||||||
if (mShowingManage) {
|
if (mShowingManage) {
|
||||||
showManageMenu(false /* show */);
|
showManageMenu(false /* show */);
|
||||||
@@ -608,7 +617,8 @@ public class BubbleStackView extends FrameLayout
|
|||||||
// If we're expanding or collapsing, ignore all touch events.
|
// If we're expanding or collapsing, ignore all touch events.
|
||||||
if (mIsExpansionAnimating
|
if (mIsExpansionAnimating
|
||||||
// Also ignore events if we shouldn't be draggable.
|
// Also ignore events if we shouldn't be draggable.
|
||||||
|| (mPositioner.showingInTaskbar() && !mIsExpanded)) {
|
|| (mPositioner.showingInTaskbar() && !mIsExpanded)
|
||||||
|
|| mShowedUserEducationInTouchListenerActive) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -629,7 +639,7 @@ public class BubbleStackView extends FrameLayout
|
|||||||
mExpandedAnimationController.dragBubbleOut(
|
mExpandedAnimationController.dragBubbleOut(
|
||||||
v, viewInitialX + dx, viewInitialY + dy);
|
v, viewInitialX + dx, viewInitialY + dy);
|
||||||
} else {
|
} else {
|
||||||
if (mStackEduView != null) {
|
if (isStackEduShowing()) {
|
||||||
mStackEduView.hide(false /* fromExpansion */);
|
mStackEduView.hide(false /* fromExpansion */);
|
||||||
}
|
}
|
||||||
mStackAnimationController.moveStackFromTouch(
|
mStackAnimationController.moveStackFromTouch(
|
||||||
@@ -647,6 +657,10 @@ public class BubbleStackView extends FrameLayout
|
|||||||
|| (mPositioner.showingInTaskbar() && !mIsExpanded)) {
|
|| (mPositioner.showingInTaskbar() && !mIsExpanded)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (mShowedUserEducationInTouchListenerActive) {
|
||||||
|
mShowedUserEducationInTouchListenerActive = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// First, see if the magnetized object consumes the event - if so, the bubble was
|
// First, see if the magnetized object consumes the event - if so, the bubble was
|
||||||
// released in the target or flung out of it, and we should ignore the event.
|
// released in the target or flung out of it, and we should ignore the event.
|
||||||
@@ -739,6 +753,7 @@ public class BubbleStackView extends FrameLayout
|
|||||||
private ImageView mManageSettingsIcon;
|
private ImageView mManageSettingsIcon;
|
||||||
private TextView mManageSettingsText;
|
private TextView mManageSettingsText;
|
||||||
private boolean mShowingManage = false;
|
private boolean mShowingManage = false;
|
||||||
|
private boolean mShowedUserEducationInTouchListenerActive = false;
|
||||||
private PhysicsAnimator.SpringConfig mManageSpringConfig = new PhysicsAnimator.SpringConfig(
|
private PhysicsAnimator.SpringConfig mManageSpringConfig = new PhysicsAnimator.SpringConfig(
|
||||||
SpringForce.STIFFNESS_MEDIUM, SpringForce.DAMPING_RATIO_LOW_BOUNCY);
|
SpringForce.STIFFNESS_MEDIUM, SpringForce.DAMPING_RATIO_LOW_BOUNCY);
|
||||||
private BubblePositioner mPositioner;
|
private BubblePositioner mPositioner;
|
||||||
@@ -930,10 +945,12 @@ public class BubbleStackView extends FrameLayout
|
|||||||
showManageMenu(false /* show */);
|
showManageMenu(false /* show */);
|
||||||
} else if (mManageEduView != null && mManageEduView.getVisibility() == VISIBLE) {
|
} else if (mManageEduView != null && mManageEduView.getVisibility() == VISIBLE) {
|
||||||
mManageEduView.hide();
|
mManageEduView.hide();
|
||||||
} else if (mStackEduView != null && mStackEduView.getVisibility() == VISIBLE) {
|
} else if (isStackEduShowing()) {
|
||||||
mStackEduView.hide(false /* isExpanding */);
|
mStackEduView.hide(false /* isExpanding */);
|
||||||
} else if (mBubbleData.isExpanded()) {
|
} else if (mBubbleData.isExpanded()) {
|
||||||
mBubbleData.setExpanded(false);
|
mBubbleData.setExpanded(false);
|
||||||
|
} else {
|
||||||
|
maybeShowStackEdu();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1164,7 +1181,7 @@ public class BubbleStackView extends FrameLayout
|
|||||||
* @return true if education view for collapsed stack should show and was not showing before.
|
* @return true if education view for collapsed stack should show and was not showing before.
|
||||||
*/
|
*/
|
||||||
private boolean maybeShowStackEdu() {
|
private boolean maybeShowStackEdu() {
|
||||||
if (!shouldShowStackEdu()) {
|
if (!shouldShowStackEdu() || isExpanded()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (mStackEduView == null) {
|
if (mStackEduView == null) {
|
||||||
@@ -1175,9 +1192,13 @@ public class BubbleStackView extends FrameLayout
|
|||||||
return mStackEduView.show(mPositioner.getDefaultStartPosition());
|
return mStackEduView.show(mPositioner.getDefaultStartPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isStackEduShowing() {
|
||||||
|
return mStackEduView != null && mStackEduView.getVisibility() == VISIBLE;
|
||||||
|
}
|
||||||
|
|
||||||
// Recreates & shows the education views. Call when a theme/config change happens.
|
// Recreates & shows the education views. Call when a theme/config change happens.
|
||||||
private void updateUserEdu() {
|
private void updateUserEdu() {
|
||||||
if (mStackEduView != null && mStackEduView.getVisibility() == VISIBLE) {
|
if (isStackEduShowing()) {
|
||||||
removeView(mStackEduView);
|
removeView(mStackEduView);
|
||||||
mStackEduView = new StackEducationView(mContext, mPositioner, mBubbleController);
|
mStackEduView = new StackEducationView(mContext, mPositioner, mBubbleController);
|
||||||
addView(mStackEduView);
|
addView(mStackEduView);
|
||||||
@@ -1859,7 +1880,7 @@ public class BubbleStackView extends FrameLayout
|
|||||||
cancelDelayedExpandCollapseSwitchAnimations();
|
cancelDelayedExpandCollapseSwitchAnimations();
|
||||||
final boolean showVertically = mPositioner.showBubblesVertically();
|
final boolean showVertically = mPositioner.showBubblesVertically();
|
||||||
mIsExpanded = true;
|
mIsExpanded = true;
|
||||||
if (mStackEduView != null) {
|
if (isStackEduShowing()) {
|
||||||
mStackEduView.hide(true /* fromExpansion */);
|
mStackEduView.hide(true /* fromExpansion */);
|
||||||
}
|
}
|
||||||
beforeExpandedViewAnimation();
|
beforeExpandedViewAnimation();
|
||||||
@@ -2397,7 +2418,7 @@ public class BubbleStackView extends FrameLayout
|
|||||||
if (flyoutMessage == null
|
if (flyoutMessage == null
|
||||||
|| flyoutMessage.message == null
|
|| flyoutMessage.message == null
|
||||||
|| !bubble.showFlyout()
|
|| !bubble.showFlyout()
|
||||||
|| (mStackEduView != null && mStackEduView.getVisibility() == VISIBLE)
|
|| isStackEduShowing()
|
||||||
|| isExpanded()
|
|| isExpanded()
|
||||||
|| mIsExpansionAnimating
|
|| mIsExpansionAnimating
|
||||||
|| mIsGestureInProgress
|
|| mIsGestureInProgress
|
||||||
@@ -2519,7 +2540,7 @@ public class BubbleStackView extends FrameLayout
|
|||||||
* them.
|
* them.
|
||||||
*/
|
*/
|
||||||
public void getTouchableRegion(Rect outRect) {
|
public void getTouchableRegion(Rect outRect) {
|
||||||
if (mStackEduView != null && mStackEduView.getVisibility() == VISIBLE) {
|
if (isStackEduShowing()) {
|
||||||
// When user education shows then capture all touches
|
// When user education shows then capture all touches
|
||||||
outRect.set(0, 0, getWidth(), getHeight());
|
outRect.set(0, 0, getWidth(), getHeight());
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ class StackEducationView constructor(
|
|||||||
* @return true if user education was shown, false otherwise.
|
* @return true if user education was shown, false otherwise.
|
||||||
*/
|
*/
|
||||||
fun show(stackPosition: PointF): Boolean {
|
fun show(stackPosition: PointF): Boolean {
|
||||||
|
isHiding = false
|
||||||
if (visibility == VISIBLE) return false
|
if (visibility == VISIBLE) return false
|
||||||
|
|
||||||
controller.updateWindowFlagsForBackpress(true /* interceptBack */)
|
controller.updateWindowFlagsForBackpress(true /* interceptBack */)
|
||||||
@@ -164,6 +165,7 @@ class StackEducationView constructor(
|
|||||||
*/
|
*/
|
||||||
fun hide(isExpanding: Boolean) {
|
fun hide(isExpanding: Boolean) {
|
||||||
if (visibility != VISIBLE || isHiding) return
|
if (visibility != VISIBLE || isHiding) return
|
||||||
|
isHiding = true
|
||||||
|
|
||||||
controller.updateWindowFlagsForBackpress(false /* interceptBack */)
|
controller.updateWindowFlagsForBackpress(false /* interceptBack */)
|
||||||
animate()
|
animate()
|
||||||
|
|||||||
Reference in New Issue
Block a user