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;
}
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;
}
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);
}
}
}
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());
}
Aggregations