Search in sources :

Example 6 with LinearLayoutManager

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);
}
Also used : CategoryArticleAdapter(com.example.jingbin.cloudreader.adapter.CategoryArticleAdapter) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) NeteaseLoadMoreView(com.example.jingbin.cloudreader.view.byview.NeteaseLoadMoreView)

Example 7 with LinearLayoutManager

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;
}
Also used : NeteaseRefreshHeaderView(com.example.jingbin.cloudreader.view.byview.NeteaseRefreshHeaderView) SpacesItemDecoration(me.jingbin.library.decoration.SpacesItemDecoration) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) NeteaseLoadMoreView(com.example.jingbin.cloudreader.view.byview.NeteaseLoadMoreView)

Example 8 with LinearLayoutManager

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) {
        }
    });
}
Also used : ByRecyclerView(me.jingbin.library.ByRecyclerView) OneAdapter(com.example.jingbin.cloudreader.adapter.OneAdapter) TabLayout(com.google.android.material.tabs.TabLayout) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager)

Example 9 with LinearLayoutManager

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);
}
Also used : FilmDetailActorAdapter(com.example.jingbin.cloudreader.adapter.FilmDetailActorAdapter) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager)

Example 10 with LinearLayoutManager

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);
}
Also used : ArrayList(java.util.ArrayList) SpannableString(android.text.SpannableString) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) MarginLayoutParams(android.view.ViewGroup.MarginLayoutParams) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) TextView(android.widget.TextView) PinnedOffsetView(io.plaidapp.ui.widget.PinnedOffsetView) ElasticDragDismissFrameLayout(io.plaidapp.core.ui.widget.ElasticDragDismissFrameLayout) CustomTabActivityHelper(io.plaidapp.core.util.customtabs.CustomTabActivityHelper) TextView(android.widget.TextView) SharedElementCallback(android.app.SharedElementCallback) Toolbar(android.widget.Toolbar)

Aggregations

LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)513 RecyclerView (androidx.recyclerview.widget.RecyclerView)308 View (android.view.View)197 TextView (android.widget.TextView)76 ArrayList (java.util.ArrayList)48 Bundle (android.os.Bundle)43 Nullable (androidx.annotation.Nullable)41 Intent (android.content.Intent)36 ImageView (android.widget.ImageView)34 Toolbar (androidx.appcompat.widget.Toolbar)34 List (java.util.List)33 NonNull (androidx.annotation.NonNull)31 Context (android.content.Context)28 ViewGroup (android.view.ViewGroup)27 AlertDialog (androidx.appcompat.app.AlertDialog)24 Test (org.junit.Test)24 LayoutInflater (android.view.LayoutInflater)23 ContextualCard (com.android.settings.homepage.contextualcards.ContextualCard)20 MenuItem (android.view.MenuItem)18 StaggeredGridLayoutManager (androidx.recyclerview.widget.StaggeredGridLayoutManager)18