Search in sources :

Example 36 with FastOutSlowInInterpolator

use of android.support.v4.view.animation.FastOutSlowInInterpolator in project Reader by TheKeeperOfPie.

the class FragmentComments method showLayoutActions.

private void showLayoutActions() {
    for (int index = layoutActions.getChildCount() - 1; index >= 0; index--) {
        final View view = layoutActions.getChildAt(index);
        view.setVisibility(View.VISIBLE);
        final int finalIndex = index;
        ViewCompat.animate(view).alpha(1f).scaleX(1f).scaleY(1f).setInterpolator(fastOutSlowInInterpolator).setDuration(DURATION_ACTIONS_FADE).setStartDelay((long) ((layoutActions.getChildCount() - 1 - index) * DURATION_ACTIONS_FADE * OFFSET_MODIFIER)).setListener(new ViewPropertyAnimatorListener() {

            @Override
            public void onAnimationStart(View view) {
                if (finalIndex == 0) {
                    buttonExpandActions.setImageResource(android.R.color.transparent);
                }
            }

            @Override
            public void onAnimationEnd(View view) {
            }

            @Override
            public void onAnimationCancel(View view) {
            }
        }).start();
    }
}
Also used : ViewPropertyAnimatorListener(android.support.v4.view.ViewPropertyAnimatorListener) BindView(butterknife.BindView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView)

Example 37 with FastOutSlowInInterpolator

use of android.support.v4.view.animation.FastOutSlowInInterpolator in project Tapad by berict.

the class MainActivity method setFab.

private void setFab() {
    fab.setFab(a);
    fab.setFabIcon(R.drawable.ic_info_white, a);
    fab.showFab();
    fab.setFabOnClickListener(new Runnable() {

        @Override
        public void run() {
            if (isToolbarVisible == false) {
                fab.hideFab(0, 200);
                anim.fadeIn(R.id.toolbar, 200, 100, "toolbarIn", a);
                if (prefs.getInt(qs, 0) == 7) {
                    Log.i("setQuickstart", "Quickstart started");
                    if (promptInfo != null) {
                        return;
                    }
                    promptInfo = new MaterialTapTargetPrompt.Builder(a).setTarget(a.findViewById(R.id.toolbar_info)).setPrimaryText(R.string.dialog_tap_target_info_primary).setSecondaryText(R.string.dialog_tap_target_info_secondary).setAnimationInterpolator(new FastOutSlowInInterpolator()).setFocalColourFromRes(R.color.blue_500).setAutoDismiss(false).setAutoFinish(false).setCaptureTouchEventOutsidePrompt(true).setOnHidePromptListener(new MaterialTapTargetPrompt.OnHidePromptListener() {

                        @Override
                        public void onHidePrompt(MotionEvent event, boolean tappedTarget) {
                            if (tappedTarget) {
                                promptInfo.finish();
                                promptInfo = null;
                                prefs.edit().putInt(qs, 8).apply();
                                Log.i("sharedPrefs", "quickstart edited to 8");
                            }
                        }

                        @Override
                        public void onHidePromptComplete() {
                        }
                    }).show();
                }
                isToolbarVisible = true;
            }
        }
    });
    // set bottom margin
    w.setMarginRelativePX(R.id.fab, 0, 0, w.convertDPtoPX(20, a), w.getNavigationBarFromPrefs(a) + w.convertDPtoPX(20, a), a);
}
Also used : FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator) MotionEvent(android.view.MotionEvent)

Example 38 with FastOutSlowInInterpolator

use of android.support.v4.view.animation.FastOutSlowInInterpolator in project Tapad by berict.

the class MainActivity method setQuickstart.

public void setQuickstart(final Activity activity) {
    final SharedPreferences pref = activity.getSharedPreferences(APPLICATION_ID, MODE_PRIVATE);
    try {
        currentVersionCode = activity.getPackageManager().getPackageInfo(activity.getPackageName(), 0).versionCode;
        Log.i("versionCode", "versionCode retrieved = " + String.valueOf(currentVersionCode));
    } catch (android.content.pm.PackageManager.NameNotFoundException e) {
        // handle exception
        currentVersionCode = -1;
        Log.e("NameNotFound", "NNFE, currentVersionCode = -1");
    }
    try {
        Log.d("VersionCode", "sharedPrefs versionCode = " + String.valueOf(pref.getInt("versionCode", -1)) + " , currentVersionCode = " + String.valueOf(currentVersionCode));
        Log.d("VersionCode", "Updated, show changelog");
        if (currentVersionCode > pref.getInt("versionCode", -1)) {
            // new app and updates
            new MaterialDialog.Builder(activity).title(w.getStringId("info_tapad_info_changelog")).content(w.getStringId("info_tapad_info_changelog_text")).contentColorRes(R.color.dark_primary).positiveText(R.string.dialog_close).positiveColorRes(R.color.colorAccent).dismissListener(new DialogInterface.OnDismissListener() {

                @Override
                public void onDismiss(DialogInterface dialogInterface) {
                    // Dialog
                    if (pref.getInt(qs, 0) == 0) {
                        closeToolbar(activity);
                        new MaterialDialog.Builder(activity).title(R.string.dialog_quickstart_welcome_title).content(R.string.dialog_quickstart_welcome_text).positiveText(R.string.dialog_quickstart_welcome_positive).positiveColorRes(R.color.colorAccent).negativeText(R.string.dialog_quickstart_welcome_negative).negativeColorRes(R.color.dark_secondary).onPositive(new MaterialDialog.SingleButtonCallback() {

                            @Override
                            public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                                pref.edit().putInt(qs, 0).apply();
                                Log.i("sharedPrefs", "quickstart edited to 0");
                            }
                        }).onNegative(new MaterialDialog.SingleButtonCallback() {

                            @Override
                            public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                                pref.edit().putInt(qs, -1).apply();
                                Log.i("sharedPrefs", "quickstart edited to -1");
                            }
                        }).dismissListener(new DialogInterface.OnDismissListener() {

                            @Override
                            public void onDismiss(DialogInterface dialogInterface) {
                                if (pref.getInt(qs, 0) == 0) {
                                    Log.i("setQuickstart", "Quickstart started");
                                    if (promptFab != null) {
                                        return;
                                    }
                                    promptToggle = new MaterialTapTargetPrompt.Builder(activity).setTarget(activity.findViewById(R.id.tgl1)).setPrimaryText(R.string.dialog_tap_target_toggle_primary).setSecondaryText(R.string.dialog_tap_target_toggle_secondary).setAnimationInterpolator(new FastOutSlowInInterpolator()).setAutoDismiss(false).setAutoFinish(false).setFocalColourFromRes(R.color.white).setCaptureTouchEventOutsidePrompt(true).setOnHidePromptListener(new MaterialTapTargetPrompt.OnHidePromptListener() {

                                        @Override
                                        public void onHidePrompt(MotionEvent event, boolean tappedTarget) {
                                            if (tappedTarget) {
                                                promptToggle.finish();
                                                promptToggle = null;
                                                pref.edit().putInt(qs, 1).apply();
                                                Log.i("sharedPrefs", "quickstart edited to 1");
                                            }
                                        }

                                        @Override
                                        public void onHidePromptComplete() {
                                            promptButton = new MaterialTapTargetPrompt.Builder(activity).setTarget(activity.findViewById(R.id.btn31)).setPrimaryText(R.string.dialog_tap_target_button_primary).setSecondaryText(R.string.dialog_tap_target_button_secondary).setAnimationInterpolator(new FastOutSlowInInterpolator()).setAutoDismiss(false).setAutoFinish(false).setFocalColourFromRes(R.color.white).setFocalRadius((float) w.convertDPtoPX(80, activity)).setCaptureTouchEventOutsidePrompt(true).setOnHidePromptListener(new MaterialTapTargetPrompt.OnHidePromptListener() {

                                                @Override
                                                public void onHidePrompt(MotionEvent event, boolean tappedTarget) {
                                                    if (tappedTarget) {
                                                        promptButton.finish();
                                                        promptButton = null;
                                                        pref.edit().putInt(qs, 3).apply();
                                                        Log.i("sharedPrefs", "quickstart edited to 3");
                                                    }
                                                }

                                                @Override
                                                public void onHidePromptComplete() {
                                                    promptSwipe = new MaterialTapTargetPrompt.Builder(activity).setTarget(activity.findViewById(R.id.btn23)).setPrimaryText(R.string.dialog_tap_target_swipe_primary).setSecondaryText(R.string.dialog_tap_target_swipe_secondary).setAnimationInterpolator(new FastOutSlowInInterpolator()).setAutoDismiss(false).setAutoFinish(false).setFocalColourFromRes(R.color.white).setFocalRadius((float) w.convertDPtoPX(80, activity)).setCaptureTouchEventOutsidePrompt(true).setOnHidePromptListener(new MaterialTapTargetPrompt.OnHidePromptListener() {

                                                        @Override
                                                        public void onHidePrompt(MotionEvent event, boolean tappedTarget) {
                                                            if (tappedTarget) {
                                                                promptSwipe.finish();
                                                                promptSwipe = null;
                                                                pref.edit().putInt(qs, 4).apply();
                                                                Log.i("sharedPrefs", "quickstart edited to 4");
                                                            }
                                                        }

                                                        @Override
                                                        public void onHidePromptComplete() {
                                                            promptLoop = new MaterialTapTargetPrompt.Builder(activity).setTarget(activity.findViewById(R.id.btn42)).setPrimaryText(R.string.dialog_tap_target_loop_primary).setSecondaryText(R.string.dialog_tap_target_loop_secondary).setAnimationInterpolator(new FastOutSlowInInterpolator()).setAutoDismiss(false).setAutoFinish(false).setFocalColourFromRes(R.color.white).setFocalRadius((float) w.convertDPtoPX(80, activity)).setCaptureTouchEventOutsidePrompt(true).setOnHidePromptListener(new MaterialTapTargetPrompt.OnHidePromptListener() {

                                                                @Override
                                                                public void onHidePrompt(MotionEvent event, boolean tappedTarget) {
                                                                    if (tappedTarget) {
                                                                        promptLoop.finish();
                                                                        promptLoop = null;
                                                                        pref.edit().putInt(qs, 5).apply();
                                                                        Log.i("sharedPrefs", "quickstart edited to 5");
                                                                    }
                                                                }

                                                                @Override
                                                                public void onHidePromptComplete() {
                                                                    promptPattern = new MaterialTapTargetPrompt.Builder(activity).setTarget(activity.findViewById(R.id.tgl7)).setPrimaryText(R.string.dialog_tap_target_pattern_primary).setSecondaryText(R.string.dialog_tap_target_pattern_secondary).setAnimationInterpolator(new FastOutSlowInInterpolator()).setAutoDismiss(false).setAutoFinish(false).setFocalColourFromRes(R.color.white).setCaptureTouchEventOutsidePrompt(true).setOnHidePromptListener(new MaterialTapTargetPrompt.OnHidePromptListener() {

                                                                        @Override
                                                                        public void onHidePrompt(MotionEvent event, boolean tappedTarget) {
                                                                            if (tappedTarget) {
                                                                                promptPattern.finish();
                                                                                promptPattern = null;
                                                                                pref.edit().putInt(qs, 5).apply();
                                                                                Log.i("sharedPrefs", "quickstart edited to 5");
                                                                            }
                                                                        }

                                                                        @Override
                                                                        public void onHidePromptComplete() {
                                                                            promptFab = new MaterialTapTargetPrompt.Builder(activity).setTarget(activity.findViewById(R.id.fab)).setPrimaryText(R.string.dialog_tap_target_fab_primary).setSecondaryText(R.string.dialog_tap_target_fab_secondary).setAnimationInterpolator(new FastOutSlowInInterpolator()).setAutoDismiss(false).setAutoFinish(false).setFocalColourFromRes(R.color.white).setCaptureTouchEventOutsidePrompt(true).setOnHidePromptListener(new MaterialTapTargetPrompt.OnHidePromptListener() {

                                                                                @Override
                                                                                public void onHidePrompt(MotionEvent event, boolean tappedTarget) {
                                                                                    if (tappedTarget) {
                                                                                        promptFab.finish();
                                                                                        promptFab = null;
                                                                                        pref.edit().putInt(qs, 6).apply();
                                                                                        Log.i("sharedPrefs", "quickstart edited to 6");
                                                                                    }
                                                                                }

                                                                                @Override
                                                                                public void onHidePromptComplete() {
                                                                                    promptPreset = new MaterialTapTargetPrompt.Builder(activity).setTarget(activity.findViewById(R.id.toolbar_preset)).setPrimaryText(R.string.dialog_tap_target_preset_primary).setSecondaryText(R.string.dialog_tap_target_preset_secondary).setAnimationInterpolator(new FastOutSlowInInterpolator()).setAutoDismiss(false).setAutoFinish(false).setFocalColourFromRes(R.color.blue_500).setCaptureTouchEventOutsidePrompt(true).setOnHidePromptListener(new MaterialTapTargetPrompt.OnHidePromptListener() {

                                                                                        @Override
                                                                                        public void onHidePrompt(MotionEvent event, boolean tappedTarget) {
                                                                                            if (tappedTarget) {
                                                                                                promptPreset.finish();
                                                                                                promptPreset = null;
                                                                                                pref.edit().putInt(qs, 7).apply();
                                                                                                Log.i("sharedPrefs", "quickstart edited to 7");
                                                                                            }
                                                                                        }

                                                                                        @Override
                                                                                        public void onHidePromptComplete() {
                                                                                        }
                                                                                    }).show();
                                                                                }
                                                                            }).show();
                                                                        }
                                                                    }).show();
                                                                }
                                                            }).show();
                                                        }
                                                    }).show();
                                                }
                                            }).show();
                                        }
                                    }).show();
                                } else {
                                    Log.i("setQuickstart", "Quickstart canceled");
                                    pref.edit().putInt(qs, -1).apply();
                                }
                            }
                        }).show();
                    }
                    // Change this
                    pref.edit().putInt("versionCode", currentVersionCode).apply();
                    Log.d("VersionCode", "putInt " + String.valueOf(pref.getInt("versionCode", -1)));
                }
            }).show();
        }
    } catch (Exception e) {
        Log.e("QuickstartException", e.getMessage());
    }
}
Also used : MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) SharedPreferences(android.content.SharedPreferences) DialogInterface(android.content.DialogInterface) MotionEvent(android.view.MotionEvent) DialogAction(com.afollestad.materialdialogs.DialogAction) NonNull(android.support.annotation.NonNull) FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator) MaterialTapTargetPrompt(uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt)

Example 39 with FastOutSlowInInterpolator

use of android.support.v4.view.animation.FastOutSlowInInterpolator in project react-native-navigation by wix.

the class LightBox method animateShow.

private void animateShow() {
    ObjectAnimator yTranslation = ObjectAnimator.ofFloat(content, View.TRANSLATION_Y, 80, 0).setDuration(400);
    yTranslation.setInterpolator(new FastOutSlowInInterpolator());
    yTranslation.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            content.setAlpha(1);
        }
    });
    ObjectAnimator lightBoxAlpha = ObjectAnimator.ofFloat(lightBox, View.ALPHA, 0, 1).setDuration(70);
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(lightBoxAlpha, yTranslation);
    animatorSet.start();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator) AnimatorSet(android.animation.AnimatorSet)

Aggregations

FastOutSlowInInterpolator (android.support.v4.view.animation.FastOutSlowInInterpolator)35 View (android.view.View)11 Animator (android.animation.Animator)8 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)6 AnimatorSet (android.animation.AnimatorSet)6 ObjectAnimator (android.animation.ObjectAnimator)6 BindView (butterknife.BindView)6 PropertyValuesHolder (android.animation.PropertyValuesHolder)4 ViewPropertyAnimatorListener (android.support.v4.view.ViewPropertyAnimatorListener)4 RecyclerView (android.support.v7.widget.RecyclerView)4 MotionEvent (android.view.MotionEvent)3 ViewGroup (android.view.ViewGroup)3 TextView (android.widget.TextView)3 ExitFragmentTransition (com.kogitune.activity_transition.fragment.ExitFragmentTransition)3 IEndListener (su.levenetc.android.textsurface.interfaces.IEndListener)3 ISurfaceAnimation (su.levenetc.android.textsurface.interfaces.ISurfaceAnimation)3 TargetApi (android.annotation.TargetApi)2 Rect (android.graphics.Rect)2 Nullable (android.support.annotation.Nullable)2 LinearOutSlowInInterpolator (android.support.v4.view.animation.LinearOutSlowInInterpolator)2