Search in sources :

Example 81 with OvershootInterpolator

use of android.view.animation.OvershootInterpolator in project LeafPic by HoraApps.

the class AlertDialogsHelper method getProgressDialogWithErrors.

public static AlertDialog getProgressDialogWithErrors(ThemedActivity activity, @StringRes int title, ProgressAdapter adapter, int max) {
    AlertDialog.Builder builder = new AlertDialog.Builder(activity, activity.getDialogStyle());
    View dialogLayout = activity.getLayoutInflater().inflate(R.layout.dialog_list_progress, null);
    final int[] progress = { 0 };
    TextView dialogTitle = dialogLayout.findViewById(R.id.text_dialog_title);
    TextView progressMessage = dialogLayout.findViewById(R.id.name_folder);
    ((ProgressBar) dialogLayout.findViewById(org.horaapps.leafpic.R.id.progress_dialog_loading)).getIndeterminateDrawable().setColorFilter(activity.getPrimaryColor(), android.graphics.PorterDuff.Mode.SRC_ATOP);
    adapter.setListener(item -> {
        progress[0]++;
        dialogTitle.setText(activity.getString(title, progress[0], max));
        progressMessage.setText(item.getName());
    });
    RecyclerView rv = dialogLayout.findViewById(R.id.rv_progress);
    rv.setLayoutManager(new LinearLayoutManager(activity));
    rv.setHasFixedSize(true);
    rv.setItemAnimator(AnimationUtils.getItemAnimator(new LandingAnimator(new OvershootInterpolator(1f))));
    rv.setAdapter(adapter);
    ((CardView) dialogLayout.findViewById(org.horaapps.leafpic.R.id.message_card)).setCardBackgroundColor(activity.getCardBackgroundColor());
    dialogTitle.setBackgroundColor(activity.getPrimaryColor());
    dialogTitle.setText(activity.getString(title, progress[0], max));
    builder.setView(dialogLayout);
    return builder.create();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) OvershootInterpolator(android.view.animation.OvershootInterpolator) CardView(android.support.v7.widget.CardView) LandingAnimator(jp.wasabeef.recyclerview.animators.LandingAnimator) TextView(android.widget.TextView) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ImageView(android.widget.ImageView) View(android.view.View) CardView(android.support.v7.widget.CardView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView)

Example 82 with OvershootInterpolator

use of android.view.animation.OvershootInterpolator in project LeafPic by HoraApps.

the class BlackWhiteListActivity method initUi.

private void initUi() {
    setSupportActionBar(toolbar);
    toolbar.setNavigationIcon(getToolbarIcon(GoogleMaterial.Icon.gmd_arrow_back));
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            onBackPressed();
        }
    });
    mRecyclerView.setHasFixedSize(true);
    mRecyclerView.setAdapter((adapter = new ItemsAdapter()));
    mRecyclerView.setLayoutManager(new GridLayoutManager(this, 1));
    mRecyclerView.setItemAnimator(AnimationUtils.getItemAnimator(new LandingAnimator(new OvershootInterpolator(1f))));
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) OvershootInterpolator(android.view.animation.OvershootInterpolator) LandingAnimator(jp.wasabeef.recyclerview.animators.LandingAnimator) View(android.view.View) CardView(android.support.v7.widget.CardView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView)

Example 83 with OvershootInterpolator

use of android.view.animation.OvershootInterpolator in project MaterialLibrary by DeveloperPaul123.

the class MaterialFloatingActionButtonMenu method init.

/**
 * Initialize the view and fields.
 * @param context the context of this view.
 * @param attrs the attribute set of this view.
 */
private void init(Context context, AttributeSet attrs) {
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MaterialFloatingActionButtonMenu);
    circleColor = a.getColor(R.styleable.MaterialFloatingActionButtonMenu_mat_fab_menu_color, getColor(android.R.color.holo_blue_dark));
    mShowAllChildren = a.getBoolean(R.styleable.MaterialFloatingActionButtonMenu_mat_fab_menu_showChildrenAlways, false);
    circlePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    buttonColor = getColor(android.R.color.holo_blue_dark);
    circlePaint.setStyle(Paint.Style.FILL);
    circlePaint.setColor(circleColor);
    menuRadius = 1f;
    circleShowAnimator = ObjectAnimator.ofFloat(this, "menuRadius", maxRadius);
    circleCloseAnimator = ObjectAnimator.ofFloat(this, "menuRadius", 1.0f);
    degreeOffsetAnimator = ObjectAnimator.ofFloat(this, "degreeOffset", 0.0f);
    OvershootInterpolator interpolator = new OvershootInterpolator();
    mExpandAnimation = new AnimatorSet().setDuration(150);
    mExpandAnimation.setInterpolator(interpolator);
    mExpandAnimation.addListener(expandMenuListener);
    mCollapseAnimation = new AnimatorSet().setDuration(100);
    mCollapseAnimation.addListener(collapseMenuListener);
    showButtonsSet = new AnimatorSet().setDuration(100);
    showButtonsSet.setInterpolator(interpolator);
    showButtonsSet.addListener(showButtonsListener);
    hideButtonsSet = new AnimatorSet().setDuration(50);
    hideButtonsSet.addListener(hideButtonsListener);
    setWillNotDraw(false);
    setClickable(false);
    setLongClickable(false);
    createAddButton(context);
    interceptDownEvents[0] = 0.0f;
    interceptDownEvents[1] = 0.0f;
    lastEventPoints[0] = 0.0f;
    lastEventPoints[1] = 0.0f;
    ViewConfiguration configuration = ViewConfiguration.get(getContext());
    mSlop = configuration.getScaledTouchSlop();
    minFlingVel = configuration.getScaledMinimumFlingVelocity();
    maxFlingVel = configuration.getScaledMaximumFlingVelocity();
    startAngle = 225f;
    collapseOnChildClick = true;
    expands = new ArrayList<>();
    collapses = new ArrayList<>();
    DisplayMetrics metrics = getContext().getResources().getDisplayMetrics();
    windowWidth = metrics.widthPixels;
    windowHeight = metrics.heightPixels;
    gestureDetector = new GestureDetector(getContext(), new GestureListener());
    mScroller = new Scroller(context, new AccelerateDecelerateInterpolator(), true);
}
Also used : ViewConfiguration(android.view.ViewConfiguration) OvershootInterpolator(android.view.animation.OvershootInterpolator) TypedArray(android.content.res.TypedArray) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) AnimatorSet(android.animation.AnimatorSet) GestureDetector(android.view.GestureDetector) Paint(android.graphics.Paint) Scroller(android.widget.Scroller) DisplayMetrics(android.util.DisplayMetrics)

Example 84 with OvershootInterpolator

use of android.view.animation.OvershootInterpolator in project ViewAnimator by florent37.

the class ViewAnimatorMainActivity method animateParallel.

protected void animateParallel() {
    final ViewAnimator viewAnimator = ViewAnimator.animate(mountain, image).dp().translationY(-1000, 0).alpha(0, 1).singleInterpolator(new OvershootInterpolator()).andAnimate(percent).scale(0, 1).andAnimate(text).textColor(Color.BLACK, Color.WHITE).backgroundColor(Color.WHITE, Color.BLACK).waitForHeight().singleInterpolator(new AccelerateDecelerateInterpolator()).duration(2000).thenAnimate(percent).custom(new AnimationListener.Update<TextView>() {

        @Override
        public void update(TextView view, float value) {
            view.setText(String.format(Locale.US, "%.02f%%", value));
        }
    }, 0, 1).andAnimate(image).rotation(0, 360).duration(5000).start();
    new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {

        @Override
        public void run() {
            viewAnimator.cancel();
        }
    }, 3000);
}
Also used : ViewAnimator(com.github.florent37.viewanimator.ViewAnimator) OvershootInterpolator(android.view.animation.OvershootInterpolator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) Handler(android.os.Handler) TextView(android.widget.TextView) AnimationListener(com.github.florent37.viewanimator.AnimationListener)

Example 85 with OvershootInterpolator

use of android.view.animation.OvershootInterpolator in project android_packages_apps_crDroidSettings by crdroidandroid.

the class FloatingActionsMenu method createAddButton.

private void createAddButton(Context context) {
    mAddButton = new AddFloatingActionButton(context) {

        @Override
        void updateBackground() {
            mPlusColor = mAddButtonPlusColor;
            mColorNormal = mAddButtonColorNormal;
            mColorPressed = mAddButtonColorPressed;
            mStrokeVisible = mAddButtonStrokeVisible;
            super.updateBackground();
        }

        @Override
        Drawable getIconDrawable() {
            final RotatingDrawable rotatingDrawable = new RotatingDrawable(super.getIconDrawable());
            mRotatingDrawable = rotatingDrawable;
            final OvershootInterpolator interpolator = new OvershootInterpolator();
            final ObjectAnimator collapseAnimator = ObjectAnimator.ofFloat(rotatingDrawable, "rotation", EXPANDED_PLUS_ROTATION, COLLAPSED_PLUS_ROTATION);
            final ObjectAnimator expandAnimator = ObjectAnimator.ofFloat(rotatingDrawable, "rotation", COLLAPSED_PLUS_ROTATION, EXPANDED_PLUS_ROTATION);
            collapseAnimator.setInterpolator(interpolator);
            expandAnimator.setInterpolator(interpolator);
            mExpandAnimation.play(expandAnimator);
            mCollapseAnimation.play(collapseAnimator);
            return rotatingDrawable;
        }
    };
    mAddButton.setId(R.id.fab_expand_menu_button);
    mAddButton.setSize(mAddButtonSize);
    mAddButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            toggle();
        }
    });
    addView(mAddButton, super.generateDefaultLayoutParams());
    mButtonsCount++;
}
Also used : OvershootInterpolator(android.view.animation.OvershootInterpolator) ObjectAnimator(android.animation.ObjectAnimator) LayerDrawable(android.graphics.drawable.LayerDrawable) Drawable(android.graphics.drawable.Drawable) TextView(android.widget.TextView) View(android.view.View)

Aggregations

OvershootInterpolator (android.view.animation.OvershootInterpolator)85 ObjectAnimator (android.animation.ObjectAnimator)32 Animator (android.animation.Animator)21 View (android.view.View)21 AnimatorSet (android.animation.AnimatorSet)15 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)14 TextView (android.widget.TextView)14 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)13 Handler (android.os.Handler)12 ValueAnimator (android.animation.ValueAnimator)10 LinearInterpolator (android.view.animation.LinearInterpolator)10 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)8 Drawable (android.graphics.drawable.Drawable)7 RecyclerView (android.support.v7.widget.RecyclerView)7 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)7 LayerDrawable (android.graphics.drawable.LayerDrawable)6 PropertyValuesHolder (android.animation.PropertyValuesHolder)5 Rect (android.graphics.Rect)5 Interpolator (android.view.animation.Interpolator)5 Point (android.graphics.Point)4