Merge "Update divider bar layout to match stage split design" into sc-v2-dev

This commit is contained in:
Android Build Prod User
2021-08-27 04:24:41 +00:00
committed by Android (Google) Code Review
9 changed files with 41 additions and 12 deletions

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2021 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@android:color/system_neutral2_500" android:lStar="35" />
</selector>

View File

@@ -22,7 +22,7 @@
<View
style="@style/DockedDividerBackground"
android:id="@+id/docked_divider_background"
android:background="@color/docked_divider_background"/>
android:background="@color/split_divider_background"/>
<com.android.wm.shell.legacysplitscreen.MinimizedDockShadow
style="@style/DockedDividerMinimizedShadow"

View File

@@ -21,8 +21,7 @@
<View
style="@style/DockedDividerBackground"
android:id="@+id/docked_divider_background"
android:background="@color/docked_divider_background"/>
android:id="@+id/docked_divider_background"/>
<com.android.wm.shell.common.split.DividerHandleView
style="@style/DockedDividerHandle"

View File

@@ -16,8 +16,12 @@
*/
-->
<resources>
<!-- Divider handle size for legacy split screen -->
<dimen name="docked_divider_handle_width">2dp</dimen>
<dimen name="docked_divider_handle_height">16dp</dimen>
<!-- Divider handle size for split screen -->
<dimen name="split_divider_handle_width">3dp</dimen>
<dimen name="split_divider_handle_height">72dp</dimen>
<!-- Padding between status bar and bubbles when displayed in expanded state, smaller
value in landscape since we have limited vertical space-->

View File

@@ -19,6 +19,7 @@
<item name="android:layout_width">10dp</item>
<item name="android:layout_height">match_parent</item>
<item name="android:layout_gravity">center_horizontal</item>
<item name="android:background">@color/split_divider_background</item>
</style>
<style name="DockedDividerHandle">

View File

@@ -17,7 +17,6 @@
*/
-->
<resources>
<color name="docked_divider_background">#ff000000</color>
<color name="docked_divider_handle">#ffffff</color>
<drawable name="forced_resizable_background">#59000000</drawable>
<color name="minimize_dock_shadow_start">#60000000</color>

View File

@@ -76,8 +76,12 @@
<!-- How high we lift the divider when touching -->
<dimen name="docked_stack_divider_lift_elevation">4dp</dimen>
<!-- Divider handle size for legacy split screen -->
<dimen name="docked_divider_handle_width">16dp</dimen>
<dimen name="docked_divider_handle_height">2dp</dimen>
<!-- Divider handle size for split screen -->
<dimen name="split_divider_handle_width">72dp</dimen>
<dimen name="split_divider_handle_height">3dp</dimen>
<!-- One-Handed Mode -->
<!-- Threshold for dragging distance to enable one-handed mode -->

View File

@@ -34,6 +34,7 @@
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">10dp</item>
<item name="android:layout_gravity">center_vertical</item>
<item name="android:background">@color/split_divider_background</item>
</style>
<style name="DockedDividerMinimizedShadow">

View File

@@ -70,7 +70,8 @@ public class DividerHandleView extends View {
private final Paint mPaint = new Paint();
private final int mWidth;
private final int mHeight;
private final int mCircleDiameter;
private final int mTouchingWidth;
private final int mTouchingHeight;
private int mCurrentWidth;
private int mCurrentHeight;
private AnimatorSet mAnimator;
@@ -80,11 +81,12 @@ public class DividerHandleView extends View {
super(context, attrs);
mPaint.setColor(getResources().getColor(R.color.docked_divider_handle, null));
mPaint.setAntiAlias(true);
mWidth = getResources().getDimensionPixelSize(R.dimen.docked_divider_handle_width);
mHeight = getResources().getDimensionPixelSize(R.dimen.docked_divider_handle_height);
mWidth = getResources().getDimensionPixelSize(R.dimen.split_divider_handle_width);
mHeight = getResources().getDimensionPixelSize(R.dimen.split_divider_handle_height);
mCurrentWidth = mWidth;
mCurrentHeight = mHeight;
mCircleDiameter = (mWidth + mHeight) / 3;
mTouchingWidth = mWidth > mHeight ? mWidth / 2 : mWidth;
mTouchingHeight = mHeight > mWidth ? mHeight / 2 : mHeight;
}
/** Sets touching state for this handle view. */
@@ -98,16 +100,16 @@ public class DividerHandleView extends View {
}
if (!animate) {
if (touching) {
mCurrentWidth = mCircleDiameter;
mCurrentHeight = mCircleDiameter;
mCurrentWidth = mTouchingWidth;
mCurrentHeight = mTouchingHeight;
} else {
mCurrentWidth = mWidth;
mCurrentHeight = mHeight;
}
invalidate();
} else {
animateToTarget(touching ? mCircleDiameter : mWidth,
touching ? mCircleDiameter : mHeight, touching);
animateToTarget(touching ? mTouchingWidth : mWidth,
touching ? mTouchingHeight : mHeight, touching);
}
mTouching = touching;
}