Anwaarullah
Anwaarullah

Reputation: 227

Need working solution to use Android Pattern Lock Screen in custom Application (and not source code redirects)

I'd like to use the Android Lock Screen Pattern in my custom application while opening the app. I've searched a lot, but everyone asks to use the LockScreenUtils.java class from the source code. I'm having a tough time doing this.

One post on stackoverflow asks to make custom 3x3 matrix with a button on each cell and listen for the selection pattern, but then that doesn't look artistically good :)

Any thoughts or suggestions on how do I implement this?

Thanks!!!

Upvotes: 11

Views: 2548

Answers (2)

Anwaarullah
Anwaarullah

Reputation: 227

After struggling with those custom buttons, spending time digging out the LockPattern Source from the AOSP, I stumbled upon this awesome library which solved my problem. Hope it helps you out as well.

Android Lock Pattern Library

Upvotes: 2

not all wrong
not all wrong

Reputation: 642

Doing it manually, you could just have a single View, and manually draw some nice graphics at the 9 points you want. Then just listen for any MotionEvent; if it's within a 'button zone' that hasn't been touched before, mark it as pushed (and change the graphics) and add a pretty line joining it to the last touched 'button' to the stuff to draw.

So all you need is:

  • A View with some simple customized rendering code and nice 'on'/'off' graphics for the buttons.
  • A list of 'button zones', with coordinates and 'on'/'off' states.
  • A list of the buttons pushed so far, used to store the pattern entered and to draw lines for the sequence so far.

This should be easier to improve the appearance of than buttons in a table.

Upvotes: 1

Related Questions