diff --git a/export_presets.cfg b/export_presets.cfg index ebd6ac5..df62b00 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -44,19 +44,20 @@ package/exclude_from_recents=false package/show_in_android_tv=false package/show_in_app_library=true package/show_as_launcher_app=false -launcher_icons/main_192x192="res://godot_only/android_icons/legacy_icon.png" -launcher_icons/adaptive_foreground_432x432="res://godot_only/android_icons/adaptive_foreground.png" -launcher_icons/adaptive_background_432x432="res://godot_only/android_icons/adaptive_background.png" +launcher_icons/main_192x192="uid://cflbbkb28mhj8" +launcher_icons/adaptive_foreground_432x432="uid://c6n5oi7xh600d" +launcher_icons/adaptive_background_432x432="uid://yawkmqc2hnvo" launcher_icons/adaptive_monochrome_432x432="uid://cop6bgxvtv4uq" graphics/opengl_debug=false shader_baker/enabled=false xr_features/xr_mode=0 gesture/swipe_to_dismiss=false -screen/immersive_mode=true +screen/immersive_mode=false screen/support_small=true screen/support_normal=true screen/support_large=true screen/support_xlarge=true +screen/edge_to_edge=false user_data_backup/allow=false command_line/extra_args="" apk_expansion/enable=false @@ -264,9 +265,9 @@ package/exclude_from_recents=false package/show_in_android_tv=false package/show_in_app_library=true package/show_as_launcher_app=false -launcher_icons/main_192x192="res://godot_only/android_icons/legacy_icon.png" -launcher_icons/adaptive_foreground_432x432="res://godot_only/android_icons/adaptive_foreground.png" -launcher_icons/adaptive_background_432x432="res://godot_only/android_icons/adaptive_background.png" +launcher_icons/main_192x192="uid://cflbbkb28mhj8" +launcher_icons/adaptive_foreground_432x432="uid://c6n5oi7xh600d" +launcher_icons/adaptive_background_432x432="uid://yawkmqc2hnvo" launcher_icons/adaptive_monochrome_432x432="uid://cop6bgxvtv4uq" graphics/opengl_debug=false shader_baker/enabled=false @@ -277,6 +278,7 @@ screen/support_small=true screen/support_normal=true screen/support_large=true screen/support_xlarge=true +screen/edge_to_edge=false user_data_backup/allow=false command_line/extra_args="" apk_expansion/enable=false diff --git a/src/autoload/HandlerGUI.gd b/src/autoload/HandlerGUI.gd index 4a1b718..22e38ff 100644 --- a/src/autoload/HandlerGUI.gd +++ b/src/autoload/HandlerGUI.gd @@ -18,6 +18,31 @@ var popup_stack: Array[Control] var shortcut_panel: PanelContainer var tabs_panel: PanelContainer +var android_runtime: JNISingleton +var is_light_system_bars: bool = false + +func set_system_bar_color(color: Color, override_appearance := false) -> void: + if not android_runtime: + return + + var activity = android_runtime.getActivity() + var callable = func (): + var window = activity.getWindow() + var decorView: JavaObject = window.getDecorView() + decorView.setBackgroundColor(color.to_argb32()) + + if (is_light_system_bars != (color.get_luminance() > 0.5)) or override_appearance: + is_light_system_bars = color.get_luminance() > 0.5 + var wic = JavaClassWrapper.wrap("android.view.WindowInsetsController") + var insets_controller = window.getInsetsController() + insets_controller.setSystemBarsAppearance( + wic.APPEARANCE_LIGHT_STATUS_BARS if is_light_system_bars else 0, wic.APPEARANCE_LIGHT_STATUS_BARS) + insets_controller.setSystemBarsAppearance( + wic.APPEARANCE_LIGHT_NAVIGATION_BARS if is_light_system_bars else 0, wic.APPEARANCE_LIGHT_NAVIGATION_BARS) + + activity.runOnUiThread(android_runtime.createRunnableFromGodotCallable(callable)) + + func _enter_tree() -> void: var window := get_window() window.files_dropped.connect(_on_files_dropped) @@ -33,6 +58,9 @@ func _ready() -> void: await get_tree().process_frame # Helps make things more consistent. update_ui_scale() + android_runtime = Engine.get_singleton("AndroidRuntime") + set_system_bar_color(ThemeUtils.overlay_panel_inner_color, true) + shortcut_panel = ShortcutPanelScene.instantiate() get_tree().root.add_child(shortcut_panel)