Example usage for android.view ViewOutlineProvider BACKGROUND

List of usage examples for android.view ViewOutlineProvider BACKGROUND

Introduction

In this page you can find the example usage for android.view ViewOutlineProvider BACKGROUND.

Prototype

ViewOutlineProvider BACKGROUND

To view the source code for android.view ViewOutlineProvider BACKGROUND.

Click Source Link

Document

Default outline provider for Views, which queries the Outline from the View's background, or generates a 0 alpha, rectangular Outline the size of the View if a background isn't present.

Usage

From source file:com.placefinder.placedetailspanel.MergedAppBarLayoutBehavior.java

private void init(@NonNull CoordinatorLayout parent, @NonNull View child) {

    AppBarLayout appBarLayout = (AppBarLayout) child;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        appBarLayout.setOutlineProvider(ViewOutlineProvider.BACKGROUND);
    }//from w ww.j  av a2 s  . co  m

    mToolbar = (Toolbar) appBarLayout.findViewById(R.id.expanded_toolbar);
    mBackground = appBarLayout.findViewById(R.id.background);
    mBackGroundLayoutParams = (FrameLayout.LayoutParams) mBackground.getLayoutParams();
    mStatusBarReplacer = appBarLayout.findViewById(R.id.status_bar_replacer);
    getBottomSheetBehavior(parent);

    mTitleTextView = findTitleTextView(mToolbar);
    if (mTitleTextView == null)
        return;

    mInitialY = child.getY();

    child.setVisibility(mVisible ? View.VISIBLE : View.INVISIBLE);
    //        setStatusBarBackgroundVisible(mVisible);

    setFullBackGroundColor(
            mVisible && mCurrentTitleAlpha == 1 ? R.color.colorPrimary : android.R.color.transparent);
    setPartialBackGroundHeight(0);
    mTitleTextView.setText(mToolbarTitle);
    mTitleTextView.setAlpha(mCurrentTitleAlpha);
    mInit = true;
    setToolbarVisible(false, child);
}

From source file:co.com.parsoniisolutions.custombottomsheetbehavior.lib.MergedAppBarLayoutBehavior.java

private void init(@NonNull CoordinatorLayout parent, @NonNull View child) {

    AppBarLayout appBarLayout = (AppBarLayout) child;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        appBarLayout.setOutlineProvider(ViewOutlineProvider.BACKGROUND);
    }//from  w  w  w .  j a v a  2  s  .  c om

    mToolbar = (Toolbar) appBarLayout.findViewById(R.id.expanded_toolbar);
    mBackground = appBarLayout.findViewById(R.id.background);
    mBackGroundLayoutParams = (FrameLayout.LayoutParams) mBackground.getLayoutParams();
    getBottomSheetBehavior(parent);

    mTitleTextView = findTitleTextView(mToolbar);
    if (mTitleTextView == null)
        return;

    mInitialY = child.getY();

    child.setVisibility(mVisible ? View.VISIBLE : View.INVISIBLE);
    //        setStatusBarBackgroundVisible(mVisible);

    setFullBackGroundColor(
            mVisible && mCurrentTitleAlpha == 1 ? R.color.colorPrimary : android.R.color.transparent);
    setPartialBackGroundHeight(0);
    mTitleTextView.setText(mToolbarTitle);
    mTitleTextView.setAlpha(mCurrentTitleAlpha);
    mInit = true;
    setToolbarVisible(false, child);
}

From source file:com.bottomsheetbehavior.MergedAppBarLayoutBehavior.java

private void init(@NonNull CoordinatorLayout parent, @NonNull View child) {

    AppBarLayout appBarLayout = (AppBarLayout) child;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        appBarLayout.setOutlineProvider(ViewOutlineProvider.BACKGROUND);
    }//w  w  w. j  a va2s . co  m

    if (mToolbar == null || mBackground == null) {
        return;
    }

    mBackGroundLayoutParams = (FrameLayout.LayoutParams) mBackground.getLayoutParams();
    getBottomSheetBehavior(parent);

    mTitleTextView = findTitleTextView(mToolbar);
    if (mTitleTextView == null)
        return;

    mInitialY = child.getY();

    child.setVisibility(mVisible ? View.VISIBLE : View.INVISIBLE);

    setFullBackGroundColor(
            mVisible && mCurrentTitleAlpha == 1 ? mBackgroundColor : android.R.color.transparent);
    setPartialBackGroundHeight(0);
    mTitleTextView.setAlpha(mCurrentTitleAlpha);
    mInit = true;
    setToolbarVisible(false, child);
}

From source file:com.example.angelina.travelapp.map.MapFragment.java

/**
 * Sets the outline of the toolbar shadow to the background color
 * of the layout (transparent, in this case)
 */// w w w .  jav  a2 s.c o  m
private void setToolbarTransparent() {
    final AppBarLayout appBarLayout = (AppBarLayout) getActivity().findViewById(R.id.map_appbar);
    appBarLayout.setOutlineProvider(ViewOutlineProvider.BACKGROUND);
}