poovamraj/PinEditTextField

Password not masked

dozieogbo opened this issue · 10 comments

The password is not masked even if textpassword or numberpassword input type is selected

This is not expected. I will look into this.

Thanks a lot

Hello, what version of the library are you using and what Pin Field View are you using?

Got the issue, will fix it by EOD

is it fixed ?

Working on this. I could provide an easy fix or a proper fix. I am working on a proper one. I will provide the build next weekend. Couldn't meet the timeline since I was fixing another issue.

can you supply me with the easy fix for the moment ?

Sure. I will give it tomorrow.

Hi,

I have fixed this. You can find it in the below version of the library

compile 'com.poovam:pin-edittext-field:1.1.0'

It will be applicable to all password input types. Use it the same way you will mask an EditText. It is applicable to both LinePinField and SquarePinField. The below image is just for reference.

Thanks for your patience. Let me know if you need any help.

whatsapp image 2018-10-27 at 6 15 20 pm

It is still not fixed through just input type of textPassword or numberPassword, You will need to use transformation method.

lineField.setTransformationMethod(new AsteriskPasswordTransformationMethod());

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
        }
    }
};