Search in sources :

Example 86 with ViewPropertyAnimator

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

the class VideoMenu method animateFadeIn.

public void animateFadeIn(final ListView v) {
    ViewPropertyAnimator vp = v.animate();
    vp.alpha(1f).setDuration(ANIMATION_DURATION);
    vp.start();
}
Also used : ViewPropertyAnimator(android.view.ViewPropertyAnimator)

Example 87 with ViewPropertyAnimator

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

the class VideoMenu method animateFadeOut.

private void animateFadeOut(final ListView v, final int level) {
    if (v == null || mPopupStatus == POPUP_IN_ANIMATION_FADE)
        return;
    mPopupStatus = POPUP_IN_ANIMATION_FADE;
    ViewPropertyAnimator vp = v.animate();
    vp.alpha(0f).setDuration(ANIMATION_DURATION);
    vp.setListener(new AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            if (level == 1) {
                mUI.dismissLevel1();
                initializePopup();
                mPopupStatus = POPUP_NONE;
                mUI.cleanupListview();
            } else if (level == 2) {
                mUI.dismissLevel2();
                mPopupStatus = POPUP_FIRST_LEVEL;
            }
        }

        @Override
        public void onAnimationCancel(Animator animation) {
            if (level == 1) {
                mUI.dismissLevel1();
                initializePopup();
                mPopupStatus = POPUP_NONE;
                mUI.cleanupListview();
            } else if (level == 2) {
                mUI.dismissLevel2();
                mPopupStatus = POPUP_FIRST_LEVEL;
            }
        }
    });
    vp.start();
}
Also used : AnimatorListener(android.animation.Animator.AnimatorListener) Animator(android.animation.Animator) ViewPropertyAnimator(android.view.ViewPropertyAnimator) ViewPropertyAnimator(android.view.ViewPropertyAnimator)

Example 88 with ViewPropertyAnimator

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

the class VideoMenu method animateSlideOut.

private void animateSlideOut(final ListView v, final int level) {
    if (v == null || mPopupStatus == POPUP_IN_ANIMATION_SLIDE)
        return;
    mPopupStatus = POPUP_IN_ANIMATION_SLIDE;
    ViewPropertyAnimator vp = v.animate();
    if (View.LAYOUT_DIRECTION_RTL == TextUtils.getLayoutDirectionFromLocale(Locale.getDefault())) {
        switch(mUI.getOrientation()) {
            case 0:
                vp.translationXBy(v.getWidth());
                break;
            case 90:
                vp.translationYBy(-2 * v.getHeight());
                break;
            case 180:
                vp.translationXBy(-2 * v.getWidth());
                break;
            case 270:
                vp.translationYBy(v.getHeight());
                break;
        }
    } else {
        switch(mUI.getOrientation()) {
            case 0:
                vp.translationXBy(-v.getWidth());
                break;
            case 90:
                vp.translationYBy(2 * v.getHeight());
                break;
            case 180:
                vp.translationXBy(2 * v.getWidth());
                break;
            case 270:
                vp.translationYBy(-v.getHeight());
                break;
        }
    }
    vp.setListener(new AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            if (level == 1) {
                mUI.dismissLevel1();
                initializePopup();
                mPopupStatus = POPUP_NONE;
                mUI.cleanupListview();
            } else if (level == 2) {
                mUI.dismissLevel2();
                mPopupStatus = POPUP_FIRST_LEVEL;
            }
        }

        @Override
        public void onAnimationCancel(Animator animation) {
            if (level == 1) {
                mUI.dismissLevel1();
                initializePopup();
                mPopupStatus = POPUP_NONE;
                mUI.cleanupListview();
            } else if (level == 2) {
                mUI.dismissLevel2();
                mPopupStatus = POPUP_FIRST_LEVEL;
            }
        }
    });
    vp.setDuration(ANIMATION_DURATION).start();
}
Also used : AnimatorListener(android.animation.Animator.AnimatorListener) Animator(android.animation.Animator) ViewPropertyAnimator(android.view.ViewPropertyAnimator) ViewPropertyAnimator(android.view.ViewPropertyAnimator)

Example 89 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);
    }
    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(androidx.fragment.app.Fragment) DialogFragment(androidx.fragment.app.DialogFragment) MediaPickerFragment(com.android.gallery3d.filtershow.mediapicker.MediaPickerFragment) 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(androidx.fragment.app.FragmentTransaction) MainPanel(com.android.gallery3d.filtershow.category.MainPanel) StraightenPanel(com.android.gallery3d.filtershow.category.StraightenPanel)

Example 90 with ViewPropertyAnimator

use of android.view.ViewPropertyAnimator in project UnityModManager by xausky.

the class FabBehavior method hide.

// 隐藏时的动画
private void hide(final View view) {
    ViewPropertyAnimator animator = view.animate().translationY(viewY).setInterpolator(INTERPOLATOR).setDuration(200);
    animator.setListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animator) {
            isAnimate = true;
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            view.setVisibility(View.INVISIBLE);
            isAnimate = false;
        }

        @Override
        public void onAnimationCancel(Animator animator) {
            show(view);
        }

        @Override
        public void onAnimationRepeat(Animator animator) {
        }
    });
    animator.start();
}
Also used : Animator(android.animation.Animator) ViewPropertyAnimator(android.view.ViewPropertyAnimator) ViewPropertyAnimator(android.view.ViewPropertyAnimator)

Aggregations

ViewPropertyAnimator (android.view.ViewPropertyAnimator)104 Animator (android.animation.Animator)59 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)36 View (android.view.View)30 ValueAnimator (android.animation.ValueAnimator)23 ObjectAnimator (android.animation.ObjectAnimator)11 RecyclerView (androidx.recyclerview.widget.RecyclerView)9 AnimatorListener (android.animation.Animator.AnimatorListener)8 SimpleItemAnimator (androidx.recyclerview.widget.SimpleItemAnimator)7 SimpleItemAnimator (android.support.v7.widget.SimpleItemAnimator)4 ViewGroup (android.view.ViewGroup)4 ImageView (android.widget.ImageView)4 FastOutSlowInInterpolator (androidx.interpolator.view.animation.FastOutSlowInInterpolator)4 ProgressCardView (org.wikipedia.feed.progress.ProgressCardView)4 Paint (android.graphics.Paint)3 ViewTreeObserver (android.view.ViewTreeObserver)3 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)3 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)3 DialogCell (org.telegram.ui.Cells.DialogCell)3 Point (android.graphics.Point)2