Search in sources :

Example 1 with OnUpcomingEventClickedListener

use of com.alexstyl.specialdates.upcoming.view.OnUpcomingEventClickedListener in project Memento-Calendar by alexstyl.

the class UpcomingEventsFragment method onCreateView.

@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.fragment_upcoming_events, container, false);
    root = Views.findById(view, R.id.root);
    progressBar = Views.findById(view, R.id.upcoming_events_progress);
    emptyView = Views.findById(view, R.id.upcoming_events_emptyview);
    upcomingList = Views.findById(view, R.id.upcoming_events_list);
    upcomingList.setHasFixedSize(true);
    upcomingList.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
    upcomingList.addItemDecoration(new UpcomingEventsDecorator(getResources().getDimensionPixelSize(R.dimen.upcoming_event_header_vertical_spacing), getResources().getDimensionPixelSize(R.dimen.upcoming_event_vertical_spacing)));
    adapter = new UpcomingEventsAdapter(new UpcomingViewHolderFactory(inflater, imageLoader), new OnUpcomingEventClickedListener() {

        @Override
        public void onContactClicked(Contact contact) {
            navigator.toContactDetails(contact, getActivity());
        }

        @Override
        public void onNamedayClicked(Date date) {
            navigator.toDateDetails(date, getActivity());
        }
    });
    adapter.setHasStableIds(true);
    upcomingList.setAdapter(adapter);
    return view;
}
Also used : OnUpcomingEventClickedListener(com.alexstyl.specialdates.upcoming.view.OnUpcomingEventClickedListener) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) UpcomingEventsView(com.alexstyl.specialdates.UpcomingEventsView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) Date(com.alexstyl.specialdates.date.Date) Contact(com.alexstyl.specialdates.contact.Contact)

Aggregations

LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 TextView (android.widget.TextView)1 UpcomingEventsView (com.alexstyl.specialdates.UpcomingEventsView)1 Contact (com.alexstyl.specialdates.contact.Contact)1 Date (com.alexstyl.specialdates.date.Date)1 OnUpcomingEventClickedListener (com.alexstyl.specialdates.upcoming.view.OnUpcomingEventClickedListener)1