@Override public boolean onDependentViewChanged( CoordinatorLayout parent, final LinearLayout child, View dependency) { shouldInitProperties(child, dependency); /* float distanceYToSubtract = ((mStartYPosition - mFinalYPosition) * (1f - expandedPercentageFactor)) + (child.getHeight()/2);*/ /*float scrollDistance = mStartYPosition - mFinalYPosition; float scrollDistanceOfDependency = dependency.getHeight(); float percentOfScroll = scrollDistance / dependency.getY() * 100; Log.e("y",Float.toString(dependency.getY())); Log.e("scroll",Float.toString(percentOfScroll)); float position = dependency.getY() / scrollDistance * 100; //float heightToSubtract = ((mStartHeight - finalHeight) * (1f - expandedPercentageFactor));*/ // child.setY(mStartYPosition + dependency.getY(); float scroll = dependency.getY() - (dependency.getHeight()) + mStartYPosition / 2; // Log.e("y",Float.toString(dependency.getY() - (dependency.getHeight()) + mStartYPosition / // 2)); // Log.e("scroll",Float.toString(dependency.getHeight() / 2)); if (scroll * -1 < dependency.getHeight() / 2) { child.setTranslationY(dependency.getY() - (dependency.getHeight()) + mStartYPosition / 2); } else { } return true; }
private void startIntroAnimation() { contentRoot.setScaleY(0.1f); contentRoot.setPivotY(drawingStartLocation); llAddComment.setTranslationY(200); contentRoot .animate() .scaleY(1) .setDuration(200) .setInterpolator(new AccelerateInterpolator()) .setListener( new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { animateContent(); } }) .start(); }