mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-11 14:54:00 +00:00
Merge "Change Pinned taskbar corners to be fixed." into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
f3e12f2b31
@@ -62,7 +62,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;
|
||||
@@ -166,7 +165,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;
|
||||
@@ -227,16 +225,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);
|
||||
@@ -615,12 +605,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() {
|
||||
@@ -1013,7 +1000,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)
|
||||
@@ -114,7 +112,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.
|
||||
*/
|
||||
@@ -123,21 +121,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)
|
||||
}
|
||||
|
||||
@@ -171,10 +166,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.MultiPropertyFactory
|
||||
import com.android.launcher3.util.MultiPropertyFactory.MULTI_PROPERTY_VALUE
|
||||
@@ -76,6 +77,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
|
||||
@@ -1574,7 +1576,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] */
|
||||
|
||||
@@ -448,6 +448,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