Merge "Move FloatingTaskInit set up into init method" into sc-v2-dev

This commit is contained in:
Fedor Kudasov
2021-11-19 10:26:46 +00:00
committed by Android (Google) Code Review

View File

@@ -73,6 +73,32 @@ public class FloatingTaskView extends FrameLayout {
mSplitPlaceholderView.setAlpha(0);
}
private void init(StatefulActivity launcher, TaskView originalView, RectF positionOut) {
mStartingPosition = positionOut;
updateInitialPositionForView(originalView);
final InsettableFrameLayout.LayoutParams lp =
(InsettableFrameLayout.LayoutParams) getLayoutParams();
mSplitPlaceholderView.setLayoutParams(new FrameLayout.LayoutParams(lp.width, lp.height));
positionOut.round(mOutline);
setPivotX(0);
setPivotY(0);
// Copy bounds of exiting thumbnail into ImageView
TaskThumbnailView thumbnail = originalView.getThumbnail();
mImageView.setImageBitmap(thumbnail.getThumbnail());
mImageView.setVisibility(VISIBLE);
mOrientationHandler = originalView.getRecentsView().getPagedOrientationHandler();
mSplitPlaceholderView.setIconView(originalView.getIconView(),
launcher.getDeviceProfile().overviewTaskIconDrawableSizePx);
mSplitPlaceholderView.getIconView().setRotation(mOrientationHandler.getDegreesRotated());
}
/**
* Configures and returns a an instance of {@link FloatingTaskView} initially matching the
* appearance of {@code originalView}.
*/
public static FloatingTaskView getFloatingTaskView(StatefulActivity launcher,
TaskView originalView, RectF positionOut) {
final BaseDragLayer dragLayer = launcher.getDragLayer();
@@ -80,28 +106,7 @@ public class FloatingTaskView extends FrameLayout {
final FloatingTaskView floatingView = (FloatingTaskView) launcher.getLayoutInflater()
.inflate(R.layout.floating_split_select_view, parent, false);
floatingView.mStartingPosition = positionOut;
floatingView.updateInitialPositionForView(originalView);
final InsettableFrameLayout.LayoutParams lp =
(InsettableFrameLayout.LayoutParams) floatingView.getLayoutParams();
floatingView.mSplitPlaceholderView.setLayoutParams(
new FrameLayout.LayoutParams(lp.width, lp.height));
positionOut.round(floatingView.mOutline);
floatingView.setPivotX(0);
floatingView.setPivotY(0);
// Copy bounds of exiting thumbnail into ImageView
TaskThumbnailView thumbnail = originalView.getThumbnail();
floatingView.mImageView.setImageBitmap(thumbnail.getThumbnail());
floatingView.mImageView.setVisibility(VISIBLE);
floatingView.mOrientationHandler =
originalView.getRecentsView().getPagedOrientationHandler();
floatingView.mSplitPlaceholderView.setIconView(originalView.getIconView(),
launcher.getDeviceProfile().overviewTaskIconDrawableSizePx);
floatingView.mSplitPlaceholderView.getIconView()
.setRotation(floatingView.mOrientationHandler.getDegreesRotated());
floatingView.init(launcher, originalView, positionOut);
parent.addView(floatingView);
return floatingView;
}