(function(context,$) {

  "use strict";
  context.JK = context.JK || {};
  context.JK.FeedScreen = function(app) {

    var logger = context.JK.logger;

    var feed = null;

    function beforeShow(data) {

    }

    function afterShow(data) {
      feed.refresh();
    }

    function initialize() {
      var screenBindings = {
        'beforeShow': beforeShow,
        'afterShow': afterShow
      };
      app.bindScreen('feed', screenBindings);

      var $screen = $('[layout-id="feed"]');
      var $scroller = $screen.find('.content-body-scroller#feedScreen-feed-scroller');
      var $content = $screen.find('.feed-content#feedScreen-feed-entry-list');
      var $noMoreFeeds = $('#feedScreen-end-of-feeds-list');
      var $refresh = $screen.find('.btn-refresh-entries');
      var $sortFeedBy = $screen.find('#feed_order_by');
      var $includeDate = $screen.find('#feed_date');
      var $includeType = $screen.find('#feed_show');

      feed = new context.JK.Feed(app);
      feed.initialize($screen, $scroller, $content, $noMoreFeeds, $refresh, $sortFeedBy, $includeDate, $includeType);
    }

    this.initialize = initialize;

    return this;
  }
})(window,jQuery);