/*
 * Copyright (C) 2014 Pedro Vicente Gómez Sánchez.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.pedrogomez.renderers.ui.renderers;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.pedrogomez.renderers.R;
import com.pedrogomez.renderers.model.Video;

import java.util.Date;

/**
 * VideoRenderer created to contains the live video presentation logic. This VideoRenderer subtype change the inflated
 * layout and override the renderer algorithm to add a new phase to render the date.
 *
 * @author Pedro Vicente Gómez Sánchez.
 */
public class LiveVideoRenderer extends VideoRenderer {

    /*
     * Widgets
     */

    private TextView date;

    /*
     * Constructor
     */

    public LiveVideoRenderer(Context context) {
        super(context);
    }

    /*
     * Override methods
     */

    @Override
    protected View inflate(LayoutInflater inflater, ViewGroup parent) {
        return inflater.inflate(R.layout.live_video_renderer, parent, false);
    }

    @Override
    protected void setUpView(View rootView) {
        super.setUpView(rootView);
        date = (TextView) rootView.findViewById(R.id.date);
    }

    @Override
    protected void renderLabel() {
        getLabel().setText(getContext().getString(R.string.live_label));
    }

    @Override
    protected void renderMarker(Video video) {
        getMarker().setVisibility(View.GONE);
    }

    @Override
    public void render() {
        super.render();
        renderDate();
    }

    /*
     * Auxiliary methods
     */

    private void renderDate() {
        String now = new Date().toLocaleString();
        date.setText(now);
    }

}


@@ -806,24 +806,87 @@
 t.TextView;%0A
+import butterknife.ButterKnife;%0Aimport butterknife.InjectView;%0A
 import com.p
@@ -1324,23 +1324,42 @@
 */%0A%0A    
-private
+@InjectView(R.id.date)%0A   
  TextVie
@@ -1619,14 +1619,27 @@
     
-return
+View inflatedView =
  inf
@@ -1706,165 +1706,272 @@
     
-%7D%0A%0A    @Override%0A    protected void setUpView(View rootView) %7B%0A        super.setUpView(rootView);%0A        date = (TextView) rootView.findViewById(R.id.date);
+    ButterKnife.inject(this, inflatedView);%0A        return inflatedView;%0A    %7D%0A%0A    @Override%0A    protected void setUpView(View rootView) %7B%0A         /*%0A          * Empty implementation substituted with the usage of ButterKnife library by Jake Wharton.%0A          */
 %0A   

Use ButterKnife library in LiveVideoRenderer to mapGUI and hookListeners.