GithubHelp home page GithubHelp logo

lisawray / passwordview Goto Github PK

View Code? Open in Web Editor NEW
707.0 707.0 86.0 3.48 MB

A Material Android password view that toggles password visibility via an eye icon.

License: The Unlicense

Java 100.00%

passwordview's People

Contributors

lisawray avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

passwordview's Issues

clicked coordinate calculation error of eye icon

When we use "padding" or "center_horizontal" of PasswordView, (getRight() - getCompoundDrawables()[2].getBounds().width()) will not show the true location of eye icon.
In this way, onTouchEvent can not handle the click event correctly.
Using getWidth() instead of getRight(), and getPaddingRight()

PasswordView cannot be shown in the Android Studio Preview window

The stacktrace is the following:

java.lang.NoSuchMethodError: android.graphics.drawable.VectorDrawable_Delegate.nCreateTreeFromCopy(JJ)J
    at android.graphics.drawable.VectorDrawable.nCreateTreeFromCopy(VectorDrawable.java)
    at android.graphics.drawable.VectorDrawable.access$400(VectorDrawable.java:204)
    at android.graphics.drawable.VectorDrawable$VectorDrawableState.createNativeTreeFromCopy(VectorDrawable.java:837)
    at android.graphics.drawable.VectorDrawable$VectorDrawableState.<init>(VectorDrawable.java:812)
    at android.graphics.drawable.VectorDrawable.mutate(VectorDrawable.java:268)
    at com.xwray.passwordview.PasswordView.getToggleDrawable(PasswordView.java:90)
    at com.xwray.passwordview.PasswordView.init(PasswordView.java:75)
    at com.xwray.passwordview.PasswordView.<init>(PasswordView.java:49)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:465)
    at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:172)
    at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:105)
    at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:176)
    at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:247)
    at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:171)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
    at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:858)
    at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
    at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:861)
    at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
    at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:861)
    at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
    at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:861)
    at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
    at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:861)
    at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
    at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:317)
    at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:429)
    at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:350)
    at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:520)
    at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:508)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:967)
    at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:508)
    at com.android.tools.idea.rendering.RenderTask.access$600(RenderTask.java:75)
    at com.android.tools.idea.rendering.RenderTask$3.call(RenderTask.java:620)
    at com.android.tools.idea.rendering.RenderTask$3.call(RenderTask.java:617)
    at com.android.tools.idea.rendering.RenderService.runRenderAction(RenderService.java:371)
    at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:617)
    at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:639)
    at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.doRender(AndroidLayoutPreviewToolWindowManager.java:654)
    at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.access$1700(AndroidLayoutPreviewToolWindowManager.java:82)
    at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7$1.run(AndroidLayoutPreviewToolWindowManager.java:596)
    at com.intellij.openapi.progress.impl.CoreProgressManager$2.run(CoreProgressManager.java:142)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:446)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:392)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:127)
    at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7.run(AndroidLayoutPreviewToolWindowManager.java:591)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:337)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:327)
    at com.intellij.util.ui.update.MergingUpdateQueue$3.run(MergingUpdateQueue.java:271)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:286)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:244)
    at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:234)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
    at com.intellij.util.Alarm$Request$1.run(Alarm.java:352)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

Can you add a CHANGELOG

๐ŸŽ† ๐ŸŽ† ๐ŸŽ† ๐ŸŽ† ๐ŸŽ† ๐ŸŽ† Congrats on v 1.0 !!

Can you add a changel og for future changes? That'll make it easy to scan for change instead of parsing commit history?

Extend AppCompatEditText instead of EditText

Since this library targets 14 as its minimum, it would be great if it would add a dependency on AppCompat and extend AppCompatEditText instead so that the material edit text style would apply even on pre 21 devices.

ๅปบ่ฎฎ(advice)

ๆœ€ๅฅฝ่ƒฝๆŠŠ่ฎพ็ฝฎๅ›พๆ ‡็›ธๅ…ณ็š„ๆ–นๆณ•ๆไพ›ๅ‡บๆฅ
imagePadding, imageRes, imageSize

Vector Drawables Pre-Lollipop

So I always thought that Vector Drawables were only supported on API 21+. But, I cloned your repo and ran your app on a API 19 device and the Vector Drawable rendered perfectly fine. Is there some reason why this all works on pre-lollipop? I was hoping you could explain.

Also in your PasswordView.java class, on lines 67 and 68 you have

eye = ContextCompat.getDrawable(getContext(), R.drawable.ic_eye).mutate();
eyeWithStrike = ContextCompat.getDrawable(getContext(), R.drawable.ic_eye_strike).mutate();

Shouldn't that be replaced with

eye = VectorDrawableCompat.create(getResources(), R.drawable.ic_eye, null).mutate();
eyeWithStrike = VectorDrawableCompat.create(getResources(), R.drawable.ic_eye_strike, null).mutate();

to support vector drawables on all API versions?

Option to disable vibration when visibility is toggled

It appears that the device does a short vibration when the visibility is changed (and the cursor jumps to the end).

Can we get an option to disable this "feature"?
It seems handy to indicate that a password-field got visible but it would be good to decide ourselves.

PS: Why is it vibrating in the first place? I cannot identify the piece of code doing it.
PPS: Using Android N Preview 2

Using setError invalidates the eye toggle

When using setError on the EditText the eye toggle stops working and does not toggle the drawable itself (the shown/hidden text works). I assume it resets the drawable somehow, any idea how to fix it?

Application crashes if password field is blank with validation too

So i recently used this library, i basically want to add a checkpoint to my application where if user leave password empty the application sets error to the field, i used password view for password field. But when user continues without entering password the application crashes, no matter if he enters email only too, i already have check point of seterror added on the email field my email field is a simple edit text and password field is password view,i tried checking logcat and it says "Please use TextInputLayout.setError() instead!
at com.xwray.passwordview.PasswordView.setError", i tried setting the type to textinputlayout but it throws an error of casting i.e. "Unable to cast edittext on textinputlayout", below is the xml and java code of my application

image_2022-03-11_113339
image
image

image of exception
image

De-deprecating this library ?

Hi,

When i wanted to implement this library to another new project , i just see that this library was deprecated because the password view has been integrated in the support library, i tested it but i think it's too much complex, we need a layout wrapper and a control inside. This support layout is great when we wan't a material design app with the text going to the top, but in my new project, i need to use a custom design and a custom font and this library is just what i need, i can subclass it to use my custom font. And this library is very easy to implement just replace EditText with it.

So for some uses, this library is very great and easier than the support library, so i think it should not be deprecated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.