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));
}
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();
}
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();
}
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));
}
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);
}
Aggregations