use of com.android.launcher3.InsettableFrameLayout.LayoutParams in project android_packages_apps_Launcher3 by AOSPA.
the class BaseDragLayer method onLayout.
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
int count = getChildCount();
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
final FrameLayout.LayoutParams flp = (FrameLayout.LayoutParams) child.getLayoutParams();
if (flp instanceof LayoutParams) {
final LayoutParams lp = (LayoutParams) flp;
if (lp.customPosition) {
child.layout(lp.x, lp.y, lp.x + lp.width, lp.y + lp.height);
}
}
}
}
use of com.android.launcher3.InsettableFrameLayout.LayoutParams in project android_packages_apps_Launcher3 by AOSPA.
the class FloatingSurfaceView method updateIconLocation.
private void updateIconLocation() {
if (mContract == null) {
return;
}
View icon = mLauncher.getFirstMatchForAppClose(-1, mContract.componentName.getPackageName(), mContract.user);
boolean iconChanged = mIcon != icon;
if (iconChanged) {
setCurrentIconVisible(true);
mIcon = icon;
setCurrentIconVisible(false);
}
if (icon != null && icon.isAttachedToWindow()) {
getLocationBoundsForView(mLauncher, icon, false, mTmpPosition, mIconBounds);
if (!mTmpPosition.equals(mIconPosition)) {
mIconPosition.set(mTmpPosition);
sendIconInfo();
LayoutParams lp = (LayoutParams) mSurfaceView.getLayoutParams();
lp.width = Math.round(mIconPosition.width());
lp.height = Math.round(mIconPosition.height());
lp.leftMargin = Math.round(mIconPosition.left);
lp.topMargin = Math.round(mIconPosition.top);
}
}
if (mIcon != null && iconChanged && !mIconBounds.isEmpty()) {
// Record the icon display
setCurrentIconVisible(true);
Canvas c = mPicture.beginRecording(mIconBounds.width(), mIconBounds.height());
c.translate(-mIconBounds.left, -mIconBounds.top);
mIcon.draw(c);
mPicture.endRecording();
setCurrentIconVisible(false);
drawOnSurface();
}
}
use of com.android.launcher3.InsettableFrameLayout.LayoutParams in project android_packages_apps_Launcher3 by AOSPA.
the class CellLayout method copyCurrentStateToSolution.
private void copyCurrentStateToSolution(ItemConfiguration solution, boolean temp) {
int childCount = mShortcutsAndWidgets.getChildCount();
for (int i = 0; i < childCount; i++) {
View child = mShortcutsAndWidgets.getChildAt(i);
LayoutParams lp = (LayoutParams) child.getLayoutParams();
CellAndSpan c;
if (temp) {
c = new CellAndSpan(lp.tmpCellX, lp.tmpCellY, lp.cellHSpan, lp.cellVSpan);
} else {
c = new CellAndSpan(lp.cellX, lp.cellY, lp.cellHSpan, lp.cellVSpan);
}
solution.add(child, c);
}
}
use of com.android.launcher3.InsettableFrameLayout.LayoutParams in project android_packages_apps_Trebuchet by LineageOS.
the class TaskView method setContextualChip.
/**
* Sets the contextual chip.
*
* @param view Wrapper view containing contextual chip.
*/
public void setContextualChip(View view) {
if (mContextualChipWrapper != null) {
removeView(mContextualChipWrapper);
}
if (view != null) {
mContextualChipWrapper = view;
LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
layoutParams.gravity = BOTTOM | CENTER_HORIZONTAL;
int expectedChipHeight = getExpectedViewHeight(view);
float chipOffset = getResources().getDimension(R.dimen.chip_hint_vertical_offset);
layoutParams.bottomMargin = (int) (((MarginLayoutParams) mSnapshotView.getLayoutParams()).bottomMargin - expectedChipHeight + chipOffset);
mContextualChip = ((FrameLayout) mContextualChipWrapper).getChildAt(0);
mContextualChip.setScaleX(0f);
mContextualChip.setScaleY(0f);
GradientDrawable scrimDrawable = (GradientDrawable) getResources().getDrawable(R.drawable.chip_scrim_gradient, mActivity.getTheme());
float cornerRadius = getTaskCornerRadius();
scrimDrawable.setCornerRadii(new float[] { 0, 0, 0, 0, cornerRadius, cornerRadius, cornerRadius, cornerRadius });
InsetDrawable scrimDrawableInset = new InsetDrawable(scrimDrawable, 0, 0, 0, (int) (expectedChipHeight - chipOffset));
mContextualChipWrapper.setBackground(scrimDrawableInset);
mContextualChipWrapper.setPadding(0, 0, 0, 0);
mContextualChipWrapper.setAlpha(0f);
addView(view, getChildCount(), layoutParams);
if (mContextualChip != null) {
mContextualChip.animate().scaleX(1f).scaleY(1f).setDuration(50);
}
if (mContextualChipWrapper != null) {
mChipTouchDelegate = new TransformingTouchDelegate(mContextualChipWrapper);
mContextualChipWrapper.animate().alpha(1f).setDuration(50);
}
}
}
use of com.android.launcher3.InsettableFrameLayout.LayoutParams in project android_packages_apps_Trebuchet by LineageOS.
the class CellLayout method beginOrAdjustReorderPreviewAnimations.
// This method starts or changes the reorder preview animations
private void beginOrAdjustReorderPreviewAnimations(ItemConfiguration solution, View dragView, int mode) {
int childCount = mShortcutsAndWidgets.getChildCount();
for (int i = 0; i < childCount; i++) {
View child = mShortcutsAndWidgets.getChildAt(i);
if (child == dragView)
continue;
CellAndSpan c = solution.map.get(child);
boolean skip = mode == ReorderPreviewAnimation.MODE_HINT && solution.intersectingViews != null && !solution.intersectingViews.contains(child);
LayoutParams lp = (LayoutParams) child.getLayoutParams();
if (c != null && !skip && (child instanceof Reorderable)) {
ReorderPreviewAnimation rha = new ReorderPreviewAnimation((Reorderable) child, mode, lp.cellX, lp.cellY, c.cellX, c.cellY, c.spanX, c.spanY);
rha.animate();
}
}
}
Aggregations