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