Created
November 9, 2024 18:50
-
-
Save ElianFabian/58720faa70ad20f3222ee0fec0d60af1 to your computer and use it in GitHub Desktop.
Android extensions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.content.Intent | |
| import android.os.Bundle | |
| @Suppress("DEPRECATION") | |
| fun Bundle.contentToString(): String { | |
| return "Bundle(${ | |
| keySet().joinToString { key -> | |
| when (val value = get(key)) { | |
| is Bundle -> "$key=${value.contentToString()}" | |
| is Array<*> -> "$key=${value.contentToString()}" | |
| is IntArray -> "$key=${value.contentToString()}" | |
| is LongArray -> "$key=${value.contentToString()}" | |
| is FloatArray -> "$key=${value.contentToString()}" | |
| is DoubleArray -> "$key=${value.contentToString()}" | |
| is BooleanArray -> "$key=${value.contentToString()}" | |
| is CharArray -> "$key=${value.contentToString()}" | |
| else -> "$key=$value" | |
| } | |
| } | |
| })" | |
| } | |
| fun Intent.contentToString(): String { | |
| return "Intent(action=$action, data=$data, type=$type, component=$component, categories=$categories, flags=$flags, selector=${selector?.contentToString()}, extras=${extras?.contentToString()})" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment