chaosleung / pinview Goto Github PK
View Code? Open in Web Editor NEWA PIN view library for Android. Use to enter PIN/OTP/password etc.
License: Apache License 2.0
A PIN view library for Android. Use to enter PIN/OTP/password etc.
License: Apache License 2.0
Hi, awesome work.
It would be nice if you could add the feature to change font family with the new feature added in support lib 26 font in XML.
Thank you for this library! 💪
Is there a way to make the line under the focused character blink?
I tried adding statlistanimator but didn't get it to work.
What kind of issue is this?
Is there a clever way to let the user switch between hide and view password in an android PinView? A number of apps let the user do this.
In layout file I have by defauult made the PinVew's password label to true, now I want to disable the view using a button. In code i tried pinView.setTransformationMethod(new PasswordTransformationMethod());
but it doesn't do anything.
What kind of issue is this?
Latest version 1.4.2 is not working with AndoridX support libraries.
What kind of issue is this?
Question. If you want to ask how to do something, or to understand why something isn't
working the way you expect it to.
Bug report. Please provide your device name, device OS version, and describe the reproduction steps.
Feature Request. Telling us what problem you’re trying to solve.
In case of inputType password the input should be first shown as text for a glance and then hide it just like native widget acts with password field.
There should be some kind of visual feedback (shaking, blinking, ...) if all fields are already filled and another number is entered.
How can i go to next activity when i put full fill text
Question.
Copy paste functionality not working in pinview even setting
android:textIsSelectable="true" on the com.chaos.view.PinView
it seems that user is able to proceed, but digits are not shown, which is undesirable
PinView is in a RecyclerView, code is below.
got a video:
class BmgPinView(
val pin: String,
val callback: (String) -> Unit,
) : DisplayDiffItem(R.layout.item_bmg_pinview, "bmg_pin", "") {
class ViewHolder(view: View) : DisplayViewHolder<BmgPinView>(view) {
override fun bind(item: BmgPinView) {
pin_view.setText(item.pin)
pin_view.doAfterTextChanged {
item.callback(it)
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/activity_horizontal_margin"
android:layout_marginTop="16dp">
<com.chaos.view.PinView
android:id="@+id/pin_view"
style="@style/PinWidget.PinView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:cursorVisible="true"
android:imeOptions="actionDone"
android:inputType="number"
android:paddingTop="20dp"
android:paddingBottom="10dp"
android:textSize="16sp"
app:itemCount="4"
app:itemHeight="65dp"
app:itemRadius="15dp"
app:itemWidth="65dp"
app:lineColor="@color/defaultBg"
tools:text="1234" />
</FrameLayout>
Hey, I'm trying to read SMS pin automatically. But I didn't find setValue or etc in Java. How can I set a value?
What kind of issue is this?
I am using PinView as a toggle option for password input with the show and hide option where I am changing showing and hiding number using InputType.TYPE_CLASS_NUMBER and InputType.TYPE_NUMBER_VARIATION_PASSWORD. But while toggling between the showing and hiding thing, the soft keyboard is also changing.
Is there a way to have consistent keyboard?
Hi, do not work auto open keyboard for view. I can't open implicit too.
Hello, @chaosleong
I have a proposal for a little enhancement. I think it's a usual UX that when you entered the symbol in PinView the line (or rectangle) under it is not drawn.
Would you mind if I will realize that little feature through additional attribute?
.callOnClick() does nothing, Adding OnClickListener shows that onClick was called programmatically, but keyboard not shown. Keyboard will appear only after manually click.
Please fix it ASAP
<com.chaos.view.PinView
android:id="@+id/pin_view"
style="@style/PinWidget.PinView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="48dp"
android:cursorVisible="false"
android:focusable="true"
android:focusableInTouchMode="true"
android:imeOptions="flagNoFullscreen"
android:inputType="numberPassword"
android:textColor="@color/grey"
android:textSize="18sp"
app:itemCount="4"
app:itemHeight="36dp"
app:itemRadius="18dp"
app:itemSpacing="16dp"
app:itemWidth="36dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/txt_description"
app:lineColor="@color/grey"
app:lineWidth="2dp"
app:viewType="rectangle" />
I'm using the above code and the app crashes with the following:
Caused by java.lang.RuntimeException The itemRadius can not be greater than itemWidth
com.chaos.view.PinView.checkItemRadius (PinView.java:193)
com.chaos.view.PinView. (PinView.java:150)
com.chaos.view.PinView. (PinView.java:104)
The radius is exactly half the item width but the app crashes.
Happening on Galaxy S3, S7 and Pixel 2 XL
hi,
how can I get text or char from pinView to compare written text and my default pin.Thanks in advance
I have the same issue. In Arabic its not working, why? Here is my question
https://stackoverflow.com/questions/48438534/pinview-not-showing-for-arabic-language
Suppose I enter 5 numbers in the edit text & I want to edit item at 2nd position only, so now I have delete all the items from the last till 2nd to edit one particular item. Is it possible to place cursor at particular item and delete only that item instead of all the items leading up to it.
Please give support for custom masking of password field like masking of entered text with asterik because right now it is by default drawing circle and I couldnt find any way to change that.
I have already doing this using below code but it is still drawing the circle as mask of entered text,
val asterik = AsteriskPasswordTransformationMethod()
firstPinView.transformationMethod = asterik
public class AsteriskPasswordTransformationMethod extends PasswordTransformationMethod {
@Override
public CharSequence getTransformation(CharSequence source, View view) {
return new PasswordCharSequence(source);
}
private class PasswordCharSequence implements CharSequence {
private CharSequence mSource;
public PasswordCharSequence(CharSequence source) {
mSource = source; // Store char sequence
}
public char charAt(int index) {
return '*'; // This is the important part
}
public int length() {
return mSource.length(); // Return default
}
public CharSequence subSequence(int start, int end) {
return mSource.subSequence(start, end); // Return default
}
}
}
-I have added this library to my android project and everything was working fine until I added design support library ( 'com.android.support:design:27.1.1'), after adding this my gradle build failed with following error
Caused by: org.gradle.internal.UncheckedException: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed MyAppDirectory\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2489: error: duplicate value for resource 'attr/itemBackground' with config ''.
and when I remove the design support library dependency then everything becomes fine.
Complete problem description : https://stackoverflow.com/questions/51709716/android-resource-compilation-failed
What kind of issue is this?
is Any option to add new method to change the background, maybe we can replace the square or the box just for a line
It shows a circle as echo character is it possible to change it to *
Is there a way to make a cursor appear on the current input box?
I tried to run my application with this pin view layout in the tablet with version 4.4.2 and it goes break off i.e., a message pop up with "Unfortunately, it stops working." But it is working fine on version 5 ( lollipop ).
What kind of issue is this?
Question. If you want to ask how to do something, or to understand why something isn't
working the way you expect it to.
Bug report. Please provide your device name, device OS version, and describe the reproduction steps.
[1] Feature Request. Telling us what problem you’re trying to solve.
For some reason using viewType="line" does not produce a line, but has some odd coloring on the sides. Below is the snippet of code I am using as well as a screenshot
<com.chaos.view.PinView android:id="@+id/pinView" style="@style/PinWidget.PinView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:inputType="number" android:singleLine="true" app:itemCount="6" app:lineWidth="2dp" app:viewType="line" />
Hello,
I'm using pinView version 1.4.4 but, when I change viewType to "line", I will get an error inflating
How to set listener for pinView there is no guideline in repo
I'm trying to do something like this:
app:lineColor="@{viewmodel.isError ? @drawable/selector_pin_view_error : @drawable/selector_pin_view}"
but there is no setter for attribute "app:lineColor" with parameter type Drawable. Worth mentioning that databinding does work with colors, like this:
app:lineColor="@{viewmodel.isError ? @color/error : @color/default}"
Feature request: allow to change background of filled item
Hi this library not working for android 9 api 28 in which it try to convert from java to androidx.
below error code come out when run in android studio.
`Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0-rc02] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.0.0-rc01] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory). Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml:5:5-19:19 to override.`
In RTL mode, when I add text, pinview disappears.
Any solution?
Hi,
I have tried many methods just to bring the keyboard, but it doesn't appear. I used its method to showSoftInput but still nothing.
Does any one have got the same problem?
Is there a way to highlight current pin item? it's to know what item is focused.
Would be possible to prefix the attrs
values in order to not conflict with other libraries?
At the moment, the attribute attr/viewType
conflicts with one with the same name in the new Androidx Media2 library androidx.media2:media2-widget
. Prefixing to something like pin_viewType
pin_backgroundColor
would almost 100% prevent conflict issues of attributes.
I'm using this view to receive PIN from user and if PIN is incorrect - pin field is must cleared and appropriate message is shown.
So when pinView.setText(null);
method is called - i can't enter PIN again, because keyboard is not showed anymore (does not matter which cell is clicked).
Currently, there's gap between the stroke and the circle that gets drawn when user enters pin.
Is there any way to remove the gap?
Also, is there another option where we can have filled circles for default state and same look with different colour when pin is entered?
What kind of issue is this?
Question. If you want to ask how to do something, or to understand why something isn't
working the way you expect it to.
Bug report. Please provide your device name, device OS version, and describe the reproduction steps.
Feature Request. Telling us what problem you’re trying to solve.
JCenter is shutting down, are there plans to migrate? - https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/
What kind of issue is this?
What kind of issue is this?
Question. If you want to ask how to do something, or to understand why something isn't
working the way you expect it to.
Bug report. Please provide your device name, device OS version, and describe the reproduction steps.
Feature Request. Telling us what problem you’re trying to solve.
Hi and first, thank you for this great lib ! 👍
I would like to set a larger spacing between 2 items than between the others. Something like that :
How can I do it please ?
Thank you in advance
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.