Search in sources :

Example 1 with CustomSnackbarMainContent

use of android.support.design.testapp.custom.CustomSnackbarMainContent in project material-components-android by material-components.

the class CustomSnackbarTest method makeCustomSnackbar.

private CustomSnackbar makeCustomSnackbar() {
    final LayoutInflater inflater = LayoutInflater.from(mCoordinatorLayout.getContext());
    final CustomSnackbarMainContent content = (CustomSnackbarMainContent) inflater.inflate(R.layout.custom_snackbar_include, mCoordinatorLayout, false);
    final BaseTransientBottomBar.ContentViewCallback contentViewCallback = new BaseTransientBottomBar.ContentViewCallback() {

        @Override
        public void animateContentIn(int delay, int duration) {
            ViewCompat.setAlpha(content, 0f);
            ViewCompat.animate(content).alpha(1f).setDuration(duration).setStartDelay(delay).start();
        }

        @Override
        public void animateContentOut(int delay, int duration) {
            ViewCompat.setAlpha(content, 1f);
            ViewCompat.animate(content).alpha(0f).setDuration(duration).setStartDelay(delay).start();
        }
    };
    return new CustomSnackbar(mCoordinatorLayout, content, contentViewCallback);
}
Also used : LayoutInflater(android.view.LayoutInflater) CustomSnackbar(android.support.design.testapp.custom.CustomSnackbar) CustomSnackbarMainContent(android.support.design.testapp.custom.CustomSnackbarMainContent)

Aggregations

CustomSnackbar (android.support.design.testapp.custom.CustomSnackbar)1 CustomSnackbarMainContent (android.support.design.testapp.custom.CustomSnackbarMainContent)1 LayoutInflater (android.view.LayoutInflater)1