You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Merge pull request #107473 from m4gr3d/address_transparency_feedback
Address remaining feedback on Android background transparency
This commit is contained in:
@@ -596,6 +596,7 @@ void DisplayServerAndroid::window_set_flag(DisplayServer::WindowFlags p_flag, bo
|
||||
}
|
||||
|
||||
bool DisplayServerAndroid::window_get_flag(DisplayServer::WindowFlags p_flag, DisplayServer::WindowID p_window) const {
|
||||
ERR_FAIL_COND_V(p_window != MAIN_WINDOW_ID, false);
|
||||
switch (p_flag) {
|
||||
case WindowFlags::WINDOW_FLAG_TRANSPARENT:
|
||||
return is_window_transparency_available();
|
||||
|
||||
@@ -1050,7 +1050,7 @@ void EditorExportPlatformAndroid::_write_tmp_manifest(const Ref<EditorExportPres
|
||||
store_string_at_path(manifest_path, manifest_text);
|
||||
}
|
||||
|
||||
bool EditorExportPlatformAndroid::_should_be_transparent(const Ref<EditorExportPreset> &p_preset) const {
|
||||
bool EditorExportPlatformAndroid::_is_transparency_allowed(const Ref<EditorExportPreset> &p_preset) const {
|
||||
return (bool)get_project_setting(p_preset, "display/window/per_pixel_transparency/allowed");
|
||||
}
|
||||
|
||||
@@ -1062,13 +1062,13 @@ void EditorExportPlatformAndroid::_fix_themes_xml(const Ref<EditorExportPreset>
|
||||
return;
|
||||
}
|
||||
|
||||
bool should_be_transparent = _should_be_transparent(p_preset);
|
||||
bool transparency_allowed = _is_transparency_allowed(p_preset);
|
||||
|
||||
// Default/Reserved theme attributes.
|
||||
Dictionary main_theme_attributes;
|
||||
main_theme_attributes["android:windowSwipeToDismiss"] = bool_to_string(p_preset->get("gesture/swipe_to_dismiss"));
|
||||
main_theme_attributes["android:windowIsTranslucent"] = bool_to_string(should_be_transparent);
|
||||
if (should_be_transparent) {
|
||||
main_theme_attributes["android:windowIsTranslucent"] = bool_to_string(transparency_allowed);
|
||||
if (transparency_allowed) {
|
||||
main_theme_attributes["android:windowBackground"] = "@android:color/transparent";
|
||||
}
|
||||
|
||||
@@ -1076,7 +1076,7 @@ void EditorExportPlatformAndroid::_fix_themes_xml(const Ref<EditorExportPreset>
|
||||
splash_theme_attributes["android:windowSplashScreenBackground"] = "@mipmap/icon_background";
|
||||
splash_theme_attributes["windowSplashScreenAnimatedIcon"] = "@mipmap/icon_foreground";
|
||||
splash_theme_attributes["postSplashScreenTheme"] = "@style/GodotAppMainTheme";
|
||||
splash_theme_attributes["android:windowIsTranslucent"] = bool_to_string(should_be_transparent);
|
||||
splash_theme_attributes["android:windowIsTranslucent"] = bool_to_string(transparency_allowed);
|
||||
|
||||
PackedStringArray reserved_splash_keys;
|
||||
reserved_splash_keys.append("postSplashScreenTheme");
|
||||
@@ -2992,7 +2992,7 @@ bool EditorExportPlatformAndroid::has_valid_project_configuration(const Ref<Edit
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (_should_be_transparent(p_preset)) {
|
||||
if (_is_transparency_allowed(p_preset)) {
|
||||
// Warning only, so don't override `valid`.
|
||||
err += vformat(TTR("\"Use Gradle Build\" is required for transparent background on Android"));
|
||||
err += "\n";
|
||||
|
||||
@@ -164,7 +164,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
|
||||
|
||||
void _write_tmp_manifest(const Ref<EditorExportPreset> &p_preset, bool p_give_internet, bool p_debug);
|
||||
|
||||
bool _should_be_transparent(const Ref<EditorExportPreset> &p_preset) const;
|
||||
bool _is_transparency_allowed(const Ref<EditorExportPreset> &p_preset) const;
|
||||
|
||||
void _fix_themes_xml(const Ref<EditorExportPreset> &p_preset);
|
||||
|
||||
|
||||
@@ -487,7 +487,9 @@ class Godot private constructor(val context: Context) {
|
||||
|
||||
// Check whether the render view should be made transparent
|
||||
val shouldBeTransparent =
|
||||
!isProjectManagerHint() && !isEditorHint() && java.lang.Boolean.parseBoolean(GodotLib.getGlobal("display/window/per_pixel_transparency/allowed"))
|
||||
!isProjectManagerHint() &&
|
||||
!isEditorHint() &&
|
||||
java.lang.Boolean.parseBoolean(GodotLib.getGlobal("display/window/per_pixel_transparency/allowed"))
|
||||
Log.d(TAG, "Render view should be transparent: $shouldBeTransparent")
|
||||
renderView = if (usesVulkan()) {
|
||||
if (meetsVulkanRequirements(context.packageManager)) {
|
||||
|
||||
Reference in New Issue
Block a user