use of com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView in project Android-ObservableScrollView by ksoichiro.
the class ScrollFromBottomRecyclerViewActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_stickyheaderrecyclerview);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
mHeaderView = findViewById(R.id.header);
ViewCompat.setElevation(mHeaderView, getResources().getDimension(R.dimen.toolbar_elevation));
mToolbarView = findViewById(R.id.toolbar);
mRecyclerView = (ObservableRecyclerView) findViewById(R.id.recycler);
mRecyclerView.setScrollViewCallbacks(this);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
mRecyclerView.setHasFixedSize(false);
View headerView = LayoutInflater.from(this).inflate(R.layout.recycler_header, null);
setDummyDataWithHeader(mRecyclerView, headerView);
ScrollUtils.addOnGlobalLayoutListener(mRecyclerView, new Runnable() {
@Override
public void run() {
int count = mRecyclerView.getAdapter().getItemCount() - 1;
int position = count == 0 ? 1 : count > 0 ? count : 0;
mRecyclerView.scrollToPosition(position);
}
});
}
use of com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView in project Android-ObservableScrollView by ksoichiro.
the class SlidingUpRecyclerViewActivity method createScrollable.
@Override
protected ObservableRecyclerView createScrollable() {
ObservableRecyclerView recyclerView = (ObservableRecyclerView) findViewById(R.id.scroll);
recyclerView.setScrollViewCallbacks(this);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setHasFixedSize(true);
recyclerView.setAdapter(new CustomAdapter(this, getDummyData()));
return recyclerView;
}
Aggregations