aritraroy / pinlockview Goto Github PK
View Code? Open in Web Editor NEWA clean, minimal, highly customizable pin lock view for Android
License: Apache License 2.0
A clean, minimal, highly customizable pin lock view for Android
License: Apache License 2.0
I would like to see the animation of the last dot appear before my onComplete function runs, is that possible?
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : Attribute application@label value=(CORRIERE) from AndroidManifest.xml:16:9-33
is also present at [com.andrognito.pinlockview:pinlockview:2.1.0] AndroidManifest.xml:11:18-50 value=(@string/app_name).
Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:13:5-39:19 to override.
Changing the "app:dotDiameter" doesn't seem to have any effect and it stays the default diameter. The parameter is not available programmatically. Please look into this.
Would it be possible to have the indicator dots show up as they're being typed (for a non-fixed PIN length) instead of having the number of dots be the length of the PIN?
Hello
Your lib is great
But keypadButtonBackgroundDrawable does not apply correctly
Even when I set
app:keypadButtonBackgroundDrawable="?attr/selectableItemBackgroundBorderless"
it's apply only to zero button
There is a "delete" button on the right side of zero, but fingerprint icon can be added on the left side. Is there any way to do it, or do you plan to include this in the upcoming versions?
Thanks in advance
Hi,
is there any plan to migrate to androidx libraries instead of the old support libraries. currently we cannot use your library unless we enable Jetifier which is not preferred as permanent solution
If I open new Intents or ask for Storage Permissions the PinLockView always opens over it. I want to know why and how I can disable this?
Anyone has an idea?
No matter what I do. The back button is not being shown.
<com.andrognito.pinlockview.PinLockView android:id="@+id/pin_lock_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/indicator_dots" app:keypadButtonSize="72dp" app:keypadTextSize="18dp" app:keypadShowDeleteButton="true" app:keypadTextColor="@color/white" android:layout_centerHorizontal="true" android:layout_marginTop="16dp" />
I can't change the color of empty or filled state of the IndicatorDots neither using "dotEmptyBackground" nor "dotFilledBackground"
How can i disable and enable pin on app startup?
Hello,
I noticed an issue where the back button changes to white when I tap it. This is problematic because I'd like to have a white background. I'm attaching three screenshots that show the keypad before I enter anything, after I've entered three numbers, and after I've pressed the delete button one time. I turned the background color blue to show what I mean.
Any ideas? Thanks!
Hi @aritraroy
it is possible to change the color of ripple effect on click at run time, if yes then how? please help to solve this issue.
**XML UI Like : **
<com.andrognito.pinlockview.PinLockView android:id="@+id/pin_lock_view" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@+id/indicator_dots" android:layout_centerHorizontal="true" android:layout_margin="16dp" app:keypadButtonSize="72dp" app:keypadDeleteButtonDrawable="@drawable/ic_backspace" app:keypadDeleteButtonSize="30dp" app:keypadShowDeleteButton="true" app:keypadTextColor="@color/white" app:keypadTextSize="26dp" />
Thanks.
how change pressed style from squarer to circle like as second screenshot in readme?
Hi,is it possible to add setTypeface methode for buttons in java code? just for setting typeface to buttons i have copied your library file into my project to customize the typeface. I want to add your library in gradle of my project.
thank you
Is there any option to change the dots color programmatically?
A GIF is worth a thousand words:
Here is the drawable (set by app:keypadButtonBackgroundDrawable
):
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/list_item_active" android:state_pressed="true"/>
<item android:drawable="@color/list_item_inactive"/>
</selector>
I am getting same error as #9 please help, how you solved it?
Error I got: error: duplicate value for resource 'attr/indicatorType' with config ''
Seems like there is an attribute conflict with com.google.android.material:material:1.3.0-alpha01.
Can you attach a prefix to the attribute indicatorType?
Hi, I have noticed this behavior when implementing the pinLockView.resetPinLockView()
method, when there is no pin entered or all the characters have been deleted via the backspace button.
After the aforementioned method clears the input (as expected), any subsequent input works as well, but the backspace button does not trigger as far as I can tell and no characters get deleted.
The listener works as well and all three methods get triggered as expected.
My workaround, for now, has been to implement an isPinResettable
flag.
The logic with resetting the pin view is as follows
if (isPinResettable)
pinLockView.resetPinLockView()
And my PinLockListener
object looks like this
private val pinLockListener: PinLockListener = object : PinLockListener {
override fun onEmpty() {
isPinResettable = false
}
override fun onComplete(pin: String?) {
// DO SOME WORK WITH PIN
}
override fun onPinChange(pinLength: Int, intermediatePin: String?) {
if (pinLength > 0)
isPinResettable = true
}
}
i tried to put the PinlockView in a dialog . but it the dialog showed up blank.
Dialog Layout :
`
<com.andrognito.pinlockview.PinLockView
android:id="@+id/pin_lock_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
`
Method to Display it :
public void showDialog(Activity activity) {
final Dialog dialog = new Dialog(activity);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setCancelable(false);
dialog.setContentView(R.layout.pindialogue);
final PinLockView mPinLockView = (PinLockView) dialog.findViewById(R.id.pin_lock_view);
mPinLockView.setPinLength(4);
mPinLockView.setPinLockListener(new PinLockListener() {
@Override
public void onComplete(String pin) {
if (pin.equals("1234")) {
dialog.hide();
}
else {
YoYo.with(Techniques.Shake).duration(700).playOn(mPinLockView);
}
}
@Override
public void onEmpty() {
}
@Override
public void onPinChange(int pinLength, String intermediatePin) {
}
});
dialog.show();
}
Hi, thanks for your good job.
I've implemented this in an application and I like to clear indicator dots when the entered pin is incorrect.
how can I do so?
I need to change the button style for button pressed status. I can not find a way to do it in XML. Is there a way to do that?
Thanks.
A question, how can one change the input type from password to number in case it is a dial pad
Please can you add ability to disable all view to prevent other user touch?
I saw that there's a pull request from like a year ago, and this feature is not yet in master.
#15
Hope this will be added soon,
thanks!
Hi, how can I show a circle background for only the pressed key (as shown in Readme second picture)? I used the keypadButtonBackgroundDrawable attribute but it shows constant background for all buttons.
<com.andrognito.pinlockview.IndicatorDots
android:id="@+id/indicator_dots"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
/>
<com.andrognito.pinlockview.PinLockView
android:id="@+id/pin_lock_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:keypadTextColor="#1565C0"
app:keypadTextSize="20sp"
app:pinLength="4"
app:dotFilledBackground="@drawable/img_indicator_active"/>
Drawable is not changing.
The delete button is clickable and deletes digits, although I set it to invisible
with setShowDeleteButton(false).
Thanks
Is it possible to remove supportsRtl and allowbackup attributes in the manifest file? Gradle sync fails when trying to use this project if my attributes are different.
When using compat library 27.0.0 the app crash when call animatorCompatHelper
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/animation/AnimatorCompatHelper;
at android.support.v7.widget.DefaultItemAnimator.resetAnimation(DefaultItemAnimator.java:515)
at android.support.v7.widget.DefaultItemAnimator.animateChange(DefaultItemAnimator.java:322)
at android.support.v7.widget.SimpleItemAnimator.animateChange(SimpleItemAnimator.java:149)
at android.support.v7.widget.RecyclerView.animateChange(RecyclerView.java:3836)
I created resource selector for keypad pressed effect. However, it causes a weird behavior that highlighted the pressed key and the button "0". Probably, there is something wrong with recycler view.
So if I had the four circles and user entered all four of them, the PIN might be incorrect, and I would like to reset it so they can keep typing instead of erasing it first then typing.
Fatal crash while opening activity. Crash detail:
android.view.InflateException: Binary XML file line #0: Error inflating class ImageView
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:714)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:756)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:759)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at com.andrognito.pinlockview.PinLockAdapter.onCreateViewHolder(PinLockAdapter.java:47)
at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6519)
at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5706)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5589)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5585)
at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2231)
at android.support.v7.widget.GridLayoutManager.layoutChunk(GridLayoutManager.java:556)
at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1518)
at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:610)
at android.support.v7.widget.GridLayoutManager.onLayoutChildren(GridLayoutManager.java:170)
at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3719)
at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:3135)
at android.view.View.measure(View.java:16497)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:719)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:455)
at android.view.View.measure(View.java:16497)
My layout file:
<com.andrognito.pinlockview.PinLockView
android:id="@+id/pin_lock_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/indicator_dots"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
app:keypadButtonSize="72dp"
app:keypadShowDeleteButton="true"
app:keypadDeleteButtonDrawable="@mipmap/ic_imgbackspace"
app:keypadButtonBackgroundDrawable="@mipmap/ic_pinfull"
app:keypadTextColor="@color/colorAccent"
app:keypadTextSize="18dp" />
<Button
android:id="@+id/forgot_pin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:background="@null"
android:text="@string/forgot_pin"
android:textColor="@color/colorAccent" />
Please help. You have built a great library
I'm aware of that I can access the pin via listeners like onComplete, onProgress and so on..
However, some scenarios require accessing the pin or its length on demand.
Use case:
UI shows PinLockView and "next" button.
User clicks the next button.
It is obvious now that I shouldn't let the user go through to the next activity because the pin is not completed yet.
The current way to deal with this scenario is to set a boolean state flag that indicates if the user can go to the next activity, it will be set to True when the onComplete is called.
However, I'll then have to reset this boolean flag once the user has clicked the "next" button
Better way:
Each time user clicks the next button, I'll be able check the PinLockView and check if the current pin length is as defined, if yes, the user is eligible to move next.
That way, there will be no need to keep a statefull boolean which might be buggy solution as well..
How to clear field if password is wrong
Hi, I'm Minseok from Korea.
I like your project, but to import this in my project, I have to refactor some code.
So, I forked this on my repository and converted to kotlin with refactoring code structure.
You can see the code HERE
What about make it new version? :)
Thank you
can i clear indicatordot? i wanna use indicatordot for verif my pin, so when pin i was input wrong indicatordot will clear. please help
I have encountered a strange bug. In one of my activities the keypad delete button cannot be used even though it is set to true in the XML and is visible. This only occurs in one activity, all other activities function correctly.
This is my xml for the layout (identical to one that works in another activity):
<com.andrognito.pinlockview.PinLockView
android:id="@+id/activeTaskViewPinLockView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="48dp"
app:keypadButtonSize="72dp"
app:keypadShowDeleteButton="true"
app:keypadTextColor="@color/white"
app:keypadTextSize="18dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
in onCreate I set it up:
pinLockView.attachIndicatorDots(pinLockIndicatorDots);
pinLockView.resetPinLockView();
pinLockListener = new PinLockListener() {
@Override
public void onComplete(String pin) {
//do stuff
}
@Override
public void onEmpty() {
}
@Override
public void onPinChange(int pinLength, String intermediatePin) {
}
};
pinLockView.setPinLockListener(pinLockListener);
This code is identical to that of a working activity. So I am stumped as to what is causing it.
Any ideas?
How can I use bold text in PinLockView keypad?
`
<com.andrognito.pinlockview.IndicatorDots
android:id="@+id/indicator_dots"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/profile_name"
android:layout_centerHorizontal="true"
android:layout_marginTop="36dp"
app:dotDiameter="12dp"
app:dotSpacing="16dp" />
<com.andrognito.pinlockview.PinLockView
android:id="@+id/pin_lock_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/indicator_dots"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
app:dotFilledBackground="@drawable/dot_filled"
app:keypadButtonSize="72dp"
app:keypadDeleteButtonPressedColor="#C8C8C8"
app:keypadDeleteButtonSize="16dp"
app:keypadShowDeleteButton="true"
app:keypadTextColor="@color/white"
app:keypadTextSize="18dp" />`
I set PinLockView widget's pinlenght = 6. It'll crash when entering the 5th digits. It seems default PIN length is 4.
Error log below
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setBackgroundResource(int)' on a null object reference at com.andrognito.pinlockview.IndicatorDots.fillDot(IndicatorDots.java:148) at com.andrognito.pinlockview.IndicatorDots.updateDot(IndicatorDots.java:107) at com.andrognito.pinlockview.PinLockView$1.onNumberClicked(PinLockView.java:46) at com.andrognito.pinlockview.PinLockAdapter$NumberViewHolder$1.onClick(PinLockAdapter.java:191)
first of all, thank you for your library!
the PinLockView does not visible number 4 my LG G3.Cat6 device.
i think, can you solve it with little edit to PinLockAdapter.
please see below lines(PinLockAdapter.java: 70):
if (position == 10) {
holder.mNumberButton.setText("0");
} else if (position == 9) {
holder.mNumberButton.setVisibility(View.INVISIBLE);
} else {
holder.mNumberButton.setText(String.valueOf((position + 1) % 10));
}
edit to:
if (position == 10) {
holder.mNumberButton.setText("0");
holder.mNumberButton.setVisibility(View.VISIBLE);
} else if (position == 9) {
holder.mNumberButton.setVisibility(View.INVISIBLE);
} else {
holder.mNumberButton.setText(String.valueOf((position + 1) % 10));
holder.mNumberButton.setVisibility(View.VISIBLE);
}
how think about it?
How to fix?
android.view.InflateException: Binary XML file line #9: Error inflating class android.widget.Button at android.view.LayoutInflater.createView(LayoutInflater.java:640) at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55) at android.view.LayoutInflater.onCreateView(LayoutInflater.java:689) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:748) at android.view.LayoutInflater.rInflate(LayoutInflater.java:813) at android.view.LayoutInflater.inflate(LayoutInflater.java:511) at android.view.LayoutInflater.inflate(LayoutInflater.java:415) at com.andrognito.pinlockview.PinLockAdapter.onCreateViewHolder(PinLockAdapter.java:41)
Error here:
PinLockAdapter.class
@Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { RecyclerView.ViewHolder viewHolder; if (viewType == VIEW_TYPE_NUMBER) { View view = View.inflate(parent.getContext(),R.layout.layout_number_item, null); viewHolder = new NumberViewHolder(view); } else { View view = View.inflate(parent.getContext(),R.layout.layout_delete_item, null); viewHolder = new DeleteViewHolder(view); } return viewHolder; }
Error when:
...
//from service:
view_pin = View.inflate(this, R.layout.activity_lock_pin, null);
...
<com.andrognito.pinlockview.PinLockView android:id="@+id/pin_lock_view_Pin" android:layout_width="300dp" android:layout_height="wrap_content" />
java.lang.ArrayIndexOutOfBoundsException:
at com.andrognito.pinlockview.PinLockAdapter.configureNumberButtonHolder (PinLockAdapter.java:69)
at com.andrognito.pinlockview.PinLockAdapter.onBindViewHolder (PinLockAdapter.java:57)
at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder (RecyclerView.java:6781)
at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder (RecyclerView.java:6823)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline (RecyclerView.java:5752)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline (RecyclerView.java:6019)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition (RecyclerView.java:5858)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition (RecyclerView.java:5854)
at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next (LinearLayoutManager.java:2230)
at androidx.recyclerview.widget.GridLayoutManager.layoutChunk (GridLayoutManager.java:557)
at androidx.recyclerview.widget.LinearLayoutManager.fill (LinearLayoutManager.java:1517)
at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren (LinearLayoutManager.java:612)
at androidx.recyclerview.widget.GridLayoutManager.onLayoutChildren (GridLayoutManager.java:171)
at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2 (RecyclerView.java:3924)
at androidx.recyclerview.widget.RecyclerView.onMeasure (RecyclerView.java:3336)
at android.view.View.measure (View.java:23393)
at android.widget.RelativeLayout.measureChildHorizontal (RelativeLayout.java:715)
at android.widget.RelativeLayout.onMeasure (RelativeLayout.java:461)
at android.view.View.measure (View.java:23393)
at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:6966)
at android.widget.FrameLayout.onMeasure (FrameLayout.java:185)
at android.view.View.measure (View.java:23393)
at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:6966)
at android.widget.FrameLayout.onMeasure (FrameLayout.java:185)
at androidx.appcompat.widget.ContentFrameLayout.onMeasure (ContentFrameLayout.java:143)
at android.view.View.measure (View.java:23393)
at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:6966)
at android.widget.LinearLayout.measureChildBeforeLayout (LinearLayout.java:1514)
at android.widget.LinearLayout.measureVertical (LinearLayout.java:806)
at android.widget.LinearLayout.onMeasure (LinearLayout.java:685)
at android.view.View.measure (View.java:23393)
at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:6966)
at android.widget.FrameLayout.onMeasure (FrameLayout.java:185)
at android.view.View.measure (View.java:23393)
at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:6966)
at android.widget.LinearLayout.measureChildBeforeLayout (LinearLayout.java:1514)
at android.widget.LinearLayout.measureVertical (LinearLayout.java:806)
at android.widget.LinearLayout.onMeasure (LinearLayout.java:685)
at android.view.View.measure (View.java:23393)
at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:6966)
at android.widget.FrameLayout.onMeasure (FrameLayout.java:185)
at com.android.internal.policy.DecorView.onMeasure (DecorView.java:915)
at android.view.View.measure (View.java:23393)
at android.view.ViewRootImpl.performMeasure (ViewRootImpl.java:2952)
at android.view.ViewRootImpl.measureHierarchy (ViewRootImpl.java:1977)
at android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:2236)
at android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:1843)
at android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:7978)
at android.view.Choreographer$CallbackRecord.run (Choreographer.java:911)
at android.view.Choreographer.doCallbacks (Choreographer.java:723)
at android.view.Choreographer.doFrame (Choreographer.java:658)
at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:897)
at android.os.Handler.handleCallback (Handler.java:790)
at android.os.Handler.dispatchMessage (Handler.java:99)
at android.os.Looper.loop (Looper.java:164)
at android.app.ActivityThread.main (ActivityThread.java:7002)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:441)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1408)
Hi, I am not sure why but when user type in the number into the pinlockview, the last of the indicator dot is not filled even though a number is typed in :(
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.