florent37 / florent37/TutoShowcase

unable to find not animated down finger image

Open
#27 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
499
Forks
85
PR merge metrics
No merged PRs in 30d

Description

i'm unable to find not animated down finger in you library. so i have make some adjustment in your code to get this functionality.

here code to make adjustment to get this functionality

private void displayScrollableDownOnView() {
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_tutoshowcase_finger_moving_down);
hand.setLayoutParams(new ViewGroup.MarginLayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));

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();

if (Build.VERSION.SDK_INT > 20) {
ViewCompat.setTranslationY(hand, y - 215);
} else {
ViewCompat.setTranslationY(hand, y - 150);
}

ViewCompat.setTranslationX(hand, x);

// if (settings.animated)
// ViewCompat.animate(hand) //- height * 0.8f - getStatusBarOffset()
// .translationY(x)
// .setStartDelay(settings.delay != null ? settings.delay : 500)
// .setDuration(settings.duration != null ? settings.duration : 600)
// .setInterpolator(new DecelerateInterpolator());

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.