Search in sources :

Example 51 with ViewPropertyAnimator

use of android.view.ViewPropertyAnimator in project apps-android-wikipedia by wikimedia.

the class FeedItemAnimator method animateRemoveImpl.

private void animateRemoveImpl(final ViewHolder holder) {
    final View view = holder.itemView;
    final ViewPropertyAnimator animation = view.animate();
    mRemoveAnimations.add(holder);
    animation.setDuration(getRemoveDuration()).alpha(0).setListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animator) {
            dispatchRemoveStarting(holder);
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            animation.setListener(null);
            view.setAlpha(1);
            dispatchRemoveFinished(holder);
            mRemoveAnimations.remove(holder);
            dispatchFinishedWhenDone();
        }
    }).start();
}
Also used : Animator(android.animation.Animator) ViewPropertyAnimator(android.view.ViewPropertyAnimator) ValueAnimator(android.animation.ValueAnimator) SimpleItemAnimator(android.support.v7.widget.SimpleItemAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) View(android.view.View) ProgressCardView(org.wikipedia.feed.progress.ProgressCardView) ViewPropertyAnimator(android.view.ViewPropertyAnimator)

Example 52 with ViewPropertyAnimator

use of android.view.ViewPropertyAnimator in project android_packages_apps_Gallery2 by LineageOS.

the class FilterShowActivity method loadEditorPanel.

public void loadEditorPanel(final FilterRepresentation representation) {
    final int currentId = representation.getEditorId();
    // show representation
    if (mCurrentEditor != null) {
        mCurrentEditor.detach();
    }
    mCurrentEditor = mEditorPlaceHolder.showEditor(currentId);
    if (mCurrentEditor.showsActionBar()) {
        setActionBar();
        showActionBar(true);
    } else {
    // showActionBar(false);
    }
    if (representation.getFilterType() == FilterRepresentation.TYPE_WATERMARK_CATEGORY) {
        loadWaterMarkPanel((FilterWatermarkRepresentation) representation);
        return;
    }
    if (currentId == ImageOnlyEditor.ID) {
        mCurrentEditor.reflectCurrentFilter();
        return;
    }
    if (currentId == EditorTruePortraitImageOnly.ID) {
        mCurrentEditor.reflectCurrentFilter();
        setActionBarForEffects(mCurrentEditor);
        return;
    }
    if (currentId == EditorCrop.ID) {
        loadEditorCropPanel();
        return;
    }
    if (useStraightenPanel(currentId)) {
        new Runnable() {

            @Override
            public void run() {
                StraightenPanel panel = new StraightenPanel();
                Bundle bundle = new Bundle();
                bundle.putInt(StraightenPanel.EDITOR_ID, currentId);
                bundle.putString(StraightenPanel.EDITOR_NAME, representation.getName());
                panel.setArguments(bundle);
                FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
                transaction.remove(getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG));
                transaction.replace(R.id.main_panel_container, panel, MainPanel.FRAGMENT_TAG);
                transaction.commit();
            }
        }.run();
        return;
    }
    if (currentId == TrueScannerEditor.ID) {
        new Runnable() {

            @Override
            public void run() {
                TrueScannerPanel panel = new TrueScannerPanel();
                FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
                transaction.remove(getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG));
                transaction.replace(R.id.main_panel_container, panel, MainPanel.FRAGMENT_TAG);
                transaction.commit();
            }
        }.run();
        return;
    }
    if (currentId == EditorTruePortraitMask.ID) {
        new Runnable() {

            @Override
            public void run() {
                setActionBarForEffects(mCurrentEditor);
                TruePortraitMaskEditorPanel panel = new TruePortraitMaskEditorPanel();
                FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
                transaction.remove(getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG));
                transaction.replace(R.id.main_panel_container, panel, MainPanel.FRAGMENT_TAG);
                transaction.commit();
            }
        }.run();
        return;
    }
    Runnable showEditor = new Runnable() {

        @Override
        public void run() {
            EditorPanel panel = new EditorPanel();
            panel.setEditor(currentId);
            setActionBarForEffects(mCurrentEditor);
            Fragment main = getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG);
            if (main instanceof MainPanel) {
                ((MainPanel) main).setEditorPanelFragment(panel);
            }
        }
    };
    Fragment main = getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG);
    boolean doAnimation = false;
    if (mShowingImageStatePanel && getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
        doAnimation = true;
    }
    if (doAnimation && main != null && main instanceof MainPanel) {
        MainPanel mainPanel = (MainPanel) main;
        View container = mainPanel.getView().findViewById(R.id.category_panel_container);
        View bottom = mainPanel.getView().findViewById(R.id.bottom_panel);
        int panelHeight = container.getHeight() + bottom.getHeight();
        ViewPropertyAnimator anim = mainPanel.getView().animate();
        anim.translationY(panelHeight).start();
        final Handler handler = new Handler();
        handler.postDelayed(showEditor, anim.getDuration());
    } else {
        showEditor.run();
    }
}
Also used : Bundle(android.os.Bundle) TruePortraitMaskEditorPanel(com.android.gallery3d.filtershow.category.TruePortraitMaskEditorPanel) EditorPanel(com.android.gallery3d.filtershow.editors.EditorPanel) Handler(android.os.Handler) TruePortraitMaskEditorPanel(com.android.gallery3d.filtershow.category.TruePortraitMaskEditorPanel) Fragment(android.support.v4.app.Fragment) MediaPickerFragment(com.android.gallery3d.filtershow.mediapicker.MediaPickerFragment) DialogFragment(android.support.v4.app.DialogFragment) CategoryView(com.android.gallery3d.filtershow.category.CategoryView) SwipableView(com.android.gallery3d.filtershow.category.SwipableView) WaterMarkView(com.android.gallery3d.filtershow.category.WaterMarkView) View(android.view.View) AdapterView(android.widget.AdapterView) Point(android.graphics.Point) TrueScannerPanel(com.android.gallery3d.filtershow.category.TrueScannerPanel) ViewPropertyAnimator(android.view.ViewPropertyAnimator) FragmentTransaction(android.support.v4.app.FragmentTransaction) MainPanel(com.android.gallery3d.filtershow.category.MainPanel) StraightenPanel(com.android.gallery3d.filtershow.category.StraightenPanel)

Example 53 with ViewPropertyAnimator

use of android.view.ViewPropertyAnimator in project animate by hitherejoe.

the class ViewPropertyAnimatorActivity method buildAndStartAnimation.

private void buildAndStartAnimation(View view) {
    ViewPropertyAnimator animator = view.animate();
    if (mAnimateAlphaCheck.isChecked() || view.getAlpha() == 0f) {
        float animationValue = view.getAlpha() == 0f ? 1f : 0f;
        animator.alpha(animationValue);
    }
    if (mAnimateScaleCheck.isChecked()) {
        float animationValue = view.getScaleY() == 0f ? 1f : 0f;
        animator.scaleX(animationValue).scaleY(animationValue);
    }
    if (mAnimateZCheck.isChecked()) {
        float animationValue = view.getTranslationZ() != 25f ? 25f : 2f;
        animator.translationZ(animationValue);
    }
    if (mAnimationDurationCheck.isChecked()) {
        animator.setDuration(500l);
    }
    if (mAnimationDelayCheck.isChecked()) {
        animator.setStartDelay(500l);
    }
    animator.setInterpolator(getSelectedInterpolator());
    animator.start();
}
Also used : ViewPropertyAnimator(android.view.ViewPropertyAnimator)

Example 54 with ViewPropertyAnimator

use of android.view.ViewPropertyAnimator in project Material-Movies by saulmm.

the class GUIUtils method startScaleAnimationFromPivotY.

public static void startScaleAnimationFromPivotY(int pivotX, int pivotY, final View v, final AnimatorListener animatorListener) {
    final AccelerateDecelerateInterpolator interpolator = new AccelerateDecelerateInterpolator();
    v.setScaleY(SCALE_START_ANCHOR);
    v.setPivotX(pivotX);
    v.setPivotY(pivotY);
    v.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {

        @Override
        public boolean onPreDraw() {
            v.getViewTreeObserver().removeOnPreDrawListener(this);
            ViewPropertyAnimator viewPropertyAnimator = v.animate().setInterpolator(interpolator).scaleY(1).setDuration(SCALE_DELAY);
            if (animatorListener != null)
                viewPropertyAnimator.setListener(animatorListener);
            viewPropertyAnimator.start();
            return true;
        }
    });
}
Also used : AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) ViewTreeObserver(android.view.ViewTreeObserver) ViewPropertyAnimator(android.view.ViewPropertyAnimator)

Example 55 with ViewPropertyAnimator

use of android.view.ViewPropertyAnimator in project Material-Movies by saulmm.

the class GUIUtils method hideScaleAnimationFromPivot.

public static void hideScaleAnimationFromPivot(View v, AnimatorListener animatorListener) {
    ViewPropertyAnimator viewPropertyAnimator = v.animate().setInterpolator(new AccelerateDecelerateInterpolator()).scaleY(SCALE_START_ANCHOR).setDuration(SCALE_DELAY);
    if (animatorListener != null)
        viewPropertyAnimator.setListener(animatorListener);
    viewPropertyAnimator.start();
}
Also used : AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) ViewPropertyAnimator(android.view.ViewPropertyAnimator)

Aggregations

ViewPropertyAnimator (android.view.ViewPropertyAnimator)63 Animator (android.animation.Animator)31 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)13 View (android.view.View)9 AnimatorListener (android.animation.Animator.AnimatorListener)7 ValueAnimator (android.animation.ValueAnimator)7 ObjectAnimator (android.animation.ObjectAnimator)4 SimpleItemAnimator (android.support.v7.widget.SimpleItemAnimator)4 ProgressCardView (org.wikipedia.feed.progress.ProgressCardView)4 ViewTreeObserver (android.view.ViewTreeObserver)3 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)3 ImageView (android.widget.ImageView)3 Point (android.graphics.Point)2 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)2 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)2 AdapterView (android.widget.AdapterView)2 TextView (android.widget.TextView)2 TimeInterpolator (android.animation.TimeInterpolator)1 TargetApi (android.annotation.TargetApi)1 Resources (android.content.res.Resources)1