Disable game bar and header on Android (#7940)

This commit is contained in:
rubenwardy 2018-12-06 23:32:15 +00:00 committed by Paramat
parent 08884d258b
commit 0c6933bdf7
1 changed files with 87 additions and 75 deletions

View File

@ -15,14 +15,18 @@
--with this program; if not, write to the Free Software Foundation, Inc.,
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
local function current_game()
local enable_gamebar = PLATFORM ~= "Android"
local current_game, singleplayer_refresh_gamebar
if enable_gamebar then
function current_game()
local last_game_id = core.settings:get("menu_last_game")
local game, index = pkgmgr.find_by_gameid(last_game_id)
return game
end
end
local function singleplayer_refresh_gamebar()
function singleplayer_refresh_gamebar()
local old_bar = ui.find_by_name("game_button_bar")
@ -83,6 +87,11 @@ local function singleplayer_refresh_gamebar()
end
btnbar:add_button(btn_name, text, image, tooltip)
end
end
else
function current_game()
return nil
end
end
local function get_formspec(tabview, name, tabdata)
@ -239,7 +248,7 @@ local function main_button_handler(this, fields, name, tabdata)
create_world_dlg:set_parent(this)
this:hide()
create_world_dlg:show()
mm_texture.update("singleplayer",current_game())
mm_texture.update("singleplayer", current_game())
return true
end
@ -282,7 +291,9 @@ local function main_button_handler(this, fields, name, tabdata)
end
end
local function on_change(type, old_tab, new_tab)
local on_change
if enable_gamebar then
function on_change(type, old_tab, new_tab)
local buttonbar = ui.find_by_name("game_button_bar")
if ( buttonbar == nil ) then
@ -305,6 +316,7 @@ local function on_change(type, old_tab, new_tab)
core.set_topleft_text("")
mm_texture.update(new_tab,nil)
end
end
end
--------------------------------------------------------------------------------