Merge "Add framework flag to allow enable/disable resize." into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
c805ce31f7
@@ -464,6 +464,9 @@
|
|||||||
<!-- Allow dragging the PIP to a location to close it -->
|
<!-- Allow dragging the PIP to a location to close it -->
|
||||||
<bool name="config_pipEnableDismissDragToEdge">true</bool>
|
<bool name="config_pipEnableDismissDragToEdge">true</bool>
|
||||||
|
|
||||||
|
<!-- Alow PIP to resize to a slightly bigger state upon touch/showing the menu -->
|
||||||
|
<bool name="config_pipEnableResizeForMenu">true</bool>
|
||||||
|
|
||||||
<!-- SystemUI Plugins that can be loaded on user builds. -->
|
<!-- SystemUI Plugins that can be loaded on user builds. -->
|
||||||
<string-array name="config_pluginWhitelist" translatable="false">
|
<string-array name="config_pluginWhitelist" translatable="false">
|
||||||
<item>com.android.systemui</item>
|
<item>com.android.systemui</item>
|
||||||
|
|||||||
@@ -67,6 +67,8 @@ public class PipTouchHandler {
|
|||||||
|
|
||||||
// Allow dragging the PIP to a location to close it
|
// Allow dragging the PIP to a location to close it
|
||||||
private final boolean mEnableDismissDragToEdge;
|
private final boolean mEnableDismissDragToEdge;
|
||||||
|
// Allow PIP to resize to a slightly bigger state upon touch
|
||||||
|
private final boolean mEnableResize;
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final IActivityManager mActivityManager;
|
private final IActivityManager mActivityManager;
|
||||||
private final PipBoundsHandler mPipBoundsHandler;
|
private final PipBoundsHandler mPipBoundsHandler;
|
||||||
@@ -188,6 +190,7 @@ public class PipTouchHandler {
|
|||||||
mImeOffset = res.getDimensionPixelSize(R.dimen.pip_ime_offset);
|
mImeOffset = res.getDimensionPixelSize(R.dimen.pip_ime_offset);
|
||||||
|
|
||||||
mEnableDismissDragToEdge = res.getBoolean(R.bool.config_pipEnableDismissDragToEdge);
|
mEnableDismissDragToEdge = res.getBoolean(R.bool.config_pipEnableDismissDragToEdge);
|
||||||
|
mEnableResize = res.getBoolean(R.bool.config_pipEnableResizeForMenu);
|
||||||
|
|
||||||
// Register the listener for input consumer touch events
|
// Register the listener for input consumer touch events
|
||||||
inputConsumerController.setInputListener(this::handleTouchEvent);
|
inputConsumerController.setInputListener(this::handleTouchEvent);
|
||||||
@@ -297,7 +300,7 @@ public class PipTouchHandler {
|
|||||||
} else {
|
} else {
|
||||||
final float offsetBufferPx = BOTTOM_OFFSET_BUFFER_DP
|
final float offsetBufferPx = BOTTOM_OFFSET_BUFFER_DP
|
||||||
* mContext.getResources().getDisplayMetrics().density;
|
* mContext.getResources().getDisplayMetrics().density;
|
||||||
final Rect toMovementBounds = mMenuState == MENU_STATE_FULL
|
final Rect toMovementBounds = mMenuState == MENU_STATE_FULL && willResizeMenu()
|
||||||
? new Rect(expandedMovementBounds)
|
? new Rect(expandedMovementBounds)
|
||||||
: new Rect(normalMovementBounds);
|
: new Rect(normalMovementBounds);
|
||||||
final int prevBottom = mMovementBounds.bottom - mMovementBoundsExtraOffsets;
|
final int prevBottom = mMovementBounds.bottom - mMovementBoundsExtraOffsets;
|
||||||
@@ -691,11 +694,12 @@ public class PipTouchHandler {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the current movement bounds based on whether the menu is currently visible.
|
* Updates the current movement bounds based on whether the menu is currently visible and
|
||||||
|
* resized.
|
||||||
*/
|
*/
|
||||||
private void updateMovementBounds(int menuState) {
|
private void updateMovementBounds(int menuState) {
|
||||||
boolean isMenuExpanded = menuState == MENU_STATE_FULL;
|
boolean isMenuExpanded = menuState == MENU_STATE_FULL;
|
||||||
mMovementBounds = isMenuExpanded
|
mMovementBounds = isMenuExpanded && willResizeMenu()
|
||||||
? mExpandedMovementBounds
|
? mExpandedMovementBounds
|
||||||
: mNormalMovementBounds;
|
: mNormalMovementBounds;
|
||||||
mPipBoundsHandler.setMinEdgeSize(
|
mPipBoundsHandler.setMinEdgeSize(
|
||||||
@@ -715,8 +719,11 @@ public class PipTouchHandler {
|
|||||||
* @return whether the menu will resize as a part of showing the full menu.
|
* @return whether the menu will resize as a part of showing the full menu.
|
||||||
*/
|
*/
|
||||||
private boolean willResizeMenu() {
|
private boolean willResizeMenu() {
|
||||||
return mExpandedBounds.width() != mNormalBounds.width() ||
|
if (!mEnableResize) {
|
||||||
mExpandedBounds.height() != mNormalBounds.height();
|
return false;
|
||||||
|
}
|
||||||
|
return mExpandedBounds.width() != mNormalBounds.width()
|
||||||
|
|| mExpandedBounds.height() != mNormalBounds.height();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dump(PrintWriter pw, String prefix) {
|
public void dump(PrintWriter pw, String prefix) {
|
||||||
|
|||||||
Reference in New Issue
Block a user