Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add back button to statistics #3267

Merged
merged 2 commits into from Sep 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 27 additions & 0 deletions frontend/ui/widget/keyvaluepage.lua
Expand Up @@ -254,6 +254,13 @@ function KeyValuePage:init()
}
end

-- return button
self.page_return_arrow = Button:new{
icon = "resources/icons/appbar.arrow.left.up.png",
callback = function() self:onReturn() end,
bordersize = 0,
show_parent = self,
}
-- group for page info
self.page_info_left_chev = Button:new{
icon = "resources/icons/appbar.chevron.left.png",
Expand Down Expand Up @@ -282,6 +289,16 @@ function KeyValuePage:init()
self.page_info_spacer = HorizontalSpan:new{
width = Screen:scaleBySize(32),
}
self.page_return_spacer = HorizontalSpan:new{
width = self.page_return_arrow:getSize().w
}

if self.callback_return == nil and self.return_button == nil then
self.page_return_arrow:hide()
elseif self.callback_return == nil then
self.page_return_arrow:disable()
end

self.page_info_left_chev:hide()
self.page_info_right_chev:hide()
self.page_info_first_chev:hide()
Expand All @@ -308,13 +325,15 @@ function KeyValuePage:init()
text_font_bold = false,
}
self.page_info = HorizontalGroup:new{
self.page_return_arrow,
self.page_info_first_chev,
self.page_info_spacer,
self.page_info_left_chev,
self.page_info_text,
self.page_info_right_chev,
self.page_info_spacer,
self.page_info_last_chev,
self.page_return_spacer,
}

local footer = BottomContainer:new{
Expand Down Expand Up @@ -406,6 +425,7 @@ function KeyValuePage:_populateItems()
key = entry[1],
value = entry[2],
callback = entry.callback,
callback_back = entry.callback_back,
textviewer_width = self.textviewer_width,
textviewer_height = self.textviewer_height,
}
Expand Down Expand Up @@ -465,4 +485,11 @@ function KeyValuePage:onClose()
return true
end

function KeyValuePage:onReturn()
if self.callback_return then
self:callback_return()
UIManager:close(self)
end
end

return KeyValuePage