use of androidx.recyclerview.widget.LinearLayoutManager in project CloudReader by youlookwhat.
the class SearchActivity method initRefreshView.
private void initRefreshView() {
binding.recyclerView.setLayoutManager(new LinearLayoutManager(this));
binding.recyclerView.setLoadingMoreView(new NeteaseLoadMoreView(this));
mAdapter = new CategoryArticleAdapter(this);
binding.recyclerView.setAdapter(mAdapter);
}
use of androidx.recyclerview.widget.LinearLayoutManager in project CloudReader by youlookwhat.
the class RefreshHelper method initLinear.
public static ByRecyclerView initLinear(ByRecyclerView recyclerView, boolean isDivider, int headerNoShowSize) {
recyclerView.setLayoutManager(new LinearLayoutManager(recyclerView.getContext()));
// recyclerView.setItemAnimator(null);
if (isDivider) {
recyclerView.addItemDecoration(new SpacesItemDecoration(recyclerView.getContext(), SpacesItemDecoration.VERTICAL, headerNoShowSize).setDrawable(R.drawable.shape_line));
}
recyclerView.setRefreshHeaderView(new NeteaseRefreshHeaderView(recyclerView.getContext()));
recyclerView.setLoadingMoreView(new NeteaseLoadMoreView(recyclerView.getContext()));
return recyclerView;
}
use of androidx.recyclerview.widget.LinearLayoutManager in project CloudReader by youlookwhat.
the class OneFragment method initRecyclerView.
private void initRecyclerView() {
oneBinding = DataBindingUtil.inflate(getLayoutInflater(), R.layout.header_item_one, null, false);
oneBinding.setView(this);
bindingView.listOne.setLayoutManager(new LinearLayoutManager(activity));
bindingView.listOne.setItemAnimator(null);
bindingView.listOne.addHeaderView(oneBinding.getRoot());
oneAdapter = new OneAdapter(activity);
bindingView.listOne.setAdapter(oneAdapter);
bindingView.listOne.setOnLoadMoreListener(new ByRecyclerView.OnLoadMoreListener() {
@Override
public void onLoadMore() {
if (oneBinding.tlMovie.getSelectedTabPosition() == 1) {
viewModel.handleNextStart();
loadComingSoonMovie();
} else {
bindingView.listOne.loadMoreEnd();
}
}
});
oneBinding.tlMovie.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
int tabPosition = oneBinding.tlMovie.getSelectedTabPosition();
if (tabPosition == 0) {
viewModel.setStart(0);
bindingView.listOne.setRefreshing(false);
loadHotMovie();
} else {
viewModel.setStart(0);
bindingView.listOne.setRefreshing(false);
loadComingSoonMovie();
}
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
}
});
}
use of androidx.recyclerview.widget.LinearLayoutManager in project CloudReader by youlookwhat.
the class FilmDetailActivity method setAdapter.
/**
* 演职员
*/
private void setAdapter(List<FilmDetailNewBean.ActorBean> listBeans) {
LinearLayoutManager mLayoutManager = new LinearLayoutManager(FilmDetailActivity.this);
mLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
bindingContentView.xrvCast.setLayoutManager(mLayoutManager);
// 需加,不然滑动不流畅
bindingContentView.xrvCast.setNestedScrollingEnabled(false);
bindingContentView.xrvCast.setHasFixedSize(false);
FilmDetailActorAdapter mAdapter = new FilmDetailActorAdapter();
mAdapter.addAll(listBeans);
bindingContentView.xrvCast.setAdapter(mAdapter);
bindingContentView.xrvCast.setFocusable(false);
bindingContentView.xrvCast.setFocusableInTouchMode(false);
}
use of androidx.recyclerview.widget.LinearLayoutManager in project plaid by nickbutcher.
the class StoryActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_designer_news_story);
long storyId = getIntent().getLongExtra(Activities.DesignerNews.Story.EXTRA_STORY_ID, -1);
if (storyId == -1) {
finishAfterTransition();
}
Injector.inject(storyId, this);
bindResources();
story = viewModel.getStory();
viewModel.getUiModel().observe(this, storyUiModel -> setupComments(storyUiModel.getComments()));
fab.setOnClickListener(fabClick);
chromeFader = new ElasticDragDismissFrameLayout.SystemChromeFader(this);
layoutManager = new LinearLayoutManager(this);
commentsList.setLayoutManager(layoutManager);
commentsList.setItemAnimator(new CommentAnimator(getResources().getInteger(io.plaidapp.R.integer.comment_expand_collapse_duration)));
header = getLayoutInflater().inflate(R.layout.designer_news_story_description, commentsList, false);
bindDescription();
// setup title/toolbar
if (collapsingToolbar != null) {
// narrow device: collapsing toolbar
collapsingToolbar.addOnLayoutChangeListener(titlebarLayout);
collapsingToolbar.setTitle(story.getTitle());
final Toolbar toolbar = findViewById(R.id.story_toolbar);
toolbar.setNavigationOnClickListener(backClick);
commentsList.addOnScrollListener(headerScrollListener);
setEnterSharedElementCallback(new SharedElementCallback() {
@Override
public void onSharedElementStart(List<String> sharedElementNames, List<View> sharedElements, List<View> sharedElementSnapshots) {
ReflowText.setupReflow(getIntent(), collapsingToolbar);
}
@Override
public void onSharedElementEnd(List<String> sharedElementNames, List<View> sharedElements, List<View> sharedElementSnapshots) {
ReflowText.setupReflow(collapsingToolbar);
}
});
} else {
// w600dp configuration: content card scrolls over title bar
final TextView title = findViewById(R.id.story_title);
title.setText(story.getTitle());
findViewById(R.id.back).setOnClickListener(backClick);
}
enterCommentView = setupCommentField();
commentsAdapter = new DesignerNewsCommentsAdapter(header, new ArrayList<>(0), enterCommentView);
commentsList.setAdapter(commentsAdapter);
draggableFrame.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
final int stableListPaddingBottom = commentsList.getPaddingBottom();
final int stableListPaddingLeft = commentsList.getPaddingLeft();
final int stableListPaddingRight = commentsList.getPaddingRight();
final int stableFabMarginBottom = ((MarginLayoutParams) fab.getLayoutParams()).bottomMargin;
final int stableFabMarginRight = ((MarginLayoutParams) fab.getLayoutParams()).rightMargin;
final View back = findViewById(R.id.back);
final int stableBackMarginLeft = back == null ? 0 : ((MarginLayoutParams) back.getLayoutParams()).leftMargin;
draggableFrame.setOnApplyWindowInsetsListener((v, insets) -> {
final MarginLayoutParams listLp = (MarginLayoutParams) v.getLayoutParams();
listLp.topMargin = insets.getSystemWindowInsetTop();
v.setLayoutParams(listLp);
commentsList.setPadding(stableListPaddingLeft + commentsList.getPaddingLeft(), commentsList.getPaddingTop(), stableListPaddingRight + insets.getSystemWindowInsetRight(), stableListPaddingBottom + insets.getSystemWindowInsetBottom());
final MarginLayoutParams fabLp = (MarginLayoutParams) fab.getLayoutParams();
fabLp.rightMargin = stableFabMarginRight + insets.getSystemWindowInsetRight();
fabLp.bottomMargin = stableFabMarginBottom + insets.getSystemWindowInsetBottom();
fab.setLayoutParams(fabLp);
if (back != null) {
final MarginLayoutParams backLp = (MarginLayoutParams) back.getLayoutParams();
backLp.leftMargin = stableBackMarginLeft + insets.getSystemWindowInsetLeft();
}
return insets;
});
customTab = new CustomTabActivityHelper();
customTab.setConnectionCallback(customTabConnect);
}
Aggregations