Java Code Examples for android.support.v4.view.ViewCompat#setScaleY()

The following examples show how to use android.support.v4.view.ViewCompat#setScaleY() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BGABannerUtil.java    From KUtils-master with Apache License 2.0 6 votes vote down vote up
public static void resetPageTransformer(List<? extends View> views) {
    if (views == null) {
        return;
    }

    for (View view : views) {
        view.setVisibility(View.VISIBLE);
        ViewCompat.setAlpha(view, 1);
        ViewCompat.setPivotX(view, view.getMeasuredWidth() * 0.5f);
        ViewCompat.setPivotY(view, view.getMeasuredHeight() * 0.5f);
        ViewCompat.setTranslationX(view, 0);
        ViewCompat.setTranslationY(view, 0);
        ViewCompat.setScaleX(view, 1);
        ViewCompat.setScaleY(view, 1);
        ViewCompat.setRotationX(view, 0);
        ViewCompat.setRotationY(view, 0);
        ViewCompat.setRotation(view, 0);
    }
}
 
Example 2
Source File: FloatLabelLayout.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Hide the label
 */
private void hideLabel(boolean animate) {
    if (animate) {
        float scale = mEditText.getTextSize() / mLabel.getTextSize();
        ViewCompat.setScaleX(mLabel, 1f);
        ViewCompat.setScaleY(mLabel, 1f);
        ViewCompat.setTranslationY(mLabel, 0f);

        ViewCompat.animate(mLabel)
                .translationY(mLabel.getHeight())
                .setDuration(ANIMATION_DURATION)
                .scaleX(scale)
                .scaleY(scale)
                .setListener(new ViewPropertyAnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(View view) {
                        mLabel.setVisibility(INVISIBLE);
                        mEditText.setHint(mHint);
                    }
                })
                .setInterpolator(mInterpolator).start();
    } else {
        mLabel.setVisibility(INVISIBLE);
        mEditText.setHint(mHint);
    }
}
 
Example 3
Source File: FloatLabelLayout.java    From standardlib with Apache License 2.0 6 votes vote down vote up
/**
 * Hide the label
 */
private void hideLabel(boolean animate) {
    if (animate) {
        float scale = mEditText.getTextSize() / mLabel.getTextSize();
        ViewCompat.setScaleX(mLabel, 1f);
        ViewCompat.setScaleY(mLabel, 1f);
        ViewCompat.setTranslationY(mLabel, 0f);

        ViewCompat.animate(mLabel)
                .translationY(mLabel.getHeight())
                .setDuration(ANIMATION_DURATION)
                .scaleX(scale)
                .scaleY(scale)
                .setListener(new ViewPropertyAnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(View view) {
                        mLabel.setVisibility(INVISIBLE);
                        mEditText.setHint(mHint);
                    }
                })
                .setInterpolator(mInterpolator).start();
    } else {
        mLabel.setVisibility(INVISIBLE);
        mEditText.setHint(mHint);
    }
}
 
Example 4
Source File: ScaleInTopAnimator.java    From RecyclerviewAnimators with Apache License 2.0 5 votes vote down vote up
@Override
    protected void preAnimateAddImpl(RecyclerView.ViewHolder holder) {
        // @TODO https://code.google.com/p/android/issues/detail?id=80863
        ViewCompat.setPivotY(holder.itemView, 0);
//        holder.itemView.setPivotY(0);
        ViewCompat.setScaleX(holder.itemView, 0);
        ViewCompat.setScaleY(holder.itemView, 0);
    }
 
Example 5
Source File: MaterialFooterView.java    From BitkyShop with MIT License 5 votes vote down vote up
@Override
public void onComlete(MaterialRefreshLayout materialRefreshLayout) {
    if (materialWaveView != null) {
        materialWaveView.onComlete(materialRefreshLayout);
    }
    if (circleProgressBar != null) {
        circleProgressBar.onComlete(materialRefreshLayout);
        ViewCompat.setTranslationY(circleProgressBar, 0);
        ViewCompat.setScaleX(circleProgressBar, 0);
        ViewCompat.setScaleY(circleProgressBar, 0);
    }


}
 
Example 6
Source File: MaterialHeaderView.java    From styT with Apache License 2.0 5 votes vote down vote up
@Override
public void onPull(MaterialRefreshLayout materialRefreshLayout, float fraction) {
    if (materialWaveView != null) {
        materialWaveView.onPull(materialRefreshLayout, fraction);
    }
    if (circleProgressBar != null) {
        circleProgressBar.onPull(materialRefreshLayout, fraction);
        float a = Util.limitValue(1, fraction);
        ViewCompat.setScaleX(circleProgressBar, a);
        ViewCompat.setScaleY(circleProgressBar, a);
        ViewCompat.setAlpha(circleProgressBar, a);
    }
}
 
Example 7
Source File: ProgressLayout.java    From AgentWebX5 with Apache License 2.0 5 votes vote down vote up
@Override
public void onPullReleasing(float fraction, float maxHeadHeight, float headHeight) {
    mIsBeingDragged = false;
    if (fraction >= 1f) {
        ViewCompat.setScaleX(mCircleView, 1f);
        ViewCompat.setScaleY(mCircleView, 1f);
    } else {
        ViewCompat.setScaleX(mCircleView, fraction);
        ViewCompat.setScaleY(mCircleView, fraction);
    }
}
 
Example 8
Source File: DepthPageTransformer.java    From LoyalNativeSlider with MIT License 5 votes vote down vote up
@Override
protected void onTransform(View view, float position) {
	if (position <= 0f) {
           ViewCompat.setTranslationX(view,0f);
           ViewCompat.setScaleX(view,1f);
           ViewCompat.setScaleY(view,1f);
	} else if (position <= 1f) {
		final float scaleFactor = MIN_SCALE + (1 - MIN_SCALE) * (1 - Math.abs(position));
           ViewCompat.setAlpha(view,1-position);
           ViewCompat.setPivotY(view,0.5f * view.getHeight());
           ViewCompat.setTranslationX(view,view.getWidth() * - position);
           ViewCompat.setScaleX(view,scaleFactor);
           ViewCompat.setScaleY(view, scaleFactor);
	}
}
 
Example 9
Source File: PrismActivity.java    From PrismView with Apache License 2.0 5 votes vote down vote up
private void mainViewUpdate(double currentValue) {
  float ratio =  (float) SpringUtil.mapValueFromRangeToRange(currentValue, 0, 1,
      1, smallRatio);
  ViewCompat.setScaleX(mainView, ratio);
  ViewCompat.setScaleY(mainView, ratio);
  ViewCompat.setAlpha(mainView, ratio);
}
 
Example 10
Source File: MaterialHeadView.java    From styT with Apache License 2.0 5 votes vote down vote up
@Override
public void onComlete(MaterialRefreshLayout materialRefreshLayout) {
    if (materialWaveView != null) {
        materialWaveView.onComlete(materialRefreshLayout);
    }
    if (circleProgressBar != null) {
        circleProgressBar.onComlete(materialRefreshLayout);
        ViewCompat.setTranslationY(circleProgressBar, 0);
        ViewCompat.setScaleX(circleProgressBar, 0);
        ViewCompat.setScaleY(circleProgressBar, 0);
    }

}
 
Example 11
Source File: ProgressLayout.java    From TwinklingRefreshLayout with Apache License 2.0 5 votes vote down vote up
@Override
public void onPullReleasing(float fraction, float maxHeadHeight, float headHeight) {
    mIsBeingDragged = false;
    if (fraction >= 1f) {
        ViewCompat.setScaleX(mCircleView, 1f);
        ViewCompat.setScaleY(mCircleView, 1f);
    } else {
        ViewCompat.setScaleX(mCircleView, fraction);
        ViewCompat.setScaleY(mCircleView, fraction);
    }
}
 
Example 12
Source File: MaterialFooterView.java    From styT with Apache License 2.0 5 votes vote down vote up
@Override
public void onPull(MaterialRefreshLayout materialRefreshLayout, float fraction) {
    if (materialWaveView != null) {
        materialWaveView.onPull(materialRefreshLayout, fraction);
    }
    if (circleProgressBar != null) {
        circleProgressBar.onPull(materialRefreshLayout, fraction);
        float a = Util.limitValue(1, fraction);
        ViewCompat.setScaleX(circleProgressBar, 1);
        ViewCompat.setScaleY(circleProgressBar, 1);
        ViewCompat.setAlpha(circleProgressBar, a);
    }
}
 
Example 13
Source File: MaterialFooterView.java    From SprintNBA with Apache License 2.0 5 votes vote down vote up
@Override
public void onPull(MaterialRefreshLayout materialRefreshLayout, float fraction) {
    if (materialWaveView != null) {
        materialWaveView.onPull(materialRefreshLayout, fraction);
    }
    if (circleProgressBar != null) {
        circleProgressBar.onPull(materialRefreshLayout, fraction);
        float a = Util.limitValue(1, fraction);
        ViewCompat.setScaleX(circleProgressBar, 1);
        ViewCompat.setScaleY(circleProgressBar, 1);
        ViewCompat.setAlpha(circleProgressBar, a);
    }
}
 
Example 14
Source File: MaterialHeadView.java    From SprintNBA with Apache License 2.0 5 votes vote down vote up
@Override
public void onPull(MaterialRefreshLayout materialRefreshLayout, float fraction) {
    if(materialWaveView != null)
    {
        materialWaveView.onPull(materialRefreshLayout, fraction);
    }
    if(circleProgressBar != null)
    {
        circleProgressBar.onPull(materialRefreshLayout, fraction);
        float a = Util.limitValue(1,fraction);
        ViewCompat.setScaleX(circleProgressBar, 1);
        ViewCompat.setScaleY(circleProgressBar, 1);
        ViewCompat.setAlpha(circleProgressBar, a);
    }
}
 
Example 15
Source File: SwipeRefreshLayout.java    From fangzhuishushenqi with Apache License 2.0 5 votes vote down vote up
/**
 * Pre API 11, this does an alpha animation.
 * @param progress
 */
private void setAnimationProgress(float progress) {
    if (isAlphaUsedForScale()) {
        setColorViewAlpha((int) (progress * MAX_ALPHA));
    } else {
        ViewCompat.setScaleX(mCircleView, progress);
        ViewCompat.setScaleY(mCircleView, progress);
    }
}
 
Example 16
Source File: ScaleInAnimator.java    From RecyclerviewAnimators with Apache License 2.0 4 votes vote down vote up
@Override
protected void preAnimateAddImpl(RecyclerView.ViewHolder holder) {
    ViewCompat.setScaleX(holder.itemView, 0);
    ViewCompat.setScaleY(holder.itemView, 0);
}
 
Example 17
Source File: WaveSwipeRefreshLayout.java    From WaveSwipeRefreshLayout with Apache License 2.0 4 votes vote down vote up
public void scaleWithKeepingAspectRatio(float scale) {
  ViewCompat.setScaleX(this, scale);
  ViewCompat.setScaleY(this, scale);
}
 
Example 18
Source File: ScaleInOutItemAnimator.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
@Override
protected void prepareAnimateAdd(RecyclerView.ViewHolder holder) {
    retrieveOriginalScale(holder);
    ViewCompat.setScaleX(holder.itemView, mInitialScaleX);
    ViewCompat.setScaleY(holder.itemView, mInitialScaleY);
}
 
Example 19
Source File: ScaleInLeftAnimator.java    From RecyclerviewAnimators with Apache License 2.0 4 votes vote down vote up
@Override
protected void preAnimateAddImpl(RecyclerView.ViewHolder holder) {
    ViewCompat.setPivotX(holder.itemView, 0);
    ViewCompat.setScaleX(holder.itemView, 0);
    ViewCompat.setScaleY(holder.itemView, 0);
}
 
Example 20
Source File: GearLoadingLayout.java    From GearLoadingProject with Apache License 2.0 4 votes vote down vote up
private void selectShowAnimation(boolean showDialog) {
    if (mActivityContentView == null || isAnimating)
        return;

    if (showDialog) {
        mActivityContentView.addView(GearLoadingLayout.this);
    }

    this.showDialog = showDialog;
    float from = 0f;
    float to = 0f;
    boolean xAxis = false;
    boolean scaleDialog = false;


    switch (mShowMode) {
        case TOP:
            from = -mDialogHeight;
            to = 0;
            break;
        case BOTTOM:
            from = mDialogHeight;
            to = 0;
            break;
        case LEFT:
            from = -mDialogWidth;
            to = 0;
            xAxis = true;
            break;
        case RIGHT:
            from = mDialogWidth;
            to = 0;
            xAxis = true;
            break;
        case CENTER:
            scaleDialog = true;
            break;
        default:
            break;
    }

    setGearLayoutWrapperGravity();
    applyStyle();
    start();
    if (scaleDialog) {
        ViewCompat.setScaleX(mGearLayoutWrapper, showDialog ? 0 : 1);
        ViewCompat.setScaleY(mGearLayoutWrapper, showDialog ? 0 : 1);
        ViewCompat.animate(mGearLayoutWrapper).scaleX(showDialog ? 1 : 0).scaleY(showDialog ? 1 : 0).setDuration(showDialogDuration).withStartAction(startAction).withEndAction(endAction).start();
    } else {
        if (!xAxis) {
            ViewCompat.setTranslationY(mGearLayoutWrapper, showDialog ? from : to);
            ViewCompat.animate(mGearLayoutWrapper).translationY(showDialog ? to : from).setDuration(showDialogDuration).withStartAction(startAction).withEndAction(endAction).start();
        } else {
            ViewCompat.setTranslationX(mGearLayoutWrapper, showDialog ? from : to);
            ViewCompat.animate(mGearLayoutWrapper).translationX(showDialog ? to : from).setDuration(showDialogDuration).withStartAction(startAction).withEndAction(endAction).start();
        }
    }

    ViewCompat.setAlpha(mMainBackground, showDialog ? 0 : isEnableBlur ? 1 : mMainBackgroundAlpha);
    ViewCompat.animate(mMainBackground).alpha(showDialog ? isEnableBlur ? 1 : mMainBackgroundAlpha : 0).setDuration(showDialogDuration).start();
}