Merge "Set taskbar to fullscreen for tooltip only once it is shown." into udc-qpr-dev
This commit is contained in:
@@ -35,6 +35,8 @@ import android.view.ContextThemeWrapper;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.app.animation.Interpolators;
|
||||
import com.android.launcher3.AbstractFloatingView;
|
||||
import com.android.launcher3.BubbleTextView;
|
||||
@@ -49,7 +51,7 @@ import com.android.launcher3.views.ArrowTipView;
|
||||
*/
|
||||
public class TaskbarHoverToolTipController implements View.OnHoverListener {
|
||||
|
||||
private static final int HOVER_TOOL_TIP_REVEAL_START_DELAY = 400;
|
||||
@VisibleForTesting protected static final int HOVER_TOOL_TIP_REVEAL_START_DELAY = 400;
|
||||
private static final int HOVER_TOOL_TIP_REVEAL_DURATION = 300;
|
||||
private static final int HOVER_TOOL_TIP_EXIT_DURATION = 150;
|
||||
|
||||
@@ -145,7 +147,6 @@ public class TaskbarHoverToolTipController implements View.OnHoverListener {
|
||||
}
|
||||
|
||||
private void startRevealHoverToolTip() {
|
||||
mActivity.setTaskbarWindowFullscreen(true);
|
||||
mHoverToolTipHandler.postDelayed(mRevealHoverToolTipRunnable,
|
||||
HOVER_TOOL_TIP_REVEAL_START_DELAY);
|
||||
}
|
||||
@@ -157,6 +158,7 @@ public class TaskbarHoverToolTipController implements View.OnHoverListener {
|
||||
if (mHoverView instanceof FolderIcon && !((FolderIcon) mHoverView).getIconVisible()) {
|
||||
return;
|
||||
}
|
||||
mActivity.setTaskbarWindowFullscreen(true);
|
||||
Rect iconViewBounds = Utilities.getViewBounds(mHoverView);
|
||||
mHoverToolTipView.showAtLocation(mToolTipText, iconViewBounds.centerX(),
|
||||
mTaskbarView.getTop(), /* shouldAutoClose= */ false);
|
||||
|
||||
+10
-3
@@ -18,6 +18,7 @@ package com.android.launcher3.taskbar;
|
||||
import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
|
||||
|
||||
import static com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_HOVERING_ICONS;
|
||||
import static com.android.launcher3.taskbar.TaskbarHoverToolTipController.HOVER_TOOL_TIP_REVEAL_START_DELAY;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
@@ -26,6 +27,7 @@ import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
@@ -56,7 +58,7 @@ import org.mockito.stubbing.Answer;
|
||||
*/
|
||||
@SmallTest
|
||||
@RunWith(AndroidTestingRunner.class)
|
||||
@TestableLooper.RunWithLooper
|
||||
@TestableLooper.RunWithLooper(setAsMainLooper = true)
|
||||
public class TaskbarHoverToolTipControllerTest extends TaskbarBaseTestCase {
|
||||
|
||||
private TaskbarHoverToolTipController mTaskbarHoverToolTipController;
|
||||
@@ -126,8 +128,10 @@ public class TaskbarHoverToolTipControllerTest extends TaskbarBaseTestCase {
|
||||
|
||||
boolean hoverHandled =
|
||||
mTaskbarHoverToolTipController.onHover(mHoverBubbleTextView, mMotionEvent);
|
||||
waitForIdleSync();
|
||||
|
||||
// Verify fullscreen is not set until the delayed runnable to reveal the tooltip has run
|
||||
verify(taskbarActivityContext, never()).setTaskbarWindowFullscreen(true);
|
||||
waitForIdleSync();
|
||||
assertThat(hoverHandled).isTrue();
|
||||
verify(taskbarActivityContext).setAutohideSuspendFlag(FLAG_AUTOHIDE_SUSPEND_HOVERING_ICONS,
|
||||
true);
|
||||
@@ -155,8 +159,10 @@ public class TaskbarHoverToolTipControllerTest extends TaskbarBaseTestCase {
|
||||
|
||||
boolean hoverHandled =
|
||||
mTaskbarHoverToolTipController.onHover(mHoverFolderIcon, mMotionEvent);
|
||||
waitForIdleSync();
|
||||
|
||||
// Verify fullscreen is not set until the delayed runnable to reveal the tooltip has run
|
||||
verify(taskbarActivityContext, never()).setTaskbarWindowFullscreen(true);
|
||||
waitForIdleSync();
|
||||
assertThat(hoverHandled).isTrue();
|
||||
verify(taskbarActivityContext).setAutohideSuspendFlag(FLAG_AUTOHIDE_SUSPEND_HOVERING_ICONS,
|
||||
true);
|
||||
@@ -216,6 +222,7 @@ public class TaskbarHoverToolTipControllerTest extends TaskbarBaseTestCase {
|
||||
}
|
||||
|
||||
private void waitForIdleSync() {
|
||||
mTestableLooper.moveTimeForward(HOVER_TOOL_TIP_REVEAL_START_DELAY + 1);
|
||||
mTestableLooper.processAllMessages();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user