Class PasswordStrengthMeter

java.lang.Object
android.view.View
android.view.ViewGroup
android.widget.LinearLayout
se.aaro.gustav.passwordstrengthmeter.PasswordStrengthMeter
All Implemented Interfaces:
Drawable.Callback, AccessibilityEventSource, KeyEvent.Callback, ViewManager, ViewParent

public class PasswordStrengthMeter
extends LinearLayout
Created by gustavaaro on 2016-11-09.
  • Field Details

  • Constructor Details

    • PasswordStrengthMeter

      public PasswordStrengthMeter​(Context context)
      Constructor used when created programmatically
      Parameters:
      context - the context of the component
    • PasswordStrengthMeter

      public PasswordStrengthMeter​(Context context, AttributeSet attrs)
      Constructor used when created from xml.
      Parameters:
      context - the context of the component.
      attrs - the AttributeSet with properties from the xml.
  • Method Details

    • setOrientation

      public void setOrientation​(int orientation)
      Overrides:
      setOrientation in class LinearLayout
    • initStrengthMeter

      public void initStrengthMeter()
      Initializes the view by defining components and laying them out
    • setAnimationDuration

      public void setAnimationDuration​(int animationDuration)
      Set animation duration for meter change animations
      Parameters:
      animationDuration -
    • onMeasure

      protected void onMeasure​(int widthMeasureSpec, int heightMeasureSpec)
      Overrides:
      onMeasure in class LinearLayout
    • onLayout

      protected void onLayout​(boolean changed, int l, int t, int r, int b)
      Overrides:
      onLayout in class LinearLayout
    • setStrengthLevels

      public void setStrengthLevels​(PasswordStrengthLevel[] strengthLevels)
      Sets the strength levels for the meter, defined by a color and a display name
      Parameters:
      strengthLevels - array of PasswordStrengthLevel
    • setShowStrengthIndicator

      public void setShowStrengthIndicator​(boolean showStrengthIndicator)
      Sets whether or not the line indicator should be visible.
      Parameters:
      showStrengthIndicator - show strength indicator boolean.
    • setEditText

      public void setEditText​(EditText passwordInput)
    • setShowStrengthLabel

      public void setShowStrengthLabel​(boolean showStrengthLabel)
      Sets whether or not the text indicator should be visible.
      Parameters:
      showStrengthLabel - show text indicator boolean.
    • setPasswordStrengthCalculator

      public void setPasswordStrengthCalculator​(PasswordStrengthCalculator passwordStrengthCalculator)
      Sets the handler responsible for the strength-algorithm. The default value is this class itself.
      Parameters:
      passwordStrengthCalculator - handler responsible for calculations and requirements.