Search in sources :

Example 16 with DividerItemDecoration

use of android.support.v7.widget.DividerItemDecoration in project baseAdapter by hongyangAndroid.

the class RecyclerViewActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_recyclerview);
    initDatas();
    mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview);
    //        mRecyclerView.setHasFixedSize(true);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    mRecyclerView.setLayoutManager(new GridLayoutManager(this, 2));
    //        mRecyclerView.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL));
    mRecyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST));
    mAdapter = new CommonAdapter<String>(this, R.layout.item_list, mDatas) {

        @Override
        protected void convert(ViewHolder holder, String s, int position) {
            holder.setText(R.id.id_item_list_title, s + " : " + holder.getAdapterPosition() + " , " + holder.getLayoutPosition());
        }
    };
    initHeaderAndFooter();
    //        initEmptyView();
    mLoadMoreWrapper = new LoadMoreWrapper(mHeaderAndFooterWrapper);
    mLoadMoreWrapper.setLoadMoreView(R.layout.default_loading);
    mLoadMoreWrapper.setOnLoadMoreListener(new LoadMoreWrapper.OnLoadMoreListener() {

        @Override
        public void onLoadMoreRequested() {
            new Handler().postDelayed(new Runnable() {

                @Override
                public void run() {
                    for (int i = 0; i < 10; i++) {
                        mDatas.add("Add:" + i);
                    }
                    mLoadMoreWrapper.notifyDataSetChanged();
                }
            }, 3000);
        }
    });
    mRecyclerView.setAdapter(mLoadMoreWrapper);
    mAdapter.setOnItemClickListener(new CommonAdapter.OnItemClickListener() {

        @Override
        public void onItemClick(View view, RecyclerView.ViewHolder holder, int position) {
            Toast.makeText(RecyclerViewActivity.this, "pos = " + position, Toast.LENGTH_SHORT).show();
            mAdapter.notifyItemRemoved(position);
        }

        @Override
        public boolean onItemLongClick(View view, RecyclerView.ViewHolder holder, int position) {
            return false;
        }
    });
}
Also used : LoadMoreWrapper(com.zhy.adapter.recyclerview.wrapper.LoadMoreWrapper) Handler(android.os.Handler) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) CommonAdapter(com.zhy.adapter.recyclerview.CommonAdapter) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) GridLayoutManager(android.support.v7.widget.GridLayoutManager) StaggeredGridLayoutManager(android.support.v7.widget.StaggeredGridLayoutManager) ViewHolder(com.zhy.adapter.recyclerview.base.ViewHolder) RecyclerView(android.support.v7.widget.RecyclerView)

Example 17 with DividerItemDecoration

use of android.support.v7.widget.DividerItemDecoration 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 18 with DividerItemDecoration

use of android.support.v7.widget.DividerItemDecoration 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)

Example 19 with DividerItemDecoration

use of android.support.v7.widget.DividerItemDecoration in project Carbon by ZieIony.

the class IconTextListItemActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_listcomponent);
    Samples.initToolbar(this, getString(R.string.iconTextListItemActivity_title));
    RecyclerView recycler = (RecyclerView) findViewById(R.id.recycler);
    recycler.setLayoutManager(new LinearLayoutManager(this));
    RowListAdapter adapter = new RowListAdapter<>(DefaultIconTextItem.class, IconTextRow::new);
    adapter.addFactory(DefaultIconSearchItem.class, parent -> new IconSearchRow(parent, new ArraySearchDataProvider(new String[] {}), filterResults -> {
    }));
    recycler.setAdapter(adapter);
    DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(new ColorDrawable(Carbon.getThemeColor(this, R.attr.carbon_dividerColor)), getResources().getDimensionPixelSize(R.dimen.carbon_1dip));
    dividerItemDecoration.setDrawRules(position -> position == 0);
    recycler.addItemDecoration(dividerItemDecoration);
    VectorDrawable drawable = new VectorDrawable(getResources(), R.raw.ic_face_24px);
    adapter.setItems(Arrays.asList(new DefaultIconSearchItem(this), new DefaultIconTextItem(drawable, "text"), new DefaultIconTextItem(drawable, "text"), new DefaultIconTextItem(drawable, "text"), new DefaultIconTextItem(drawable, "text")));
}
Also used : Arrays(java.util.Arrays) Bundle(android.os.Bundle) IconSearchRow(carbon.component.IconSearchRow) DividerItemDecoration(carbon.recycler.DividerItemDecoration) IconTextRow(carbon.component.IconTextRow) ColorDrawable(android.graphics.drawable.ColorDrawable) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DefaultIconTextItem(carbon.component.DefaultIconTextItem) DefaultIconSearchItem(carbon.component.DefaultIconSearchItem) Carbon(carbon.Carbon) RecyclerView(carbon.widget.RecyclerView) SamplesActivity(tk.zielony.carbonsamples.SamplesActivity) VectorDrawable(carbon.drawable.VectorDrawable) R(tk.zielony.carbonsamples.R) RowListAdapter(carbon.recycler.RowListAdapter) Nullable(android.support.annotation.Nullable) ArraySearchDataProvider(carbon.widget.ArraySearchDataProvider) Samples(tk.zielony.carbonsamples.Samples) DefaultIconSearchItem(carbon.component.DefaultIconSearchItem) ColorDrawable(android.graphics.drawable.ColorDrawable) IconTextRow(carbon.component.IconTextRow) RowListAdapter(carbon.recycler.RowListAdapter) RecyclerView(carbon.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(carbon.recycler.DividerItemDecoration) DefaultIconTextItem(carbon.component.DefaultIconTextItem) IconSearchRow(carbon.component.IconSearchRow) VectorDrawable(carbon.drawable.VectorDrawable) ArraySearchDataProvider(carbon.widget.ArraySearchDataProvider)

Example 20 with DividerItemDecoration

use of android.support.v7.widget.DividerItemDecoration in project remusic by aa112901.

the class AlbumDetailFragment method onCreateView.

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_common, container, false);
    recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
    layoutManager = new LinearLayoutManager(mContext);
    recyclerView.setLayoutManager(layoutManager);
    mAdapter = new AlbumDetailAdapter(null);
    recyclerView.setAdapter(mAdapter);
    itemDecoration = new DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL_LIST);
    recyclerView.addItemDecoration(itemDecoration);
    recyclerView.setHasFixedSize(true);
    reloadAdapter();
    AlbumInfo albumInfo = MusicUtils.getAlbumInfo(mContext, albumID);
    Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
    toolbar.setPadding(0, CommonUtils.getStatusHeight(mContext), 0, 0);
    ((AppCompatActivity) mContext).setSupportActionBar(toolbar);
    ab = ((AppCompatActivity) mContext).getSupportActionBar();
    ab.setHomeAsUpIndicator(R.drawable.actionbar_back);
    ab.setDisplayHomeAsUpEnabled(true);
    ab.setTitle(albumInfo.album_name);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (getActivity() != null)
                getActivity().onBackPressed();
        }
    });
    return view;
}
Also used : AlbumInfo(com.wm.remusic.info.AlbumInfo) AppCompatActivity(android.support.v7.app.AppCompatActivity) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(com.wm.remusic.widget.DividerItemDecoration) ImageView(android.widget.ImageView) TintImageView(com.bilibili.magicasakura.widgets.TintImageView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)73 RecyclerView (android.support.v7.widget.RecyclerView)42 View (android.view.View)36 TextView (android.widget.TextView)23 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)19 DividerItemDecoration (android.support.v7.widget.DividerItemDecoration)15 ImageView (android.widget.ImageView)14 DividerItemDecoration (com.wm.remusic.widget.DividerItemDecoration)9 Drawable (android.graphics.drawable.Drawable)8 DividerItemDecoration (de.madcyph3r.example.DividerItemDecoration)8 DividerItemDecoration (io.hefuyi.listener.widget.DividerItemDecoration)7 Nullable (android.support.annotation.Nullable)6 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)6 Context (android.content.Context)5 Toolbar (android.support.v7.widget.Toolbar)5 Intent (android.content.Intent)4 ActionBar (android.support.v7.app.ActionBar)4 DividerItemDecoration (com.lzy.demo.base.DividerItemDecoration)4 DividerItemDecoration (org.michenux.drodrolib.ui.recyclerview.DividerItemDecoration)4 TargetApi (android.annotation.TargetApi)3