Search in sources :

Example 1 with DividerItemDecoration

use of com.jakewharton.u2020.ui.misc.DividerItemDecoration in project u2020 by JakeWharton.

the class TrendingView method onFinishInflate.

@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    ButterKnife.bind(this);
    AnimationDrawable ellipsis = (AnimationDrawable) ContextCompat.getDrawable(getContext(), R.drawable.dancing_ellipsis);
    loadingMessageView.setCompoundDrawablesWithIntrinsicBounds(null, null, ellipsis, null);
    ellipsis.start();
    toolbarView.setNavigationIcon(R.drawable.menu_icon);
    toolbarView.setNavigationOnClickListener(v -> drawerLayout.openDrawer(GravityCompat.START));
    timespanView.setAdapter(timespanAdapter);
    timespanView.setSelection(TrendingTimespan.WEEK.ordinal());
    swipeRefreshView.setColorSchemeResources(R.color.accent);
    swipeRefreshView.setOnRefreshListener(this);
    trendingAdapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {

        @Override
        public void onChanged() {
            animatorView.setDisplayedChildId(//
            trendingAdapter.getItemCount() == 0 ? //
            R.id.trending_empty : R.id.trending_swipe_refresh);
            swipeRefreshView.setRefreshing(false);
        }
    });
    trendingView.setLayoutManager(new LinearLayoutManager(getContext()));
    trendingView.addItemDecoration(new DividerItemDecoration(getContext(), VERTICAL_LIST, dividerPaddingStart, safeIsRtl()));
    trendingView.setAdapter(trendingAdapter);
}
Also used : AnimationDrawable(android.graphics.drawable.AnimationDrawable) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(com.jakewharton.u2020.ui.misc.DividerItemDecoration)

Aggregations

AnimationDrawable (android.graphics.drawable.AnimationDrawable)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 DividerItemDecoration (com.jakewharton.u2020.ui.misc.DividerItemDecoration)1