当前位置: 首页>>代码示例>>Java>>正文


Java ScrollUtils.getFloat方法代码示例

本文整理汇总了Java中com.github.ksoichiro.android.observablescrollview.ScrollUtils.getFloat方法的典型用法代码示例。如果您正苦于以下问题:Java ScrollUtils.getFloat方法的具体用法?Java ScrollUtils.getFloat怎么用?Java ScrollUtils.getFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.github.ksoichiro.android.observablescrollview.ScrollUtils的用法示例。


在下文中一共展示了ScrollUtils.getFloat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onScrollChanged

import com.github.ksoichiro.android.observablescrollview.ScrollUtils; //导入方法依赖的package包/类
@Override
public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) {
    if (mDragging) {
        int toolbarHeight = mToolbarView.getHeight();
        if (mFirstScroll) {
            mFirstScroll = false;
            float currentHeaderTranslationY = ViewHelper.getTranslationY(mHeaderView);
            if (-toolbarHeight < currentHeaderTranslationY) {
                mBaseTranslationY = scrollY;
            }
        }
        float headerTranslationY = ScrollUtils.getFloat(-(scrollY - mBaseTranslationY), -toolbarHeight, 0);
        ViewPropertyAnimator.animate(mHeaderView).cancel();
        ViewHelper.setTranslationY(mHeaderView, headerTranslationY);
    }
}
 
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:17,代码来源:StickyHeaderWebViewActivity.java

示例2: onScrollChanged

import com.github.ksoichiro.android.observablescrollview.ScrollUtils; //导入方法依赖的package包/类
@Override
public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) {
    // Translate overlay and image
    float flexibleRange = mFlexibleSpaceImageHeight - mActionBarSize;
    int minOverlayTransitionY = mActionBarSize - mOverlayView.getHeight();
    ViewHelper.setTranslationY(mOverlayView, ScrollUtils.getFloat(-scrollY, minOverlayTransitionY, 0));
    ViewHelper.setTranslationY(mImageView, ScrollUtils.getFloat(-scrollY / 2, minOverlayTransitionY, 0));

    // Translate list background
    ViewHelper.setTranslationY(mRecyclerViewBackground, Math.max(0, -scrollY + mFlexibleSpaceImageHeight));

    // Change alpha of overlay
    ViewHelper.setAlpha(mOverlayView, ScrollUtils.getFloat((float) scrollY / flexibleRange, 0, 1));

    // Scale title text
    float scale = 1 + ScrollUtils.getFloat((flexibleRange - scrollY) / flexibleRange, 0, MAX_TEXT_SCALE_DELTA);
    setPivotXToTitle();
    ViewHelper.setPivotY(mTitleView, 0);
    ViewHelper.setScaleX(mTitleView, scale);
    ViewHelper.setScaleY(mTitleView, scale);

    // Translate title text
    int maxTitleTranslationY = (int) (mFlexibleSpaceImageHeight - mTitleView.getHeight() * scale);
    int titleTranslationY = maxTitleTranslationY - scrollY;
    ViewHelper.setTranslationY(mTitleView, titleTranslationY);
}
 
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:27,代码来源:FlexibleSpaceWithImageRecyclerViewActivity.java

示例3: updateFlexibleSpaceText

import com.github.ksoichiro.android.observablescrollview.ScrollUtils; //导入方法依赖的package包/类
private void updateFlexibleSpaceText(final int scrollY) {
    ViewHelper.setTranslationY(mFlexibleSpaceView, -scrollY);
    int adjustedScrollY = (int) ScrollUtils.getFloat(scrollY, 0, mFlexibleSpaceHeight);

    // Special logic for WebView.
    adjustTopMargin(mWebViewContainer, adjustedScrollY <= mFlexibleSpaceHeight ? 0 : mFlexibleSpaceHeight + getActionBarSize());

    float maxScale = (float) (mFlexibleSpaceHeight - mToolbarView.getHeight()) / mToolbarView.getHeight();
    float scale = maxScale * ((float) mFlexibleSpaceHeight - adjustedScrollY) / mFlexibleSpaceHeight;

    ViewHelper.setPivotX(mTitleView, 0);
    ViewHelper.setPivotY(mTitleView, 0);
    ViewHelper.setScaleX(mTitleView, 1 + scale);
    ViewHelper.setScaleY(mTitleView, 1 + scale);
    int maxTitleTranslationY = mToolbarView.getHeight() + mFlexibleSpaceHeight - (int) (mTitleView.getHeight() * (1 + scale));
    int titleTranslationY = (int) (maxTitleTranslationY * ((float) mFlexibleSpaceHeight - adjustedScrollY) / mFlexibleSpaceHeight);
    ViewHelper.setTranslationY(mTitleView, titleTranslationY);
}
 
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:19,代码来源:FlexibleSpaceToolbarWebViewActivity.java

示例4: updateFlexibleSpace

import com.github.ksoichiro.android.observablescrollview.ScrollUtils; //导入方法依赖的package包/类
private void updateFlexibleSpace(float translationY) {
    ViewHelper.setTranslationY(mInterceptionLayout, translationY);
    int minOverlayTransitionY = getActionBarSize() - mOverlayView.getHeight();
    ViewHelper.setTranslationY(mImageView, ScrollUtils.getFloat(-translationY / 2, minOverlayTransitionY, 0));

    // Change alpha of overlay
    float flexibleRange = mFlexibleSpaceHeight - getActionBarSize();
    ViewHelper.setAlpha(mOverlayView, ScrollUtils.getFloat(-translationY / flexibleRange, 0, 1));

    // Scale title text
    float scale = 1 + ScrollUtils.getFloat((flexibleRange + translationY - mTabHeight) / flexibleRange, 0, MAX_TEXT_SCALE_DELTA);
    setPivotXToTitle();
    ViewHelper.setPivotY(mTitleView, 0);
    ViewHelper.setScaleX(mTitleView, scale);
    ViewHelper.setScaleY(mTitleView, scale);
}
 
开发者ID:kumarramjee,项目名称:Android-ObservableScrollView-master,代码行数:17,代码来源:FlexibleSpaceWithImageWithViewPagerTab2Activity.java

示例5: onMoveMotionEvent

import com.github.ksoichiro.android.observablescrollview.ScrollUtils; //导入方法依赖的package包/类
public void onMoveMotionEvent(MotionEvent ev, float diffX, float diffY) {
    float translationY = ScrollUtils.getFloat(ViewHelper.getTranslationY(touchInterceptionFrameLayout) + diffY, -scrollViewCanScrollHeight, 0);

    ViewHelper.setTranslationY(touchInterceptionFrameLayout, translationY);
    if (shouldStayViews != null && shouldStayViews.length > 0) {
        for (View v : shouldStayViews) {
            ViewHelper.setTranslationY(v, -translationY);
        }
    }
    requestRootLayout(translationY);
    onViewResize(translationY);
}
 
开发者ID:Grasea,项目名称:Grandroid2,代码行数:13,代码来源:SimpleObservableScrollHandler.java

示例6: onMoveMotionEvent

import com.github.ksoichiro.android.observablescrollview.ScrollUtils; //导入方法依赖的package包/类
@Override
public void onMoveMotionEvent(MotionEvent ev, float diffX, float diffY) {
    float translationY = ScrollUtils.getFloat(ViewHelper.getTranslationY(mInterceptionLayout) + diffY, -mToolbarView.getHeight(), 0);
    ViewHelper.setTranslationY(mInterceptionLayout, translationY);
    if (translationY < 0) {
        FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mInterceptionLayout.getLayoutParams();
        lp.height = (int) (-translationY + getScreenHeight());
        mInterceptionLayout.requestLayout();
    }
}
 
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:11,代码来源:ViewPagerTab2Activity.java

示例7: onScrollChanged

import com.github.ksoichiro.android.observablescrollview.ScrollUtils; //导入方法依赖的package包/类
@Override
public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) {
    int toolbarHeight = mToolbarView.getHeight();
    if (dragging || scrollY < toolbarHeight) {
        if (firstScroll) {
            float currentHeaderTranslationY = ViewHelper.getTranslationY(mHeaderView);
            if (-toolbarHeight < currentHeaderTranslationY && toolbarHeight < scrollY) {
                mBaseTranslationY = scrollY;
            }
        }
        float headerTranslationY = ScrollUtils.getFloat(-(scrollY - mBaseTranslationY), -toolbarHeight, 0);
        ViewPropertyAnimator.animate(mHeaderView).cancel();
        ViewHelper.setTranslationY(mHeaderView, headerTranslationY);
    }
}
 
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:16,代码来源:ScrollFromBottomRecyclerViewActivity.java

示例8: onScrollChanged

import com.github.ksoichiro.android.observablescrollview.ScrollUtils; //导入方法依赖的package包/类
@Override
public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) {
    if (dragging) {
        int toolbarHeight = mToolbarView.getHeight();
        if (firstScroll) {
            float currentHeaderTranslationY = ViewHelper.getTranslationY(mHeaderView);
            if (-toolbarHeight < currentHeaderTranslationY) {
                mBaseTranslationY = scrollY;
            }
        }
        float headerTranslationY = ScrollUtils.getFloat(-(scrollY - mBaseTranslationY), -toolbarHeight, 0);
        ViewPropertyAnimator.animate(mHeaderView).cancel();
        ViewHelper.setTranslationY(mHeaderView, headerTranslationY);
    }
}
 
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:16,代码来源:StickyHeaderListViewActivity.java

示例9: onMoveMotionEvent

import com.github.ksoichiro.android.observablescrollview.ScrollUtils; //导入方法依赖的package包/类
@Override
public void onMoveMotionEvent(MotionEvent ev, float diffX, float diffY) {
    int flexibleSpace = mFlexibleSpaceHeight - mTabHeight;
    float translationY = ScrollUtils.getFloat(
            ViewHelper.getTranslationY(mInterceptionLayout) + diffY, -flexibleSpace, 0);
    updateFlexibleSpace(translationY);
    if (translationY < 0) {
        FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams)
                mInterceptionLayout.getLayoutParams();
        lp.height = (int) (-translationY + getScreenHeight());
        mInterceptionLayout.requestLayout();
    }
}
 
开发者ID:jyjeanne,项目名称:Studyandcook,代码行数:14,代码来源:DetailActivity.java

示例10: updateFlexibleSpaceText

import com.github.ksoichiro.android.observablescrollview.ScrollUtils; //导入方法依赖的package包/类
private void updateFlexibleSpaceText(final int scrollY) {
    ViewHelper.setTranslationY(mFlexibleSpaceView, -scrollY);
    int adjustedScrollY = (int) ScrollUtils.getFloat(scrollY, 0, mFlexibleSpaceHeight);
    float maxScale = (float) (mFlexibleSpaceHeight - mToolbarView.getHeight()) / mToolbarView.getHeight();
    float scale = maxScale * ((float) mFlexibleSpaceHeight - adjustedScrollY) / mFlexibleSpaceHeight;

    ViewHelper.setPivotX(mTitleView, 0);
    ViewHelper.setPivotY(mTitleView, 0);
    ViewHelper.setScaleX(mTitleView, 1 + scale);
    ViewHelper.setScaleY(mTitleView, 1 + scale);
    int maxTitleTranslationY = mToolbarView.getHeight() + mFlexibleSpaceHeight - (int) (mTitleView.getHeight() * (1 + scale));
    int titleTranslationY = (int) (maxTitleTranslationY * ((float) mFlexibleSpaceHeight - adjustedScrollY) / mFlexibleSpaceHeight);
    ViewHelper.setTranslationY(mTitleView, titleTranslationY);
}
 
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:15,代码来源:FlexibleSpaceToolbarScrollViewActivity.java

示例11: onScrollChanged

import com.github.ksoichiro.android.observablescrollview.ScrollUtils; //导入方法依赖的package包/类
@Override
public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) {
    if (dragging) {
        int toolbarHeight = mToolbarView.getHeight();
        float currentHeaderTranslationY = ViewHelper.getTranslationY(mHeaderView);
        if (firstScroll) {
            if (-toolbarHeight < currentHeaderTranslationY) {
                mBaseTranslationY = scrollY;
            }
        }
        float headerTranslationY = ScrollUtils.getFloat(-(scrollY - mBaseTranslationY), -toolbarHeight, 0);
        ViewPropertyAnimator.animate(mHeaderView).cancel();
        ViewHelper.setTranslationY(mHeaderView, headerTranslationY);
    }
}
 
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:16,代码来源:ViewPagerTabActivity.java

示例12: onMoveMotionEvent

import com.github.ksoichiro.android.observablescrollview.ScrollUtils; //导入方法依赖的package包/类
@Override
public void onMoveMotionEvent(MotionEvent ev, float diffX, float diffY) {
    int flexibleSpace = mFlexibleSpaceHeight - mTabHeight;
    float translationY = ScrollUtils.getFloat(ViewHelper.getTranslationY(mInterceptionLayout) + diffY, -flexibleSpace, 0);
    MotionEvent e = MotionEvent.obtainNoHistory(ev);
    e.offsetLocation(0, translationY - mBaseTranslationY);
    mVelocityTracker.addMovement(e);
    updateFlexibleSpace(translationY);
}
 
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:10,代码来源:FlexibleSpaceWithImageWithViewPagerTab2Activity.java

示例13: onMoveMotionEvent

import com.github.ksoichiro.android.observablescrollview.ScrollUtils; //导入方法依赖的package包/类
@Override
public void onMoveMotionEvent(MotionEvent ev, float diffX, float diffY) {
    View toolbarView = getActivity().findViewById(R.id.toolbar);
    float translationY = ScrollUtils.getFloat(ViewHelper.getTranslationY(mInterceptionLayout) + diffY, -toolbarView.getHeight(), 0);
    ViewHelper.setTranslationY(mInterceptionLayout, translationY);
    ViewHelper.setTranslationY(toolbarView, translationY);
    if (translationY < 0) {
        FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mInterceptionLayout.getLayoutParams();
        lp.height = (int) (-translationY + getScreenHeight());
        mInterceptionLayout.requestLayout();
    }
}
 
开发者ID:brucetoo,项目名称:Android-ObservableScrollView,代码行数:13,代码来源:ViewPagerTabFragmentParentFragment.java

示例14: onScrollChanged

import com.github.ksoichiro.android.observablescrollview.ScrollUtils; //导入方法依赖的package包/类
@Override
	public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) {
		int actionbarSize = getResources().getDimensionPixelSize(R.dimen.actionbar_height);
		float flexibleRange = mImageCoverHeight - actionbarSize;
		int minOverlayTranslationY = actionbarSize - mViewOverlay.getHeight();

		// translate over and image
		ViewHelper.setTranslationY(mViewOverlay, ScrollUtils.getFloat(-scrollY, minOverlayTranslationY, 0));
		ViewHelper.setTranslationY(mImageCover, ScrollUtils.getFloat(-scrollY / 2, minOverlayTranslationY, 0));

		// Change alpha of overlay
		ViewHelper.setAlpha(mViewOverlay, ScrollUtils.getFloat((float) scrollY / flexibleRange, 0, 1));

//		// Scale title text
		float scale = 1 + ScrollUtils.getFloat((flexibleRange - scrollY) / flexibleRange, 0, 0.3f);
		ViewHelper.setPivotY(mTextTitle, 0);
		ViewHelper.setScaleX(mTextTitle, scale);
		ViewHelper.setScaleY(mTextTitle, scale);

		// Translate title text
		int maxTitleTranslationY = (int) (mImageCoverHeight - mTextTitle.getHeight() * scale);
		int titleTranslationY = maxTitleTranslationY - scrollY;
		ViewHelper.setTranslationY(mTextTitle, titleTranslationY);
		ViewHelper.setTranslationY(mFabPlay, scrollY / 4);

		// change alpha of FAB
		ViewHelper.setAlpha(mFabPlay, ScrollUtils.getFloat(1.0f - (float)scrollY / flexibleRange, 0, 1));
	}
 
开发者ID:enginebai,项目名称:Movie-lol-android,代码行数:29,代码来源:TrailerActivity.java

示例15: onScrollChanged

import com.github.ksoichiro.android.observablescrollview.ScrollUtils; //导入方法依赖的package包/类
@Override
public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) {
	if (dragging) {
		int toolbarHeight = mToolbar.getHeight();
		float currentHeaderTranslationY = ViewHelper.getTranslationY(mHeaderView);
		if (firstScroll) {
			if (-toolbarHeight < currentHeaderTranslationY) {
				mBaseTranslationY = scrollY;
			}
		}
		float headerTranslationY = ScrollUtils.getFloat(-(scrollY - mBaseTranslationY), -toolbarHeight, 0);
		ViewPropertyAnimator.animate(mHeaderView).cancel();
		ViewHelper.setTranslationY(mHeaderView, headerTranslationY);
	}
}
 
开发者ID:fython,项目名称:ExpressHelper,代码行数:16,代码来源:MainActivity.java


注:本文中的com.github.ksoichiro.android.observablescrollview.ScrollUtils.getFloat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。