|
|
@ -48,6 +48,7 @@ local T = require("ffi/util").template
|
|
|
|
local _ = require("gettext")
|
|
|
|
local _ = require("gettext")
|
|
|
|
|
|
|
|
|
|
|
|
local KeyValueItem = InputContainer:extend{
|
|
|
|
local KeyValueItem = InputContainer:extend{
|
|
|
|
|
|
|
|
show_parent = nil,
|
|
|
|
key = nil,
|
|
|
|
key = nil,
|
|
|
|
value = nil,
|
|
|
|
value = nil,
|
|
|
|
value_lang = nil,
|
|
|
|
value_lang = nil,
|
|
|
@ -278,6 +279,8 @@ end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local KeyValuePage = FocusManager:extend{
|
|
|
|
local KeyValuePage = FocusManager:extend{
|
|
|
|
|
|
|
|
show_parent = nil,
|
|
|
|
|
|
|
|
kv_pairs = nil, -- not mandatory
|
|
|
|
title = "",
|
|
|
|
title = "",
|
|
|
|
width = nil,
|
|
|
|
width = nil,
|
|
|
|
height = nil,
|
|
|
|
height = nil,
|
|
|
@ -288,9 +291,14 @@ local KeyValuePage = FocusManager:extend{
|
|
|
|
-- now: 50%): "left" (stick to key), "right" (stick to scren right border)
|
|
|
|
-- now: 50%): "left" (stick to key), "right" (stick to scren right border)
|
|
|
|
value_overflow_align = "left",
|
|
|
|
value_overflow_align = "left",
|
|
|
|
single_page = nil, -- show all items on one single page (and make them small)
|
|
|
|
single_page = nil, -- show all items on one single page (and make them small)
|
|
|
|
|
|
|
|
title_bar_align = "left",
|
|
|
|
|
|
|
|
title_bar_left_icon = nil,
|
|
|
|
|
|
|
|
title_bar_left_icon_tap_callback = nil,
|
|
|
|
|
|
|
|
title_bar_left_icon_hold_callback = nil,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function KeyValuePage:init()
|
|
|
|
function KeyValuePage:init()
|
|
|
|
|
|
|
|
self.show_parent = self.show_parent or self
|
|
|
|
self.kv_pairs = self.kv_pairs or {}
|
|
|
|
self.kv_pairs = self.kv_pairs or {}
|
|
|
|
self.dimen = Geom:new{
|
|
|
|
self.dimen = Geom:new{
|
|
|
|
x = 0,
|
|
|
|
x = 0,
|
|
|
@ -328,7 +336,7 @@ function KeyValuePage:init()
|
|
|
|
icon = BD.mirroredUILayout() and "back.top.rtl" or "back.top",
|
|
|
|
icon = BD.mirroredUILayout() and "back.top.rtl" or "back.top",
|
|
|
|
callback = function() self:onReturn() end,
|
|
|
|
callback = function() self:onReturn() end,
|
|
|
|
bordersize = 0,
|
|
|
|
bordersize = 0,
|
|
|
|
show_parent = self,
|
|
|
|
show_parent = self.show_parent,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
-- group for page info
|
|
|
|
-- group for page info
|
|
|
|
local chevron_left = "chevron.left"
|
|
|
|
local chevron_left = "chevron.left"
|
|
|
@ -343,25 +351,25 @@ function KeyValuePage:init()
|
|
|
|
icon = chevron_left,
|
|
|
|
icon = chevron_left,
|
|
|
|
callback = function() self:prevPage() end,
|
|
|
|
callback = function() self:prevPage() end,
|
|
|
|
bordersize = 0,
|
|
|
|
bordersize = 0,
|
|
|
|
show_parent = self,
|
|
|
|
show_parent = self.show_parent,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
self.page_info_right_chev = self.page_info_right_chev or Button:new{
|
|
|
|
self.page_info_right_chev = self.page_info_right_chev or Button:new{
|
|
|
|
icon = chevron_right,
|
|
|
|
icon = chevron_right,
|
|
|
|
callback = function() self:nextPage() end,
|
|
|
|
callback = function() self:nextPage() end,
|
|
|
|
bordersize = 0,
|
|
|
|
bordersize = 0,
|
|
|
|
show_parent = self,
|
|
|
|
show_parent = self.show_parent,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
self.page_info_first_chev = self.page_info_first_chev or Button:new{
|
|
|
|
self.page_info_first_chev = self.page_info_first_chev or Button:new{
|
|
|
|
icon = chevron_first,
|
|
|
|
icon = chevron_first,
|
|
|
|
callback = function() self:goToPage(1) end,
|
|
|
|
callback = function() self:goToPage(1) end,
|
|
|
|
bordersize = 0,
|
|
|
|
bordersize = 0,
|
|
|
|
show_parent = self,
|
|
|
|
show_parent = self.show_parent,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
self.page_info_last_chev = self.page_info_last_chev or Button:new{
|
|
|
|
self.page_info_last_chev = self.page_info_last_chev or Button:new{
|
|
|
|
icon = chevron_last,
|
|
|
|
icon = chevron_last,
|
|
|
|
callback = function() self:goToPage(self.pages) end,
|
|
|
|
callback = function() self:goToPage(self.pages) end,
|
|
|
|
bordersize = 0,
|
|
|
|
bordersize = 0,
|
|
|
|
show_parent = self,
|
|
|
|
show_parent = self.show_parent,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
self.page_info_spacer = HorizontalSpan:new{
|
|
|
|
self.page_info_spacer = HorizontalSpan:new{
|
|
|
|
width = Screen:scaleBySize(32),
|
|
|
|
width = Screen:scaleBySize(32),
|
|
|
@ -441,11 +449,15 @@ function KeyValuePage:init()
|
|
|
|
title = self.title,
|
|
|
|
title = self.title,
|
|
|
|
fullscreen = self.covers_fullscreen,
|
|
|
|
fullscreen = self.covers_fullscreen,
|
|
|
|
width = self.width,
|
|
|
|
width = self.width,
|
|
|
|
align = "left",
|
|
|
|
align = self.title_bar_align,
|
|
|
|
with_bottom_line = true,
|
|
|
|
with_bottom_line = true,
|
|
|
|
bottom_line_color = Blitbuffer.COLOR_DARK_GRAY,
|
|
|
|
bottom_line_color = Blitbuffer.COLOR_DARK_GRAY,
|
|
|
|
bottom_line_h_padding = padding,
|
|
|
|
bottom_line_h_padding = padding,
|
|
|
|
|
|
|
|
left_icon = self.title_bar_left_icon,
|
|
|
|
|
|
|
|
left_icon_tap_callback = self.title_bar_left_icon_tap_callback,
|
|
|
|
|
|
|
|
left_icon_hold_callback = self.title_bar_left_icon_hold_callback,
|
|
|
|
close_callback = function() self:onClose() end,
|
|
|
|
close_callback = function() self:onClose() end,
|
|
|
|
|
|
|
|
show_parent = self.show_parent or self,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
-- setup main content
|
|
|
|
-- setup main content
|
|
|
@ -665,7 +677,7 @@ function KeyValuePage:_populateItems()
|
|
|
|
value_align = self.value_align,
|
|
|
|
value_align = self.value_align,
|
|
|
|
kv_pairs_idx = kv_pairs_idx,
|
|
|
|
kv_pairs_idx = kv_pairs_idx,
|
|
|
|
kv_page = self,
|
|
|
|
kv_page = self,
|
|
|
|
show_parent = self,
|
|
|
|
show_parent = self.show_parent,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
table.insert(self.main_content, kv_item)
|
|
|
|
table.insert(self.main_content, kv_item)
|
|
|
|
table.insert(self.layout, { kv_item })
|
|
|
|
table.insert(self.layout, { kv_item })
|
|
|
@ -776,6 +788,10 @@ function KeyValuePage:onMultiSwipe(arg, ges_ev)
|
|
|
|
return true
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function KeyValuePage:setTitleBarLeftIcon(icon)
|
|
|
|
|
|
|
|
self.title_bar:setLeftIcon(icon)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function KeyValuePage:onClose()
|
|
|
|
function KeyValuePage:onClose()
|
|
|
|
UIManager:close(self)
|
|
|
|
UIManager:close(self)
|
|
|
|
if self.close_callback then
|
|
|
|
if self.close_callback then
|
|
|
|