WPatternLock: Android jetpack compose pattern lock library

Overview

WPatternLock

android jetpack compose pattern lock library

  • easy to use
  • customizable
  • beautiful design

Installation

install WPatternLock library from jitpack.io repository

step 1 : Add the JitPack repository to your build file

allprojects {
    repositories {
	...
	maven { url 'https://jitpack.io' }
    }
}

step 2 : Add WPatternLock the dependency

dependencies {
    implementation 'com.github.amirhwsyn:WPatternLock:5.0.0'
}

Usage

Use WPatternLock in composeable block

WPatternLock(
    size = 400.dp,
    // key -> sorted list of dots id that must connect
    key = arrayListOf(0, 1, 2),
    dotColor = Color.White,
    dotRadius = 18f,
    lineColor = Color.White,
    lineStroke = 12f,
    callback = object : WPatternLockCallback {
        override fun onStart() {
            // when wirting pattern start    
        }
        override fun onProgress(index: Int) {
            // when writing and new dot connected
            // index -> dot id
            // dots are sorted from left to right and up to down
        }
        override fun onEnd(result: ArrayList<Int>, isCorrect:Boolean) {
            // when writing pattern end
            // result -> connected dots during writing
            // isCorrect -> check if writed pattern correct based on key parameter
        }
    }
)

Exampel

preview :

Alt Text

code :

Column(
    modifier = Modifier.fillMaxSize(),
    horizontalAlignment = Alignment.CenterHorizontally,
    verticalArrangement = Arrangement.Center
) {
    WPatternLock(
        size = 400.dp,
        key = arrayListOf(0, 1, 2, 5, 8),
        dotColor = Color.White,
        dotRadius = 18f,
        lineColor = Color.White,
        lineStroke = 12f,
        callback = object : WPatternLockCallback {
            override fun onStart() {
                Toast.makeText(this@MainActivity,"start!",Toast.LENGTH_LONG).show()
            }
            override fun onProgress(index: Int) {
                Toast.makeText(this@MainActivity,"dot $index connected!",Toast.LENGTH_LONG).show()
            }
            override fun onEnd(result: ArrayList<Int>, isCorrect:Boolean) {
                Toast.makeText(this@MainActivity,"pattern was ${if (isCorrect) "correct" else "wrong"}",Toast.LENGTH_LONG).show()
            }
        }
    )
}
You might also like...
This is a sample app(For beginners - App #2) built using Jetpack Compose. It demonstrates the concept of State Hoisting in Jetpack Compose.
This is a sample app(For beginners - App #2) built using Jetpack Compose. It demonstrates the concept of State Hoisting in Jetpack Compose.

JetBMICalculator This is a sample app(For beginners - App #2) built using Jetpack Compose. It demonstrates the concept of State Hoisting in Jetpack Co

Jetpack-Compose-Demo - Instagram Profile UI using Jetpack Compose
Jetpack-Compose-Demo - Instagram Profile UI using Jetpack Compose

Jetpack-Compose-Demo Instagram Profile UI using Jetpack Compose

Jetpack-compose-animations-examples - Cool animations implemented with Jetpack compose
Jetpack-compose-animations-examples - Cool animations implemented with Jetpack compose

Jetpack-compose-animations-examples This repository consists of 4 animations: St

Compose-navigation - Set of utils to help with integrating Jetpack Compose and Jetpack's Navigation

Jetpack Compose Navigation Set of utils to help with integrating Jetpack Compose

Jetpack-compose-uis - A collection of some UIs using Jetpack Compose. built using Katalog

Jetpack Compose UIs This is a collection of some UIs using Jetpack Compose. It i

A simple authentication application using Jetpack compose to illustrate signin and sign up using Mvvm, Kotlin and jetpack compose
A simple authentication application using Jetpack compose to illustrate signin and sign up using Mvvm, Kotlin and jetpack compose

Authentication A simple authentication application using Jetpack compose to illustrate signin and sign up using Mvvm, Kotlin and jetpack compose Scree

Android.compose.squircle - Android LightWeight Squircle Library for JetPack Compose

Android LightWeight Squircle Library for JetPack Compose Usage Based on Compose

A Kotlin library to use Jetpack Compose in Android and iOS. Allow to write UI for both in Kotin. Still experimental as many compose features are not yet available.
A Kotlin library to use Jetpack Compose in Android and iOS. Allow to write UI for both in Kotin. Still experimental as many compose features are not yet available.

Multiplatform Compose A Kotlin library to use Jetpack Compose in Android and iOS. Allow to write UI for both in Kotin. Still experimental as many comp

Compose Curved-Scroll is an Android Jetpack Compose library made with ❤️
Compose Curved-Scroll is an Android Jetpack Compose library made with ❤️

Compose-Curved-Scroll-library Compose Curved-Scroll is an Android Jetpack Compos

Releases(6.0.0)
Owner
amirhossin
amirhossin
Lock Screen-Compose - Lock Screen with Jetpack Compose

Lock_Screen-Compose 此專案為Jetpack Compose練習題.

Kanneki Chen 0 Jan 26, 2022
Android App made by Jetpack Compose Components with Kotlin, MVVM Pattern, Multi Module, Navigation, Hilt, Coroutines, Retrofit and cached data by Room

Android App made by Jetpack Compose Components with Kotlin, MVVM Pattern, Multi Module, Navigation, Hilt, Coroutines, Retrofit and cached data by Room

Yogi Dewansyah 13 Aug 31, 2022
Android App made by Jetpack Compose Components with Kotlin, MVVM Pattern, Multi Module, Navigation, Hilt, Coroutines, Retrofit and cached data by Room

Mobile Banking Android App made by Jetpack Compose Components with Kotlin, MVVM Pattern, Multi Module, Navigation, Hilt, Coroutines, Retrofit and cach

Yogi Dewansyah 13 Aug 31, 2022
An implementation of the Bloc pattern for Kotlin and Jetpack Compose

Kotlin Bloc An implementation of the Bloc pattern for Kotlin and Jetpack Compose. Documentation Documentation is available here: https://ptrbrynt.gith

Peter Bryant 21 Dec 7, 2022
FullMangement - an application that helps you manage your tasks effectively. built with the latest tachs like Compose UI, Jetpack libraries, and MVVM design pattern.

Full Management is an application that helps you manage your tasks effectively. built with the latest tachs like Compose UI, Jetpack libraries and MVVM design pattern.

Amr algnyat 4 Nov 1, 2022
A sample project in Kotlin to demonstrate Jetpack Compose, MVVM, Coroutines, Hilt, Room, Coil, Retrofit, Moshi, Leak Canary and Repository pattern

Jetpack-Compose-Boilerplate This repository contains a sample project in Kotlin to demonstrate Jetpack Compose, MVVM, Coroutines, Hilt, Room, Coil, Re

Areg Petrosyan 14 Dec 12, 2022
Carol 12 Sep 25, 2022
Learn Jetpack Compose for Android by Examples. Learn how to use Jetpack Compose for Android App Development. Android’s modern toolkit for building native UI.

Learn Jetpack Compose for Android by Examples. Learn how to use Jetpack Compose for Android App Development. Android’s modern toolkit for building native UI.

MindOrks 382 Jan 5, 2023
Jetpack Compose Boids | Flocking Insect 🐜. bird or Fish simulation using Jetpack Compose Desktop 🚀, using Canvas API 🎨

?? ?? ?? Compose flocking Ants(boids) ?? ?? ?? Jetpack compose Boids | Flocking Insect. bird or Fish simulation using Jetpack Compose Desktop ?? , usi

Chetan Gupta 38 Sep 25, 2022
A collection of animations, compositions, UIs using Jetpack Compose. You can say Jetpack Compose cookbook or play-ground if you want!

Why Not Compose! A collection of animations, compositions, UIs using Jetpack Compose. You can say Jetpack Compose cookbook or play-ground if you want!

Md. Mahmudul Hasan Shohag 186 Jan 1, 2023