Search in sources :

Example 16 with Outline

use of android.graphics.Outline in project android_frameworks_base by crdroidandroid.

the class TaskView method onFinishInflate.

@Override
protected void onFinishInflate() {
    // Bind the views
    mHeaderView = (TaskViewHeader) findViewById(R.id.task_view_bar);
    mThumbnailView = (TaskViewThumbnail) findViewById(R.id.task_view_thumbnail);
    mThumbnailView.updateClipToTaskBar(mHeaderView);
    mActionButtonView = findViewById(R.id.lock_to_app_fab);
    mActionButtonView.setOutlineProvider(new ViewOutlineProvider() {

        @Override
        public void getOutline(View view, Outline outline) {
            // Set the outline to match the FAB background
            outline.setOval(0, 0, mActionButtonView.getWidth(), mActionButtonView.getHeight());
            outline.setAlpha(0.35f);
        }
    });
    mActionButtonView.setOnClickListener(this);
    mActionButtonTranslationZ = mActionButtonView.getTranslationZ();
}
Also used : Outline(android.graphics.Outline) ViewOutlineProvider(android.view.ViewOutlineProvider) View(android.view.View) TextView(android.widget.TextView)

Example 17 with Outline

use of android.graphics.Outline in project android_frameworks_base by crdroidandroid.

the class TaskCardView method setAsScreenShotView.

private void setAsScreenShotView(Bitmap screenshot, ImageView screenshotView) {
    LayoutParams lp = (LayoutParams) screenshotView.getLayoutParams();
    lp.width = LayoutParams.MATCH_PARENT;
    lp.height = LayoutParams.MATCH_PARENT;
    screenshotView.setLayoutParams(lp);
    screenshotView.setClipToOutline(true);
    screenshotView.setOutlineProvider(new ViewOutlineProvider() {

        @Override
        public void getOutline(View view, Outline outline) {
            outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), mCornerRadius);
        }
    });
    screenshotView.setImageBitmap(screenshot);
}
Also used : Outline(android.graphics.Outline) ViewOutlineProvider(android.view.ViewOutlineProvider) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView)

Example 18 with Outline

use of android.graphics.Outline in project Depth-LIB-Android- by danielzeller.

the class DepthLayout method initView.

private void initView(AttributeSet attrs) {
    edgePaint.setColor(DEFAULT_EDGE_COLOR);
    edgePaint.setAntiAlias(true);
    if (attrs != null) {
        TypedArray arr = getContext().obtainStyledAttributes(attrs, R.styleable.DepthView);
        edgePaint.setColor(arr.getInt(R.styleable.DepthView_edge_color, DEFAULT_EDGE_COLOR));
        setIsCircle(arr.getBoolean(R.styleable.DepthView_is_circle, false));
        depth = arr.getDimension(R.styleable.DepthView_depth, DEFAULT_THICKNESS * getResources().getDisplayMetrics().density);
        customShadowElevation = arr.getDimension(R.styleable.DepthView_custom_elevation, 0);
    } else {
        edgePaint.setColor(DEFAULT_EDGE_COLOR);
        depth = DEFAULT_THICKNESS * getResources().getDisplayMetrics().density;
    }
    setOutlineProvider(new ViewOutlineProvider() {

        @Override
        public void getOutline(View view, Outline outline) {
        }
    });
}
Also used : TypedArray(android.content.res.TypedArray) Outline(android.graphics.Outline) ViewOutlineProvider(android.view.ViewOutlineProvider) View(android.view.View)

Example 19 with Outline

use of android.graphics.Outline in project cardslib by gabrielemariotti.

the class LPreviewUtilsBase method setupCircleButton.

//----------------------------------------------------------------------------
// Circle Button
//----------------------------------------------------------------------------
public void setupCircleButton(ImageButton sourceButton) {
    if (hasL()) {
        if (sourceButton != null) {
            final int size = mActivity.getResources().getDimensionPixelSize(R.dimen.hd_fab_size);
            sourceButton.setOutlineProvider(new ViewOutlineProvider() {

                @Override
                public void getOutline(View view, Outline outline) {
                    outline.setOval(0, 0, size, size);
                }
            });
            sourceButton.setClipToOutline(true);
        }
    }
}
Also used : Outline(android.graphics.Outline) ViewOutlineProvider(android.view.ViewOutlineProvider) View(android.view.View)

Example 20 with Outline

use of android.graphics.Outline in project ListenerMusicPlayer by hefuyicoder.

the class PlayPauseView method onSizeChanged.

@Override
protected void onSizeChanged(final int w, final int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);
    mDrawable.setBounds(0, 0, w, h);
    mWidth = w;
    mHeight = h;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        setOutlineProvider(new ViewOutlineProvider() {

            @TargetApi(Build.VERSION_CODES.LOLLIPOP)
            @Override
            public void getOutline(View view, Outline outline) {
                outline.setOval(0, 0, view.getWidth(), view.getHeight());
            }
        });
        setClipToOutline(true);
    }
}
Also used : Outline(android.graphics.Outline) ViewOutlineProvider(android.view.ViewOutlineProvider) TargetApi(android.annotation.TargetApi) View(android.view.View)

Aggregations

Outline (android.graphics.Outline)37 View (android.view.View)26 ViewOutlineProvider (android.view.ViewOutlineProvider)26 TextView (android.widget.TextView)16 TargetApi (android.annotation.TargetApi)8 ImageView (android.widget.ImageView)7 LayoutlibDelegate (com.android.tools.layoutlib.annotations.LayoutlibDelegate)5 ColorStateList (android.content.res.ColorStateList)3 ColorDrawable (android.graphics.drawable.ColorDrawable)3 RippleDrawable (android.graphics.drawable.RippleDrawable)3 Animator (android.animation.Animator)2 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)2 AnimatorSet (android.animation.AnimatorSet)2 ObjectAnimator (android.animation.ObjectAnimator)2 Rect (android.graphics.Rect)2 Drawable (android.graphics.drawable.Drawable)2 StateListDrawable (android.graphics.drawable.StateListDrawable)2 ViewGroup (android.view.ViewGroup)2 Interpolator (android.view.animation.Interpolator)2 AdapterView (android.widget.AdapterView)2