Example usage for android.view.animation AccelerateDecelerateInterpolator AccelerateDecelerateInterpolator

List of usage examples for android.view.animation AccelerateDecelerateInterpolator AccelerateDecelerateInterpolator

Introduction

In this page you can find the example usage for android.view.animation AccelerateDecelerateInterpolator AccelerateDecelerateInterpolator.

Prototype

public AccelerateDecelerateInterpolator() 

Source Link

Usage

From source file:org.kontalk.ui.ComposeMessageFragment.java

private void startAttachmentViewAnimation() {
    mAttachAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    mAttachAnimator.setDuration(250);
    mAttachAnimator.start();
}

From source file:com.zertinteractive.wallpaper.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.e(LOG_TAG, "onCreate()");
    setContentView(R.layout.activity_main);
    context = this;
    checkPermission();//from w  w w  . j  a v  a  2  s. co m
    DetailActivity.setContext(this);
    initDownloadComponents();
    downloadTestImage();
    initSearchGridView();

    progressBar = (ProgressBar) findViewById(R.id.progressBarImageSearch);
    progressBar.setVisibility(View.GONE);

    searchQueryButton = (ImageView) findViewById(R.id.search_query_ok);
    searchQueryButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            InputMethodManager in = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            in.hideSoftInputFromWindow(searchKey.getApplicationWindowToken(),
                    InputMethodManager.HIDE_NOT_ALWAYS);
            searchActionMethod();
        }
    });

    searchKey = (EditText) findViewById(R.id.search_key);
    searchKey.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            //                if (event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) {
            //                    InputMethodManager in = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            //                    in.hideSoftInputFromWindow(searchKey.getApplicationWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
            //                    Log.e("SEARCH", searchKey.getText().toString());
            //                }
            searchActionMethod();
            return false;
        }
    });

    searchQueryClear = (ImageView) findViewById(R.id.search_query_clear);
    searchQueryClear.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            searchKey.setText("");
        }
    });

    // Gets the ad view defined in layout/ad_fragment.xml with ad unit ID set in
    // values/strings.xml.
    mAdView = (AdView) findViewById(R.id.adView);
    mAdView.setVisibility(View.GONE);

    //        mAdView.setScaleX(1.3f);
    AdRequest adRequest = new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build();

    // Start loading the ad in sthe background.
    mAdView.loadAd(adRequest);
    mAdView.setAdListener(new AdListener() {
        @Override
        public void onAdLoaded() {
            super.onAdLoaded();
            mAdView.setVisibility(View.VISIBLE);
        }
    });

    //        AdView mAdView = (AdView) findViewById(R.id.adView);
    //        AdRequest adRequest = new AdRequest.Builder().build();
    //        mAdView.loadAd(adRequest);

    initWallpaperLists();
    initRecyclerView(GRIDVIEW_COLUMN);
    initSearchView();
    initFab();
    initToolbar();
    setupDrawerLayout();
    setCategorySutter(false);
    categorySutterChange(1200);
    //        setNotification();

    setupWindowAnimations();

    reminderCount = 0;

    timerTasks = new TimerTasks(context);

    timerTasks.startTimerTask();

    currentWallpaperCategory = WallpaperCategory.ALL;
    DetailActivity.checkDir();

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        setRecyclerAdapter(recyclerView, 0);
        currentWallpaperCategory = WallpaperCategory.ALL;
    }

    LinearLayout categoryHappyWallpaper = (LinearLayout) findViewById(R.id.category_happy);
    LinearLayout categorySadWallpaper = (LinearLayout) findViewById(R.id.category_sad);
    LinearLayout categorySurpriseWallpaper = (LinearLayout) findViewById(R.id.category_surprise);
    LinearLayout categoryAngryWallpaper = (LinearLayout) findViewById(R.id.category_angry);
    LinearLayout categoryFunnyWallpaper = (LinearLayout) findViewById(R.id.category_funny);
    LinearLayout categoryAmazedWallpaper = (LinearLayout) findViewById(R.id.category_amazed);
    categoryHappyWallpaper.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            setRecyclerAdapter(recyclerView, 1);
            currentWallpaperCategory = WallpaperCategory.HAPPY;
        }
    });
    categorySadWallpaper.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            setRecyclerAdapter(recyclerView, 2);
            currentWallpaperCategory = WallpaperCategory.SAD;
        }
    });
    categorySurpriseWallpaper.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            setRecyclerAdapter(recyclerView, 3);
            currentWallpaperCategory = WallpaperCategory.SURPRISE;
        }
    });
    categoryAngryWallpaper.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            setRecyclerAdapter(recyclerView, 4);
            currentWallpaperCategory = WallpaperCategory.ANGRY;
        }
    });
    categoryFunnyWallpaper.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            setRecyclerAdapter(recyclerView, 5);
            currentWallpaperCategory = WallpaperCategory.FUNNY;
        }
    });
    categoryAmazedWallpaper.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            setRecyclerAdapter(recyclerView, 6);
            currentWallpaperCategory = WallpaperCategory.AMAZED;
        }
    });

    ImageView category_daily = (ImageView) findViewById(R.id.category_daily);
    ImageView category_featured = (ImageView) findViewById(R.id.category_featured);
    ImageView category_favourite = (ImageView) findViewById(R.id.category_favourite);
    category_daily.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            setRecyclerAdapter(recyclerView, 7);
            currentWallpaperCategory = WallpaperCategory.DAILY;
        }
    });
    category_featured.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            setRecyclerAdapter(recyclerView, 8);
            currentWallpaperCategory = WallpaperCategory.FEATURED;
        }
    });
    category_favourite.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            setRecyclerAdapter(recyclerView, 9);
            currentWallpaperCategory = WallpaperCategory.FAVOURITE;
        }
    });

    LinearLayout categoryWallpaper = (LinearLayout) findViewById(R.id.categoryButtonArrow);
    LinearLayout categoryAllWallpaper = (LinearLayout) findViewById(R.id.categoryWallpaper);
    LinearLayout kidsyWallpaperAction = (LinearLayout) findViewById(R.id.kidsyWallpaperAction);
    LinearLayout keepCalmWallpaperAction = (LinearLayout) findViewById(R.id.keepCalmWallpaperAction);
    LinearLayout romanticWallpaperAction = (LinearLayout) findViewById(R.id.romanticWallpaperAction);
    LinearLayout materialWallpaperAction = (LinearLayout) findViewById(R.id.materialWallpaperAction);
    categoryAllWallpaper.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            setRecyclerAdapter(recyclerView, 0);
            currentWallpaperCategory = WallpaperCategory.ALL;
        }
    });
    categoryWallpaper.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            categorySutterChange(600);
            //                YoYo.with(Techniques.RotateAntiClockWise)
            //                        .duration(300)
            //                        .interpolate(new AccelerateDecelerateInterpolator())
            //                        .withListener(new Animator.AnimatorListener() {
            //                            @Override
            //                            public void onAnimationStart(Animator animation) {
            //
            //                            }
            //
            //                            @Override
            //                            public void onAnimationEnd(Animator animation) {
            //
            //                            }
            //
            //                            @Override
            //                            public void onAnimationCancel(Animator animation) {
            //                                Toast.makeText(MainActivity.this, "canceled", Toast.LENGTH_SHORT).show();
            //                            }
            //
            //                            @Override
            //                            public void onAnimationRepeat(Animator animation) {
            //
            //                            }
            //                        })
            //                        .playOn(findViewById(R.id.categoryButtonArrow));
        }
    });
    kidsyWallpaperAction.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            openUri(PLAY_STORE_URL);
        }
    });
    keepCalmWallpaperAction.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            openUri(PLAY_STORE_URL);
        }
    });
    romanticWallpaperAction.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            openUri(PLAY_STORE_URL);
        }
    });
    materialWallpaperAction.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            openUri(PLAY_STORE_URL);
        }
    });

    //        Button button = (Button) findViewById(R.id.testButton);
    //        button.setOnClickListener(new View.OnClickListener() {
    //            @Override
    //            public void onClick(View v) {
    //                Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/Roboto-LightItalic.ttf");
    //                SnackbarManager.show(
    //                        SnackBar.with(MainActivity.this)
    //                                .text("Something has been done")
    //                                .actionLabel("Undo")
    //                                .margin(15, 15)
    //                                .backgroundDrawable(R.drawable.custom_shape)
    //                                .actionLabelTypeface(tf)
    //                                .actionListener(new ActionClickListener() {
    //                                    @Override
    //                                    public void onActionClicked(SnackBar snackBar) {
    //                                        Toast.makeText(MainActivity.this,
    //                                                "Action undone",
    //                                                Toast.LENGTH_SHORT).show();
    //                                    }
    //                                }));
    //            }
    //        });

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        Window w = getWindow();
        w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION,
                WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
        w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
                WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    } else {
        // do something for lower version
    }

    recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            super.onScrolled(recyclerView, dx, dy);
            if (dy > 0 && isSearchOn && !isSearchAnimationRunning) {
                isSearchOn = false;
                isSearchAnimationRunning = true;
                YoYo.with(Techniques.ZoomOutPosition).duration(500)
                        .interpolate(new AccelerateDecelerateInterpolator())
                        .withListener(new Animator.AnimatorListener() {
                            @Override
                            public void onAnimationStart(Animator animation) {

                            }

                            @Override
                            public void onAnimationEnd(Animator animation) {
                                fabSearchWallpaper.setVisibility(View.GONE);
                                isSearchAnimationRunning = false;
                            }

                            @Override
                            public void onAnimationCancel(Animator animation) {
                                Toast.makeText(MainActivity.this, "canceled", Toast.LENGTH_SHORT).show();
                            }

                            @Override
                            public void onAnimationRepeat(Animator animation) {

                            }
                        }).playOn(findViewById(R.id.fab_search_wallpaper));
            } else if (dy < 0 && !isSearchOn && !isSearchAnimationRunning) {
                isSearchOn = true;
                isSearchAnimationRunning = true;
                fabSearchWallpaper.setVisibility(View.VISIBLE);
                YoYo.with(Techniques.ZoomInPosition).duration(500)
                        .interpolate(new AccelerateDecelerateInterpolator())
                        .withListener(new Animator.AnimatorListener() {
                            @Override
                            public void onAnimationStart(Animator animation) {

                            }

                            @Override
                            public void onAnimationEnd(Animator animation) {
                                isSearchAnimationRunning = false;
                            }

                            @Override
                            public void onAnimationCancel(Animator animation) {
                                Toast.makeText(MainActivity.this, "canceled", Toast.LENGTH_SHORT).show();
                            }

                            @Override
                            public void onAnimationRepeat(Animator animation) {

                            }
                        }).playOn(findViewById(R.id.fab_search_wallpaper));
            }
        }
    });

}

From source file:com.igniva.filemanager.activities.MainActivity.java

/**
 * show search view with a circular reveal animation
 *///from w ww  .  ja  va 2 s.c  o  m
void revealSearchView() {

    final int START_RADIUS = 16;
    int endRadius = Math.max(toolbar.getWidth(), toolbar.getHeight());

    Animator animator;
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        animator = ViewAnimationUtils.createCircularReveal(searchViewLayout, searchCoords[0] + 32,
                searchCoords[1] - 16, START_RADIUS, endRadius);
    } else {
        // TODO:ViewAnimationUtils.createCircularReveal
        animator = new ObjectAnimator().ofFloat(searchViewLayout, "alpha", 0f, 1f);
    }

    utils.revealShow(mFabBackground, true);

    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.setDuration(600);
    searchViewLayout.setVisibility(View.VISIBLE);
    animator.start();
    animator.addListener(new Animator.AnimatorListener() {
        @Override
        public void onAnimationStart(Animator animation) {

        }

        @Override
        public void onAnimationEnd(Animator animation) {

            searchViewEditText.requestFocus();
            InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.showSoftInput(searchViewEditText, InputMethodManager.SHOW_IMPLICIT);
            isSearchViewEnabled = true;
        }

        @Override
        public void onAnimationCancel(Animator animation) {

        }

        @Override
        public void onAnimationRepeat(Animator animation) {

        }
    });

}

From source file:com.zertinteractive.wallpaper.MainActivity.java

public void categorySutterChange(int miliseconds) {
    if (isSutterOn) {
        categoryLayout.setVisibility(View.GONE);
        isSutterOn = false;/*from ww  w  . j  a  v  a2  s  .  c  o m*/
    } else {
        categoryLayout.setVisibility(View.VISIBLE);
        YoYo.with(Techniques.AlphaAnim).duration(miliseconds)
                .interpolate(new AccelerateDecelerateInterpolator())
                .withListener(new Animator.AnimatorListener() {
                    @Override
                    public void onAnimationStart(Animator animation) {

                    }

                    @Override
                    public void onAnimationEnd(Animator animation) {

                    }

                    @Override
                    public void onAnimationCancel(Animator animation) {
                        Toast.makeText(MainActivity.this, "canceled", Toast.LENGTH_SHORT).show();
                    }

                    @Override
                    public void onAnimationRepeat(Animator animation) {

                    }
                }).playOn(findViewById(R.id.categoryLayout));
        isSutterOn = true;
    }
}

From source file:com.igniva.filemanager.activities.MainActivity.java

/**
 * hide search view with a circular reveal animation
 *//*from  w  ww  .j  av  a 2s . c  om*/
public void hideSearchView() {

    final int END_RADIUS = 16;
    int startRadius = Math.max(searchViewLayout.getWidth(), searchViewLayout.getHeight());
    Animator animator;
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        animator = ViewAnimationUtils.createCircularReveal(searchViewLayout, searchCoords[0] + 32,
                searchCoords[1] - 16, startRadius, END_RADIUS);
    } else {
        // TODO: ViewAnimationUtils.createCircularReveal
        animator = new ObjectAnimator().ofFloat(searchViewLayout, "alpha", 1f, 0f);
    }

    // removing background fade view
    utils.revealShow(mFabBackground, false);
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.setDuration(600);
    animator.start();
    animator.addListener(new Animator.AnimatorListener() {
        @Override
        public void onAnimationStart(Animator animation) {

        }

        @Override
        public void onAnimationEnd(Animator animation) {

            searchViewLayout.setVisibility(View.GONE);
            isSearchViewEnabled = false;
            InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
            inputMethodManager.hideSoftInputFromWindow(searchViewEditText.getWindowToken(),
                    InputMethodManager.HIDE_IMPLICIT_ONLY);
        }

        @Override
        public void onAnimationCancel(Animator animation) {

        }

        @Override
        public void onAnimationRepeat(Animator animation) {

        }
    });
}

From source file:com.amaze.carbonfilemanager.activities.MainActivity.java

/**
 * show search view with a circular reveal animation
 *///from w w w  . j  a  v  a  2s .c  o m
void revealSearchView() {
    final int START_RADIUS = 16;
    int endRadius = Math.max(toolbar.getWidth(), toolbar.getHeight());

    Animator animator;
    if (SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        animator = ViewAnimationUtils.createCircularReveal(searchViewLayout, searchCoords[0] + 32,
                searchCoords[1] - 16, START_RADIUS, endRadius);
    } else {
        // TODO:ViewAnimationUtils.createCircularReveal
        animator = ObjectAnimator.ofFloat(searchViewLayout, "alpha", 0f, 1f);
    }

    utils.revealShow(fabBgView, true);

    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.setDuration(600);
    searchViewLayout.setVisibility(View.VISIBLE);
    animator.start();
    animator.addListener(new Animator.AnimatorListener() {
        @Override
        public void onAnimationStart(Animator animation) {
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            searchViewEditText.requestFocus();
            InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.showSoftInput(searchViewEditText, InputMethodManager.SHOW_IMPLICIT);
            isSearchViewEnabled = true;
        }

        @Override
        public void onAnimationCancel(Animator animation) {
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        }
    });
}

From source file:com.amaze.carbonfilemanager.activities.MainActivity.java

/**
 * hide search view with a circular reveal animation
 *///  w  w  w  .j  av a 2 s .  c om
public void hideSearchView() {
    final int END_RADIUS = 16;
    int startRadius = Math.max(searchViewLayout.getWidth(), searchViewLayout.getHeight());
    Animator animator;
    if (SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        animator = ViewAnimationUtils.createCircularReveal(searchViewLayout, searchCoords[0] + 32,
                searchCoords[1] - 16, startRadius, END_RADIUS);
    } else {
        // TODO: ViewAnimationUtils.createCircularReveal
        animator = ObjectAnimator.ofFloat(searchViewLayout, "alpha", 1f, 0f);
    }

    // removing background fade view
    utils.revealShow(fabBgView, false);
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.setDuration(600);
    animator.start();
    animator.addListener(new Animator.AnimatorListener() {
        @Override
        public void onAnimationStart(Animator animation) {
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            searchViewLayout.setVisibility(View.GONE);
            isSearchViewEnabled = false;
            InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
            inputMethodManager.hideSoftInputFromWindow(searchViewEditText.getWindowToken(),
                    InputMethodManager.HIDE_IMPLICIT_ONLY);
        }

        @Override
        public void onAnimationCancel(Animator animation) {
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        }
    });
}

From source file:com.stanleyidesis.quotograph.ui.activity.LWQSettingsActivity.java

Animator generateAnimator(View target, boolean dismiss, long startDelay) {
    float[] fadeIn = new float[] { 0f, 1f };
    float[] fadeOut = new float[] { 1f, 0f };
    final ObjectAnimator propAnimator = ObjectAnimator.ofPropertyValuesHolder(target,
            PropertyValuesHolder.ofFloat(View.ALPHA, dismiss ? fadeOut : fadeIn),
            PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, dismiss ? (target.getHeight() * 2f) : 0f));
    propAnimator.setStartDelay(startDelay);
    propAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    propAnimator.setDuration(240);/* w  w  w . j  a  v a2  s .com*/
    return propAnimator;
}

From source file:com.stanleyidesis.quotograph.ui.activity.LWQSettingsActivity.java

void animateProgressBar(final boolean reveal) {
    runOnUiThread(new Runnable() {
        @Override/* w w  w  .j  a v  a 2 s .  c  om*/
        public void run() {
            progressBar.animate().alpha(reveal ? 1f : 0f).setDuration(150)
                    .setInterpolator(new AccelerateDecelerateInterpolator())
                    .setListener(new AnimatorListenerAdapter() {
                        @Override
                        public void onAnimationStart(Animator animation) {
                            progressBar.setTag(R.id.view_tag_flags, reveal ? FLAG_REVEAL : FLAG_HIDE);
                        }
                    }).start();
        }
    });
}

From source file:com.stanleyidesis.quotograph.ui.activity.LWQSettingsActivity.java

void animateContent(final boolean dismiss) {
    content.clearAnimation();/*  w ww .  jav  a  2s. c  om*/
    content.animate().alpha(dismiss ? 0f : 1f).setDuration(300)
            .setInterpolator(new AccelerateDecelerateInterpolator()).start();
}