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

The following examples show how to use android.support.v4.view.ViewCompat#setScaleX() . 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: 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 2
Source File: SwipeRefreshLayout.java    From BookReader 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 3
Source File: MaterialHeaderView.java    From BitkyShop with MIT License 5 votes vote down vote up
@Override
public void onBegin(MaterialRefreshLayout materialRefreshLayout) {
    if (materialWaveView != null) {
        materialWaveView.onBegin(materialRefreshLayout);
    }
    if (circleProgressBar != null) {
        ViewCompat.setScaleX(circleProgressBar, 0.001f);
        ViewCompat.setScaleY(circleProgressBar, 0.001f);
        circleProgressBar.onBegin(materialRefreshLayout);
    }
}
 
Example 4
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 5
Source File: ZoomPageTransformer.java    From KUtils-master with Apache License 2.0 5 votes vote down vote up
@Override
public void handleLeftPage(View view, float position) {
    float scale = Math.max(mMinScale, 1 + position);
    float vertMargin = view.getHeight() * (1 - scale) / 2;
    float horzMargin = view.getWidth() * (1 - scale) / 2;
    ViewCompat.setTranslationX(view, horzMargin - vertMargin / 2);
    ViewCompat.setScaleX(view, scale);
    ViewCompat.setScaleY(view, scale);
    ViewCompat.setAlpha(view, mMinAlpha + (scale - mMinScale) / (1 - mMinScale) * (1 - mMinAlpha));
}
 
Example 6
Source File: MaterialFoodView.java    From BitkyShop with MIT License 5 votes vote down vote up
@Override
public void onBegin(MaterialRefreshLayout materialRefreshLayout) {
    if (materialWaveView != null) {
        materialWaveView.onBegin(materialRefreshLayout);
    }
    if (circleProgressBar != null) {
        circleProgressBar.onBegin(materialRefreshLayout);
        ViewCompat.setScaleX(circleProgressBar, 1);
        ViewCompat.setScaleY(circleProgressBar, 1);
    }
}
 
Example 7
Source File: ZoomCenterPageTransformer.java    From JD-Test with Apache License 2.0 5 votes vote down vote up
@Override
public void handleLeftPage(View view, float position) {
    ViewCompat.setTranslationX(view, -view.getWidth() * position);

    ViewCompat.setPivotX(view, view.getWidth() * 0.5f);
    ViewCompat.setPivotY(view, view.getHeight() * 0.5f);
    ViewCompat.setScaleX(view, 1 + position);
    ViewCompat.setScaleY(view, 1 + position);

    if (position < -0.95f) {
        ViewCompat.setAlpha(view, 0);
    } else {
        ViewCompat.setAlpha(view, 1);
    }
}
 
Example 8
Source File: ViewHelper.java    From RecyclerviewAnimators with Apache License 2.0 5 votes vote down vote up
public static void clear(View v) {
        ViewCompat.setAlpha(v, 1);
        ViewCompat.setScaleY(v, 1);
        ViewCompat.setScaleX(v, 1);
        ViewCompat.setTranslationY(v, 0);
        ViewCompat.setTranslationX(v, 0);
        ViewCompat.setRotation(v, 0);
        ViewCompat.setRotationY(v, 0);
        ViewCompat.setRotationX(v, 0);
        // @TODO https://code.google.com/p/android/issues/detail?id=80863
        ViewCompat.setPivotY(v, v.getMeasuredHeight() / 2);
//        v.setPivotY(v.getMeasuredHeight() / 2);
        ViewCompat.setPivotX(v, v.getMeasuredWidth() / 2);
        ViewCompat.animate(v).setInterpolator(null);
    }
 
Example 9
Source File: SwipyRefreshLayout.java    From SwipyRefreshLayout with MIT License 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 10
Source File: SuperSwipeRefreshLayout.java    From SuperSwipeRefreshLayout with Apache License 2.0 5 votes vote down vote up
private void setAnimationProgress(float progress) {
    if (!usingDefaultHeader) {
        progress = 1;
    }
    ViewCompat.setScaleX(mHeadViewContainer, progress);
    ViewCompat.setScaleY(mHeadViewContainer, progress);
}
 
Example 11
Source File: FloatLabelLayout.java    From xifan with Apache License 2.0 5 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 12
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 13
Source File: MaterialHeaderView.java    From SprintNBA with Apache License 2.0 5 votes vote down vote up
@Override
public void onBegin(MaterialRefreshLayout materialRefreshLayout) {
    if (materialWaveView != null) {
        materialWaveView.onBegin(materialRefreshLayout);
    }
    if (circleProgressBar != null) {
        ViewCompat.setScaleX(circleProgressBar, 0.001f);
        ViewCompat.setScaleY(circleProgressBar, 0.001f);
        circleProgressBar.onBegin(materialRefreshLayout);
    }
}
 
Example 14
Source File: ViewHelper.java    From MemoryCleaner with Apache License 2.0 5 votes vote down vote up
public static void clear(View v) {
    ViewCompat.setAlpha(v, 1);
    ViewCompat.setScaleY(v, 1);
    ViewCompat.setScaleX(v, 1);
    ViewCompat.setTranslationY(v, 0);
    ViewCompat.setTranslationX(v, 0);
    ViewCompat.setRotation(v, 0);
    ViewCompat.setRotationY(v, 0);
    ViewCompat.setRotationX(v, 0);
    v.setPivotY(v.getMeasuredHeight() / 2);
    ViewCompat.setPivotX(v, v.getMeasuredWidth() / 2);
    ViewCompat.animate(v).setInterpolator(null);
}
 
Example 15
Source File: ZoomFadePageTransformer.java    From JD-Test with Apache License 2.0 5 votes vote down vote up
@Override
public void handleLeftPage(View view, float position) {
    ViewCompat.setTranslationX(view, -view.getWidth() * position);

    ViewCompat.setPivotX(view, view.getWidth() * 0.5f);
    ViewCompat.setPivotY(view, view.getHeight() * 0.5f);
    ViewCompat.setScaleX(view, 1 + position);
    ViewCompat.setScaleY(view, 1 + position);

    ViewCompat.setAlpha(view, 1 + position);
}
 
Example 16
Source File: MaterialFoodView.java    From MousePaint 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 17
Source File: ZoomStackPageTransformer.java    From KUtils-master with Apache License 2.0 5 votes vote down vote up
@Override
public void handleRightPage(View view, float position) {
    ViewCompat.setTranslationX(view, -view.getWidth() * position);

    ViewCompat.setPivotX(view, view.getWidth() * 0.5f);
    ViewCompat.setPivotY(view, view.getHeight() * 0.5f);
    ViewCompat.setScaleX(view, 1 + position);
    ViewCompat.setScaleY(view, 1 + position);

    if (position > 0.95f) {
        ViewCompat.setAlpha(view, 0);
    } else {
        ViewCompat.setAlpha(view, 1);
    }
}
 
Example 18
Source File: MaterialHeadView.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 19
Source File: ZoomInAnimator.java    From PowerfulRecyclerView with Apache License 2.0 4 votes vote down vote up
@Override
protected void onPreAnimateAdd(RecyclerView.ViewHolder holder) {
    ViewCompat.setScaleX(holder.itemView, 0);
    ViewCompat.setScaleY(holder.itemView, 0);
    //setAddDuration(1000);
}
 
Example 20
Source File: ScaleInOutItemAnimator.java    From narrate-android with Apache License 2.0 4 votes vote down vote up
@Override
protected void prepareAnimateAdd(RecyclerView.ViewHolder holder) {
    retrieveOriginalScale(holder);
    ViewCompat.setScaleX(holder.itemView, 0);
    ViewCompat.setScaleY(holder.itemView, 0);
}