Search in sources :

Example 1 with DividerDecoration

use of com.google.samples.apps.iosched.schedule.DividerDecoration in project iosched by google.

the class MyIOFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mLoadingSwitcher = (ViewSwitcher) view.findViewById(R.id.loading_switcher);
    mLoadingView = (LottieAnimationView) view.findViewById(R.id.loading_anim);
    mRecyclerView = (RecyclerView) view.findViewById(android.R.id.list);
    mRecyclerView.addItemDecoration(new DividerDecoration(getContext()));
    mAdapter = new MyIOAdapter(getContext(), this);
    mRecyclerView.setAdapter(mAdapter);
    mRecyclerView.setLayoutManager(new StickyHeadersLinearLayoutManager<MyIOAdapter>(getContext()));
    mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {

        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            mScrolled = true;
            recyclerView.removeOnScrollListener(this);
        }
    });
    View header = view.findViewById(R.id.header_anim);
    if (header instanceof ImageView) {
        AnimatedVectorDrawable avd = (AnimatedVectorDrawable) ContextCompat.getDrawable(getContext(), R.drawable.avd_header_my_io);
        ((ImageView) header).setImageDrawable(avd);
        avd.start();
    }
}
Also used : DividerDecoration(com.google.samples.apps.iosched.schedule.DividerDecoration) RecyclerView(android.support.v7.widget.RecyclerView) ImageView(android.widget.ImageView) LottieAnimationView(com.airbnb.lottie.LottieAnimationView) ImageView(android.widget.ImageView) View(android.view.View) MyIoView(com.google.samples.apps.iosched.myio.MyIOContract.MyIoView) RecyclerView(android.support.v7.widget.RecyclerView) AnimatedVectorDrawable(android.graphics.drawable.AnimatedVectorDrawable)

Aggregations

AnimatedVectorDrawable (android.graphics.drawable.AnimatedVectorDrawable)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 LottieAnimationView (com.airbnb.lottie.LottieAnimationView)1 MyIoView (com.google.samples.apps.iosched.myio.MyIOContract.MyIoView)1 DividerDecoration (com.google.samples.apps.iosched.schedule.DividerDecoration)1