mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 15:26:58 +00:00
Change Pinned taskbar corners to be fixed.
Based on new UX guidelines, the corners for the pinned taskbar should be 16 dp. Fix: 337872323 Test: Put device in 3 button mode and pinned taskbar and observe sharper, fixed corners. Transient taskbar remains unchanged. Flag: EXEMPT bugfix Change-Id: I2130e91dcdc0afb007fde93438f3fa603bc15af8
This commit is contained in:
@@ -63,7 +63,6 @@ import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
import android.view.Gravity;
|
||||
import android.view.RoundedCorner;
|
||||
import android.view.Surface;
|
||||
import android.view.View;
|
||||
import android.view.WindowInsets;
|
||||
@@ -167,7 +166,6 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
private final TaskbarControllers mControllers;
|
||||
|
||||
private final WindowManager mWindowManager;
|
||||
private final @Nullable RoundedCorner mLeftCorner, mRightCorner;
|
||||
private DeviceProfile mDeviceProfile;
|
||||
private WindowManager.LayoutParams mWindowLayoutParams;
|
||||
private boolean mIsFullscreen;
|
||||
@@ -228,16 +226,8 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
Context c = getApplicationContext();
|
||||
mWindowManager = c.getSystemService(WindowManager.class);
|
||||
|
||||
boolean phoneMode = isPhoneMode();
|
||||
mLeftCorner = phoneMode
|
||||
? null
|
||||
: display.getRoundedCorner(RoundedCorner.POSITION_BOTTOM_LEFT);
|
||||
mRightCorner = phoneMode
|
||||
? null
|
||||
: display.getRoundedCorner(RoundedCorner.POSITION_BOTTOM_RIGHT);
|
||||
|
||||
// Inflate views.
|
||||
int taskbarLayout = DisplayController.isTransientTaskbar(this) && !phoneMode
|
||||
int taskbarLayout = DisplayController.isTransientTaskbar(this) && !isPhoneMode()
|
||||
? R.layout.transient_taskbar
|
||||
: R.layout.taskbar;
|
||||
mDragLayer = (TaskbarDragLayer) mLayoutInflater.inflate(taskbarLayout, null, false);
|
||||
@@ -617,12 +607,9 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
return mImeDrawsImeNavBar;
|
||||
}
|
||||
|
||||
public int getLeftCornerRadius() {
|
||||
return mLeftCorner == null ? 0 : mLeftCorner.getRadius();
|
||||
}
|
||||
|
||||
public int getRightCornerRadius() {
|
||||
return mRightCorner == null ? 0 : mRightCorner.getRadius();
|
||||
public int getCornerRadius() {
|
||||
return isPhoneMode() ? 0 : getResources().getDimensionPixelSize(
|
||||
R.dimen.persistent_taskbar_corner_radius);
|
||||
}
|
||||
|
||||
public WindowManager.LayoutParams getWindowLayoutParams() {
|
||||
@@ -1015,7 +1002,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
|
||||
|
||||
return mDeviceProfile.taskbarHeight
|
||||
+ Math.max(getLeftCornerRadius(), getRightCornerRadius())
|
||||
+ getCornerRadius()
|
||||
+ extraHeightForTaskbarTooltips;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,15 +66,13 @@ class TaskbarBackgroundRenderer(private val context: TaskbarActivityContext) {
|
||||
private var keyShadowDistance = 0f
|
||||
private var bottomMargin = 0
|
||||
|
||||
private val fullLeftCornerRadius = context.leftCornerRadius.toFloat()
|
||||
private val fullRightCornerRadius = context.rightCornerRadius.toFloat()
|
||||
private var leftCornerRadius = fullLeftCornerRadius
|
||||
private var rightCornerRadius = fullRightCornerRadius
|
||||
private val fullCornerRadius = context.cornerRadius.toFloat()
|
||||
private var cornerRadius = fullCornerRadius
|
||||
private var widthInsetPercentage = 0f
|
||||
private val square: Path = Path()
|
||||
private val circle: Path = Path()
|
||||
private val invertedLeftCornerPath: Path = Path()
|
||||
private val invertedRightCornerPath: Path = Path()
|
||||
private val square = Path()
|
||||
private val circle = Path()
|
||||
private val invertedLeftCornerPath = Path()
|
||||
private val invertedRightCornerPath = Path()
|
||||
|
||||
private var stashedHandleWidth =
|
||||
context.resources.getDimensionPixelSize(R.dimen.taskbar_stashed_handle_width)
|
||||
@@ -103,7 +101,7 @@ class TaskbarBackgroundRenderer(private val context: TaskbarActivityContext) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the roundness of the round corner above Taskbar. No effect on transient Taskkbar.
|
||||
* Sets the roundness of the round corner above Taskbar. No effect on transient Taskbar.
|
||||
*
|
||||
* @param cornerRoundness 0 has no round corner, 1 has complete round corner.
|
||||
*/
|
||||
@@ -112,21 +110,18 @@ class TaskbarBackgroundRenderer(private val context: TaskbarActivityContext) {
|
||||
return
|
||||
}
|
||||
|
||||
leftCornerRadius = fullLeftCornerRadius * cornerRoundness
|
||||
rightCornerRadius = fullRightCornerRadius * cornerRoundness
|
||||
cornerRadius = fullCornerRadius * cornerRoundness
|
||||
|
||||
// Create the paths for the inverted rounded corners above the taskbar. Start with a filled
|
||||
// square, and then subtract out a circle from the appropriate corner.
|
||||
square.reset()
|
||||
square.addRect(0f, 0f, leftCornerRadius, leftCornerRadius, Path.Direction.CW)
|
||||
square.addRect(0f, 0f, cornerRadius, cornerRadius, Path.Direction.CW)
|
||||
circle.reset()
|
||||
circle.addCircle(leftCornerRadius, 0f, leftCornerRadius, Path.Direction.CW)
|
||||
circle.addCircle(cornerRadius, 0f, cornerRadius, Path.Direction.CW)
|
||||
invertedLeftCornerPath.op(square, circle, Path.Op.DIFFERENCE)
|
||||
|
||||
square.reset()
|
||||
square.addRect(0f, 0f, rightCornerRadius, rightCornerRadius, Path.Direction.CW)
|
||||
circle.reset()
|
||||
circle.addCircle(0f, 0f, rightCornerRadius, Path.Direction.CW)
|
||||
circle.addCircle(0f, 0f, cornerRadius, Path.Direction.CW)
|
||||
invertedRightCornerPath.op(square, circle, Path.Op.DIFFERENCE)
|
||||
}
|
||||
|
||||
@@ -160,10 +155,10 @@ class TaskbarBackgroundRenderer(private val context: TaskbarActivityContext) {
|
||||
}
|
||||
|
||||
// Draw the inverted rounded corners above the taskbar.
|
||||
canvas.translate(0f, -leftCornerRadius)
|
||||
canvas.translate(0f, -cornerRadius)
|
||||
canvas.drawPath(invertedLeftCornerPath, paint)
|
||||
canvas.translate(0f, leftCornerRadius)
|
||||
canvas.translate(canvas.width - rightCornerRadius, -rightCornerRadius)
|
||||
canvas.translate(0f, cornerRadius)
|
||||
canvas.translate(canvas.width - cornerRadius, -cornerRadius)
|
||||
canvas.drawPath(invertedRightCornerPath, paint)
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@ import com.android.launcher3.pm.UserCache
|
||||
import com.android.launcher3.testing.TestLogging
|
||||
import com.android.launcher3.testing.shared.TestProtocol
|
||||
import com.android.launcher3.util.CancellableTask
|
||||
import com.android.launcher3.util.DisplayController
|
||||
import com.android.launcher3.util.Executors
|
||||
import com.android.launcher3.util.RunnableList
|
||||
import com.android.launcher3.util.SafeCloseable
|
||||
@@ -75,6 +76,7 @@ import com.android.launcher3.util.TraceHelper
|
||||
import com.android.launcher3.util.TransformingTouchDelegate
|
||||
import com.android.launcher3.util.ViewPool
|
||||
import com.android.launcher3.util.rects.set
|
||||
import com.android.launcher3.views.ActivityContext
|
||||
import com.android.quickstep.RecentsModel
|
||||
import com.android.quickstep.RemoteAnimationTargets
|
||||
import com.android.quickstep.TaskAnimationManager
|
||||
@@ -1521,7 +1523,20 @@ constructor(
|
||||
|
||||
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)
|
||||
open fun computeWindowCornerRadius(context: Context): Float {
|
||||
return QuickStepContract.getWindowCornerRadius(context)
|
||||
val activityContext: ActivityContext? = ActivityContext.lookupContextNoThrow(context)
|
||||
|
||||
// The corner radius is fixed to match when Taskbar is persistent mode
|
||||
return if (
|
||||
activityContext != null &&
|
||||
activityContext.deviceProfile?.isTaskbarPresent == true &&
|
||||
DisplayController.isTransientTaskbar(context)
|
||||
) {
|
||||
context.resources
|
||||
.getDimensionPixelSize(R.dimen.persistent_taskbar_corner_radius)
|
||||
.toFloat()
|
||||
} else {
|
||||
QuickStepContract.getWindowCornerRadius(context)
|
||||
}
|
||||
}
|
||||
|
||||
/** Sets the progress in range [0, 1] */
|
||||
|
||||
@@ -443,6 +443,9 @@
|
||||
<!-- Size of the maximum radius for the enforced rounded rectangles. -->
|
||||
<dimen name="enforced_rounded_corner_max_radius">16dp</dimen>
|
||||
|
||||
<!-- Size of the radius for the rounded corners of Persistent Taskbar. -->
|
||||
<dimen name="persistent_taskbar_corner_radius">16dp</dimen>
|
||||
|
||||
<!-- Base Swipe Detector, speed in dp/s -->
|
||||
<dimen name="base_swift_detector_fling_release_velocity">1dp</dimen>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user