use of android.support.v7.widget.RecyclerView.LayoutManager in project wire-android by wireapp.
the class MentioningFragment method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
visible = true;
final LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity(), OrientationHelper.HORIZONTAL, false);
layoutManager.setStackFromEnd(true);
recyclerView.setLayoutManager(layoutManager);
recyclerView.addItemDecoration(new SpacingItemDecorator(getResources().getDimensionPixelSize(R.dimen.mentioning__item__padding_outer)));
mentioningAdapter = new MentioningAdapter();
mentioningAdapter.setOnItemClickListener(this);
recyclerView.setAdapter(mentioningAdapter);
recyclerView.setBackground(ViewUtils.getRoundedRect(getResources().getDimensionPixelSize(R.dimen.mentioning__popover__height) / 2, getResources().getColor(R.color.mentioning__popover__background)));
recyclerView.post(new Runnable() {
@Override
public void run() {
if (getActivity() == null || getResources() == null || contentView == null) {
return;
}
maxLeft = getResources().getDimensionPixelSize(R.dimen.content__separator__avatar_container__width) - getResources().getDimensionPixelSize(R.dimen.content__separator__chathead__size);
totalWidth = contentView.getMeasuredWidth();
maxRight = totalWidth - maxLeft;
}
});
hide();
}
use of android.support.v7.widget.RecyclerView.LayoutManager in project mosby by sockeqwe.
the class SearchFragment method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
// Init toolbar
toolbar.setNavigationIcon(BuildUtils.getBackArrowDrawable(getActivity()));
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getActivity().finish();
}
});
toolbar.inflateMenu(R.menu.search_menu);
toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem menuItem) {
if (menuItem.getItemId() == R.id.search) {
loadData(false);
return true;
}
return false;
}
});
// search
searchEditView.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
loadData(false);
}
@Override
public void afterTextChanged(Editable s) {
}
});
// load more
layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
int visibleItemCount = layoutManager.getChildCount();
int totalItemCount = layoutManager.getItemCount();
int lastVisibleItemPosition = layoutManager.findLastVisibleItemPosition();
if (canLoadMore && !isLoadingMore && lastVisibleItemPosition == totalItemCount - 1) {
loadOlderMails();
}
}
});
}
use of android.support.v7.widget.RecyclerView.LayoutManager in project Rutgers-Course-Tracker by tevjef.
the class SubjectFragment method initRecyclerView.
public void initRecyclerView() {
LinearLayoutManager layoutManager = new LinearLayoutManager(getParentActivity());
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
layoutManager.setSmoothScrollbarEnabled(true);
mRecyclerView.setLayoutManager(layoutManager);
mRecyclerView.setHasFixedSize(true);
if (mListDataset == null) {
mListDataset = new ArrayList<>(10);
}
if (mRecyclerView.getAdapter() == null) {
mRecyclerView.setAdapter(new SubjectFragmentAdapter(mListDataset, this));
}
}
use of android.support.v7.widget.RecyclerView.LayoutManager in project Rutgers-Course-Tracker by tevjef.
the class CourseFragment method initRecyclerView.
public void initRecyclerView() {
LinearLayoutManager layoutManager = new LinearLayoutManager(getParentActivity());
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
layoutManager.setSmoothScrollbarEnabled(true);
mRecyclerView.setLayoutManager(layoutManager);
mRecyclerView.setHasFixedSize(true);
if (mListDataset == null) {
mListDataset = new ArrayList<>(10);
}
if (mRecyclerView.getAdapter() == null) {
mRecyclerView.setAdapter(new CourseFragmentAdapter(mListDataset, this));
}
}
use of android.support.v7.widget.RecyclerView.LayoutManager in project Rutgers-Course-Tracker by tevjef.
the class CourseInfoFragment method initRecyclerView.
public void initRecyclerView() {
LinearLayoutManager layoutManager = new LinearLayoutManager(getParentActivity());
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
mRecyclerView.setLayoutManager(layoutManager);
mRecyclerView.setHasFixedSize(true);
if (mRecyclerView.getAdapter() == null) {
mRecyclerView.setAdapter(new CourseInfoFragmentAdapter(mHeaderViews, mSelectedCourse.getSections(), this));
}
}
Aggregations