Search in sources :

Example 1 with StatusAdapter

use of com.funstill.kelefun.adapter.StatusAdapter in project keleFanfou by kelefun.

the class FavouriteStatusListFragment method initView.

protected void initView(View view) {
    SwipeRefreshLayout mRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.line_swipe_refresh);
    // 禁用下拉刷新
    mRefreshLayout.setEnabled(false);
    mRecyclerView = (RecyclerView) view.findViewById(R.id.line_recycler);
    LinearLayoutManager mLayoutManager = new LinearLayoutManager(getActivity());
    mRecyclerView.setLayoutManager(mLayoutManager);
    mAdapter = new StatusAdapter(getActivity(), data);
    mRecyclerView.setAdapter(mAdapter);
    Map<String, String> map = new ArrayMap<>();
    map.put("id", tuserId);
    map.put("page", "1");
    getUserTimeLineStatus(map);
    mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {

        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            super.onScrolled(recyclerView, dx, dy);
        }

        @Override
        public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
            if (newState == RecyclerView.SCROLL_STATE_IDLE && (mLayoutManager.findLastVisibleItemPosition() + 1 == mLayoutManager.getItemCount()) && !isLoadingMore) {
                isLoadingMore = true;
                if (data.size() > 0) {
                    Map<String, String> loadMoreParam = new ArrayMap<>();
                    loadMoreParam.put("max_id", data.get(data.size() - 1).getId());
                    loadMoreParam.put("count", "20");
                    loadMoreParam.put("id", tuserId);
                    loadMoreHomeLineStatus(loadMoreParam);
                }
            }
        }
    });
}
Also used : StatusAdapter(com.funstill.kelefun.adapter.StatusAdapter) ArrayMap(android.util.ArrayMap) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) Map(java.util.Map) ArrayMap(android.util.ArrayMap)

Example 2 with StatusAdapter

use of com.funstill.kelefun.adapter.StatusAdapter in project keleFanfou by kelefun.

the class MentionsPagerFragment method initView.

private void initView(View view) {
    mRecyclerView = (RecyclerView) view.findViewById(R.id.line_recycler);
    mLayoutManager = new LinearLayoutManager(_mActivity);
    mRecyclerView.setLayoutManager(mLayoutManager);
    mRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.no_toolbar_swipe_refresh);
    mRefreshLayout.setColorSchemeResources(R.color.colorPrimary, R.color.colorOrange, R.color.colorRed);
    mRefreshLayout.setOnRefreshListener(this);
    mRefreshLayout.post(() -> mRefreshLayout.setRefreshing(true));
    mAdapter = new StatusAdapter(getActivity(), data);
    mRecyclerView.setAdapter(mAdapter);
    mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {

        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            super.onScrolled(recyclerView, dx, dy);
            mScrollTotal += dy;
            mInAtTop = mScrollTotal <= 0;
        }

        @Override
        public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
            if (newState == RecyclerView.SCROLL_STATE_IDLE && (mLayoutManager.findLastVisibleItemPosition() + 1 == mLayoutManager.getItemCount()) && !isLoadingMore) {
                if (data.size() > 0) {
                    Map<String, String> loadMoreParam = new ArrayMap<>();
                    loadMoreParam.put("max_id", data.get(data.size() - 1).getId());
                    loadMoreParam.put("count", "20");
                    loadMoreMentions(loadMoreParam);
                }
            }
        }
    });
}
Also used : StatusAdapter(com.funstill.kelefun.adapter.StatusAdapter) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) Map(java.util.Map) ArrayMap(android.util.ArrayMap)

Example 3 with StatusAdapter

use of com.funstill.kelefun.adapter.StatusAdapter in project keleFanfou by kelefun.

the class StatusListFragment method initView.

protected void initView(View view) {
    mRecyclerView = (RecyclerView) view.findViewById(R.id.line_recycler);
    LinearLayoutManager mLayoutManager = new LinearLayoutManager(getActivity());
    mRecyclerView.setLayoutManager(mLayoutManager);
    mAdapter = new StatusAdapter(getActivity(), data);
    mRecyclerView.setAdapter(mAdapter);
    if (getArguments() != null) {
        tuserId = getArguments().getString(KelefunConst.USER_ID);
    }
    Map<String, String> map = new ArrayMap<>();
    map.put("id", tuserId);
    map.put("page", "1");
    getUserTimeLineStatus(map);
    mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {

        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            super.onScrolled(recyclerView, dx, dy);
        }

        @Override
        public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
            if (newState == RecyclerView.SCROLL_STATE_IDLE && (mLayoutManager.findLastVisibleItemPosition() + 1 == mLayoutManager.getItemCount()) && !isLoadingMore) {
                isLoadingMore = true;
                if (data.size() > 0) {
                    Map<String, String> loadMoreParam = new ArrayMap<>();
                    loadMoreParam.put("max_id", data.get(data.size() - 1).getId());
                    loadMoreParam.put("count", "20");
                    loadMoreParam.put("id", tuserId);
                    loadMoreHomeLineStatus(loadMoreParam);
                }
            }
        }
    });
}
Also used : StatusAdapter(com.funstill.kelefun.adapter.StatusAdapter) ArrayMap(android.util.ArrayMap) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) Map(java.util.Map) ArrayMap(android.util.ArrayMap)

Example 4 with StatusAdapter

use of com.funstill.kelefun.adapter.StatusAdapter in project keleFanfou by kelefun.

the class FavouriteStatusListFragment method initView.

protected void initView(View view) {
    mRecyclerView = (RecyclerView) view.findViewById(R.id.line_recycler);
    LinearLayoutManager mLayoutManager = new LinearLayoutManager(getActivity());
    mRecyclerView.setLayoutManager(mLayoutManager);
    mAdapter = new StatusAdapter(getActivity(), data);
    mRecyclerView.setAdapter(mAdapter);
    if (getArguments() != null) {
        tuserId = getArguments().getString(KelefunConst.USER_ID);
    }
    Map<String, String> map = new ArrayMap<>();
    map.put("id", tuserId);
    map.put("page", "1");
    getFavourites(map);
    mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {

        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            super.onScrolled(recyclerView, dx, dy);
        }

        @Override
        public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
            if (newState == RecyclerView.SCROLL_STATE_IDLE && (mLayoutManager.findLastVisibleItemPosition() + 1 == mLayoutManager.getItemCount()) && !isLoadingMore) {
                isLoadingMore = true;
                if (data.size() > 0) {
                    Map<String, String> loadMoreParam = new ArrayMap<>();
                    loadMoreParam.put("max_id", data.get(data.size() - 1).getId());
                    loadMoreParam.put("count", "20");
                    loadMoreParam.put("id", tuserId);
                    loadMoreFavouriteStatus(loadMoreParam);
                }
            }
        }
    });
}
Also used : StatusAdapter(com.funstill.kelefun.adapter.StatusAdapter) ArrayMap(android.util.ArrayMap) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) Map(java.util.Map) ArrayMap(android.util.ArrayMap)

Example 5 with StatusAdapter

use of com.funstill.kelefun.adapter.StatusAdapter in project keleFanfou by kelefun.

the class ExploreFragmentChild method initView.

private void initView(View view) {
    mToolbar = (Toolbar) view.findViewById(R.id.toolbar);
    mToolbar.setTitle("随便看看");
    mRecyclerView = (RecyclerView) view.findViewById(R.id.line_recycler);
    mLayoutManager = new LinearLayoutManager(_mActivity);
    mRecyclerView.setLayoutManager(mLayoutManager);
    mRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipe_refresh);
    mRefreshLayout.setColorSchemeResources(R.color.colorPrimary, R.color.colorOrange, R.color.colorRed);
    mRefreshLayout.setOnRefreshListener(this);
    mRefreshLayout.post(() -> mRefreshLayout.setRefreshing(true));
    mAdapter = new StatusAdapter(getActivity(), data);
    mRecyclerView.setAdapter(mAdapter);
    // 初始化数据
    Map<String, String> map = new ArrayMap<>();
    map.put("count", "20");
    getPublicTimeLineStatus(map);
    mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {

        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            super.onScrolled(recyclerView, dx, dy);
            mScrollTotal += dy;
            mInAtTop = mScrollTotal <= 0;
        }

        @Override
        public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
            if (newState == RecyclerView.SCROLL_STATE_IDLE && (mLayoutManager.findLastVisibleItemPosition() + 1 == mLayoutManager.getItemCount()) && !isLoadingMore) {
                isLoadingMore = true;
                // 处理逻辑
                if (data.size() > 0) {
                    Map<String, String> loadMoreParam = new ArrayMap<>();
                    loadMoreParam.put("max_id", data.get(data.size() - 1).getId());
                    loadMoreParam.put("count", "20");
                    loadMore(loadMoreParam);
                }
            }
        }
    });
}
Also used : StatusAdapter(com.funstill.kelefun.adapter.StatusAdapter) ArrayMap(android.util.ArrayMap) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) Map(java.util.Map) ArrayMap(android.util.ArrayMap)

Aggregations

LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)7 RecyclerView (android.support.v7.widget.RecyclerView)7 ArrayMap (android.util.ArrayMap)7 StatusAdapter (com.funstill.kelefun.adapter.StatusAdapter)7 Map (java.util.Map)7 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)2