diff --git a/plugin.js b/plugin.js index 5136ea5..078c729 100644 --- a/plugin.js +++ b/plugin.js @@ -135,6 +135,28 @@ return html; }; + // Required by ActivitySlide contract. Activates navigation the same way the + // native catalog (Main) does: Scroll owns focus/scroll, Controller just drives + // Navigator. Scroll auto-scrolls the focused card into view. + this.start = function () { + var started = false; + Lampa.Controller.add('content', { + toggle: function () { + var first = $('.mymovies .card.selector')[0]; + if (first && !started) { + started = true; + Lampa.Controller.collectionFocus(first, $('.mymovies')); + } + }, + left: function () { if (Navigator.canmove('left')) Navigator.move('left'); else Lampa.Controller.toggle('menu'); }, + right: function () { Navigator.move('right'); }, + up: function () { Navigator.move('up'); }, + down: function () { Navigator.move('down'); }, + back: function () { Lampa.Activity.backward(); } + }); + Lampa.Controller.toggle('content'); + }; + // Build each card and append through the native Scroll (handles focus + scroll). function renderMovies(movies) { movies.forEach(function (m) {