Search in sources :

Example 1 with CoordinatorLayout

use of android.support.design.widget.CoordinatorLayout in project MaterialLibrary by DeveloperPaul123.

the class BaseFabListActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    params.gravity = Gravity.BOTTOM | Gravity.RIGHT;
    coordinatorLayout = new CoordinatorLayout(this);
    coordinatorLayout.setLayoutParams(params);
    CoordinatorLayout.LayoutParams coorLayoutParams = new CoordinatorLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    coorLayoutParams.setBehavior(new MaterialFabDefaultBehavior());
    coorLayoutParams.gravity = Gravity.BOTTOM | Gravity.RIGHT;
    materialFloatingActionButton = new MaterialFloatingActionButton(this);
    materialFloatingActionButton.setLayoutParams(coorLayoutParams);
    coordinatorLayout.addView(materialFloatingActionButton);
    getHomeLayout().addView(coordinatorLayout);
    ScrollListener scrollListener = new ScrollListener();
    scrollListener.setListView(getListView());
    scrollListener.setScrollThreshold(getResources().getDimensionPixelOffset(R.dimen.material_library_scroll_threshold));
    getListView().setOnScrollListener(scrollListener);
    materialFloatingActionButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            onActionButtonClicked();
        }
    });
    isShowing = true;
}
Also used : CoordinatorLayout(android.support.design.widget.CoordinatorLayout) MaterialFabDefaultBehavior(com.devpaul.materiallibrary.behaviors.MaterialFabDefaultBehavior) FrameLayout(android.widget.FrameLayout) MaterialFloatingActionButton(com.devpaul.materiallibrary.views.MaterialFloatingActionButton) AbstractScrollListener(com.devpaul.materiallibrary.abstracts.AbstractScrollListener) View(android.view.View)

Example 2 with CoordinatorLayout

use of android.support.design.widget.CoordinatorLayout in project RxBinding by JakeWharton.

the class RxSwipeDismissBehaviorTestActivity method onCreate.

@SuppressWarnings("ResourceType")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    parent = new CoordinatorLayout(this);
    view = new View(this);
    view.setId(1);
    view.setLayoutParams(new CoordinatorLayout.LayoutParams(100, 100));
    view.setBackgroundColor(0xFFFF0000);
    parent.addView(view);
    setContentView(parent);
}
Also used : CoordinatorLayout(android.support.design.widget.CoordinatorLayout) View(android.view.View)

Example 3 with CoordinatorLayout

use of android.support.design.widget.CoordinatorLayout in project AndroidChromium by JackyAndroid.

the class SnackbarView method addToParent.

private void addToParent() {
    // we create new LayoutParams every time.
    if (mParent instanceof CoordinatorLayout) {
        CoordinatorLayout.LayoutParams lp = new LayoutParams(getLayoutParams());
        lp.gravity = Gravity.BOTTOM | Gravity.START;
        lp.setBehavior(new CompositorViewHolderBehavior());
        mParent.addView(mView, lp);
    } else if (mParent instanceof FrameLayout) {
        FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(getLayoutParams());
        lp.gravity = Gravity.BOTTOM | Gravity.START;
        mParent.addView(mView, lp);
    } else {
        assert false : "Only FrameLayout and CoordinatorLayout are supported to show snackbars";
    }
    // Why setting listener on parent? It turns out that if we force a relayout in the layout
    // change listener of the view itself, the force layout flag will be reset to 0 when
    // layout() returns. Therefore we have to do request layout on one level above the requested
    // view.
    mParent.addOnLayoutChangeListener(mLayoutListener);
}
Also used : CoordinatorLayout(android.support.design.widget.CoordinatorLayout) MarginLayoutParams(android.view.ViewGroup.MarginLayoutParams) LayoutParams(android.support.design.widget.CoordinatorLayout.LayoutParams) LayoutParams(android.support.design.widget.CoordinatorLayout.LayoutParams) FrameLayout(android.widget.FrameLayout) CompositorViewHolderBehavior(org.chromium.chrome.browser.compositor.CompositorViewHolderBehavior)

Example 4 with CoordinatorLayout

use of android.support.design.widget.CoordinatorLayout in project WordPress-Android by wordpress-mobile.

the class AccountSettingsFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View coordinatorView = inflater.inflate(R.layout.preference_coordinator, container, false);
    CoordinatorLayout coordinator = (CoordinatorLayout) coordinatorView.findViewById(R.id.coordinator);
    View preferenceView = super.onCreateView(inflater, coordinator, savedInstanceState);
    coordinator.addView(preferenceView);
    return coordinatorView;
}
Also used : CoordinatorLayout(android.support.design.widget.CoordinatorLayout) View(android.view.View) TextView(android.widget.TextView)

Example 5 with CoordinatorLayout

use of android.support.design.widget.CoordinatorLayout in project WordPress-Android by wordpress-mobile.

the class ReaderPostListActivity method disableFilteredRecyclerViewToolbar.

/*
    * This method hides the FilteredRecyclerView toolbar with spinner so to disable content filtering, for reusability
    * */
private void disableFilteredRecyclerViewToolbar() {
    // make it invisible - setting height to zero here because setting visibility to View.GONE wouldn't take the
    // occupied space, as otherwise expected
    AppBarLayout appBarLayout = (AppBarLayout) findViewById(R.id.app_bar_layout);
    if (appBarLayout != null) {
        CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) appBarLayout.getLayoutParams();
        lp.height = 0;
        appBarLayout.setLayoutParams(lp);
    }
    // disabling any CoordinatorLayout behavior for scrolling
    Toolbar toolbarWithSpinner = (Toolbar) findViewById(R.id.toolbar_with_spinner);
    if (toolbarWithSpinner != null) {
        AppBarLayout.LayoutParams p = (AppBarLayout.LayoutParams) toolbarWithSpinner.getLayoutParams();
        p.setScrollFlags(0);
        toolbarWithSpinner.setLayoutParams(p);
    }
}
Also used : CoordinatorLayout(android.support.design.widget.CoordinatorLayout) AppBarLayout(android.support.design.widget.AppBarLayout) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

CoordinatorLayout (android.support.design.widget.CoordinatorLayout)58 View (android.view.View)37 AppBarLayout (android.support.design.widget.AppBarLayout)18 TextView (android.widget.TextView)15 ViewGroup (android.view.ViewGroup)14 RecyclerView (android.support.v7.widget.RecyclerView)13 Intent (android.content.Intent)9 Toolbar (android.support.v7.widget.Toolbar)9 Snackbar (android.support.design.widget.Snackbar)8 ImageView (android.widget.ImageView)7 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)6 LayoutInflater (android.view.LayoutInflater)6 Nullable (android.support.annotation.Nullable)5 NavigationView (android.support.design.widget.NavigationView)5 ViewPager (android.support.v4.view.ViewPager)5 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)5 SearchView (android.support.v7.widget.SearchView)5 ViewParent (android.view.ViewParent)5 FrameLayout (android.widget.FrameLayout)5 Bundle (android.os.Bundle)4