Advance Wayland and KDE package bring-up
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
SPDX-FileCopyrightText: 2024 Volker Krause <vkrause@kde.org>
|
||||
SPDX-License-Identifier: BSD-2-Clause
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.kde.guiaddons">
|
||||
</manifest>
|
||||
@@ -0,0 +1,11 @@
|
||||
# SPDX-FileCopyrightText: 2024 Volker Krause <vkrause@kde.org>
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
|
||||
gradle_add_aar(kguiaddons_aar BUILDFILE ${CMAKE_CURRENT_SOURCE_DIR}/build.gradle NAME KF6GuiAddons)
|
||||
gradle_install_aar(kguiaddons_aar DESTINATION jar)
|
||||
|
||||
install(
|
||||
FILES KF6GuiAddons-android-dependencies.xml
|
||||
DESTINATION ${KDE_INSTALL_LIBDIR}
|
||||
RENAME KF6GuiAddons_${CMAKE_ANDROID_ARCH_ABI}-android-dependencies.xml
|
||||
)
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
SPDX-FileCopyrightText: 2024 Volker Krause <vkrause@kde.org>
|
||||
SPDX-License-Identifier: BSD-2-Clause
|
||||
-->
|
||||
<rules>
|
||||
<dependencies>
|
||||
<lib name="KF6GuiAddons">
|
||||
<depends>
|
||||
<jar bundling="1" file="jar/KF6GuiAddons.aar"/>
|
||||
</depends>
|
||||
</lib>
|
||||
</dependencies>
|
||||
</rules>
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2024 Volker Krause <vkrause@kde.org>
|
||||
SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:@Gradle_ANDROID_GRADLE_PLUGIN_VERSION@'
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
compileSdkVersion @ANDROID_SDK_COMPILE_API@
|
||||
buildToolsVersion '@ANDROID_SDK_BUILD_TOOLS_REVISION@'
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
manifest.srcFile '@CMAKE_CURRENT_SOURCE_DIR@/AndroidManifest.xml'
|
||||
java.srcDirs = ['@CMAKE_CURRENT_SOURCE_DIR@/org']
|
||||
}
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion @ANDROID_API_LEVEL@
|
||||
targetSdkVersion @ANDROID_SDK_COMPILE_API@
|
||||
namespace "org.kde.guiaddons"
|
||||
}
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2024 Mathis Brüchert <mbb@kaidan.im>
|
||||
SPDX-FileCopyrightText: 2024 Carl Schwan <carl@carlschwan.eu>
|
||||
SPDX-FileCopyrightText: 2024 Volker Krause <vkrause@kde.org>
|
||||
SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
*/
|
||||
|
||||
package org.kde.guiaddons;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Build;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.WindowInsetsController;
|
||||
|
||||
public class KWindowInsetsController
|
||||
{
|
||||
public static void setStatusBarBackground(android.app.Activity activity, int color)
|
||||
{
|
||||
Window window = activity.getWindow();
|
||||
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||
window.setStatusBarColor(color);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 30) {
|
||||
if (isDark(color)) {
|
||||
window.getInsetsController().setSystemBarsAppearance(0, WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS);
|
||||
} else {
|
||||
window.getInsetsController().setSystemBarsAppearance(WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS, WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS);
|
||||
}
|
||||
} else {
|
||||
int visibility = window.getDecorView().getSystemUiVisibility();
|
||||
if (isDark(color)) {
|
||||
visibility &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
|
||||
} else {
|
||||
visibility |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
|
||||
}
|
||||
window.getDecorView().setSystemUiVisibility(visibility);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setNavigationBarBackground(android.app.Activity activity, int color)
|
||||
{
|
||||
Window window = activity.getWindow();
|
||||
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||
window.setNavigationBarColor(color);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 30) {
|
||||
if (isDark(color)) {
|
||||
window.getInsetsController().setSystemBarsAppearance(0, WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS);
|
||||
} else {
|
||||
window.getInsetsController().setSystemBarsAppearance(WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS, WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS);
|
||||
}
|
||||
} else {
|
||||
int visibility = window.getDecorView().getSystemUiVisibility();
|
||||
if (isDark(color)) {
|
||||
visibility &= ~View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
|
||||
} else {
|
||||
visibility |= View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
|
||||
}
|
||||
window.getDecorView().setSystemUiVisibility(visibility);
|
||||
}
|
||||
}
|
||||
|
||||
private static double luma(int color)
|
||||
{
|
||||
return (0.299 * (color >> 24) + 0.587 * ((color >> 16) & 0xff) + 0.114 * ((color >> 8) & 0xff)) / 255.0;
|
||||
}
|
||||
|
||||
private static boolean isDark(int color)
|
||||
{
|
||||
return luma(color) <= 0.5;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user