📘 AppUtils Documentation

Examples: Gradle KTS, Gradle (Groovy), and Kotlin — (No Java examples)

🔹 Download & Setup (Gradle KTS & Groovy)

Add JitPack and library dependency. Choose the block for your Gradle DSL.
Kotlin DSL (build.gradle.kts)

repositories {
    maven { url = uri("https://jitpack.io") }
}dependencies { implementation("com.github.mohamed-zaitoon:apputils:1.4.1") } 
Groovy DSL (build.gradle)

repositories {
    maven { url 'https://jitpack.io' }
}dependencies { implementation 'com.github.mohamed-zaitoon:apputils:1.4.1' } 

🔹 Initialize AppUtils (Kotlin)

Call from Application.onCreate and register lifecycle callbacks.

class MyApplication : Application() {
   
override fun onCreate() {
    super.onCreate()
    AppUtils.initialize(this)
    registerActivityLifecycleCallbacks(AppUtils.activityTracker)
}

} 

🔹 Toast (Kotlin)


AppUtils.showToast("Hello World")
AppUtils.showToast("Long Toast", long = true)
    

🔹 Connectivity (Kotlin)


val connected = AppUtils.isConnected
AppUtils.addConnectionListener { isOnline ->
    AppUtils.showToast("Network changed: $isOnline")
}
    

🔹 Clipboard (Kotlin)


AppUtils.copyText("Copied text")
val copied = AppUtils.getCopiedText()
    

🔹 Device Info (Kotlin)


val model = AppUtils.getDeviceModel()
val version = AppUtils.getAndroidVersion()
    

🔹 Permissions (Kotlin)


AppUtils.requestPermission(this, Manifest.permission.CAMERA, 1001)
    

🔹 Keyboard (Kotlin)


AppUtils.hideKeyboard(this)
    

🔹 Sharing (Kotlin)


AppUtils.shareText(this, "Hello from AppUtils!")
    

🔹 Vibration (Kotlin)


AppUtils.vibrate(300)
AppUtils.vibratePattern(longArrayOf(0,200,100,300), -1)
    

🔹 Open URL (Kotlin)


AppUtils.openUrl(this, "https://google.com")
    

🔹 Screen Capture (Kotlin)


AppUtils.blockCapture()
AppUtils.unblockCapture()
    

🔹 Notification (Kotlin)


val intent = Intent(this, ExampleActivity::class.java)
val pendingIntent = PendingIntent.getActivity(
    this,
    0,
    intent,
    PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
)AppUtils.showNotification( channelId = "default_channel", title = "Hello", text = "This is a notification", iconResId = R.drawable.ic_launcher, intent = pendingIntent ) 

🔹 App Signatures (Kotlin)


val signatures = AppUtils.getAppSignatures()
val valid = AppUtils.validateAppSignature("YOUR_SHA1")
    

🔹 Full Usage Flow — All Functions (Kotlin)


class DemoActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_demo)AppUtils.setLanguage("en")
    val lang = AppUtils.loadLanguage()
    val connected = AppUtils.isConnected
    AppUtils.addConnectionListener { isOnline ->
        AppUtils.showToast("Network: $isOnline")
    }
    AppUtils.showToast("Hello")
    val model = AppUtils.getDeviceModel()
    val version = AppUtils.getAndroidVersion()
    AppUtils.showDialog("Device Info", "$model\\n$version")
    AppUtils.log("TAG", "Message")
    AppUtils.requestPermission(this, Manifest.permission.CAMERA, 1001)
    AppUtils.hideKeyboard(this)
    AppUtils.shareText(this, "Sharing text")
    AppUtils.vibrate(300)
    AppUtils.vibratePattern(longArrayOf(0,200,100,300), -1)
    AppUtils.openUrl(this, "https://google.com")
    AppUtils.blockCapture()
    AppUtils.unblockCapture()
    AppUtils.showNotification("default_channel", "Hi", "Test Notification", R.drawable.ic_launcher_foreground)
    val signatures = AppUtils.getAppSignatures()
    val valid = AppUtils.validateAppSignature("SHA1")
    AppUtils.copyText("Copied text")
    val copied = AppUtils.getCopiedText()
}

} 

🔹 License

This license text is now copyable via the button.

Copyright (c) 2025 Mohamed Zaitoon