Search in sources :

Example 1 with MaterialFloatingActionButton

use of com.devpaul.materiallibrary.views.MaterialFloatingActionButton 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 MaterialFloatingActionButton

use of com.devpaul.materiallibrary.views.MaterialFloatingActionButton 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)

Example 3 with MaterialFloatingActionButton

use of com.devpaul.materiallibrary.views.MaterialFloatingActionButton in project MaterialLibrary by DeveloperPaul123.

the class MaterialFloatingActionButtonMenu method assignOnClickListeners.

/**
 * Assigns on click listeners for all the child views.
 */
private void assignOnClickListeners() {
    int count = getChildCount();
    for (int i = 0; i < count; i++) {
        View child = getChildAt(i);
        if (child instanceof MaterialFloatingActionButton) {
            continue;
        } else {
            child.setTag(i);
            child.setOnClickListener(childListener);
        }
    }
}
Also used : MaterialFloatingActionButton(com.devpaul.materiallibrary.views.MaterialFloatingActionButton) View(android.view.View) Paint(android.graphics.Paint)

Example 4 with MaterialFloatingActionButton

use of com.devpaul.materiallibrary.views.MaterialFloatingActionButton in project MaterialLibrary by DeveloperPaul123.

the class MaterialFloatingActionButtonMenu method createAddButton.

/**
 * Creates the main button.
 * @param context
 */
private void createAddButton(Context context) {
    mAddButton = new MaterialFloatingActionButton(getContext());
    mAddButton.setId(R.id.fab_expand_menu_button);
    mAddButton.setButtonColor(buttonColor);
    mAddButton.setButtonPressedColor(ColorUtils.getDarkerColor(buttonColor));
    mAddButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            toggle();
        }
    });
    addView(mAddButton, super.generateDefaultLayoutParams());
}
Also used : MaterialFloatingActionButton(com.devpaul.materiallibrary.views.MaterialFloatingActionButton) View(android.view.View)

Aggregations

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