Example usage for android.view View SCALE_Y

List of usage examples for android.view View SCALE_Y

Introduction

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

Prototype

Property SCALE_Y

To view the source code for android.view View SCALE_Y.

Click Source Link

Document

A Property wrapper around the scaleY functionality handled by the View#setScaleY(float) and View#getScaleY() methods.

Usage

From source file:Main.java

@NonNull
private static AnimatorSet createDisappearAnim(View btnPanel, View recyclerView, View locationTxt,
        View headline) {//from  w w w  . java  2  s .c  o  m
    AnimatorSet animAll = new AnimatorSet();

    Animator anim1_1 = ObjectAnimator.ofFloat(headline, View.ALPHA, 1, 0);
    Animator anim1_2 = ObjectAnimator.ofFloat(btnPanel, View.ALPHA, 1, 0);
    Animator anim1_3 = ObjectAnimator.ofFloat(btnPanel, View.ALPHA, 1, 0);
    Animator anim1_4 = ObjectAnimator.ofFloat(recyclerView, View.ALPHA, 1, 0);
    setBatchTiming(400, 0, anim1_1, anim1_2, anim1_3, anim1_4, anim1_4);
    animAll.play(anim1_1).with(anim1_2).with(anim1_3).with(anim1_4);

    Interpolator interpolator2 = new DecelerateInterpolator();
    Animator anim2_1 = ObjectAnimator.ofFloat(locationTxt, View.ALPHA, 1, 0);
    Animator anim2_2 = ObjectAnimator.ofFloat(locationTxt, View.SCALE_X, 1f, 2f);
    Animator anim2_3 = ObjectAnimator.ofFloat(locationTxt, View.SCALE_Y, 1f, 2f);
    anim2_1.setInterpolator(interpolator2);
    anim2_2.setInterpolator(interpolator2);
    anim2_3.setInterpolator(interpolator2);
    setBatchTiming(800, 0, anim2_1, anim2_2, anim2_3);
    animAll.play(anim2_1).with(anim2_2).with(anim2_3).after(anim1_1);
    return animAll;
}

From source file:Main.java

@NonNull
private static AnimatorSet createRevealAnimation(View headline, View image, View startBtn, View pick1,
        View pick2) {/*w w  w . ja  v  a 2s  .c  o m*/
    AnimatorSet animAll = new AnimatorSet();

    Animator anim1_1 = ObjectAnimator.ofFloat(headline, View.ALPHA, 0, 1, 1);
    Animator anim1_2 = ObjectAnimator.ofFloat(headline, View.TRANSLATION_Y, -headline.getBottom(), 60, 0);
    Animator anim1_3 = ObjectAnimator.ofFloat(headline, View.SCALE_X, 0.1f, 0.475f, 1);
    Animator anim1_4 = ObjectAnimator.ofFloat(headline, View.SCALE_Y, 0.1f, 0.475f, 1);
    setBatchTiming(1000, 0, anim1_1, anim1_2, anim1_3, anim1_4);
    animAll.play(anim1_1).with(anim1_2).with(anim1_3).with(anim1_4);

    Animator anim2_1 = ObjectAnimator.ofFloat(image, View.ALPHA, 0, 1);
    Animator anim2_2 = ObjectAnimator.ofFloat(image, View.TRANSLATION_Y, image.getHeight() / 4, 0);
    setBatchTiming(800, 0, anim2_1, anim2_2);
    animAll.play(anim2_1).with(anim2_2).after(anim1_1);

    Animator anim3_1 = ObjectAnimator.ofFloat(startBtn, View.ALPHA, 0, 1);
    Animator anim3_2 = ObjectAnimator.ofFloat(startBtn, View.ALPHA, 0, 1);
    Animator anim3_3 = ObjectAnimator.ofFloat(pick1, View.ALPHA, 0, 1);
    Animator anim3_4 = ObjectAnimator.ofFloat(pick2, View.ALPHA, 0, 1);
    setBatchTiming(1800, 0, anim3_1, anim3_2, anim3_3, anim3_4);
    animAll.play(anim3_1).with(anim3_2).with(anim3_3).with(anim3_4).after(anim1_1);
    return animAll;
}

From source file:Main.java

@NonNull
private static AnimatorSet createDisappearAnim(View startBtn, View pick1, View pick2, View image,
        View headline) {//from w ww  .j a v a 2 s .  c  om
    AnimatorSet animAll = new AnimatorSet();

    Animator anim1_1 = ObjectAnimator.ofFloat(headline, View.ALPHA, 1, 0);
    Animator anim1_2 = ObjectAnimator.ofFloat(startBtn, View.ALPHA, 1, 0);
    Animator anim1_3 = ObjectAnimator.ofFloat(startBtn, View.ALPHA, 1, 0);
    Animator anim1_4 = ObjectAnimator.ofFloat(pick1, View.ALPHA, 1, 0);
    Animator anim1_5 = ObjectAnimator.ofFloat(pick2, View.ALPHA, 1, 0);
    setBatchTiming(400, 0, anim1_1, anim1_2, anim1_3, anim1_4, anim1_5);
    animAll.play(anim1_1).with(anim1_2).with(anim1_3).with(anim1_4).with(anim1_5);

    Interpolator interpolator2 = new DecelerateInterpolator();
    Animator anim2_1 = ObjectAnimator.ofFloat(image, View.ALPHA, 1, 0);
    Animator anim2_2 = ObjectAnimator.ofFloat(image, View.SCALE_X, 1f, 2f);
    Animator anim2_3 = ObjectAnimator.ofFloat(image, View.SCALE_Y, 1f, 2f);
    anim2_1.setInterpolator(interpolator2);
    anim2_2.setInterpolator(interpolator2);
    anim2_3.setInterpolator(interpolator2);
    setBatchTiming(800, 0, anim2_1, anim2_2, anim2_3);
    animAll.play(anim2_1).with(anim2_2).with(anim2_3).after(anim1_1);
    return animAll;
}

From source file:com.github.rubensousa.floatingtoolbar.FloatingAnimatorImpl.java

@Override
public void show() {
    super.show();
    int rootWidth = getRootView().getWidth();
    float endFabX;

    if (getFab().getLeft() > rootWidth / 2f) {
        endFabX = getFab().getLeft() - getFab().getWidth();
    } else {/*w w  w. j  a  va2  s  .  c om*/
        endFabX = getFab().getLeft() + getFab().getWidth();
    }

    PropertyValuesHolder xProperty = PropertyValuesHolder.ofFloat(View.X, endFabX);
    PropertyValuesHolder yProperty = PropertyValuesHolder.ofFloat(View.Y, getFloatingToolbar().getY() * 0.95f);
    PropertyValuesHolder scaleXProperty = PropertyValuesHolder.ofFloat(View.SCALE_X, 0);
    PropertyValuesHolder scaleYProperty = PropertyValuesHolder.ofFloat(View.SCALE_Y, 0);

    ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(getFab(), xProperty, yProperty,
            scaleXProperty, scaleYProperty);
    animator.setDuration(FAB_MORPH_DURATION);
    animator.setInterpolator(new AccelerateInterpolator());
    animator.start();

    ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(getFloatingToolbar(), "scaleX", 1f);
    objectAnimator.setDuration(CIRCULAR_REVEAL_DURATION);
    objectAnimator.setStartDelay(CIRCULAR_REVEAL_DELAY);
    objectAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    objectAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationStart(Animator animation) {
            getFloatingToolbar().setVisibility(View.VISIBLE);
            getFab().setVisibility(View.INVISIBLE);
        }
    });
    objectAnimator.start();
}

From source file:net.huannguyen.conductorexample.transition.DetailPopAnimChangeHandler.java

@NonNull
@Override//from w w w.  j ava  2 s  .  c om
protected Animator getAnimator(@NonNull ViewGroup container, @Nullable View from, @Nullable View to,
        boolean isPush, boolean toAddedToContainer) {

    // Make sure the from view is a CountryDetailView
    if (from == null || !(from instanceof CountryDetailView))
        throw new IllegalArgumentException("The from view must be a CountryDetailView");

    if (to == null)
        throw new IllegalArgumentException("The to view must not be null");

    final CountryDetailView detailView = (CountryDetailView) from;

    AnimatorSet animatorSet = new AnimatorSet();

    // Set the to View's alpha to 0 to hide it at the beginning.
    to.setAlpha(0);

    // Scale down to hide the fab button
    PropertyValuesHolder fabScaleX = PropertyValuesHolder.ofFloat(View.SCALE_X, 0);
    PropertyValuesHolder fabScaleY = PropertyValuesHolder.ofFloat(View.SCALE_Y, 0);
    Animator hideFabButtonAnimator = ObjectAnimator.ofPropertyValuesHolder(detailView.favouriteFab, fabScaleX,
            fabScaleY);

    // Slide up the flag
    Animator flagAnimator = ObjectAnimator.ofFloat(detailView.flagView, View.TRANSLATION_Y, 0,
            -detailView.flagView.getHeight());

    // Slide down the details
    Animator detailAnimator = ObjectAnimator.ofFloat(detailView.detailGroup, View.TRANSLATION_Y, 0,
            detailView.detailGroup.getHeight());

    // Show the new view
    Animator showToViewAnimator = ObjectAnimator.ofFloat(to, View.ALPHA, 0, 1);

    animatorSet.playTogether(hideFabButtonAnimator, flagAnimator, detailAnimator, showToViewAnimator);
    animatorSet.setDuration(300);
    animatorSet.setInterpolator(new FastOutLinearInInterpolator());

    animatorSet.start();

    return animatorSet;
}

From source file:io.jawg.osmcontributor.ui.adapters.OfflineRegionsAdapter.java

@Override
public void onBindViewHolder(final OfflineRegionHolder holder, final int position) {
    OfflineRegionItem region = offlineRegions.get(position);

    String regionName = OfflineRegionManager.decodeRegionName(region.getOfflineRegion().getMetadata());
    holder.offlineRegionTextView.setText(regionName);

    if (region.isSelected()) {
        Animator animX = ObjectAnimator.ofFloat(holder.cardView, View.SCALE_X, 1.15f);
        Animator animY = ObjectAnimator.ofFloat(holder.cardView, View.SCALE_Y, 1.15f);
        AnimatorSet animSet = new AnimatorSet();
        animSet.playTogether(animX, animY);
        animSet.start();// w w w.j a  va 2 s . co  m
    } else {
        Animator animX = ObjectAnimator.ofFloat(holder.cardView, View.SCALE_X, 1.0f);
        Animator animY = ObjectAnimator.ofFloat(holder.cardView, View.SCALE_Y, 1.0f);
        AnimatorSet animSet = new AnimatorSet();
        animSet.playTogether(animX, animY);
        animSet.start();
    }

    if (region.getStatus().isComplete()) {
        holder.cardView.setBackgroundColor(ContextCompat.getColor(context, R.color.colorPrimaryDark));
        holder.offlineRegionTextView.setTextColor(Color.WHITE);
    } else {
        holder.cardView.setBackgroundColor(ContextCompat.getColor(context, R.color.active_text));
        holder.offlineRegionTextView.setTextColor(ContextCompat.getColor(context, R.color.disable_text));
    }
}

From source file:net.huannguyen.conductorexample.transition.DetailPushAnimChangeHandler.java

@NonNull
@Override//www .  j av a2 s  .  c  om
protected Animator getAnimator(@NonNull ViewGroup container, @Nullable View from, @Nullable View to,
        boolean isPush, boolean toAddedToContainer) {

    // Make sure the to view is a CountryDetailView
    if (to == null || !(to instanceof CountryDetailView))
        throw new IllegalArgumentException("The to view must be a CountryDetailView");

    final CountryDetailView detailView = (CountryDetailView) to;

    // Set the button scale to 0 to make it invisible at the beginning.
    detailView.favouriteFab.setScaleX(0);
    detailView.favouriteFab.setScaleY(0);

    AnimatorSet animatorSet = new AnimatorSet();

    AnimatorSet flagAndDetailAnim = new AnimatorSet();

    // Hide the old view
    Animator hideFromViewAnim = ObjectAnimator.ofFloat(from, View.ALPHA, 1, 0);

    // Slide down the flag
    Animator flagAnim = ObjectAnimator.ofFloat(detailView.flagView, View.TRANSLATION_Y,
            -detailView.flagView.getHeight(), 0);

    // Slide up the details
    Animator detailAnim = ObjectAnimator.ofFloat(detailView.detailGroup, View.TRANSLATION_Y,
            detailView.detailGroup.getHeight(), 0);

    flagAndDetailAnim.playTogether(hideFromViewAnim, flagAnim, detailAnim);
    flagAndDetailAnim.setDuration(300);
    flagAndDetailAnim.setInterpolator(new FastOutSlowInInterpolator());

    // Scale up the favourite fab
    PropertyValuesHolder fabScaleX = PropertyValuesHolder.ofFloat(View.SCALE_X, 0, 1);
    PropertyValuesHolder fabScaleY = PropertyValuesHolder.ofFloat(View.SCALE_Y, 0, 1);
    Animator favouriteAnim = ObjectAnimator
            .ofPropertyValuesHolder(detailView.favouriteFab, fabScaleX, fabScaleY).setDuration(200);

    animatorSet.playSequentially(flagAndDetailAnim, favouriteAnim);

    animatorSet.start();

    return animatorSet;
}

From source file:com.bartoszlipinski.viewpropertyobjectanimator.ViewPropertyObjectAnimator.java

public ViewPropertyObjectAnimator scaleY(float scaleY) {
    animateProperty(View.SCALE_Y, scaleY);
    return this;
}

From source file:com.bartoszlipinski.viewpropertyobjectanimator.ViewPropertyObjectAnimator.java

public ViewPropertyObjectAnimator scaleYBy(float scaleYBy) {
    animatePropertyBy(View.SCALE_Y, scaleYBy);
    return this;
}

From source file:MainActivity.java

private void zoomFromThumbnail(final ImageView imageViewThumb) {
    if (mCurrentAnimator != null) {
        mCurrentAnimator.cancel();//from ww  w. ja va 2  s.c o m
    }

    final Rect startBounds = new Rect();
    final Rect finalBounds = new Rect();
    final Point globalOffset = new Point();

    imageViewThumb.getGlobalVisibleRect(startBounds);
    findViewById(R.id.frameLayout).getGlobalVisibleRect(finalBounds, globalOffset);
    mImageViewExpanded
            .setImageBitmap(loadSampledResource(R.drawable.image, finalBounds.height(), finalBounds.width()));

    startBounds.offset(-globalOffset.x, -globalOffset.y);
    finalBounds.offset(-globalOffset.x, -globalOffset.y);

    float startScale;
    if ((float) finalBounds.width() / finalBounds.height() > (float) startBounds.width()
            / startBounds.height()) {
        startScale = (float) startBounds.height() / finalBounds.height();
        float startWidth = startScale * finalBounds.width();
        float deltaWidth = (startWidth - startBounds.width()) / 2;
        startBounds.left -= deltaWidth;
        startBounds.right += deltaWidth;
    } else {
        startScale = (float) startBounds.width() / finalBounds.width();
        float startHeight = startScale * finalBounds.height();
        float deltaHeight = (startHeight - startBounds.height()) / 2;
        startBounds.top -= deltaHeight;
        startBounds.bottom += deltaHeight;
    }

    imageViewThumb.setVisibility(View.GONE);
    mImageViewExpanded.setVisibility(View.VISIBLE);
    mImageViewExpanded.setPivotX(0f);
    mImageViewExpanded.setPivotY(0f);

    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.play(ObjectAnimator.ofFloat(mImageViewExpanded, View.X, startBounds.left, finalBounds.left))
            .with(ObjectAnimator.ofFloat(mImageViewExpanded, View.Y, startBounds.top, finalBounds.top))
            .with(ObjectAnimator.ofFloat(mImageViewExpanded, View.SCALE_X, startScale, 1f))
            .with(ObjectAnimator.ofFloat(mImageViewExpanded, View.SCALE_Y, startScale, 1f));
    animatorSet.setDuration(1000);
    animatorSet.setInterpolator(new AccelerateInterpolator());
    animatorSet.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            mCurrentAnimator = null;
        }

        @Override
        public void onAnimationCancel(Animator animation) {
            mCurrentAnimator = null;
        }
    });
    animatorSet.start();
    mCurrentAnimator = animatorSet;
}