mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 01:46:49 +00:00
Set thumbnails for GroupedTaskView based on split layout bounds
Bug: 181704764 Test: Go to stage split in landscape w/ home rotation on/off, swipe up. Thumbnails aren't perfectly overlaid, polish needed Change-Id: I54e39cc5a18f527e80a664d60aca72dfd706ebdc
This commit is contained in:
@@ -35,6 +35,7 @@ import android.view.MotionEvent;
|
||||
import android.view.Surface;
|
||||
import android.view.VelocityTracker;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
@@ -507,6 +508,39 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupedTaskViewThumbnailBounds(View mSnapshotView, View mSnapshotView2,
|
||||
View taskParent, SplitConfigurationOptions.StagedSplitBounds splitBoundsConfig,
|
||||
DeviceProfile dp) {
|
||||
int spaceAboveSnapshot = dp.overviewTaskThumbnailTopMarginPx;
|
||||
int totalThumbnailHeight = taskParent.getHeight() - spaceAboveSnapshot;
|
||||
int totalThumbnailWidth = taskParent.getWidth();
|
||||
int dividerBar = (dp.isLandscape ?
|
||||
splitBoundsConfig.mDividerBounds.width() :
|
||||
splitBoundsConfig.mDividerBounds.height())
|
||||
/ 2;
|
||||
ViewGroup.LayoutParams primaryLp = mSnapshotView.getLayoutParams();
|
||||
ViewGroup.LayoutParams secondaryLp = mSnapshotView2.getLayoutParams();
|
||||
|
||||
if (dp.isLandscape) {
|
||||
primaryLp.height = totalThumbnailHeight;
|
||||
primaryLp.width = (int)(totalThumbnailWidth * splitBoundsConfig.mLeftTaskPercent);
|
||||
|
||||
secondaryLp.height = totalThumbnailHeight;
|
||||
secondaryLp.width = totalThumbnailWidth - primaryLp.width - dividerBar;
|
||||
mSnapshotView2.setTranslationX(primaryLp.width + dividerBar);
|
||||
mSnapshotView2.setTranslationY(spaceAboveSnapshot);
|
||||
} else {
|
||||
primaryLp.width = totalThumbnailWidth;
|
||||
primaryLp.height = (int)(totalThumbnailHeight * splitBoundsConfig.mTopTaskPercent);
|
||||
|
||||
secondaryLp.width = totalThumbnailWidth;
|
||||
secondaryLp.height = totalThumbnailHeight - primaryLp.height - dividerBar;
|
||||
mSnapshotView2.setTranslationY(primaryLp.height + spaceAboveSnapshot + dividerBar);
|
||||
mSnapshotView2.setTranslationX(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FloatProperty getSplitSelectTaskOffset(FloatProperty primary, FloatProperty secondary,
|
||||
DeviceProfile dp) {
|
||||
|
||||
Reference in New Issue
Block a user