Search in sources :

Example 96 with DefaultItemAnimator

use of android.support.v7.widget.DefaultItemAnimator in project CloudReader by youlookwhat.

the class SlideScrollViewActivity method initRecyclerView.

private void initRecyclerView() {
    rcvGoodsList.setVisibility(View.VISIBLE);
    final RCVListAdapter adapter = new RCVListAdapter(this);
    View header = new View(this);
    header.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    header.getLayoutParams().height = getResources().getDimensionPixelOffset(R.dimen.new_home_header_size) - getStatusBarHeight(this);
    adapter.setHeader(header);
    rcvGoodsList.setLayoutManager(new LinearLayoutManager(this));
    rcvGoodsList.setItemAnimator(new DefaultItemAnimator());
    rcvGoodsList.setAdapter(adapter);
    adapter.setDataSource(Arrays.asList("", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""));
    adapter.notifyDataSetChanged();
    rcvGoodsList.setOnScrollListener(new RecyclerView.OnScrollListener() {

        public int scrolledY = 0;

        @Override
        public void onScrolled(RecyclerView recyclerView, final int dx, final int dy) {
            super.onScrolled(recyclerView, dx, dy);
            scrolledY += dy;
            scrollChangeHeader(scrolledY);
        }
    });
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ImageView(android.widget.ImageView) DiscoverScrollView(com.example.jingbin.cloudreader.view.DiscoverScrollView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) RCVListAdapter(com.example.jingbin.cloudreader.view.test.RCVListAdapter) LinearLayout(android.widget.LinearLayout) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Example 97 with DefaultItemAnimator

use of android.support.v7.widget.DefaultItemAnimator in project CloudReader by youlookwhat.

the class EverydayFragment method initRecyclerView.

private void initRecyclerView() {
    bindingView.xrvEveryday.setPullRefreshEnabled(false);
    bindingView.xrvEveryday.setLoadingMoreEnabled(false);
    if (mHeaderView == null) {
        mHeaderView = mHeaderBinding.getRoot();
        bindingView.xrvEveryday.addHeaderView(mHeaderView);
    }
    if (mFooterView == null) {
        mFooterBinding = DataBindingUtil.inflate(LayoutInflater.from(getContext()), R.layout.footer_item_everyday, null, false);
        mFooterView = mFooterBinding.getRoot();
        bindingView.xrvEveryday.addFootView(mFooterView, true);
        bindingView.xrvEveryday.noMoreLoading();
    }
    bindingView.xrvEveryday.setLayoutManager(new LinearLayoutManager(getContext()));
    // 需加,不然滑动不流畅
    bindingView.xrvEveryday.setNestedScrollingEnabled(false);
    bindingView.xrvEveryday.setHasFixedSize(false);
    bindingView.xrvEveryday.setItemAnimator(new DefaultItemAnimator());
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Example 98 with DefaultItemAnimator

use of android.support.v7.widget.DefaultItemAnimator in project PhotoNoter by yydcdut.

the class MediaPhotoFragment method initUI.

@Override
public void initUI(View view) {
    ButterKnife.bind(this, view);
    mGalleryActivity = (GalleryActivity) getActivity();
    GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), 3);
    mRecyclerView.setLayoutManager(gridLayoutManager);
    mRecyclerView.setItemAnimator(new DefaultItemAnimator());
    mMediaPhotoPresenter.attachView(this);
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Example 99 with DefaultItemAnimator

use of android.support.v7.widget.DefaultItemAnimator in project SwipeRecyclerView by yanzhenjie.

the class RefreshLoadMoreActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_refresh_load_more);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    assert actionBar != null;
    actionBar.setDisplayHomeAsUpEnabled(true);
    mContext = this;
    mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_layout);
    mSwipeRefreshLayout.setOnRefreshListener(mOnRefreshListener);
    mDataList = new ArrayList<>();
    for (int i = 0; i < size; i++) {
        mDataList.add("我是第" + i + "个。");
    }
    mSwipeMenuRecyclerView = (SwipeMenuRecyclerView) findViewById(R.id.recycler_view);
    // 布局管理器。
    mSwipeMenuRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    // 如果Item够简单,高度是确定的,打开FixSize将提高性能。
    mSwipeMenuRecyclerView.setHasFixedSize(true);
    // 设置Item默认动画,加也行,不加也行。
    mSwipeMenuRecyclerView.setItemAnimator(new DefaultItemAnimator());
    // 添加分割线。
    mSwipeMenuRecyclerView.addItemDecoration(new ListViewDecoration());
    // 添加滚动监听。
    mSwipeMenuRecyclerView.addOnScrollListener(mOnScrollListener);
    // 为SwipeRecyclerView的Item创建菜单就两句话,不错就是这么简单:
    // 设置菜单创建器。
    mSwipeMenuRecyclerView.setSwipeMenuCreator(swipeMenuCreator);
    // 设置菜单Item点击监听。
    mSwipeMenuRecyclerView.setSwipeMenuItemClickListener(menuItemClickListener);
    mMenuAdapter = new MenuAdapter(mDataList);
    mMenuAdapter.setOnItemClickListener(onItemClickListener);
    mSwipeMenuRecyclerView.setAdapter(mMenuAdapter);
}
Also used : ListViewDecoration(com.yanzhenjie.swiperecyclerview.view.ListViewDecoration) MenuAdapter(com.yanzhenjie.swiperecyclerview.adapter.MenuAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ActionBar(android.support.v7.app.ActionBar) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator) Toolbar(android.support.v7.widget.Toolbar)

Example 100 with DefaultItemAnimator

use of android.support.v7.widget.DefaultItemAnimator in project PhotoNoter by yydcdut.

the class FilePhotoFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ButterKnife.bind(this, view);
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
    mRecyclerView.setLayoutManager(linearLayoutManager);
    mRecyclerView.setItemAnimator(new DefaultItemAnimator());
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Aggregations

DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)103 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)71 RecyclerView (android.support.v7.widget.RecyclerView)63 View (android.view.View)55 TextView (android.widget.TextView)30 ImageView (android.widget.ImageView)25 ArrayList (java.util.ArrayList)16 GridLayoutManager (android.support.v7.widget.GridLayoutManager)14 ClickItemTouchListener (com.sdsmdg.harjot.MusicDNA.clickitemtouchlistener.ClickItemTouchListener)14 Toolbar (android.support.v7.widget.Toolbar)13 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)10 FastAdapter (com.mikepenz.fastadapter.FastAdapter)10 UnifiedTrack (com.sdsmdg.harjot.MusicDNA.models.UnifiedTrack)10 MaterializeBuilder (com.mikepenz.materialize.MaterializeBuilder)9 ItemTouchHelper (android.support.v7.widget.helper.ItemTouchHelper)8 LocalTrack (com.sdsmdg.harjot.MusicDNA.models.LocalTrack)8 DividerItemDecoration (de.madcyph3r.example.DividerItemDecoration)8 Button (android.widget.Button)7 Random (java.util.Random)6 Intent (android.content.Intent)5