package net.squanchy.eventdetails.widget;

import android.content.Context;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.FloatingActionButton;
import android.util.AttributeSet;

import net.squanchy.R;
import net.squanchy.schedule.domain.view.Event;

public class EventDetailsCoordinatorLayout extends CoordinatorLayout {

    private FloatingActionButton floatingActionButton;
    private EventDetailsHeaderLayout headerLayout;
    private EventDetailsLayout detailsLayout;

    public EventDetailsCoordinatorLayout(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public EventDetailsCoordinatorLayout(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();

        floatingActionButton = (FloatingActionButton) findViewById(R.id.favorite_fab);
        headerLayout = (EventDetailsHeaderLayout) findViewById(R.id.event_details_header);
        detailsLayout = (EventDetailsLayout) findViewById(R.id.event_details);
    }

    public void updateWith(Event event) {
        headerLayout.updateWith(event);
        detailsLayout.updateWith(event);
    }
}

@@ -1254,21 +1254,225 @@
 With(event);
+%0A%0A        floatingActionButton.setImageResource(%0A                event.favorited() ?%0A                        R.drawable.ic_favorite_filled :%0A                        R.drawable.ic_favorite_empty%0A        );
 %0A    %7D%0A%7D%0A

Swap FAB icon based on favorite status