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


Java ViewTransformer类代码示例

本文整理汇总了Java中com.flipboard.bottomsheet.ViewTransformer的典型用法代码示例。如果您正苦于以下问题:Java ViewTransformer类的具体用法?Java ViewTransformer怎么用?Java ViewTransformer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getViewTransformer

import com.flipboard.bottomsheet.ViewTransformer; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public ViewTransformer getViewTransformer() {
    return null;
}
 
开发者ID:NandagopalR,项目名称:Bottom-sheet-Listview,代码行数:8,代码来源:BottomSheetFragment.java

示例2: getViewTransformer

import com.flipboard.bottomsheet.ViewTransformer; //导入依赖的package包/类
@Override
public ViewTransformer getViewTransformer()
  {
  final float targetSizeWhenBottomSheetExpanded=getResources().getDimensionPixelSize(R.dimen.moving_image_expanded_bottom_sheet_size);
  final float startSizeWhenBottomSheetCollapsed=getResources().getDimensionPixelSize(R.dimen.moving_image_collapsed_bottom_sheet_size);
  final float startMarginBottom=getResources().getDimensionPixelSize(R.dimen.moving_image_expanded_bottom_sheet_margin_bottom);
  return new BaseViewTransformer()
    {
    boolean init=false;
    float mOriginalContactPhotoXCoordinate;
    float mOriginalBottomSheetBackgroundImageViewY;
    float scaleDiff;

    @Override
    public void transformView(final float translation,final float maxTranslation,final float peekedTranslation,final BottomSheetLayout parent,final View view)
      {
      if(!init)
        {
        mOriginalBottomSheetBackgroundImageViewY=mMovingImageviewSize/2;
        mOriginalContactPhotoXCoordinate=mMovingIconImageView.getX();
        scaleDiff=(startSizeWhenBottomSheetCollapsed-targetSizeWhenBottomSheetExpanded)/startSizeWhenBottomSheetCollapsed;
        init=true;
        }
      if(translation<mBottomSheetHeightPeeked)
        {
        //hidden<->peeked or hidden
        reportState(translation==0?BottomSheetState.HIDDEN:BottomSheetState.HIDDEN_PEEKED);
        return;
        }
      if(translation==mBottomSheetHeightPeeked)
        {
        //peek
        reportState(BottomSheetState.PEEKED);
        }
      else
        {
        //peek->expand
        reportState(translation==maxTranslation?BottomSheetState.EXPANDED:BottomSheetState.PEEKED_EXPANDED);
        }
      float progress=(translation-mBottomSheetHeightPeeked)/(maxTranslation-mBottomSheetHeightPeeked);
      mMovingIconImageView.setX(mOriginalContactPhotoXCoordinate-progress*(mOriginalContactPhotoXCoordinate-mMovingImageExpandedBottomSheetMarginLeft));
      final float scaleForImageView=1-progress*scaleDiff;
      mMovingIconImageView.setScaleX(scaleForImageView);
      mMovingIconImageView.setScaleY(scaleForImageView);
      final float newMovingIconImageViewY=progress*(mBottomSheetHeightExpanded-startMarginBottom-mMovingIconImageView.getHeight()*scaleForImageView);
      mMovingIconImageView.setY(newMovingIconImageViewY);
      final float newBottomSheetBackgroundImageContainerY=mOriginalBottomSheetBackgroundImageViewY*(1-progress);
      mBottomSheetBackgroundImageView.setY(newBottomSheetBackgroundImageContainerY);
      }
    };
  }
 
开发者ID:AndroidDeveloperLB,项目名称:ThreePhasesBottomSheet,代码行数:52,代码来源:MyFragment.java

示例3: getViewTransformer

import com.flipboard.bottomsheet.ViewTransformer; //导入依赖的package包/类
@Override
public ViewTransformer getViewTransformer() {
    final float targetSizeWhenBottomSheetExpanded = getResources().getDimensionPixelSize(R.dimen.moving_image_expanded_bottom_sheet_size);
    final float startSizeWhenBottomSheetCollapsed = getResources().getDimensionPixelSize(R.dimen.moving_image_collapsed_bottom_sheet_size);
    final float startMarginBottom = getResources().getDimensionPixelSize(R.dimen.moving_image_expanded_bottom_sheet_margin_bottom);
    return new BaseViewTransformer() {
        boolean init = false;
        float mOriginalContactPhotoXCoordinate;
        float mOriginalBottomSheetBackgroundImageViewY;
        float scaleDiff;

        @Override
        public void transformView(final float translation, final float maxTranslation, final float peekedTranslation, final BottomSheetLayout parent, final View view) {
            if (!init) {
                mOriginalBottomSheetBackgroundImageViewY = mMovingImageviewSize / 2;
                mOriginalContactPhotoXCoordinate = mMovingIconImageView.getX();
                scaleDiff = (startSizeWhenBottomSheetCollapsed - targetSizeWhenBottomSheetExpanded) / startSizeWhenBottomSheetCollapsed;
                init = true;
            }
            if (translation < mBottomSheetHeightPeeked) {
                //hidden<->peeked or hidden
                reportState(translation == 0 ? BottomSheetState.HIDDEN : BottomSheetState.HIDDEN_PEEKED);
                return;
            }
            if (translation == mBottomSheetHeightPeeked) {
                //peek
                reportState(BottomSheetState.PEEKED);
            } else {
                //peek->expand
                reportState(translation == maxTranslation ? BottomSheetState.EXPANDED : BottomSheetState.PEEKED_EXPANDED);
            }
            float progress = (translation - mBottomSheetHeightPeeked) / (maxTranslation - mBottomSheetHeightPeeked);
            mMovingIconImageView.setX(mOriginalContactPhotoXCoordinate - progress * (mOriginalContactPhotoXCoordinate - mMovingImageExpandedBottomSheetMarginLeft));
            final float scaleForImageView = 1 - progress * scaleDiff;
            mMovingIconImageView.setScaleX(scaleForImageView);
            mMovingIconImageView.setScaleY(scaleForImageView);
            final float newMovingIconImageViewY = progress * (mBottomSheetHeightExpanded - startMarginBottom - mMovingIconImageView.getHeight() * scaleForImageView);
            mMovingIconImageView.setY(newMovingIconImageViewY);
            final float newBottomSheetBackgroundImageContainerY = mOriginalBottomSheetBackgroundImageViewY * (1 - progress);
            mBottomSheetTopHeader.setY(newBottomSheetBackgroundImageContainerY);
            mBottomSheetTopHeader.getLayoutParams().height =
                    (int) getValFromProgress(mBottomSheetHeightPeeked - mMovingImageviewSize / 2, mBottomSheetHeightExpanded, progress);
            ((MarginLayoutParams) mBottomsheetContentView.getLayoutParams()).topMargin = (int) getValFromProgress(mBottomSheetHeightPeeked, mBottomSheetHeightExpanded, progress);
            mBottomsheetContentView.requestLayout();
            mBottomSheetTopHeader.requestLayout();
        }
    };
}
 
开发者ID:AndroidDeveloperLB,项目名称:ThreePhasesBottomSheet,代码行数:49,代码来源:MyFragment2.java

示例4: getViewTransformer

import com.flipboard.bottomsheet.ViewTransformer; //导入依赖的package包/类
/**
 * Override this to proved a custom {@link ViewTransformer}.
 */
ViewTransformer getViewTransformer();
 
开发者ID:NandagopalR,项目名称:Bottom-sheet-Listview,代码行数:5,代码来源:BottomSheetFragmentInterface.java


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