Merge "Hide PiP menu when expanding" into rvc-dev am: 86f8ef1aa8
Change-Id: I7172413ef6f6f5e787e8e921ce76a330aed2dcd8
This commit is contained in:
@@ -99,6 +99,7 @@ public class PipMenuActivity extends Activity {
|
||||
public static final int MESSAGE_ANIMATION_ENDED = 6;
|
||||
public static final int MESSAGE_POINTER_EVENT = 7;
|
||||
public static final int MESSAGE_MENU_EXPANDED = 8;
|
||||
public static final int MESSAGE_FADE_OUT_MENU = 9;
|
||||
|
||||
private static final int INITIAL_DISMISS_DELAY = 3500;
|
||||
private static final int POST_INTERACTION_DISMISS_DELAY = 2000;
|
||||
@@ -182,6 +183,10 @@ public class PipMenuActivity extends Activity {
|
||||
mMenuContainerAnimator.start();
|
||||
break;
|
||||
}
|
||||
case MESSAGE_FADE_OUT_MENU: {
|
||||
fadeOutMenu();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -409,6 +414,18 @@ public class PipMenuActivity extends Activity {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Different from {@link #hideMenu()}, this function does not try to finish this menu activity
|
||||
* and instead, it fades out the controls by setting the alpha to 0 directly without menu
|
||||
* visibility callbacks invoked.
|
||||
*/
|
||||
private void fadeOutMenu() {
|
||||
mMenuContainer.setAlpha(0f);
|
||||
mSettingsButton.setAlpha(0f);
|
||||
mDismissButton.setAlpha(0f);
|
||||
mResizeHandle.setAlpha(0f);
|
||||
}
|
||||
|
||||
private void hideMenu() {
|
||||
hideMenu(null);
|
||||
}
|
||||
|
||||
@@ -262,6 +262,9 @@ public class PipMenuActivityController {
|
||||
*/
|
||||
public void showMenuWithDelay(int menuState, Rect stackBounds, boolean allowMenuTimeout,
|
||||
boolean willResizeMenu, boolean showResizeHandle) {
|
||||
// hide all visible controls including close button and etc. first, this is to ensure
|
||||
// menu is totally invisible during the transition to eliminate unpleasant artifacts
|
||||
fadeOutMenu();
|
||||
showMenuInternal(menuState, stackBounds, allowMenuTimeout, willResizeMenu,
|
||||
true /* withDelay */, showResizeHandle);
|
||||
}
|
||||
@@ -347,6 +350,23 @@ public class PipMenuActivityController {
|
||||
}
|
||||
}
|
||||
|
||||
private void fadeOutMenu() {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "fadeOutMenu() state=" + mMenuState
|
||||
+ " hasActivity=" + (mToActivityMessenger != null)
|
||||
+ " callers=\n" + Debug.getCallers(5, " "));
|
||||
}
|
||||
if (mToActivityMessenger != null) {
|
||||
Message m = Message.obtain();
|
||||
m.what = PipMenuActivity.MESSAGE_FADE_OUT_MENU;
|
||||
try {
|
||||
mToActivityMessenger.send(m);
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "Could not notify menu to fade out", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides the menu activity.
|
||||
*/
|
||||
@@ -513,7 +533,8 @@ public class PipMenuActivityController {
|
||||
private void onMenuStateChanged(int menuState, boolean resize, Runnable callback) {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "onMenuStateChanged() mMenuState=" + mMenuState
|
||||
+ " menuState=" + menuState + " resize=" + resize);
|
||||
+ " menuState=" + menuState + " resize=" + resize
|
||||
+ " callers=\n" + Debug.getCallers(5, " "));
|
||||
}
|
||||
|
||||
if (menuState != mMenuState) {
|
||||
|
||||
Reference in New Issue
Block a user