Pretty print plugin will read the bundle parameter from any method annotated with @Pretty
, and prints the bundle values and total size as shown in the below example.
For eg:
@Pretty(headerName = "MainActivity")
private void intialize(Bundle extras) {
//intialization.
}
@Pretty(headerName = "KotlinClass")
private fun intialize(extras:Bundle) {
//intialization.
}
and all the extras will be printed in your logcat as below.
╔═══════════╤══════════════╗
║ ClassName │ KotlinClass ║
╠═══════════╪══════════════╣
║ number │ 2 ║
╟───────────┼──────────────╢
║ string │ string value ║
╟───────────┼──────────────╢
║ int │ 12 ║
╟───────────┼──────────────╢
║ float │ 12.0 ║
╟───────────┼──────────────╢
║ hello │ text ║
╟───────────┼──────────────╢
║ world │ text ║
╟───────────┼──────────────╢
║ SIZE │ 212 Bytes ║
╚═══════════╧══════════════╝
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.com.karthik:pretty-plugin:0.2"
}
}
apply plugin: "com.karthik.prettyprint"
-
- Printing Custom objects, not only primitives.
Pretty Print drew a huge inspiration from the Jake Wharton's Hugo and Can Elmas Let Libraries.