worker8 / TourGuide

TourGuide is an Android library that aims to provide an easy way to add pointers with animations over a desired Android View
MIT License
2.63k stars 416 forks source link

Skip option #129

Open amarsaurabh opened 6 years ago

amarsaurabh commented 6 years ago

It is not an issue, it's my suggestion that, There should be one skip button so that user can skip the tutorial any time instead of going one by one at the last and finish the tutorial.

ugochirico commented 6 years ago

I agree with @amarsaurabh. How can we add a skip button to allos the user to skip the tutorial at any time?

insessor commented 5 years ago

You can add Skip button or any other ui on overlay, like I added Skip button,

FrameLayout frameLayout = tourGuideHandler.getOverlay();

                if (frameLayout != null) {
                    //set the properties for button
                    Button btnTag = new Button(context);
                    final FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);

                    params.gravity = Gravity.TOP | Gravity.RIGHT;

                    Rect rectangle = new Rect();
                    Window window = context.getWindow();
                    window.getDecorView().getWindowVisibleDisplayFrame(rectangle);
                    int statusBarHeight = rectangle.top;

                    int marginTop = 10 + statusBarHeight;
                    int marginBottom = 10 + statusBarHeight*2;
                    int marginRight = 10;
                    int marginLeft = 10;

                    params.setMargins(marginLeft, marginTop, marginRight, marginBottom);
                    btnTag.setLayoutParams(params);
                    btnTag.setText("Skip");
                    btnTag.setId((int) System.currentTimeMillis());

                    //add button to the layout
                    frameLayout.addView(btnTag);

                    btnTag.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {

                        }
                    });
                }