Search in sources :

Example 6 with DefaultItemAnimator

use of android.support.v7.widget.DefaultItemAnimator in project Signal-Android by WhisperSystems.

the class GiphyFragment method onActivityCreated.

@Override
public void onActivityCreated(Bundle bundle) {
    super.onActivityCreated(bundle);
    this.giphyAdapter = new GiphyAdapter(getActivity(), new LinkedList<GiphyImage>());
    this.giphyAdapter.setListener(this);
    this.recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    this.recyclerView.setItemAnimator(new DefaultItemAnimator());
    this.recyclerView.setAdapter(giphyAdapter);
    this.recyclerView.addOnScrollListener(new GiphyScrollListener());
    getLoaderManager().initLoader(0, null, this);
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) LinkedList(java.util.LinkedList) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Example 7 with DefaultItemAnimator

use of android.support.v7.widget.DefaultItemAnimator in project FastDev4Android by jiangqqlmj.

the class RecyclerViewTestActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.recyclerview_test_layout);
    top_bar_linear_back = (LinearLayout) this.findViewById(R.id.top_bar_linear_back);
    btn_add = (Button) this.findViewById(R.id.btn_add);
    btn_delete = (Button) this.findViewById(R.id.btn_delete);
    top_bar_linear_back.setOnClickListener(new CustomOnClickListener());
    btn_add.setOnClickListener(new CustomOnClickListener());
    btn_delete.setOnClickListener(new CustomOnClickListener());
    top_bar_title = (TextView) this.findViewById(R.id.top_bar_title);
    top_bar_title.setText("RecyclerView使用实例");
    //开始设置RecyclerView
    recyclerView_one = (RecyclerView) this.findViewById(R.id.recyclerView_one);
    recyclerView_one.setHasFixedSize(true);
    //1.LinearLayoutManager 线性布局类型
    mLayoutManager = new LinearLayoutManager(this);
    mLayoutManager.setOrientation(OrientationHelper.VERTICAL);
    recyclerView_one.setLayoutManager(mLayoutManager);
    //2.GridLayoutManager 表格布局类型
    //        GridLayoutManager girdLayoutManager=new GridLayoutManager(this,4);
    //        recyclerView_one.setLayoutManager(girdLayoutManager);
    //3.采用StaggeredGridLayoutManager  流式布局类型
    //        StaggeredGridLayoutManager staggeredGridLayoutManager=new StaggeredGridLayoutManager(2,OrientationHelper.VERTICAL);
    //        recyclerView_one.setLayoutManager(staggeredGridLayoutManager);
    //添加默认的动画效果
    recyclerView_one.setItemAnimator(new DefaultItemAnimator());
    //添加分隔线
    recyclerView_one.addItemDecoration(new AdvanceDecoration(this, OrientationHelper.VERTICAL));
    mAdapter = new TestRecyclerAdapter(this, new TestRecyclerAdapter.OnRecyclerItemClickListener() {

        @Override
        public void onItemClick(View view, int position) {
            Toast.makeText(RecyclerViewTestActivity.this, "点击了第" + position + "项", Toast.LENGTH_SHORT).show();
        }
    });
    recyclerView_one.setAdapter(mAdapter);
}
Also used : AdvanceDecoration(com.chinaztt.fda.widget.AdvanceDecoration) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator) TestRecyclerAdapter(com.chinaztt.fda.adapter.TestRecyclerAdapter)

Example 8 with DefaultItemAnimator

use of android.support.v7.widget.DefaultItemAnimator in project FastDev4Android by jiangqqlmj.

the class RecyclerGalleryActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.recycler_gallery_layout);
    top_bar_linear_back = (LinearLayout) this.findViewById(R.id.top_bar_linear_back);
    btn_add = (Button) this.findViewById(R.id.btn_add);
    btn_delete = (Button) this.findViewById(R.id.btn_delete);
    top_bar_linear_back.setOnClickListener(new CustomOnClickListener());
    btn_add.setOnClickListener(new CustomOnClickListener());
    btn_delete.setOnClickListener(new CustomOnClickListener());
    top_bar_title = (TextView) this.findViewById(R.id.top_bar_title);
    top_bar_title.setText("RecyclerView打造Gallery效果");
    //初始化RecyclerView控件
    gallery_recycler = (RecyclerView) this.findViewById(R.id.gallery_recycler);
    //固定高度
    gallery_recycler.setHasFixedSize(true);
    //创建布局管理器
    LinearLayoutManager linearLayoutManager = new CustomLinearLayoutManager(this);
    //设置横向
    linearLayoutManager.setOrientation(OrientationHelper.HORIZONTAL);
    //设置布局管理器
    gallery_recycler.setLayoutManager(linearLayoutManager);
    //设置分割线
    gallery_recycler.addItemDecoration(new TestDecoration(this));
    //设置动画
    gallery_recycler.setItemAnimator(new DefaultItemAnimator());
    //创建适配器
    adapter = new GalleryRecyclerAdapter(this);
    //绑定适配器
    gallery_recycler.setAdapter(adapter);
    adapter.setOnRecyclerViewItemClickListener(new GalleryRecyclerAdapter.OnRecyclerViewItemClickListener() {

        @Override
        public void onItemClick(View view, int position) {
            Toast.makeText(RecyclerGalleryActivity.this, "您点击的Item的索引为:" + position, Toast.LENGTH_SHORT).show();
        }
    });
}
Also used : CustomLinearLayoutManager(com.chinaztt.fda.widget.CustomLinearLayoutManager) GalleryRecyclerAdapter(com.chinaztt.fda.adapter.GalleryRecyclerAdapter) TestDecoration(com.chinaztt.fda.widget.TestDecoration) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) CustomLinearLayoutManager(com.chinaztt.fda.widget.CustomLinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Example 9 with DefaultItemAnimator

use of android.support.v7.widget.DefaultItemAnimator in project okhttp-OkGo by jeasonlzy.

the class OkHttpActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_recycler);
    initToolBar(toolbar, true, "OkGo功能介绍");
    initData();
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.addItemDecoration(new DividerItemDecoration(this, LinearLayoutManager.VERTICAL));
    recyclerView.setAdapter(new MainAdapter(this));
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(com.lzy.demo.base.DividerItemDecoration) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Example 10 with DefaultItemAnimator

use of android.support.v7.widget.DefaultItemAnimator in project okhttp-OkGo by jeasonlzy.

the class RxActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_recycler);
    initToolBar(toolbar, true, "OkRx使用示例");
    initData();
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.addItemDecoration(new DividerItemDecoration(this, LinearLayoutManager.VERTICAL));
    recyclerView.setAdapter(new RxActivity.MainAdapter(this));
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(com.lzy.demo.base.DividerItemDecoration) 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