Example usage for android.widget AbsListView.RecyclerListener AbsListView.RecyclerListener

List of usage examples for android.widget AbsListView.RecyclerListener AbsListView.RecyclerListener

Introduction

In this page you can find the example usage for android.widget AbsListView.RecyclerListener AbsListView.RecyclerListener.

Prototype

AbsListView.RecyclerListener

Source Link

Usage

From source file:com.juick.android.ThreadFragment.java

private void initAdapterStageTwo(boolean cached) {
    if (!isAdded()) {
        return;/*from  ww w . jav a 2s. c  o m*/
    }
    String replies = getResources().getString(R.string.Replies) + " ("
            + Integer.toString(listAdapter.getCount() - 1) + ")";
    listAdapter.addDisabledItem(replies, 1);
    if (!cached) {
        if (listAdapter.getCount() > 0)
            parentActivity.onThreadLoaded(listAdapter.getItem(0));
    }

    getListView().setRecyclerListener(new AbsListView.RecyclerListener() {
        @Override
        public void onMovedToScrapHeap(View view) {
            listAdapter.recycleView(view);
        }
    });

}

From source file:com.juick.android.MessagesFragment.java

private void initListWithMessages(ArrayList<JuickMessage> messages) {
    if (messages.size() != 0) {
        Log.w("com.juick.advanced", "getFirst: in ui thread!");
        listAdapter.clear();// ww  w .  ja v a  2 s.c om
        listAdapter.addAllMessages(messages);
        Log.w("com.juick.advanced", "getFirst: added all");
        if (getListView().getFooterViewsCount() == 0) {
            getListView().addFooterView(viewLoading, null, false);
            Log.w("com.juick.advanced", "getFirst: added footer");
        }
        topMessageId = messages.get(0).getMID();
    } else {
        topMessageId = null;
    }

    if (false && (getListView().getHeaderViewsCount() == 0 && messagesSource.supportsBackwardRefresh()
            && sp.getBoolean("enable_pull_to_refresh", false))) {
        getListView().addHeaderView(mRefreshView, null, false);
        mRefreshViewHeight = mRefreshView.getMeasuredHeight();
    }

    if (getListAdapter() != listAdapter) {
        setListAdapter(listAdapter);
        Log.w("com.juick.advanced", "getFirst: adapter set");
    }

    loading = false;
    resetHeader();
    Log.w("com.juick.advanced", "getFirst: header reset");
    getListView().invalidateViews();
    Log.w("com.juick.advanced", "getFirst: invalidated views");
    getListView().setRecyclerListener(new AbsListView.RecyclerListener() {
        @Override
        public void onMovedToScrapHeap(View view) {
            listAdapter.recycleView(view);
        }
    });
}