mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-02 08:56:55 +00:00
Show Digital Wellbeing Banners for split tasks
Fixes: 199936292 Change-Id: I38743d58f53a65ef717b1babc21ad1df2dc840a4
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.launcher3.touch;
|
||||
|
||||
import static android.view.Gravity.BOTTOM;
|
||||
import static android.view.Gravity.CENTER_VERTICAL;
|
||||
import static android.view.Gravity.END;
|
||||
import static android.view.Gravity.START;
|
||||
@@ -29,6 +30,7 @@ import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_TYPE_MA
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.Rect;
|
||||
import android.util.Pair;
|
||||
import android.view.Surface;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
@@ -105,6 +107,47 @@ public class SeascapePagedViewHandler extends LandscapePagedViewHandler {
|
||||
return new PointF(-margin, margin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<Float, Float> setDwbLayoutParamsAndGetTranslations(int taskViewWidth,
|
||||
int taskViewHeight, StagedSplitBounds splitBounds, DeviceProfile deviceProfile,
|
||||
View[] thumbnailViews, int desiredTaskId, View banner) {
|
||||
float translationX = 0;
|
||||
float translationY = 0;
|
||||
FrameLayout.LayoutParams bannerParams = (FrameLayout.LayoutParams) banner.getLayoutParams();
|
||||
banner.setPivotX(0);
|
||||
banner.setPivotY(0);
|
||||
banner.setRotation(getDegreesRotated());
|
||||
FrameLayout.LayoutParams snapshotParams =
|
||||
(FrameLayout.LayoutParams) thumbnailViews[0]
|
||||
.getLayoutParams();
|
||||
bannerParams.gravity = BOTTOM | END;
|
||||
translationX = taskViewWidth - banner.getHeight();
|
||||
if (splitBounds == null) {
|
||||
// Single, fullscreen case
|
||||
bannerParams.width = taskViewHeight - snapshotParams.topMargin;
|
||||
translationY = banner.getHeight();
|
||||
return new Pair<>(translationX, translationY);
|
||||
}
|
||||
|
||||
// Set correct width
|
||||
if (desiredTaskId == splitBounds.leftTopTaskId) {
|
||||
bannerParams.width = thumbnailViews[1].getMeasuredHeight();
|
||||
} else {
|
||||
bannerParams.width = thumbnailViews[0].getMeasuredHeight();
|
||||
}
|
||||
|
||||
// Set translations
|
||||
if (desiredTaskId == splitBounds.rightBottomTaskId) {
|
||||
translationY = -(taskViewHeight - snapshotParams.topMargin)
|
||||
* (1f - splitBounds.leftTaskPercent)
|
||||
+ banner.getHeight();
|
||||
}
|
||||
if (desiredTaskId == splitBounds.leftTopTaskId) {
|
||||
translationY = banner.getHeight();
|
||||
}
|
||||
return new Pair<>(translationX, translationY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDistanceToBottomOfRect(DeviceProfile dp, Rect rect) {
|
||||
return dp.widthPx - rect.right;
|
||||
|
||||
Reference in New Issue
Block a user