erkutaras / ShowcaseView

ShowcaseView library for Android
Apache License 2.0
231 stars 41 forks source link

Showcase is not showing in center of the view. #3

Closed jigarpatel17 closed 6 years ago

jigarpatel17 commented 6 years ago

I have implemented as per below.

val builder = ShowcaseManager.Builder()
                                    builder.context(mActivity)
                                            .view(view.imgProjectSelection)
                                            .descriptionImageRes(android.R.color.transparent)
                                            .descriptionTitle("")
                                            .descriptionText("Select this checkbox and you will see quick progress of this project on home screen")
                                            .buttonText("Got it!")
                                            .colorButtonBackground(mActivity.getColor(R.color.colorPrimary))
                                            .key("TEST")
                                            .developerMode(true)
                                            .colorFocusArea(mActivity.getColor(android.R.color.transparent))
                                            .add().build()
                                            .show()

Right now i have made updates as per below and it is working fine.

private float getCircleCenterY(Rect viewPositionRect) {
            return viewPositionRect.top
                    + ((view.getHeight() - view.getPaddingBottom() + view.getPaddingTop()) / 2);
        }
erkutaras commented 6 years ago

Actually, there is not necessary padding subtraction. I removed subtraction and changed this method as:

private float getCircleCenterY(Rect viewPositionRect) {
       return viewPositionRect.top + (view.getHeight() / 2);
}

The fix is released in version 1.0.6. Thanks for issue.

jigarpatel17 commented 6 years ago

@erkutaras Just wanted to ask that is there any need to draw variable named as "bitmap" in ShowCaseView for which you have added comment("draw all views and update location of descriptionView").

private Bitmap bitmap;
bitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
// draw all views and update location of descriptionView
canvas.drawBitmap(bitmap, 0, 0, null);

Thanks for the above fix.

erkutaras commented 6 years ago

Thanks for your attention. There is no need to use "bitmap" and it is removed.