santalu / maskara Goto Github PK
View Code? Open in Web Editor NEWA simple way to format text fields without getting affected by input filters
License: Apache License 2.0
A simple way to format text fields without getting affected by input filters
License: Apache License 2.0
Wanted to use with letters only and on delete action, the last character gets deleted and the cursor jumps to the very beginning of the text
Hi Mr. Fatih..
Thanks for this nice library,,
i've used it since 1.0.9,
got error after migrating to androidx & updated this lib to version 1.1.0,
Should i updated it or better stay in v1.0.9?
How to use it for : IP Mask
example :
192.168.0.1
198.168.127.250
every part : 0..255
also with hint like :
input ip : xxx.xxx.xxx.xxx
Hi,
I am using your mask edittext. It works fine in a normal user case but it fails when i edit a phone number from between
(568) 766-4444
Mask :- (###) ###-####
And then if i put the cursor in between, let say near the "-" and press backspace on the keyboard multiple times, so now the phone number becomes :-
()))) )----85
implementation 'com.github.santalu:mask-edittext:1.0.7'
right
I am getting this compile time error
Hi, you're project is great and I noticed you have a update [1.0.0 -> 1.1.1].
Is it possible to get a change log or release notes on what changed from these two versions? Would love to know if there bug fixes or performance improvements!
Strange behaviour: use this example
<com.santalu.maskedittext.MaskEditText
android:id="@+id/etPhoneNumber"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="some text"
android:inputType="text"
app:met_mask="## ## ## ## ## ## ## ##"/>
At runtime, put some characters, than delete some of them using back button, do this action (put some characters than delete some ones) more times (twice or three).
As result i see some characters repeated.
hitting on the Edit Text multiple times for showing keyboard
Hello, Dear Developer.
Using the following code and format
<com.santalu.maskedittext.MaskEditText
android:id="@+id/maskEditText"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="21dp"
android:layout_marginLeft="21dp"
android:layout_marginTop="25dp"
android:layout_marginEnd="21dp"
android:layout_marginRight="21dp"
android:background="@drawable/rounded_input_phone_pass"
android:hint="Telephone nomery"
android:inputType="phone"
android:paddingLeft="23dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView2"
app:met_mask="+8(###) ### - ## - ##" />
After first delete numbers in mask. Happend this:
I have used this widget in my project but when I'll try to click on this view in the sake of adding the text, unable to add text in it
Using the following mask.
val postCodeMask = Mask(
value = "___ ___",
character = '_',
style = MaskStyle.NORMAL
)
I get an IndexOutOfBoundsExeption when hitting the space character when the user hits the space bar key, not sure if this an expected behaviour. I would expect here the space bar to be treated as the space character.
Stack trace:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: __________________t, PID: 21295
java.lang.IndexOutOfBoundsException: setSpan (5 ... 5) ends beyond length 4
at android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:1325)
at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:684)
at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:676)
at android.text.Selection.setSelection(Selection.java:94)
at android.text.Selection.setSelection(Selection.java:78)
at android.text.Selection.setSelection(Selection.java:153)
at com.santalu.maskara.MaskResultKt.apply(MaskResult.kt:26)
at com.santalu.maskara.MaskChangedListener.afterTextChanged(MaskChangedListener.kt:31)
at android.widget.TextView.sendAfterTextChanged(TextView.java:10551)
at android.widget.TextView$ChangeWatcher.afterTextChanged(TextView.java:13388)
at android.text.SpannableStringBuilder.sendAfterTextChanged(SpannableStringBuilder.java:1277)
at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:577)
at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:507)
at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:37)
at android.view.inputmethod.BaseInputConnection.replaceText(BaseInputConnection.java:843)
at android.view.inputmethod.BaseInputConnection.commitText(BaseInputConnection.java:197)
at com.android.internal.widget.EditableInputConnection.commitText(EditableInputConnection.java:177)
at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:339)
at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:89)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Hello! Please, make the main class open
Is it possible to use a mask that as the user enters additional values, they will appear starting with the right-most digit, pushing older digit entries left as they type?
For example, I have the following mask: ##.###,##
What I want to input: 100,00
But since the mask starts from left to right if I try to input 100,00 I will end up with 10.000, due to the natural mask comportament.
I recently used 1.1.1 version, and its not working
Hi @santalu!
The widget makes the app crash if it is used without a mask. It is becasue a null listener is added on the overriden function onAttachedToWindow
I have replaced line 65 of MaskEditText.kt with the following validation to fix the issue
if(maskChangedListener != null) {
addTextChangedListener(maskChangedListener)
}
Good library!!
Thank you!
Cesar.-
Hello,
How can I mask with below format ?
(XXX) XXX-XXXX ext.XXXXXX i.e (654) 321-5846 ext.654321
Thanks.
Hey. Just to let you know, I'm not sure if this is some weird interaction between your lib and android 7.1.1, but for some reason, the input is getting duplicated sometimes. Example bellow:
Mask: ##:##:##:##:##:##
inputType: textCapCharacters
Scenario: try typing ABCDEFGHIL on a software keyboard (it works fine with a hardware keyboard).
You'll see the following result "AB:CD:CD:...". It duplicates the "CD" right after you type "D". This happens with other strings as well.
Adding the input type as "textCapCharacters | textNoSuggestions" fixes the issue.
Apply mask on the each line:
<com.santalu.maskedittext.MaskEditText
android:id="@+id/phones_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textMultiLine|phone"
android:scrollbars="vertical"
android:minLines="4"
android:maxLines="4"
android:lines="4"
app:mask="+90(###) ### ## ##"/>
Unable to set text programmatically to MaskedEditText
Is posible change the mask programmatically? I really need to do that..
Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.0.1] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:5:5-30:19 to override.
Hi @santalu,
When i try to enter text, it always duplicate the text before.
Is this normal?
Using the following code and format
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_margin="@dimen/material_margin"
android:hint="@string/phone">
<com.santalu.maskedittext.MaskEditText
android:id="@+id/PhoneTextInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="phone"
app:met_mask="###-###-####x######"/>
</com.google.android.material.textfield.TextInputLayout>
</com.google.android.material.textfield.TextInputLayout>
When placing your cursor before the 'x' (for extension) and deleting a number creates duplicate 'x' characters.
There is one issue with mask. If you set phone code to let's say +998 (__) ____ - __ - , here the code contains the digits 9 and 8, then you cannot type 9 and 8 when you just open keyboard. Similarly, if it is +78 () ____ - __ - __, then you cannot type 7 and 8 in the beginning
mask-edittext is totally broken when you use previously saved value. You just can't setText to MaskEditText. Also you cannot fix problem cos MaskEditText is final class.
Could you be so kind to fix this bug? Thx
bug: 定义手机格式"### #### ####",然后输入123 4567 8900,然后从头部开始删除比如2或者3后,格式变成了12 4567 8900,正确的应该是124 5678 900
I am trying to change the color of the text with "android:textColor".
But for some reason, the color remains "colorPrimary" from the library.
Does this library have the ability to change the color of the text?
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.