|
|
@ -9,6 +9,7 @@ local playback = require("playback") |
|
|
|
local theme = require("theme") |
|
|
|
local theme = require("theme") |
|
|
|
local screen = require("screen") |
|
|
|
local screen = require("screen") |
|
|
|
local database = require("database") |
|
|
|
local database = require("database") |
|
|
|
|
|
|
|
local img = require("images") |
|
|
|
|
|
|
|
|
|
|
|
return screen:new{ |
|
|
|
return screen:new{ |
|
|
|
create_ui = function(self) |
|
|
|
create_ui = function(self) |
|
|
@ -54,6 +55,7 @@ return screen:new{ |
|
|
|
} |
|
|
|
} |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (self.mediatype == database.MediaTypes.Music) then |
|
|
|
local buttons = header:Object({ |
|
|
|
local buttons = header:Object({ |
|
|
|
flex = { |
|
|
|
flex = { |
|
|
|
flex_direction = "row", |
|
|
|
flex_direction = "row", |
|
|
@ -89,8 +91,30 @@ return screen:new{ |
|
|
|
playback.playing:set(true) |
|
|
|
playback.playing:set(true) |
|
|
|
backstack.push(playing:new()) |
|
|
|
backstack.push(playing:new()) |
|
|
|
end) |
|
|
|
end) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local get_icon_func = nil |
|
|
|
|
|
|
|
local show_listened = self.mediatype == database.MediaTypes.Audiobook or self.mediatype == database.MediaTypes.Podcast |
|
|
|
|
|
|
|
if show_listened then |
|
|
|
|
|
|
|
get_icon_func = function (item) |
|
|
|
|
|
|
|
local contents = item:contents() |
|
|
|
|
|
|
|
if type(contents) == "userdata" then |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
local track = database.track_by_id(contents) |
|
|
|
|
|
|
|
if not track then return end |
|
|
|
|
|
|
|
if (track.play_count > 0) then |
|
|
|
|
|
|
|
return img.listened |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
return img.unlistened |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
widgets.InfiniteList(self.root, self.iterator, { |
|
|
|
widgets.InfiniteList(self.root, self.iterator, { |
|
|
|
|
|
|
|
get_icon = get_icon_func, |
|
|
|
callback = function(item) |
|
|
|
callback = function(item) |
|
|
|
return function() |
|
|
|
return function() |
|
|
|
local contents = item:contents() |
|
|
|
local contents = item:contents() |
|
|
@ -98,6 +122,7 @@ return screen:new{ |
|
|
|
backstack.push(require("browser"):new{ |
|
|
|
backstack.push(require("browser"):new{ |
|
|
|
title = self.title, |
|
|
|
title = self.title, |
|
|
|
iterator = contents, |
|
|
|
iterator = contents, |
|
|
|
|
|
|
|
mediatype = self.mediatype, |
|
|
|
breadcrumb = tostring(item) |
|
|
|
breadcrumb = tostring(item) |
|
|
|
}) |
|
|
|
}) |
|
|
|
else |
|
|
|
else |
|
|
|