use of android.support.v7.widget.GridLayoutManager in project MusicDNA by harjot-oberai.
the class AlbumFragment method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
bottomMarginLayout = view.findViewById(R.id.bottom_margin_layout);
if (HomeActivity.isReloaded)
bottomMarginLayout.setVisibility(View.GONE);
else
bottomMarginLayout.setVisibility(View.VISIBLE);
rv = (RecyclerView) view.findViewById(R.id.albums_recycler);
abAdapter = new AlbumRecyclerAdapter(HomeActivity.finalAlbums, getContext());
glManager = new GridLayoutManager(getContext(), 2);
rv.setLayoutManager(glManager);
rv.setItemAnimator(new DefaultItemAnimator());
rv.setAdapter(abAdapter);
rv.addOnItemTouchListener(new ClickItemTouchListener(rv) {
@Override
boolean onClick(RecyclerView parent, View view, int position, long id) {
HomeActivity.tempAlbum = HomeActivity.finalAlbums.get(position);
mCallback.onAlbumClick();
return true;
}
@Override
boolean onLongClick(RecyclerView parent, View view, int position, long id) {
return true;
}
@Override
public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {
}
});
}
use of android.support.v7.widget.GridLayoutManager in project android-advancedrecyclerview by h6ah4i.
the class DraggableGridExampleFragment method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
//noinspection ConstantConditions
mRecyclerView = (RecyclerView) getView().findViewById(R.id.recycler_view);
mLayoutManager = new GridLayoutManager(getContext(), 3, GridLayoutManager.VERTICAL, false);
// drag & drop manager
mRecyclerViewDragDropManager = new RecyclerViewDragDropManager();
mRecyclerViewDragDropManager.setDraggingItemShadowDrawable((NinePatchDrawable) ContextCompat.getDrawable(getContext(), R.drawable.material_shadow_z3));
// Start dragging after long press
mRecyclerViewDragDropManager.setInitiateOnLongPress(true);
mRecyclerViewDragDropManager.setInitiateOnMove(false);
mRecyclerViewDragDropManager.setLongPressTimeout(750);
// setup dragging item effects (NOTE: DraggableItemAnimator is required)
mRecyclerViewDragDropManager.setDragStartItemAnimationDuration(250);
mRecyclerViewDragDropManager.setDraggingItemAlpha(0.8f);
mRecyclerViewDragDropManager.setDraggingItemScale(1.3f);
mRecyclerViewDragDropManager.setDraggingItemRotation(15.0f);
//adapter
final DraggableGridExampleAdapter myItemAdapter = new DraggableGridExampleAdapter(getDataProvider());
mAdapter = myItemAdapter;
// wrap for dragging
mWrappedAdapter = mRecyclerViewDragDropManager.createWrappedAdapter(myItemAdapter);
// DraggableItemAnimator is required to make item animations properly.
GeneralItemAnimator animator = new DraggableItemAnimator();
mRecyclerView.setLayoutManager(mLayoutManager);
// requires *wrapped* adapter
mRecyclerView.setAdapter(mWrappedAdapter);
mRecyclerView.setItemAnimator(animator);
//noinspection StatementWithEmptyBody
if (supportsViewElevation()) {
// Lollipop or later has native drop shadow feature. ItemShadowDecorator is not required.
} else {
mRecyclerView.addItemDecoration(new ItemShadowDecorator((NinePatchDrawable) ContextCompat.getDrawable(getContext(), R.drawable.material_shadow_z1)));
}
mRecyclerViewDragDropManager.attachRecyclerView(mRecyclerView);
// for debugging
// animator.setDebug(true);
// animator.setMoveDuration(2000);
}
use of android.support.v7.widget.GridLayoutManager in project MaterialViewPager by florent37.
the class RecyclerViewFragment method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
ButterKnife.bind(this, view);
final List<Object> items = new ArrayList<>();
for (int i = 0; i < ITEM_COUNT; ++i) {
items.add(new Object());
}
if (GRID_LAYOUT) {
mRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 2));
} else {
mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
}
mRecyclerView.setHasFixedSize(true);
//Use this now
mRecyclerView.addItemDecoration(new MaterialViewPagerHeaderDecorator());
mRecyclerView.setAdapter(new TestRecyclerViewAdapter(items));
}
use of android.support.v7.widget.GridLayoutManager in project RecyclerViewItemAnimators by gabrielemariotti.
the class AnimationGridActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_recycler);
//Setup Spinner
setupSpinner();
//Setup RecyclerView
mRecyclerView = (RecyclerView) findViewById(R.id.list);
//mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new GridLayoutManager(this, 5));
mAdapter = new AnimationGridAdapter(this);
AlphaAnimatorAdapter animatorAdapter = new AlphaAnimatorAdapter(mAdapter, mRecyclerView);
animatorAdapter.getViewAnimator().setInitialDelayMillis(500);
mRecyclerView.setAdapter(animatorAdapter);
}
use of android.support.v7.widget.GridLayoutManager in project RecyclerViewItemAnimators by gabrielemariotti.
the class GridActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_recycler);
//Setup Spinner
setupSpinner();
//Setup RecyclerView
mRecyclerView = (RecyclerView) findViewById(R.id.list);
//mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new GridLayoutManager(this, 5));
mAdapter = new GridAdapter(this);
mRecyclerView.setAdapter(mAdapter);
}
Aggregations