A collection of utility functions and extensions for Android development.
Add the dependency to your app's build.gradle:
implementation("com.paulcoding:androidtools:1.0.0")Initialize AndroidTools in your Application class:
AndroidTools.initialize(context) {
enableLogging = true // Optional, default is true
enableCrashReporting = true // Optional, default is true
}log("Your message") // Prints formatted log message
someValue.alsoLog() // Logs value and returns itcontext.readFile("path/to/file.txt") // Read text file
context.readJSONFile<YourDataClass>("data.json") // Read and parse JSON filemakeToast("Message") // Show short toast
makeToast(R.string.message) // Show toast from string resource// Animated navigation composable with fade transitions
NavGraphBuilder.animatedComposable(
route = "route",
content = { /* Your composable content */ }
)getAppName(context) // Get application name
context.getSignature() // Get app signature detailsActivity Extensions:
window.setSecureScreen(true) // Enable/disable secure screenContext Extensions:
context.openInBrowser("https://example.com") // Open URL in browserList Extensions:
lazyListState.isScrolledToEnd() // Check if LazyList is at the end
lazyListState.isScrollingUp() // Observe scroll directionString Extensions:
"hello".toCapital() // Capitalize first letter
"text".toInputStream() // Convert string to InputStreamPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.