Search in sources :

Example 46 with DividerItemDecoration

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

the class RecyclerViewFragment method initView.

private void initView() {
    mContext = getActivity();
    mRecyclerView = (RecyclerView) mView.findViewById(R.id.id_recyclerview);
    mList = new ArrayList<String>();
    for (int i = 0; i < 50; i++) {
        mList.add(i + "");
    }
    mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    mRecyclerView.setAdapter(new MyAdapter(getActivity(), mList));
    mRecyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST));
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(com.zhy.sample.view.DividerItemDecoration)

Example 47 with DividerItemDecoration

use of android.support.v7.widget.DividerItemDecoration in project ListenerMusicPlayer by hefuyicoder.

the class AlbumDetailFragment method onViewCreated.

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ButterKnife.bind(this, view);
    ATE.apply(this, ATEUtil.getATEKey(context));
    if (getArguments().getBoolean("transition")) {
        albumArt.setTransitionName(getArguments().getString("transition_name"));
    }
    recyclerView.setAdapter(mAdapter);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST, false));
    setupToolbar();
    mPresenter.subscribe(albumID);
    subscribeMetaChangedEvent();
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(io.hefuyi.listener.widget.DividerItemDecoration) TargetApi(android.annotation.TargetApi)

Example 48 with DividerItemDecoration

use of android.support.v7.widget.DividerItemDecoration in project ListenerMusicPlayer by hefuyicoder.

the class FolderSongsFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ATE.apply(this, ATEUtil.getATEKey(getActivity()));
    if (Build.VERSION.SDK_INT < 21 && view.findViewById(R.id.status_bar) != null) {
        view.findViewById(R.id.status_bar).setVisibility(View.GONE);
        if (Build.VERSION.SDK_INT >= 19) {
            int statusBarHeight = DensityUtil.getStatusBarHeight(getContext());
            view.findViewById(R.id.toolbar).setPadding(0, statusBarHeight, 0, 0);
        }
    }
    ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
    final ActionBar ab = ((AppCompatActivity) getActivity()).getSupportActionBar();
    ab.setDisplayHomeAsUpEnabled(true);
    ab.setTitle(R.string.folders);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    recyclerView.setAdapter(mAdapter);
    recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST, true));
    mPresenter.loadSongs(path);
    subscribeMetaChangedEvent();
}
Also used : AppCompatActivity(android.support.v7.app.AppCompatActivity) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(io.hefuyi.listener.widget.DividerItemDecoration) ActionBar(android.support.v7.app.ActionBar)

Example 49 with DividerItemDecoration

use of android.support.v7.widget.DividerItemDecoration in project UltimateAndroid by cymcsg.

the class LayoutFragment method onViewCreated.

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    final Activity activity = getActivity();
    mToast = Toast.makeText(activity, "", Toast.LENGTH_SHORT);
    mToast.setGravity(Gravity.CENTER, 0, 0);
    mRecyclerView = (TwoWayView) view.findViewById(R.id.list);
    mRecyclerView.setHasFixedSize(true);
    mRecyclerView.setLongClickable(true);
    mPositionText = (TextView) view.getRootView().findViewById(R.id.position);
    mCountText = (TextView) view.getRootView().findViewById(R.id.count);
    mStateText = (TextView) view.getRootView().findViewById(R.id.state);
    updateState(SCROLL_STATE_IDLE);
    final ItemClickSupport itemClick = ItemClickSupport.addTo(mRecyclerView);
    itemClick.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(RecyclerView parent, View child, int position, long id) {
            mToast.setText("Item clicked: " + position);
            mToast.show();
        }
    });
    itemClick.setOnItemLongClickListener(new OnItemLongClickListener() {

        @Override
        public boolean onItemLongClick(RecyclerView parent, View child, int position, long id) {
            mToast.setText("Item long pressed: " + position);
            mToast.show();
            return true;
        }
    });
    mRecyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() {

        @Override
        public void onScrollStateChanged(RecyclerView recyclerView, int scrollState) {
            updateState(scrollState);
        }

        @Override
        public void onScrolled(RecyclerView recyclerView, int i, int i2) {
            mPositionText.setText("First: " + mRecyclerView.getFirstVisiblePosition());
            mCountText.setText("Count: " + mRecyclerView.getChildCount());
        }
    });
    final Drawable divider = getResources().getDrawable(R.drawable.two_way_view_divider);
    mRecyclerView.addItemDecoration(new DividerItemDecoration(divider));
    mRecyclerView.setAdapter(new LayoutAdapter(activity, mRecyclerView, mLayoutId));
}
Also used : OnItemClickListener(com.marshalchen.common.uimodule.twowayview.ItemClickSupport.OnItemClickListener) Drawable(android.graphics.drawable.Drawable) Activity(android.app.Activity) DividerItemDecoration(com.marshalchen.common.uimodule.twowayview.widget.DividerItemDecoration) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) TwoWayView(com.marshalchen.common.uimodule.twowayview.widget.TwoWayView) OnItemLongClickListener(com.marshalchen.common.uimodule.twowayview.ItemClickSupport.OnItemLongClickListener) RecyclerView(android.support.v7.widget.RecyclerView) ItemClickSupport(com.marshalchen.common.uimodule.twowayview.ItemClickSupport)

Example 50 with DividerItemDecoration

use of android.support.v7.widget.DividerItemDecoration in project AndroidSwipeLayout by daimajia.

the class RecyclerViewExample method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.recyclerview);
    recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        ActionBar actionBar = getActionBar();
        if (actionBar != null) {
            actionBar.setTitle("RecyclerView");
        }
    }
    // Layout Managers:
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    // Item Decorator:
    recyclerView.addItemDecoration(new DividerItemDecoration(getResources().getDrawable(R.drawable.divider)));
    recyclerView.setItemAnimator(new FadeInLeftAnimator());
    // Adapter:
    String[] adapterData = new String[] { "Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming" };
    mDataSet = new ArrayList<String>(Arrays.asList(adapterData));
    mAdapter = new RecyclerViewAdapter(this, mDataSet);
    ((RecyclerViewAdapter) mAdapter).setMode(Attributes.Mode.Single);
    recyclerView.setAdapter(mAdapter);
    /* Listeners */
    recyclerView.setOnScrollListener(onScrollListener);
}
Also used : FadeInLeftAnimator(jp.wasabeef.recyclerview.animators.FadeInLeftAnimator) RecyclerViewAdapter(com.daimajia.swipedemo.adapter.RecyclerViewAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(com.daimajia.swipedemo.adapter.util.DividerItemDecoration) ActionBar(android.app.ActionBar)

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