Search in sources :

Example 1 with TransformingTouchDelegate

use of com.android.launcher3.util.TransformingTouchDelegate in project android_packages_apps_Launcher3 by crdroidandroid.

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(((View) getParent()).getMeasuredWidth(), LayoutParams.WRAP_CONTENT);
        layoutParams.gravity = BOTTOM | CENTER_HORIZONTAL;
        int expectedChipHeight = getExpectedViewHeight(view);
        float chipOffset = getResources().getDimension(R.dimen.chip_hint_vertical_offset);
        layoutParams.bottomMargin = -expectedChipHeight - (int) chipOffset;
        mContextualChipWrapper.setScaleX(0f);
        mContextualChipWrapper.setScaleY(0f);
        addView(view, getChildCount(), layoutParams);
        if (mContextualChipWrapper != null) {
            float scale = comp(mModalness);
            mContextualChipWrapper.animate().scaleX(scale).scaleY(scale).setDuration(50);
            mChipTouchDelegate = new TransformingTouchDelegate(mContextualChipWrapper);
        }
    }
}
Also used : TransformingTouchDelegate(com.android.launcher3.util.TransformingTouchDelegate)

Example 2 with TransformingTouchDelegate

use of com.android.launcher3.util.TransformingTouchDelegate in project android_packages_apps_Launcher3 by AOSPA.

the class TaskView method onFinishInflate.

@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    mSnapshotView = findViewById(R.id.snapshot);
    mIconView = findViewById(R.id.icon);
    mIconTouchDelegate = new TransformingTouchDelegate(mIconView);
}
Also used : TransformingTouchDelegate(com.android.launcher3.util.TransformingTouchDelegate)

Example 3 with TransformingTouchDelegate

use of com.android.launcher3.util.TransformingTouchDelegate 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);
        }
    }
}
Also used : TransformingTouchDelegate(com.android.launcher3.util.TransformingTouchDelegate) InsetDrawable(android.graphics.drawable.InsetDrawable) GradientDrawable(android.graphics.drawable.GradientDrawable)

Example 4 with TransformingTouchDelegate

use of com.android.launcher3.util.TransformingTouchDelegate in project android_packages_apps_Launcher3 by ArrowOS.

the class GroupedTaskView method onFinishInflate.

@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    mSnapshotView2 = findViewById(R.id.bottomright_snapshot);
    mIconView2 = findViewById(R.id.bottomRight_icon);
    mIcon2TouchDelegate = new TransformingTouchDelegate(mIconView2);
}
Also used : TransformingTouchDelegate(com.android.launcher3.util.TransformingTouchDelegate)

Example 5 with TransformingTouchDelegate

use of com.android.launcher3.util.TransformingTouchDelegate in project android_packages_apps_Launcher3 by ProtonAOSP.

the class GroupedTaskView method onFinishInflate.

@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    mSnapshotView2 = findViewById(R.id.bottomright_snapshot);
    mIconView2 = findViewById(R.id.bottomRight_icon);
    mIcon2TouchDelegate = new TransformingTouchDelegate(mIconView2);
}
Also used : TransformingTouchDelegate(com.android.launcher3.util.TransformingTouchDelegate)

Aggregations

TransformingTouchDelegate (com.android.launcher3.util.TransformingTouchDelegate)12 GradientDrawable (android.graphics.drawable.GradientDrawable)1 InsetDrawable (android.graphics.drawable.InsetDrawable)1