Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set paddings based on angle #8

Open
xoex opened this issue Jan 29, 2017 · 0 comments
Open

Set paddings based on angle #8

xoex opened this issue Jan 29, 2017 · 0 comments

Comments

@xoex
Copy link

xoex commented Jan 29, 2017

You can set paddings based on angle to prevent unused paddings ,
code is below (resetShadow() ) :

    final int padding = (int) (mShadowDistance + mShadowRadius);
    if (mShadowAngle == 0 || mShadowAngle == 360)
    {
        setPadding(0 , 0 , padding, 0);
    }
    else if (mShadowAngle == 90)
    {
        setPadding(0, 0, 0, padding);
    }
    else if (mShadowAngle == 180)
    {
        setPadding(padding, 0, 0, 0);
    }
    else if (mShadowAngle == 270)
    {
        setPadding(0, padding, 0, 0);
    }
    else if ( mShadowAngle > 0 && mShadowAngle < 90)
    {
        setPadding(0, 0, padding, padding);
    }
    else if ( mShadowAngle > 90 && mShadowAngle < 180)
    {
        setPadding(padding, 0, 0, padding);
    }
    else if ( mShadowAngle > 180 && mShadowAngle < 270)
    {
        setPadding(padding, padding, 0, 0);
    }
    else if ( mShadowAngle > 270 && mShadowAngle < 360)
    {
        setPadding(0, padding, padding, 0);
    }
@xoex xoex changed the title Setting padding based on angle Set paddings based on angle Jan 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant