|
|
|
@ -2,6 +2,8 @@ local BD = require("ui/bidi")
|
|
|
|
|
local Blitbuffer = require("ffi/blitbuffer")
|
|
|
|
|
local BottomContainer = require("ui/widget/container/bottomcontainer")
|
|
|
|
|
local Button = require("ui/widget/button")
|
|
|
|
|
local CenterContainer = require("ui/widget/container/centercontainer")
|
|
|
|
|
local CheckMark = require("ui/widget/checkmark")
|
|
|
|
|
local CloseButton = require("ui/widget/closebutton")
|
|
|
|
|
local Device = require("device")
|
|
|
|
|
local Font = require("ui/font")
|
|
|
|
@ -10,7 +12,6 @@ local Geom = require("ui/geometry")
|
|
|
|
|
local GestureRange = require("ui/gesturerange")
|
|
|
|
|
local HorizontalGroup = require("ui/widget/horizontalgroup")
|
|
|
|
|
local InputContainer = require("ui/widget/container/inputcontainer")
|
|
|
|
|
local LeftContainer = require("ui/widget/container/leftcontainer")
|
|
|
|
|
local LineWidget = require("ui/widget/linewidget")
|
|
|
|
|
local OverlapGroup = require("ui/widget/overlapgroup")
|
|
|
|
|
local Size = require("ui/size")
|
|
|
|
@ -90,9 +91,8 @@ end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local SortItemWidget = InputContainer:new{
|
|
|
|
|
key = nil,
|
|
|
|
|
cface = Font:getFace("smallinfofont"),
|
|
|
|
|
tface = Font:getFace("smallinfofontbold"),
|
|
|
|
|
item = nil,
|
|
|
|
|
face = Font:getFace("smallinfofont"),
|
|
|
|
|
width = nil,
|
|
|
|
|
height = nil,
|
|
|
|
|
}
|
|
|
|
@ -114,22 +114,37 @@ function SortItemWidget:init()
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local frame_padding = Size.padding.default
|
|
|
|
|
local frame_internal_width = self.width - frame_padding * 2
|
|
|
|
|
local item_checkable = false
|
|
|
|
|
local item_checked = self.item.checked
|
|
|
|
|
if self.item.checked_func then
|
|
|
|
|
item_checkable = true
|
|
|
|
|
item_checked = self.item.checked_func()
|
|
|
|
|
end
|
|
|
|
|
local checkmark_widget = CheckMark:new{
|
|
|
|
|
checkable = item_checkable,
|
|
|
|
|
checked = item_checked,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
local checked_widget = CheckMark:new{ -- for layout, to :getSize()
|
|
|
|
|
checked = true,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
local text_max_width = self.width - 2*Size.padding.default - checked_widget:getSize().w
|
|
|
|
|
|
|
|
|
|
self[1] = FrameContainer:new{
|
|
|
|
|
padding = 0,
|
|
|
|
|
bordersize = 0,
|
|
|
|
|
LeftContainer:new{
|
|
|
|
|
dimen = {
|
|
|
|
|
w = frame_internal_width,
|
|
|
|
|
h = self.height
|
|
|
|
|
HorizontalGroup:new {
|
|
|
|
|
align = "center",
|
|
|
|
|
CenterContainer:new{
|
|
|
|
|
dimen = Geom:new{ w = checked_widget:getSize().w },
|
|
|
|
|
checkmark_widget,
|
|
|
|
|
},
|
|
|
|
|
TextWidget:new{
|
|
|
|
|
text = self.text,
|
|
|
|
|
max_width = frame_internal_width,
|
|
|
|
|
face = self.tface,
|
|
|
|
|
}
|
|
|
|
|
text = self.item.text,
|
|
|
|
|
max_width = text_max_width,
|
|
|
|
|
face = self.face,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
self[1].invert = self.invert
|
|
|
|
@ -146,6 +161,10 @@ function SortItemWidget:onTap()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function SortItemWidget:onHold()
|
|
|
|
|
if self.item.callback then
|
|
|
|
|
self.item:callback()
|
|
|
|
|
self.show_parent:_populateItems()
|
|
|
|
|
end
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@ -421,8 +440,7 @@ function SortWidget:_populateItems()
|
|
|
|
|
SortItemWidget:new{
|
|
|
|
|
height = self.item_height,
|
|
|
|
|
width = self.item_width,
|
|
|
|
|
text = self.item_table[idx].text,
|
|
|
|
|
label = self.item_table[idx].label,
|
|
|
|
|
item = self.item_table[idx],
|
|
|
|
|
invert = invert_status,
|
|
|
|
|
index = idx,
|
|
|
|
|
show_parent = self,
|
|
|
|
|