Search in sources :

Example 1 with MaterialFabDefaultBehavior

use of com.devpaul.materiallibrary.behaviors.MaterialFabDefaultBehavior 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 MaterialFabDefaultBehavior

use of com.devpaul.materiallibrary.behaviors.MaterialFabDefaultBehavior in project MaterialLibrary by DeveloperPaul123.

the class BaseRecyclerFabActivity 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.setRecyclerView(getRecyclerView());
    scrollListener.setScrollThreshold(getResources().getDimensionPixelOffset(R.dimen.material_library_scroll_threshold));
    getRecyclerView().addOnScrollListener(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) AbstractRecyclerScrollListener(com.devpaul.materiallibrary.abstracts.AbstractRecyclerScrollListener) View(android.view.View)

Aggregations

CoordinatorLayout (android.support.design.widget.CoordinatorLayout)2 View (android.view.View)2 FrameLayout (android.widget.FrameLayout)2 MaterialFabDefaultBehavior (com.devpaul.materiallibrary.behaviors.MaterialFabDefaultBehavior)2 MaterialFloatingActionButton (com.devpaul.materiallibrary.views.MaterialFloatingActionButton)2 AbstractRecyclerScrollListener (com.devpaul.materiallibrary.abstracts.AbstractRecyclerScrollListener)1 AbstractScrollListener (com.devpaul.materiallibrary.abstracts.AbstractScrollListener)1