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

make animated to non animated #29

Open
rtinku opened this issue Feb 16, 2018 · 0 comments
Open

make animated to non animated #29

rtinku opened this issue Feb 16, 2018 · 0 comments

Comments

@rtinku
Copy link

rtinku commented Feb 16, 2018

i also make animated item to non animated .

code

private void displayScrollableUpOnView() {
final Rect rect = new Rect();
view.getGlobalVisibleRect(rect);
final int height = rect.height();

        final ImageView hand = new ImageView(view.getContext());
        hand.setImageResource(R.drawable.ic_hand_finger_on_up_arrow);
        ViewGroup.MarginLayoutParams layoutParams = new ViewGroup.MarginLayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);

        hand.setLayoutParams(layoutParams);
        hand.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
            @Override
            public boolean onPreDraw() {
                int x = (int) (rect.centerX() - hand.getWidth() / 2f);
                int y = (int) (rect.centerY() - hand.getHeight() / 2f) - getStatusBarOffset();
                ViewCompat.setTranslationY(hand, y - 25);
                ViewCompat.setTranslationX(hand, x);

//
// if (settings.animated)
// ViewCompat.animate(hand) // - height * 0.8f - getStatusBarOffset()
// .translationY(rect.top-50)
// .setStartDelay(settings.delay != null ? settings.delay : 1500)
// .setDuration(settings.duration != null ? settings.duration : 3000)
// .setInterpolator(new DecelerateInterpolator());

                hand.getViewTreeObserver().removeOnPreDrawListener(this);
                return false;
            }
        });


        tutoShowcase.container.addView(hand, layoutParams);
        tutoShowcase.container.invalidate();
    }
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