Skip to content

paulcoding810/android-tools

Repository files navigation

AndroidTools

Maven Central

A collection of utility functions and extensions for Android development.

Installation

Add the dependency to your app's build.gradle:

implementation("com.paulcoding:androidtools:1.0.0")

Usage

Initialize AndroidTools in your Application class:

AndroidTools.initialize(context) {
    enableLogging = true // Optional, default is true
    enableCrashReporting = true // Optional, default is true
}

Features

Logging

log("Your message") // Prints formatted log message
someValue.alsoLog() // Logs value and returns it

File Operations

context.readFile("path/to/file.txt") // Read text file
context.readJSONFile<YourDataClass>("data.json") // Read and parse JSON file

Toast Messages

makeToast("Message") // Show short toast
makeToast(R.string.message) // Show toast from string resource

Navigation

// Animated navigation composable with fade transitions
NavGraphBuilder.animatedComposable(
    route = "route",
    content = { /* Your composable content */ }
)

App Info

getAppName(context) // Get application name
context.getSignature() // Get app signature details

Extensions

Activity Extensions:

window.setSecureScreen(true) // Enable/disable secure screen

Context Extensions:

context.openInBrowser("https://example.com") // Open URL in browser

List Extensions:

lazyListState.isScrolledToEnd() // Check if LazyList is at the end
lazyListState.isScrollingUp() // Observe scroll direction

String Extensions:

"hello".toCapital() // Capitalize first letter
"text".toInputStream() // Convert string to InputStream

License

MIT

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Releases

No releases published

Packages

 
 
 

Contributors

Languages