Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to change color when its wrong #12

Open
ArbazMateen opened this issue Jan 9, 2018 · 2 comments
Open

how to change color when its wrong #12

ArbazMateen opened this issue Jan 9, 2018 · 2 comments

Comments

@ArbazMateen
Copy link

how to change color like you did in second screenshot

@markusressel
Copy link

Use these attributes in your xml layout:

app:correctStateColor="@color/md_green_A400"
app:normalStateColor="@color/white"
app:wrongStateColor="@color/md_red_A700"

f.ex.:

<com.andrognito.patternlockview.PatternLockView
            android:id="@+id/patternLockView"
            android:layout_width="280dp"
            android:layout_height="280dp"
            app:correctStateColor="@color/md_green_A400"
            app:normalStateColor="@color/white"
            app:wrongStateColor="@color/md_red_A700" />

then in your activity setup a listener for your PatternLockView
and change it's ViewMode after you validated the pattern:

// if the pattern was correct:
patternLockView.setViewMode(PatternLockView.PatternViewMode.CORRECT)
// if the pattern was wrong:
patternLockView.setViewMode(PatternLockView.PatternViewMode.WRONG)

to reset the color (and pattern) just call:

patternLockView.clearPattern()

@EhsanMashhadi
Copy link

I did what you said but the color not change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants