android.support.v7.widget.SimpleItemAnimator Java Examples

The following examples show how to use android.support.v7.widget.SimpleItemAnimator. 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: WeekdaysDataSource.java    From weekdays-buttons-bar with MIT License 6 votes vote down vote up
private void initRecyclerView(Context context) {
        if (mRecyclerView == null) return;
        mRecyclerView.setBackgroundColor(mBackgroundColor);
        mRecyclerView.setHasFixedSize(true);
        mLayoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);

        mRecyclerView.setLayoutManager(mLayoutManager);
        mRecyclerView.setAdapter(createAdapter());
        mRecyclerView.setNestedScrollingEnabled(isNestedScrollEnable());


//        mRecyclerView.getItemAnimator().setSupportsChangeAnimations(true);
        RecyclerView.ItemAnimator animator = mRecyclerView.getItemAnimator();
        if (animator instanceof SimpleItemAnimator) {
            ((SimpleItemAnimator) animator).setSupportsChangeAnimations(false);
        }
        onRecyclerViewInit(mRecyclerView);
    }
 
Example #2
Source File: BookcaseFragment.java    From FriendBook with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void setRecyclerView(RecyclerView recyclerView) {
    recyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 3));
    recyclerView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
    ((SimpleItemAnimator)recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
    int i = getResources().getDisplayMetrics().widthPixels;
    int y = DensityUtil.dp2px(getContext(), 90);
    int p = DensityUtil.dp2px(getContext(), 15);
    int padding = (3 * y + 2 * 3 * p + 2 * p - i) / (2 * 3);

    recyclerView.setPadding(
            padding,
            DensityUtil.dp2px(getContext(), 8),
            padding,
            DensityUtil.dp2px(getContext(), 8)
    );
}
 
Example #3
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 #4
Source File: BeautyControlView.java    From PLDroidShortVideo with Apache License 2.0 6 votes vote down vote up
private void initHairView() {
    mRvHair = findViewById(R.id.rv_hair);
    mRvHair.setHasFixedSize(true);
    mRvHair.setLayoutManager(new GridLayoutManager(mContext, 5));
    mHairAdapter = new HairAdapter();
    mRvHair.setAdapter(mHairAdapter);
    ((SimpleItemAnimator) mRvHair.getItemAnimator()).setSupportsChangeAnimations(false);
    Arrays.fill(sHairLevel, 0.6f);

    ArrayList<Effect> hairEffects = EffectEnum.getEffectsByEffectType(Effect.EFFECT_TYPE_HAIR_NORMAL);
    ArrayList<Effect> hairGradientEffects = EffectEnum.getEffectsByEffectType(Effect.EFFECT_TYPE_HAIR_GRADIENT);
    mHairGradientCount = hairGradientEffects.size() - 1;
    mEffects = new ArrayList<>(mHairGradientCount + hairEffects.size());
    mEffects.addAll(hairGradientEffects);
    hairEffects.remove(0);
    mEffects.addAll(hairEffects);
}
 
Example #5
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 #6
Source File: MultiImagePickerFragment.java    From YImagePicker with Apache License 2.0 6 votes vote down vote up
/**
 * 初始化相关adapter
 */
private void initAdapters() {
    mFolderListRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    mImageSetAdapter = new PickerFolderAdapter(presenter, uiConfig);
    mFolderListRecyclerView.setAdapter(mImageSetAdapter);
    mImageSetAdapter.refreshData(imageSets);

    mAdapter = new PickerItemAdapter(selectList, new ArrayList<ImageItem>(), selectConfig, presenter, uiConfig);
    mAdapter.setHasStableIds(true);
    mAdapter.setOnActionResult(this);
    layoutManager = new GridLayoutManager(mContext, selectConfig.getColumnCount());
    if (mRecyclerView.getItemAnimator() instanceof SimpleItemAnimator) {
        ((SimpleItemAnimator) mRecyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
        mRecyclerView.getItemAnimator().setChangeDuration(0);// 通过设置动画执行时间为0来解决闪烁问题
    }
    mRecyclerView.setLayoutManager(layoutManager);
    mRecyclerView.setAdapter(mAdapter);
}
 
Example #7
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 #8
Source File: FUEffectFrag.java    From sealrtc-android with MIT License 6 votes vote down vote up
@Override
protected View onInflateView(
        LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.layout_fu_effect, container, false);

    RecyclerView recyclerView = view.findViewById(R.id.fu_effect_recycler);
    recyclerView.setLayoutManager(
            new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false));
    recyclerView.setHasFixedSize(true);
    recyclerView.setAdapter(
            mEffectRecyclerAdapter =
                    new EffectRecyclerAdapter(
                            getActivity(), Effect.EFFECT_TYPE_NORMAL, mFUControlListener));
    ((SimpleItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
    mEffectRecyclerAdapter.setOnDescriptionChangeListener(
            new EffectRecyclerAdapter.OnDescriptionChangeListener() {
                @Override
                public void onDescriptionChangeListener(Effect click) {
                    mCurrentEffect = click;
                    //                showDescription(click.description());
                }
            });
    return view;
}
 
Example #9
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 #10
Source File: AppleCalendarActivity.java    From CalendarSelector with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_apple_calendar);
    setTitle("2016");
    rvCalendar = (RecyclerView) findViewById(R.id.rvCalendar);
    rvCalendar.setLayoutManager(new LinearLayoutManager(this));
    ((SimpleItemAnimator) rvCalendar.getItemAnimator()).setSupportsChangeAnimations(false);
    List<SCMonth> months = SCDateUtils.generateMonths(2016, 2016);
    rvCalendar.setAdapter(new CalendarAdpater(months));
    selector = new CalendarSelector(months, SingleMonthSelector.SEGMENT);
    selector.setSegmentSelectListener(new SegmentSelectListener() {
        @Override
        public void onSegmentSelect(FullDay startDay, FullDay endDay) {
            // TODO
        }
    });
}
 
Example #11
Source File: AlbumAdapter.java    From Camera-Roll-Android-App with Apache License 2.0 5 votes vote down vote up
public AlbumAdapter(SelectorModeManager.Callback callback, final RecyclerView recyclerView,
                    final Album album, boolean pick_photos) {
    super(pick_photos);

    setData(album);
    setSelectorModeManager(new SelectorModeManager());
    if (callback != null) {
        getSelectorManager().addCallback(callback);
    }

    if (pick_photos) {
        getSelectorManager().setSelectorMode(true);
        if (callback != null) {
            callback.onSelectorModeEnter();
        }
    }

    //disable default change animation
    ((SimpleItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);

    if (callback != null && dragSelectEnabled()) {
        dragSelectTouchListener = new DragSelectTouchListener()
                .withSelectListener(new DragSelectTouchListener.OnDragSelectListener() {
                    @Override
                    public void onSelectChange(int start, int end, boolean isSelected) {
                        for (int i = start; i <= end; i++) {
                            getSelectorManager().onItemSelect(getData()
                                    .getAlbumItems().get(i).getPath());
                            //update ViewHolder
                            notifyItemChanged(i);
                        }
                    }
                });
        recyclerView.addOnItemTouchListener(dragSelectTouchListener);
    }
}
 
Example #12
Source File: DownloadsFragment.java    From OneTapVideoDownload with GNU General Public License v3.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    View rootView = inflater.inflate(R.layout.fragment_downloads, container, false);
    mRecyclerView = (RecyclerView) rootView.findViewById(R.id.downloadRecyclerView);
    ((SimpleItemAnimator) mRecyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
    LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
    layoutManager.setReverseLayout(true);
    layoutManager.setStackFromEnd(true);
    mRecyclerView.setLayoutManager(layoutManager);
    mRecyclerView.setHasFixedSize(true);

    mDownloadAdapter = new DownloadAdapter(getActivity());
    mRecyclerView.setAdapter(mDownloadAdapter);
    mEmptyView = rootView.findViewById(R.id.empty_view);
    FloatingActionButton usageInstructionButton = (FloatingActionButton)rootView.findViewById(R.id.usage_instruction_button);
    usageInstructionButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent usageInstructionIntent = new Intent(getActivity(), UsageInstruction.class);
            startActivity(usageInstructionIntent);
        }
    });

    return rootView;
}
 
Example #13
Source File: CalendarSelectorActivity.java    From CalendarSelector with Apache License 2.0 5 votes vote down vote up
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_scrolling);
        if(savedInstanceState != null)
            selector = savedInstanceState.getParcelable("selector");
        rvCalendar = (RecyclerView) findViewById(R.id.rvCalendar);
        rvCalendar.setLayoutManager(new LinearLayoutManager(this));
        ((SimpleItemAnimator) rvCalendar.getItemAnimator()).setSupportsChangeAnimations(false);
        data = getData();
        segmentMode();
//        intervalMode();
    }
 
Example #14
Source File: ProfileActivity.java    From social-app-android with Apache License 2.0 5 votes vote down vote up
private void loadPostsList() {
    if (recyclerView == null) {

        recyclerView = findViewById(R.id.recycler_view);
        postsAdapter = new PostsByUserAdapter(this, userID);
        postsAdapter.setCallBack(new PostsByUserAdapter.CallBack() {
            @Override
            public void onItemClick(final Post post, final View view) {
                presenter.onPostClick(post, view);
            }

            @Override
            public void onPostsListChanged(int postsCount) {
                presenter.onPostListChanged(postsCount);
            }

            @Override
            public void onPostLoadingCanceled() {
                hideLoadingPostsProgress();
            }
        });

        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        ((SimpleItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
        recyclerView.setAdapter(postsAdapter);
        postsAdapter.loadPosts();
    }
}
 
Example #15
Source File: SimpleRecyclerView.java    From SimpleRecyclerView with Apache License 2.0 5 votes vote down vote up
private void disableChangeAnimations() {
  ItemAnimator animator = getItemAnimator();
  if (animator instanceof SimpleItemAnimator) {
    ((SimpleItemAnimator) animator).setSupportsChangeAnimations(false);
  }

  // todo temp fix: load more doesn't work good with grid layout mode
  setItemAnimator(null);
}
 
Example #16
Source File: AnimCalendarSelectorActivity.java    From CalendarSelector with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_scrolling);
    if(savedInstanceState != null)
        selector = savedInstanceState.getParcelable("selector");
    rvCalendar = (RecyclerView) findViewById(R.id.rvCalendar);
    rvCalendar.setLayoutManager(new LinearLayoutManager(this));
    ((SimpleItemAnimator) rvCalendar.getItemAnimator()).setSupportsChangeAnimations(false);
    data = getData();
    segmentMode();
}
 
Example #17
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 #18
Source File: RecyclerViewUtil.java    From NIM_Android_UIKit with MIT License 5 votes vote down vote up
public static void changeItemAnimation(RecyclerView recyclerView, boolean isOpen) {
    // 关闭viewholder动画效果。解决viewholder闪烁问题
    RecyclerView.ItemAnimator animator = recyclerView.getItemAnimator();
    if (animator instanceof SimpleItemAnimator) {
        ((SimpleItemAnimator) animator).setSupportsChangeAnimations(isOpen);
    }
}
 
Example #19
Source File: MainActivity.java    From PlayStoreParallelDownload with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
    LinearLayoutManager llm = new LinearLayoutManager(this);
    recyclerView.setLayoutManager(llm);
    ((SimpleItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);

    String jsonObject = loadJSONFromAsset();
    parseJson(jsonObject);

}
 
Example #20
Source File: BeautyControlView.java    From PLDroidShortVideo with Apache License 2.0 5 votes vote down vote up
private void initHahaMirror() {
    mRvHahaMirror = findViewById(R.id.rv_effect_haha_mirror);
    mRvHahaMirror.setLayoutManager(new GridLayoutManager(mContext, 5));
    mRvHahaMirror.setHasFixedSize(true);
    EffectRecyclerAdapter hahaMirrorAdapter = new EffectRecyclerAdapter(mContext, Effect.EFFECT_TYPE_FACE_WARP);
    hahaMirrorAdapter.setOnEffectSelectListener(mOnEffectSelectListener);
    hahaMirrorAdapter.setOnDescriptionChangeListener(mOnDescriptionChangeListener);
    mRvHahaMirror.setAdapter(hahaMirrorAdapter);
    ((SimpleItemAnimator) mRvHahaMirror.getItemAnimator()).setSupportsChangeAnimations(false);
}
 
Example #21
Source File: BeautyControlView.java    From PLDroidShortVideo with Apache License 2.0 5 votes vote down vote up
private void initPortraitDrive() {
    mRvPortraitDrive = findViewById(R.id.rv_effect_portrait_drive);
    mRvPortraitDrive.setLayoutManager(new GridLayoutManager(mContext, 5));
    mRvPortraitDrive.setHasFixedSize(true);
    EffectRecyclerAdapter portraitDriveAdapter = new EffectRecyclerAdapter(mContext, Effect.EFFECT_TYPE_PORTRAIT_DRIVE);
    portraitDriveAdapter.setOnEffectSelectListener(mOnEffectSelectListener);
    portraitDriveAdapter.setOnDescriptionChangeListener(mOnDescriptionChangeListener);
    mRvPortraitDrive.setAdapter(portraitDriveAdapter);
    ((SimpleItemAnimator) mRvPortraitDrive.getItemAnimator()).setSupportsChangeAnimations(false);
}
 
Example #22
Source File: BeautyControlView.java    From PLDroidShortVideo with Apache License 2.0 5 votes vote down vote up
private void initBackground() {
    mRvBackground = findViewById(R.id.rv_effect_background);
    mRvBackground.setLayoutManager(new GridLayoutManager(mContext, 5));
    mRvBackground.setHasFixedSize(true);
    EffectRecyclerAdapter backgroundAdapter = new EffectRecyclerAdapter(mContext, Effect.EFFECT_TYPE_BACKGROUND);
    backgroundAdapter.setOnEffectSelectListener(mOnEffectSelectListener);
    backgroundAdapter.setOnDescriptionChangeListener(mOnDescriptionChangeListener);
    mRvBackground.setAdapter(backgroundAdapter);
    ((SimpleItemAnimator) mRvBackground.getItemAnimator()).setSupportsChangeAnimations(false);
}
 
Example #23
Source File: BeautyControlView.java    From PLDroidShortVideo with Apache License 2.0 5 votes vote down vote up
private void initMakeupView() {
    mRvMakeupItems = (RecyclerView) findViewById(R.id.rv_face_makeup);
    mRvMakeupItems.setHasFixedSize(true);
    ((SimpleItemAnimator) mRvMakeupItems.getItemAnimator()).setSupportsChangeAnimations(false);
    mRvMakeupItems.setLayoutManager(new GridLayoutManager(mContext, 5));
    mRvMakeupItems.addItemDecoration(new VHSpaceItemDecoration(0, getResources().getDimensionPixelSize(R.dimen.x15)));
    mFaceMakeupAdapter = new FaceMakeupAdapter(FaceMakeupEnum.getBeautyFaceMakeup());
    OnFaceMakeupClickListener onMpItemClickListener = new OnFaceMakeupClickListener();
    mFaceMakeupAdapter.setOnItemClickListener(onMpItemClickListener);
    mRvMakeupItems.setAdapter(mFaceMakeupAdapter);
    mFaceMakeupAdapter.setItemSelected(0);
}
 
Example #24
Source File: X8AiLineFavoritesFragment.java    From FimiX8-RE with MIT License 5 votes vote down vote up
@Nullable
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
    if (this.rootView == null) {
        this.rootView = inflater.inflate(R.layout.x8_fragment_ai_line_history, container, false);
        this.mRecyclerView = (RecyclerView) this.rootView.findViewById(R.id.recycleview);
        this.list = X8AiLinePointInfoHelper.getIntance().getLastItem(GlobalConfig.getInstance().getMapType() == MapType.AMap ? 1 : 0, true, 20);
        this.mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
        ((SimpleItemAnimator) this.mRecyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
        this.mX8AiLineHistoryAdapter2 = new X8AiLineHistoryAdapter2(getContext(), this.list, 1);
        this.mX8AiLineHistoryAdapter2.setOnX8AiLineSelectListener(this.mX8AiLineSelectListener);
        this.mRecyclerView.setAdapter(this.mX8AiLineHistoryAdapter2);
    }
    return this.rootView;
}
 
Example #25
Source File: X8MediaBaseFragment.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void initData() {
    setClickEnable(this.lbBottomDelect, false);
    setClickEnable(this.lbBottomDownload, false);
    this.panelRecycleAdapter = new X8sPanelRecycleAdapter((Context) this.contextWeakReference.get(), this.isCamera, this);
    if (this.contextWeakReference.get() != null) {
        this.mRecyclerView.setLayoutManager(new MyGridLayoutManager((Context) this.contextWeakReference.get(), 4));
    }
    ((SimpleItemAnimator) this.mRecyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
    this.mRecyclerView.setAdapter(this.panelRecycleAdapter);
    this.mRecyclerView.setOverScrollMode(2);
    this.mRecyclerView.addItemDecoration(new RBaseItemDecoration((Context) this.contextWeakReference.get(), SizeTool.pixToDp(2.5f, (Context) this.contextWeakReference.get()), 17170445));
    this.mRecyclerView.getItemAnimator().setChangeDuration(0);
    initPresenter();
}
 
Example #26
Source File: X8BlackBoxController.java    From FimiX8-RE with MIT License 5 votes vote down vote up
private void initView(View contentView) {
    this.imgReturn = (ImageView) contentView.findViewById(R.id.img_return);
    this.imgDelete = (ImageView) contentView.findViewById(R.id.img_delete);
    this.btnUploadToggle = (Button) contentView.findViewById(R.id.btn_upload_toggle);
    this.tvNoFiles = (TextView) contentView.findViewById(R.id.tv_no_files);
    this.imgDelete.setEnabled(false);
    this.btnUploadToggle.setEnabled(false);
    RecyclerView recyclerView = (RecyclerView) contentView.findViewById(R.id.ryv_black_box);
    recyclerView.setLayoutManager(new LinearLayoutManager(contentView.getContext()));
    ((SimpleItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
    recyclerView.setAdapter(this.mX8B2oxAdapter);
}
 
Example #27
Source File: PuzzleSelectorActivity.java    From imsdk-android with MIT License 5 votes vote down vote up
private void initPhotos() {
    rvPhotos = (RecyclerView) findViewById(R.id.rv_photos);
    ((SimpleItemAnimator) rvPhotos.getItemAnimator()).setSupportsChangeAnimations(false);//去除item更新的闪光

    photoList.addAll(albumModel.getCurrAlbumItemPhotos(0));
    photosAdapter = new PuzzleSelectorAdapter(this, photoList, this);

    int columns = getResources().getInteger(R.integer.photos_columns_easy_photos);

    GridLayoutManager gridLayoutManager = new GridLayoutManager(this, columns);
    rvPhotos.setLayoutManager(gridLayoutManager);
    rvPhotos.setAdapter(photosAdapter);
}
 
Example #28
Source File: ProfileActivity.java    From social-app-android with Apache License 2.0 5 votes vote down vote up
private void loadPostsList() {
    if (recyclerView == null) {

        recyclerView = findViewById(R.id.recycler_view);
        postsAdapter = new PostsByUserAdapter(this, userID);
        postsAdapter.setCallBack(new PostsByUserAdapter.CallBack() {
            @Override
            public void onItemClick(final Post post, final View view) {
                presenter.onPostClick(post, view);
            }

            @Override
            public void onPostsListChanged(int postsCount) {
                presenter.onPostListChanged(postsCount);
            }

            @Override
            public void onPostLoadingCanceled() {
                hideLoadingPostsProgress();
            }
        });

        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        ((SimpleItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
        recyclerView.setAdapter(postsAdapter);
        postsAdapter.loadPosts();
    }
}
 
Example #29
Source File: BeautyControlView.java    From sealrtc-android with MIT License 5 votes vote down vote up
private void initViewFilterRecycler() {
    mFilterRecyclerView = findViewById(R.id.filter_recycle_view);
    mFilterRecyclerView.setLayoutManager(
            new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
    mFilterRecyclerView.setAdapter(mFilterRecyclerAdapter = new FilterRecyclerAdapter());
    ((SimpleItemAnimator) mFilterRecyclerView.getItemAnimator())
            .setSupportsChangeAnimations(false);
}
 
Example #30
Source File: WalletFragment.java    From alpha-wallet-android with MIT License 5 votes vote down vote up
private void initList() {
    adapter = new TokensAdapter(this, viewModel.getAssetDefinitionService(), viewModel.getTokensService(), getContext());
    adapter.setHasStableIds(true);
    setLinearLayoutManager(TAB_ALL);
    recyclerView.setAdapter(adapter);
    if (recyclerView.getItemAnimator() != null)
        ((SimpleItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);

    ItemTouchHelper itemTouchHelper = new ItemTouchHelper(new SwipeCallback(adapter));
    itemTouchHelper.attachToRecyclerView(recyclerView);

    refreshLayout.setOnRefreshListener(this::refreshList);
}