Composable Debug Drawer for Jetpack Compose apps
Configure jitpack:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add dependencies:
implementation 'com.github.alorma.Compose-Debug-Drawer:drawer-base:0.1.0-beta-06'
implementation 'com.github.alorma.Compose-Debug-Drawer:drawer-modules:0.1.0-beta-06'
implementation 'com.github.alorma.Compose-Debug-Drawer:developer-shortcuts:0.1.0-beta-06'
Wrap your content with DebugDrawerLayout
:
DebugDrawerLayout(
debug = { BuildConfig.DEBUG },
drawerModules = {
TODO()
}
) {
// TODO Add your APP Content here
}
This library automatically handles the debug / release state, so no need to remove the drawer on Release builds
Add modules as a list of DebugModule
s
DebugDrawerLayout(
debug = { BuildConfig.DEBUG },
drawerModules = {
listOf(DeviceModule(), BuildModule())
}
) {
// TODO Add your APP Content here
}
This module receive a List<DebugDrawerAction>
Actions
-
ButtonAction: Shows a
Button
with given text, and register a lambda to receive it's click -
SwitchAction: Shows a
Switch
and register a lambda to receive it's changes
All
DebugDrawerAction
can modify it's default UI by pass amodifier
Shows information about the app: Version code, Version name and Package
Shows information about device running the app such as Device, and manufacturer
Some quick shortcuts to open common developer tools.
Missing any? Open an issue here
You can create your own module by creating a class that extends: DrawerModule
class UserModule : DebugModule {
override val icon: IconType
override val title: String =
@Composable
override fun build() {
TODO()
}
}
Use drawerColors
to customize drawer theme colors
DebugDrawerLayout(
drawerColors = YourColorScheme,
)
Any module has access to DrawerColors
and must use it to match the colors used by modules from this library
Update module UI by pass Modifier
DebugDrawerLayout(
moduleModifier = Modifier
.padding()
.clip()
.border(),
)