Skip to content

Add dark mode listener support across all Android bootstraps#3306

Open
kengoon wants to merge 2 commits intokivy:developfrom
kengoon:dark-mode
Open

Add dark mode listener support across all Android bootstraps#3306
kengoon wants to merge 2 commits intokivy:developfrom
kengoon:dark-mode

Conversation

@kengoon
Copy link
Copy Markdown
Contributor

@kengoon kengoon commented Apr 26, 2026

This pull request adds support for detecting and responding to system dark mode changes on Android devices in Python-for-Android apps. It introduces a new Python interface for dark mode detection and corresponding Java hooks in all supported bootstraps, along with user documentation.

Dark Mode Detection and Listener Support

  • Added a new Python module android.darkmode that allows apps to set or remove a listener for system dark mode changes, providing a callback with the current dark mode state.
  • Updated documentation (apis.rst) to describe the new dark mode detection API and usage examples for app developers.

Java Integration for All Bootstraps

  • Added a DarkModeListener interface and related methods (setDarkModeListener, onConfigurationChanged) to PythonActivity.java in the qt, sdl2, sdl3, and webview bootstraps, enabling the Java side to notify Python code of dark mode changes. [1] [2] [3] [4]
  • Imported android.content.res.Configuration in all affected PythonActivity.java files to support configuration change detection for dark mode. [1] [2] [3] [4]
Screen_Recording_20260426_204249.mp4

kengoon added 2 commits April 26, 2026 20:14
Introduce `DarkModeListener` interface to detect and handle system dark mode changes. Update Java and Python APIs to support listener registration for monitoring and reacting to dark mode state changes. Document usage in APIs.
…nd standardize method signature formatting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant