Example usage for android.view View setScaleX

List of usage examples for android.view View setScaleX

Introduction

In this page you can find the example usage for android.view View setScaleX.

Prototype

public void setScaleX(float scaleX) 

Source Link

Document

Sets the amount that the view is scaled in x around the pivot point, as a proportion of the view's unscaled width.

Usage

From source file:org.kei.android.phone.cellhistory.transformers.DepthPageTransformer.java

@Override
public void transformPage(final View view, final float position) {
    final int pageWidth = view.getWidth();

    if (position < -1) { // [-Infinity,-1)
        // This page is way off-screen to the left.
        view.setAlpha(0);//from   w w  w  .j ava2 s .  co  m

    } else if (position <= 0) { // [-1,0]
        // Use the default slide transition when moving to the left page
        view.setAlpha(1);
        view.setTranslationX(0);
        view.setScaleX(1);
        view.setScaleY(1);

    } else if (position <= 1) { // (0,1]
        // Fade the page out.
        view.setAlpha(1 - position);

        // Counteract the default slide transition
        view.setTranslationX(pageWidth * -position);

        // Scale the page down (between MIN_SCALE and 1)
        final float scaleFactor = MIN_SCALE + (1 - MIN_SCALE) * (1 - Math.abs(position));
        view.setScaleX(scaleFactor);
        view.setScaleY(scaleFactor);

    } else { // (1,+Infinity]
        // This page is way off-screen to the right.
        view.setAlpha(0);
    }
}

From source file:com.stanleyidesis.quotograph.ui.activity.LWQActivateActivity.java

void setupSourceBubbles() {
    sourceBubbles.get(0).setRotation(-5f);
    sourceBubbles.get(1).setRotation(5f);
    sourceBubbles.get(2).setRotation(-10f);
    for (View bubble : sourceBubbles) {
        bubble.setScaleX(0f);
        bubble.setScaleY(0f);//from w  w w  . ja  va  2s  . co m
    }
}

From source file:me.xiaopan.android.widget.DepthPageTransformer.java

@SuppressLint("NewApi")
@Override//from  w  w  w  . ja va 2s  .c om
public void transformPage(View view, float position) {
    int pageWidth = view.getWidth();
    if (position < -1) { // [-Infinity,-1)
                         // This page is way off-screen to the left.
        view.setAlpha(0);
    } else if (position <= 0) { // [-1,0]
                                // Use the default slide transition when
                                // moving to the left page
        view.setAlpha(1);
        view.setTranslationX(0);
        view.setScaleX(1);
        view.setScaleY(1);
    } else if (position <= 1) { // (0,1]
                                // Fade the page out.
        view.setAlpha(1 - position);
        // Counteract the default slide transition
        view.setTranslationX(pageWidth * -position);
        // Scale the page down (between MIN_SCALE and 1)
        float scaleFactor = MIN_SCALE + (1 - MIN_SCALE) * (1 - Math.abs(position));
        view.setScaleX(scaleFactor);
        view.setScaleY(scaleFactor);
    } else { // (1,+Infinity]
             // This page is way off-screen to the right.
        view.setAlpha(0);
    }
}

From source file:com.amaze.filemanager.utils.FlipAnim.java

public void transformPage(View view, float position) {
    int pageWidth = view.getWidth();
    if (position < -1) { // [-Infinity,-1)
        // This page is way off-screen to the left.
        view.setAlpha(0);//w  ww  .j  av  a 2 s . com
    } else if (position <= 0) { // [-1,0]
        // Use the default slide transition when moving to the left page
        view.setAlpha(1);
        view.setTranslationY(0);
        //   view.setRotationX(Math.round(360*position));
        view.setRotationY(Math.round(360 * position));
        view.setScaleX(1 + position);
        view.setScaleY(1 + position);
    } else if (position <= 1) { // (0,1]
        // Fade the page out.
        view.setAlpha(1 - position);
        // Counteract the default slide transition
        view.setTranslationY(pageWidth * position * position);
        view.setTranslationX(pageWidth * position * position);
        //   view.setRotationX(Math.round(360*position));
        view.setRotationY(Math.round(360 * position));
        // Scale the page down (between MIN_SCALE and 1)

        view.setScaleX(1 - position);
        view.setScaleY(1 - position);
    } else { // (1,+Infinity]
        // This page is way off-screen to the right.
        view.setAlpha(0);
    }
}

From source file:com.muller.snappingsample.SnappingRecyclerView.java

private void updateViews() {
    for (int i = 0; i < getChildCount(); i++) {
        View child = getChildAt(i);
        setMarginsForChild(child);// www  . j a  v a2  s.c o m

        if (_scaleViews) {
            float percentage = getPercentageFromCenter(child);
            float scale = 1f - (0.7f * percentage);

            child.setScaleX(scale);
            child.setScaleY(scale);
        }
    }
}

From source file:com.hannesdorfmann.home.HomeActivity.java

private void popAnim(View v, int startDelay, int duration) {
    if (v != null) {
        v.setAlpha(0f);//from   ww w.  j a  v  a 2s . c  om
        v.setScaleX(0f);
        v.setScaleY(0f);

        v.animate().alpha(1f).scaleX(1f).scaleY(1f).setStartDelay(startDelay).setDuration(duration)
                .setInterpolator(AnimationUtils.loadInterpolator(this, android.R.interpolator.overshoot));
    }
}

From source file:net.dewep.intranetepitech.animation.ZoomOutPageTransformer.java

private void positionPositive(View view, float position) {
    // [-1,1]//from  ww w . j  av a  2 s  .c  om
    // Modify the default slide transition to shrink the page as well
    int pageWidth = view.getWidth();
    int pageHeight = view.getHeight();
    float scaleFactor = Math.max(MIN_SCALE, 1 - Math.abs(position));
    float vertMargin = pageHeight * (1 - scaleFactor) / 2;
    float horzMargin = pageWidth * (1 - scaleFactor) / 2;
    if (position < 0) {
        view.setTranslationX(horzMargin - vertMargin / 2);
    } else {
        view.setTranslationX(-horzMargin + vertMargin / 2);
    }
    // Scale the page down (between MIN_SCALE and 1)
    view.setScaleX(scaleFactor);
    view.setScaleY(scaleFactor);
    // Fade the page relative to its size.
    view.setAlpha(MIN_ALPHA + (scaleFactor - MIN_SCALE) / (1 - MIN_SCALE) * (1 - MIN_ALPHA));
}

From source file:com.betterAlarm.deskclock.timer.TimerFragment.java

private void restoreScale(View view) {
    view.setScaleX(1.0f);
    view.setScaleY(1.0f);
}

From source file:edward.com.recyclerview.BaseItemAnimator.java

void reset(View v) {
    v.setAlpha(1);/*from  w  w w. j a v a  2  s. c  om*/
    v.setScaleY(1);
    v.setScaleX(1);
    v.setTranslationY(0);
    v.setTranslationX(0);
    v.setRotation(0);
    v.setRotationY(0);
    v.setRotationX(0);
    v.setPivotX(v.getMeasuredWidth() / 2);
    v.setPivotY(v.getMeasuredHeight() / 2);
    v.animate().setInterpolator(null);
}

From source file:org.alfresco.mobile.android.application.fragments.node.rendition.CarouselPreviewFragment.java

public void transformPage(View view, float position) {
    int pageWidth = view.getWidth();

    if (position < -1) { // [-Infinity,-1)
                         // This page is way off-screen to the left.
        view.setAlpha(0);//w  w  w . jav  a2  s . c  o  m

    } else if (position <= 0) { // [-1,0]
                                // Use the default slide transition when moving to the left page
        view.setAlpha(1);
        view.setTranslationX(0);
        view.setScaleX(1);
        view.setScaleY(1);

    } else if (position <= 1) { // (0,1]
                                // Fade the page out.
        view.setAlpha(1 - position);

        // Counteract the default slide transition
        view.setTranslationX(pageWidth * -position);

        // Scale the page down (between MIN_SCALE and 1)
        float scaleFactor = MIN_SCALE + (1 - MIN_SCALE) * (1 - Math.abs(position));
        view.setScaleX(scaleFactor);
        view.setScaleY(scaleFactor);

    } else { // (1,+Infinity]
             // This page is way off-screen to the right.
        view.setAlpha(0);
    }
}