public void prepareAndHandleInfo(final StreamInfo info, boolean scrollToTop) { if (DEBUG) Log.d(TAG, "prepareAndHandleInfo() called with: info = [" + info + "], scrollToTop = [" + scrollToTop + "]"); setInitialData(info.getServiceId(), info.getOriginalUrl(), info.getName()); pushToStack(serviceId, url, name); showLoading(); Log.d(TAG, "prepareAndHandleInfo() called parallaxScrollRootView.getScrollY(): " + parallaxScrollRootView.getScrollY()); final boolean greaterThanThreshold = parallaxScrollRootView.getScrollY() > (int) (getResources().getDisplayMetrics().heightPixels * .1f); if (scrollToTop) parallaxScrollRootView.smoothScrollTo(0, 0); animateView(contentRootLayoutHiding, false, greaterThanThreshold ? 250 : 0, 0, () -> { handleResult(info); showContentWithAnimation(120, 0, .01f); }); }
private void makeViewsParallax() { if (getChildCount() > 0 && getChildAt(0) instanceof ViewGroup) { ViewGroup viewsHolder = (ViewGroup) getChildAt(0); int numOfParallaxViews = Math.min(this.numOfParallaxViews, viewsHolder.getChildCount()); for (int i = 0; i < numOfParallaxViews; i++) { ParallaxedView parallaxedView = new ScrollViewParallaxedItem(viewsHolder.getChildAt(i)); parallaxedViews.add(parallaxedView); } } }
public ParallaxScrollView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(context, attrs); }
protected void prepareAndLoadInfo() { parallaxScrollRootView.smoothScrollTo(0, 0); pushToStack(serviceId, url, name); startLoading(false); }
@Override protected void onFinishInflate() { super.onFinishInflate(); makeViewsParallax(); }
public ParallaxScrollView(Context context, AttributeSet attrs) { super(context, attrs); init(context, attrs); }