The Passcode Android Jetpack Library is tool designed to simplify the implementation of passcode functionality in Android applications. It is built on top of the Android Jetpack components, which provide a set of libraries and guidelines to develop robust and efficient Android apps.
- Number Passcode
- Drag Passcode
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add the desired calendar library (view or compose) to your app build.gradle
:
dependencies {
// The compose passcode library
implementation 'implementation 'com.github.Poojan29:ComposePasscode:<latest-version>'
}
You can find the latest version of the library on the JitPack badge above.
Implement PasscodeListener
in your Activity
private var passcodeManager: PasscodeManager = PasscodeManager() // Available from the library
private var passcodeViewModel: PasscodeViewModel = PasscodeViewModel(passcodeManager) // Available from the library
@Composable
fun MainScreen() {
// just add Passcode or DraggablePasscode composable function
PasscodeScreen(
viewModel = passcodeViewModel,
this,
passcodeManager
)
DraggablePasscode(
dragViewModel = passcodeViewModel,
this,
passcodeManager
)
}
Based on user input you will get passcode in onPassCodeReceive
callback function.
Please not that you can check entered passcode with PasscodeManager
override fun onPassCodeReceive(passcode: String) {
if (passcodeManager.getSavedDragPasscode() == passcode) {
// Navigate to new screen
} else {
// Show error message
}
}
Do support us by giving a ⭐ to the repository! :-)