Java Code Examples for android.support.v7.widget.SimpleItemAnimator#setSupportsChangeAnimations()

The following examples show how to use android.support.v7.widget.SimpleItemAnimator#setSupportsChangeAnimations() . 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: DownloadingFragment.java    From DanDanPlayForAndroid with MIT License 6 votes vote down vote up
@Override
public void initView() {
    taskStateBeanList = new ArrayList<>();

    taskRv.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
    taskRv.setNestedScrollingEnabled(false);
    taskRv.setItemViewCacheSize(10);
    SimpleItemAnimator simpleItemAnimator = ((SimpleItemAnimator) taskRv.getItemAnimator());
    if (simpleItemAnimator != null)
        simpleItemAnimator.setSupportsChangeAnimations(false);

    taskRvAdapter = new BaseRvAdapter<TaskStateBean>(taskStateBeanList) {
        @NonNull
        @Override
        public AdapterItem<TaskStateBean> onCreateItem(int viewType) {
            return new TaskDownloadingItem(taskManageListener);
        }
    };
    taskRv.setAdapter(taskRvAdapter);

}
 
Example 2
Source File: MessagesList.java    From ChatKit with Apache License 2.0 6 votes vote down vote up
/**
 * Sets adapter for MessagesList
 *
 * @param adapter       Adapter. Must extend MessagesListAdapter
 * @param reverseLayout weather to use reverse layout for layout manager.
 * @param <MESSAGE>     Message model class
 */
public <MESSAGE extends IMessage>
void setAdapter(MessagesListAdapter<MESSAGE> adapter, boolean reverseLayout) {
    SimpleItemAnimator itemAnimator = new DefaultItemAnimator();
    itemAnimator.setSupportsChangeAnimations(false);

    LinearLayoutManager layoutManager = new LinearLayoutManager(getContext(),
            LinearLayoutManager.VERTICAL, reverseLayout);

    setItemAnimator(itemAnimator);
    setLayoutManager(layoutManager);
    adapter.setLayoutManager(layoutManager);
    adapter.setStyle(messagesListStyle);

    addOnScrollListener(new RecyclerScrollMoreListener(layoutManager, adapter));
    super.setAdapter(adapter);
}
 
Example 3
Source File: DialogsList.java    From ChatKit with Apache License 2.0 6 votes vote down vote up
/**
 * Sets adapter for DialogsList
 *
 * @param adapter       Adapter. Must extend DialogsListAdapter
 * @param reverseLayout weather to use reverse layout for layout manager.
 * @param <DIALOG>      Dialog model class
 */
public <DIALOG extends IDialog>
void setAdapter(DialogsListAdapter<DIALOG> adapter, boolean reverseLayout) {
    SimpleItemAnimator itemAnimator = new DefaultItemAnimator();
    itemAnimator.setSupportsChangeAnimations(false);

    LinearLayoutManager layoutManager = new LinearLayoutManager(getContext(),
            LinearLayoutManager.VERTICAL, reverseLayout);

    setItemAnimator(itemAnimator);
    setLayoutManager(layoutManager);

    adapter.setStyle(dialogStyle);

    super.setAdapter(adapter);
}
 
Example 4
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);
}