android.support.v7.widget.DefaultItemAnimator Java Examples

The following examples show how to use android.support.v7.widget.DefaultItemAnimator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GoodsListActivity.java    From enjoyshop with Apache License 2.0 6 votes vote down vote up
/**
 * 展示数据
 */
private void showData() {

    if (datas != null && datas.size() > 0) {
        mTxtSummary.setText("共有" + datas.size() + "件商品");
    } else {
        mLlSummary.setVisibility(View.GONE);
        ToastUtils.showUiToast(GoodsListActivity.this,"暂无商品信息");
        return;
    }

    mAdatper = new HotGoodsAdapter(datas, this);
    mRecyclerview.setAdapter(mAdatper);
    if (actionType == ACTION_LIST) {
        mRecyclerview.setLayoutManager(new LinearLayoutManager(this));
    } else {
        mRecyclerview.setLayoutManager(new GridLayoutManager(this, 2));
    }

    mRecyclerview.setItemAnimator(new DefaultItemAnimator());
    mRecyclerview.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration
            .HORIZONTAL));

}
 
Example #2
Source File: EpisodeListView.java    From EpisodeListView with Apache License 2.0 6 votes vote down vote up
private void init() {
    LayoutInflater inflater = LayoutInflater.from(mContext);
    inflater.inflate(R.layout.episodelist_layout, this, true);

    mChildrenView = (RecyclerView) findViewById(R.id.episodes);
    mParentView = (RecyclerView) findViewById(R.id.groups);

    mEpisodesLayoutManager = new LinearLayoutManager(mContext, LinearLayout.HORIZONTAL, false);
    mGroupLayoutManager = new LinearLayoutManager(mContext, LinearLayout.HORIZONTAL, false);

    mChildrenView.setLayoutManager(mEpisodesLayoutManager);
    mParentView.setLayoutManager(mGroupLayoutManager);

    mChildrenView.setItemAnimator(new DefaultItemAnimator());
    mParentView.setItemAnimator(new DefaultItemAnimator());

    mChildrenView.setOnFocusChangeListener(this);
    mParentView.setOnFocusChangeListener(this);
    this.setOnFocusChangeListener(this);
}
 
Example #3
Source File: NoteListFragment.java    From timecat with Apache License 2.0 6 votes vote down vote up
@Override
public void initView() {
    dataList = DB.notes().findAll();
    if (dataList == null || dataList.isEmpty()) {
        empty_view.setVisibility(View.VISIBLE);
        recyclerView.setVisibility(View.GONE);
    } else {
        empty_view.setVisibility(View.GONE);
        recyclerView.setVisibility(View.VISIBLE);
    }
    NoteListAdapter adapter = new NoteListAdapter(dataList, (Activity) getContext());
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setAdapter(adapter);
    new Handler().postDelayed(()-> getPresenter().refreshData(), 500);
}
 
Example #4
Source File: TweetsSQLiteFragment.java    From storio with Apache License 2.0 6 votes vote down vote up
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ButterKnife.bind(this, view);

    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    recyclerView.setAdapter(tweetsAdapter);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setHasFixedSize(true);
    recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL));

    uiStateController = new UiStateController.Builder()
            .withLoadingUi(view.findViewById(R.id.tweets_loading_ui))
            .withErrorUi(view.findViewById(R.id.tweets_error_ui))
            .withEmptyUi(view.findViewById(R.id.tweets_empty_ui))
            .withContentUi(recyclerView)
            .build();
}
 
Example #5
Source File: RoutinesListFragment.java    From timecat with Apache License 2.0 6 votes vote down vote up
@Override
public void initView() {
    dataList = DB.routines().findAll();
    empty_icon.setImageResource(R.drawable.ic_routines_grey_24dp);
    empty_head.setText(R.string.empty_routines_head);
    empty_attention.setText(R.string.empty_routines);
    empty_long_press_routine.setVisibility(View.VISIBLE);
    empty_long_press_note.setVisibility(View.INVISIBLE);
    if (dataList == null || dataList.isEmpty()) {
        empty_view.setVisibility(View.VISIBLE);
        recyclerView.setVisibility(View.GONE);
    } else {
        empty_view.setVisibility(View.GONE);
        recyclerView.setVisibility(View.VISIBLE);
    }
    RoutineListAdapter adapter = new RoutineListAdapter(dataList, (Activity) getContext());
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setAdapter(adapter);
    new Handler().postDelayed(()-> getPresenter().refreshData(), 500);
}
 
Example #6
Source File: HoriListFragment.java    From PracticeDemo with Apache License 2.0 6 votes vote down vote up
protected void init(Bundle savedInstanceState) {

        mData = new ArrayList<>();
        mAdapter = new ListAdapter(getActivity(), mData, (view, position) -> {
            Snackbar.make(view, "点击了position:" + position, Snackbar.LENGTH_SHORT)
                    .setAction("删除该项目",v-> {
                        mData.remove(position);
                        mAdapter.notifyItemRemoved(position);
                    })
                    .show();
        });

        for (int i = 0; i < 20; i++) {
            mData.add("~~" + i);
        }

        mRvList.setItemAnimator(new DefaultItemAnimator());
        mRvList.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false));
        mRvList.setHasFixedSize(true);
        mRvList.setAdapter(mAdapter);
    }
 
Example #7
Source File: AboutListItemView.java    From EasyAbout with MIT License 6 votes vote down vote up
private void init(Context context, String title, int titleColor) {
    inflate(getContext(), R.layout.ea_card_list, this);
    aboutItemList = new ArrayList<>();
    easyAboutAdapter = new EasyAboutAdapter(context, aboutItemList);
    RecyclerView recyclerView = findViewById(R.id.recycler_view);
    recyclerView.setNestedScrollingEnabled(false);
    ViewCompat.setNestedScrollingEnabled(recyclerView, false);
    recyclerView.setLayoutManager(new LinearLayoutManager(context));
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setAdapter(easyAboutAdapter);
    TextView titleTv = findViewById(R.id.card_title);
    if (titleColor==0)
        titleColor = ColorUtils.getThemeAccentColor(context);
    titleTv.setTextColor(titleColor);
    if (title==null)
        titleTv.setVisibility(GONE);
    else titleTv.setText(title);

    int cardColor = ColorUtils.getThemeAttrColor(context, "aboutCardBackground");
    if (cardColor!= 0)
        ((CardView) findViewById(R.id.card_view)).setCardBackgroundColor(cardColor);
}
 
Example #8
Source File: QuicFragment.java    From clb-quic-demo with Apache License 2.0 6 votes vote down vote up
private void loadItems() {
    numberOfImages = 0;

    RecyclerView cronetView = (RecyclerView) view.findViewById(R.id.quic_images_view);
    GridLayoutManager gridLayoutManager =
            new GridLayoutManager(getActivity(), 3);

    viewAdapter = new com.tencent.samples.quic_sample.QuicViewAdapter(getActivity());
    // In order to enable Netlog, a Cronet logging system, enable write permissions.
    // Find more info about Netlog here:
    // https://www.chromium.org/developers/design-documents/network-stack/netlog
    enableWritingPermissionForLogging();

    cronetView.setLayoutManager(gridLayoutManager);
    cronetView.setAdapter(viewAdapter);
    cronetView.setItemAnimator(new DefaultItemAnimator());
    onItemsLoadComplete();

}
 
Example #9
Source File: RecommendDetailsFragment.java    From HHComicViewer with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_recommend_details, container, false);
    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
    Bundle bundle = getArguments();
    ComicTabList comicTabList = (ComicTabList) bundle.getSerializable("tab_list");
    if (comicTabList != null) {
        RecommendDetailsAdapter adapter = new RecommendDetailsAdapter(getActivity(), comicTabList);
        recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
        recyclerView.setItemAnimator(new DefaultItemAnimator());
        recyclerView.setAdapter(new ScaleInAnimationAdapter(adapter));
    }
    return view;
}
 
Example #10
Source File: NewsTabFragment.java    From okhttp-OkGo with Apache License 2.0 6 votes vote down vote up
@Override
protected void initData() {
    url = Urls.URL_GANK_BASE + fragmentTitle + "/" + PAGE_SIZE + "/";
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setLayoutManager(new LinearLayoutManager(context));
    newsAdapter = new NewsAdapter(null);
    newsAdapter.openLoadAnimation(BaseQuickAdapter.SCALEIN);
    newsAdapter.isFirstOnly(false);
    recyclerView.setAdapter(newsAdapter);

    refreshLayout.setColorSchemeColors(Color.RED, Color.BLUE, Color.GREEN);
    refreshLayout.setOnRefreshListener(this);
    newsAdapter.setOnLoadMoreListener(this);

    //开启loading,获取数据
    setRefreshing(true);
    onRefresh();
}
 
Example #11
Source File: MessageList.java    From aurora-imui with MIT License 6 votes vote down vote up
/**
 * Set adapter for MessageList.
 *
 * @param adapter Adapter, extends MsgListAdapter.
 * @param         <MESSAGE> Message model extends IMessage.
 */
public <MESSAGE extends IMessage> void setAdapter(MsgListAdapter<MESSAGE> adapter) {
    mAdapter = adapter;
    SimpleItemAnimator itemAnimator = new DefaultItemAnimator();
    itemAnimator.setSupportsChangeAnimations(false);
    setItemAnimator(itemAnimator);

    LinearLayoutManager layoutManager = new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, true);
    layoutManager.setStackFromEnd(true);
    setLayoutManager(layoutManager);

    adapter.setLayoutManager(layoutManager);
    adapter.setStyle(mContext, mMsgListStyle);
    mScrollMoreListener = new ScrollMoreListener(layoutManager, adapter);
    addOnScrollListener(mScrollMoreListener);
    super.setAdapter(adapter);
}
 
Example #12
Source File: UtilitiesFragment.java    From Travel-Mate with MIT License 6 votes vote down vote up
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.fragment_utility, container, false);

    ButterKnife.bind(this, view);

    List<CardItemEntity> cardEntities = getUtilityItems();

    CardViewOptionsAdapter cardViewOptionsAdapter = new CardViewOptionsAdapter(this, cardEntities);
    RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(mActivity.getApplicationContext());
    mUtilityOptionsRecycleView.setLayoutManager(mLayoutManager);
    mUtilityOptionsRecycleView.setItemAnimator(new DefaultItemAnimator());
    mUtilityOptionsRecycleView.setAdapter(cardViewOptionsAdapter);

    PackageManager mManager = getActivity().getPackageManager();
    boolean hasAccelerometer = mManager.hasSystemFeature(PackageManager.FEATURE_SENSOR_ACCELEROMETER);
    boolean hasMagneticSensor = mManager.hasSystemFeature(PackageManager.FEATURE_SENSOR_COMPASS);
    if (!hasAccelerometer || !hasMagneticSensor) {
        this.mHasMagneticSensor = false;
    }

    return view;
}
 
Example #13
Source File: searchActivity.java    From music_player with Open Software License 3.0 6 votes vote down vote up
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_search);

        //动态注册广播
//        dismissReceiver = new DismissReceiver();
//        IntentFilter intentFilter = new IntentFilter();
//        intentFilter.addAction("dismiss_dialog");
//        registerReceiver(dismissReceiver, intentFilter);

        Toolbar search_toolbar = (Toolbar) findViewById(R.id.search_toolbar);
        search_toolbar.inflateMenu(R.menu.search_menu);
        search_toolbar.setTitle("搜索");
        setSupportActionBar(search_toolbar);//设置返回键可用
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        RecyclerView search_recycler_view = (RecyclerView) findViewById(R.id.search_RecyclerView);
        LinearLayoutManager layoutManager = new LinearLayoutManager(this);
        layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        search_recycler_view.setLayoutManager(layoutManager);
        search_recycler_view.setItemAnimator(new DefaultItemAnimator());
        mSearchAdapter = new searchAdapter();
        search_recycler_view.setAdapter(mSearchAdapter);
    }
 
Example #14
Source File: ImageStreamUi.java    From belvedere with Apache License 2.0 6 votes vote down vote up
private void initRecycler(ImageStreamAdapter adapter) {
    final int columns = bottomSheet.getContext().getResources().getInteger(R.integer.belvedere_image_stream_column_count);
    final StaggeredGridLayoutManager staggeredGridLayoutManager =
            new StaggeredGridLayoutManager(columns, StaggeredGridLayoutManager.VERTICAL);

    imageList.setLayoutManager(staggeredGridLayoutManager);
    imageList.setHasFixedSize(true);
    imageList.setDrawingCacheEnabled(true);
    imageList.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);

    final DefaultItemAnimator defaultItemAnimator = new DefaultItemAnimator();
    defaultItemAnimator.setSupportsChangeAnimations(false);
    imageList.setItemAnimator(defaultItemAnimator);

    imageList.setAdapter(adapter);
}
 
Example #15
Source File: GroupPopularListFragment.java    From citrus with Apache License 2.0 6 votes vote down vote up
@Override
public void onViewCreated(final View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    String categoryName = GroupHelper.CATEGORY_POPULAR;
    RealmResults<Group> groups = GroupRepository.findAllByCategoryName(mUIThreadRealm, categoryName);
    mGroupListAdapter = new GroupListAdapter(groups, this);

    RecyclerView recyclerView = findById(view, R.id.group_list_recycler_view);
    recyclerView.addItemDecoration(
            new DividerItemDecoration(Utils.getDrawableResource(getActivity(), R.drawable.line)));
    final LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setHasFixedSize(true);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setAdapter(mGroupListAdapter);
}
 
Example #16
Source File: FindGankAty.java    From myapplication with Apache License 2.0 6 votes vote down vote up
@Override
public void handleMessage(Message msg) {
    String gankJsonStr = msg.obj.toString();
    Log.d("FindGankAty", " Json: " + gankJsonStr);

    Gson gson = new Gson();
    mSearchBean = gson.fromJson(gankJsonStr, SearchBean.class);
    if (!mSearchBean.getResults().isEmpty() && mSearchBean != null) {
        mDatas = mSearchBean.getResults();

        mFindSearchAdapter = new FindSearchAdapter(FindGankAty.this, mDatas);
        mLayoutManager = new LinearLayoutManager(FindGankAty.this,
                LinearLayoutManager.VERTICAL, false);
        mRecyclerView.setAdapter(mFindSearchAdapter);
        mRecyclerView.setLayoutManager(mLayoutManager);
        mRecyclerView.setItemAnimator(new DefaultItemAnimator());//默认动画
        mRecyclerView.setHasFixedSize(true);//效率最高
        mFindSearchAdapter.setOnItemClickListener(FindGankAty.this);
        mMaterialDialog.dismiss();
    } else {
        mMaterialDialog.dismiss();
        Toast.makeText(FindGankAty.this,
                "数据加载出错!",
                Toast.LENGTH_SHORT).show();
    }
}
 
Example #17
Source File: DownloadListActivity.java    From okhttp-OkGo with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_download_list);
    initToolBar(toolbar, true, "开始下载");

    initData();
    OkDownload.getInstance().setFolder(Environment.getExternalStorageDirectory().getAbsolutePath() + "/aaa/");
    OkDownload.getInstance().getThreadPool().setCorePoolSize(3);

    folder.setText(String.format("下载路径: %s", OkDownload.getInstance().getFolder()));
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.addItemDecoration(new DividerItemDecoration(this, LinearLayoutManager.VERTICAL));

    //从数据库中恢复数据
    List<Progress> progressList = DownloadManager.getInstance().getAll();
    OkDownload.restore(progressList);
    adapter = new DownloadListAdapter(this);
    recyclerView.setAdapter(adapter);

    checkSDCardPermission();
}
 
Example #18
Source File: AnchorListFragment.java    From Sky31Radio with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_anchor_list, container, false);
    ButterKnife.inject(this, view);
    recyclerView.setHasFixedSize(true);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 2));

    loaderView.setAdapter(adapter);
    loaderView.setOnRefreshListener(this);

    return  view;
}
 
Example #19
Source File: RecyclerViewActivity.java    From android-advanced-light with MIT License 5 votes vote down vote up
public void setListView(){
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    mRecyclerView.addItemDecoration(new DividerItemDecoration(RecyclerViewActivity.this, DividerItemDecoration.VERTICAL_LIST));
    mRecyclerView.setItemAnimator(new DefaultItemAnimator());
    mHomeAdaper=new HomeAdapter(this, mList);
    setLister();
    mRecyclerView.setAdapter(mHomeAdaper);
}
 
Example #20
Source File: ViewUtil.java    From RecyclerRenderers with Apache License 2.0 5 votes vote down vote up
public static void configMultiRecyclerView(final Context context, RecyclerView recyclerView) {
  recyclerView.setHasFixedSize(true);
  recyclerView.setItemAnimator(new DefaultItemAnimator());
  GridLayoutManager layoutManager = new GridLayoutManager(context, 2);
  layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
  recyclerView.addItemDecoration(new MarginDecoration(context));
  recyclerView.setLayoutManager(layoutManager);
  recyclerView.setAdapter(new MultiRendererAdapter(generateObjects(),
      new RendererBuilder(new Factory()), LayoutInflater.from(context)));
}
 
Example #21
Source File: ClassifiesShowActivity.java    From HHComicViewer with Apache License 2.0 5 votes vote down vote up
@Override
public void onSuccess(final int maxPage, final List<Comic> comics) {
    mMaxPage = maxPage;
    mComicList.addAll(comics);
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            if (mAdapter == null) {
                MyStaggerLayoutManager layoutManager = new MyStaggerLayoutManager(3,
                        StaggeredGridLayoutManager.VERTICAL);
                layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
                mBinding.recyclerView.setLayoutManager(layoutManager);
                mBinding.recyclerView.setItemAnimator(new DefaultItemAnimator());
                mInnerAdapter = new StaggeredComicAdapter(ClassifiesShowActivity.this, null, mComicList);
                mAdapter = new StaggeredComicAdapterWrapper(mInnerAdapter);
                mBinding.recyclerView.setAdapter(mAdapter);
                mBinding.recyclerView.setVisibility(View.VISIBLE);
                mBinding.progressBar.setVisibility(View.GONE);
            } else {
                mInnerAdapter.updateComicList(mComicList);
                if (mMaxPage == mPage) {
                    mBinding.recyclerView.setNoMore(true);
                } else {
                    //参数为每页加载数量
                    mBinding.recyclerView.refreshComplete(comics.size());
                }
                mAdapter.notifyDataSetChanged();
            }
        }
    });
}
 
Example #22
Source File: XRecyclerView.java    From ARecyclerView with MIT License 5 votes vote down vote up
public XRecyclerView verticalDivider(@ColorRes int colorRes, @DimenRes int dimenRes) {
    setItemAnimator(new DefaultItemAnimator());
    setHasFixedSize(true);
    addItemDecoration(new VerticalDividerItemDecoration.Builder(getContext())
            .colorResId(colorRes)
            .size(getContext().getResources().getDimensionPixelSize(dimenRes))
            .build()
    );
    return this;
}
 
Example #23
Source File: DialogsList.java    From ChatKit with Apache License 2.0 5 votes vote down vote up
@Override
protected void onAttachedToWindow() {
    super.onAttachedToWindow();

    LinearLayoutManager layout = new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false);
    SimpleItemAnimator animator = new DefaultItemAnimator();

    setLayoutManager(layout);
    setItemAnimator(animator);
}
 
Example #24
Source File: SearchFragment.java    From talk-android with MIT License 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_search, container, false);
    ButterKnife.inject(this, view);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setAdapter(adapter);
    recyclerView.addOnScrollListener(mOnScrollListener);

    etKeyword.addTextChangedListener(this);
    etKeyword.setOnKeyListener(new View.OnKeyListener() {
        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            if ((keyCode == KeyEvent.KEYCODE_SEARCH || keyCode == KeyEvent.KEYCODE_ENTER) &&
                    StringUtil.isNotBlank(etKeyword.getText().toString())) {
                adapter.search();
                return true;
            }
            return false;
        }
    });

    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            showKeyboard();
        }
    }, 200);
    return view;
}
 
Example #25
Source File: RecyclerView.java    From ZfsoftCampusAssit with Apache License 2.0 5 votes vote down vote up
private void initRecyclerView(Context context) {
    // init LinearLayoutManager
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
    // set the VERTICAL layout
    linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    // set layout manager
    this.setLayoutManager(linearLayoutManager);
    // set item animator
    this.setItemAnimator(new DefaultItemAnimator());
    // keep recyclerview fixed size
    this.setHasFixedSize(true);
}
 
Example #26
Source File: MovieDetailFragment.java    From Popular-Movies-App with Apache License 2.0 5 votes vote down vote up
private void initReviewsList() {
    reviewsAdapter = new MovieReviewsAdapter();
    reviewsAdapter.setOnItemClickListener((itemView, position) -> onMovieReviewClicked(position));
    movieReviews.setAdapter(reviewsAdapter);
    movieReviews.setItemAnimator(new DefaultItemAnimator());
    LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
    movieReviews.setLayoutManager(layoutManager);
}
 
Example #27
Source File: FollowersFragment.java    From meiShi with Apache License 2.0 5 votes vote down vote up
@Override
protected void onFragmentCreate() {
    uid = getArguments().getString(UID_KEY);
    mPresenter = new FollowersPresenterImpl(this);
    mRecyclerView = getRecyclerView();
    mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    mRecyclerView.setItemAnimator(new DefaultItemAnimator());
    mAdapter = new FollowsAdapter();
    mAdapter.setHasMoreData(true);
    mRecyclerView.setAdapter(mAdapter);
    setAdapter(mAdapter);
    // first automatic loading
    mAdapter.setHasFooter(true);
    onFragmentLoadMore();
}
 
Example #28
Source File: ShareMessageFragment.java    From TestChat with Apache License 2.0 5 votes vote down vote up
@Override
        public void initData() {
                presenter = new ShareMessagePresenter();
                presenter.setViewAndModel(this, new ShareMessageModel());
                mAdapter = new ShareMultipleLayoutAdapter();
                View headerView = getHeaderView();
                mAdapter.setHeaderView(headerView, 0);
                mAdapter.setOnShareMessageItemClickListener(this);
                display.setLayoutManager(mLinearLayoutManager = new LinearLayoutManager(getActivity()));
//                display.setHasFixedSize(true);
                display.setItemAnimator(new DefaultItemAnimator());
                display.setAdapter(mAdapter);
                GroupMessageService.registerListener(this);
                mMenu.attachToRecyclerView(display);
                mAdapter.setOnLoadMoreDataListener(new OnLoadMoreDataListener() {
                        @Override
                        public void onLoadMoreData() {
                                int size = mAdapter.getAllData().size();
                                if (mAdapter != null && size > 0) {
                                        loadData(false, mAdapter.getData(size - 1).getCreatedAt());
                                } else {
                                        LogUtil.e("获取更多的时候data为空");
                                }
                        }
                }, display);

                refresh.post(new Runnable() {
                        @Override
                        public void run() {
                                refresh.setRefreshing(true);
                                mOnRefreshListener.onRefresh();
                        }
                });
        }
 
Example #29
Source File: FoldersFragment.java    From IdealMedia with Apache License 2.0 5 votes vote down vote up
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    listView = (RecyclerView) view.findViewById(android.R.id.list);
    listView.setLayoutManager(new LinearLayoutManager(getActivity()));
    listView.setItemAnimator(new DefaultItemAnimator());

    Tracker t = ((NavigationActivity)getActivity()).getTracker(NavigationActivity.TrackerName.APP_TRACKER);
    t.setScreenName("Folders and files");
    t.send(new HitBuilders.AppViewBuilder().build());
}
 
Example #30
Source File: OtherStoriesFragment.java    From ZhihuDaily with Apache License 2.0 5 votes vote down vote up
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mPresenter = new OtherStoryPresenter(this);
    OtherStoriesListAdapter adapter = new OtherStoriesListAdapter(getContext(), mItemList);
    mLoadMoreWrapper = new LoadMoreWrapper(adapter);
    mLoadMoreWrapper.setLoadMoreView(R.layout.default_loading);
    mLoadMoreWrapper.setOnLoadMoreListener(new LoadMoreWrapper.OnLoadMoreListener() {
        @Override
        public void onLoadMoreRequested() {
            if (story_id != 0) {
                mPresenter.getMoreThemeStories(id, story_id);
            }
        }
    });

    mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    mRecyclerView.setItemAnimator(new DefaultItemAnimator());
    mRecyclerView.setAdapter(mLoadMoreWrapper);
    mPresenter.getOtherStories(id);
    mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            isRefresh = true;
            mPresenter.getOtherStories(id);
        }
    });
}