This third-party library brings Android 12’s Material You theming to any app
Material You is the latest revision of Google’s design language. With Material You, Google is emphasizing personalization, which is why in Android 12, there’s a new dynamic theming system that recolors your UX using colors extracted from your wallpaper. This dynamic theming system, code-named “monet”, went live in Android 12 Beta 2, but Google has yet to document the APIs/implementation, provide support libraries, or open up Google Play to publishing apps targeting API level 31 (Android 12), so the vast majority of developers haven’t even bothered looking at adapting their apps to support the dynamic theming system.
That doesn’t mean that no developer is toying with Android 12’s theming system, though. The developer of the popular automation app Tasker has demonstrated dynamic theming support in his app using Android 12’s official APIs. On the other hand, another developer, kdrag0n, recreated the system in its entirety using his own color extraction and palette generation algorithm. Kdrag0n shared source code for his theme engine and is working on a Jetpack Compose and Flutter library so third-party apps built for older OS versions can implement his take on “monet.”
Now, XDA Recognized Developer Quinny899 has created a library of his own that’s based on kdrag0n’s custom “monet” implementation (ie. it’s not based on Google’s theme engine). Developers can integrate this MonetCompat library into their apps to add support for dynamically theming their app’s UI based on the user’s wallpaper. This library works on devices running Android 5.0 and above (using the Palette API in compatibility mode) and Android 8.1 Oreo and above in normal mode. The library can’t extract colors from live wallpapers on versions prior to Android 8.1 due to limitations in the platform APIs.
As for why a developer might want to use this library, Quinny899 himself explains on the project’s GitHub page. “It’s also not currently known if Google will provide their own backwards compatibility library for Monet with Android 12’s release, so this library may be replaced by an official one eventually. No proprietary Google code is used in this project, and thus it is licensed with the MIT license for use in third party apps.”
The first app to use MonetCompat is, of course, Quinny899’s own DarQ app. DarQ is an app that lets you toggle Android’s force dark mode setting on a per-app basis. It originally used root access to set a system property but was updated to use an ADB shell script run on the user’s PC, dropping the root requirement. In DarQ 2.0, users no longer have to run the ADB script from their PC, as the app now integrates Shizuku. Shizuku is an app and service that lets other apps run shell commands or access APIs with ADB shell user privileges – think of it as a superuser management app but for ADB shell access. On Android 11+, the Shizuku service can be started through the built-in wireless debugging feature, so you no longer need a PC at all to set up DarQ. With the move to Shizuku, DarQ also now uses a ProcessObserver rather than an AccessibilityService, which the developer says lets DarQ detect when an app has opened (and thus apply the force dark setting) much more quickly.
If, for whatever reason, you don’t like the color generated by MonetCompat for the DarQ app, you can tap on “DarQ 2.0” three times to enable Developer Options in the app. Here, you can select “Monet Color Picker” to change the color you want the app to use.
DarQ 2.0 changelog
- DarQ 2.0 has an entirely new design, with Material You elements and Monet (wallpaper-based) colours.
- The ADB script is now gone, and instead Shizuku handles the service on non-root devices. If you don’t know what Shizuku is, think of it like a Superuser app for non-root devices. Start Shizuku via ADB on a computer (or even on your phone on Android 11 and above) once per boot, and any app that uses Shizuku can use ADB services.
- The Accessibility Service has been replaced with a ProcessObserver, using the Shizuku/Root service. This is much quicker than Accessibility, so apps that previously were opening too quick to be supported may now work.
- Improvements to the auto dark theme at sunrise/sunset to work better on different devices.
- Improvements to the Xposed module for apps that try to block the use of force dark, preventing them from doing so.
DarQ XDA Forum Thread ||| MonetCompat Library on GitHub
The post This third-party library brings Android 12’s Material You theming to any app appeared first on xda-developers.
from xda-developers https://ift.tt/3qAhDIB
via IFTTT
ليست هناك تعليقات: