public class

PdfPasswordView

extends LinearLayoutCompat
implements FloatingHintEditText.EditTextListener
java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ androidx.appcompat.widget.LinearLayoutCompat
         ↳ com.pspdfkit.ui.PdfPasswordView

Class Overview

Password view used when accessing password protected documents.

Summary

Nested Classes
interface PdfPasswordView.OnPasswordSubmitListener Listener for entered password being submitted. 
[Expand]
Inherited Constants
From class androidx.appcompat.widget.LinearLayoutCompat
From class android.view.ViewGroup
From class android.view.View
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
PdfPasswordView(Context context)
PdfPasswordView(Context context, AttributeSet attrs)
PdfPasswordView(Context context, AttributeSet attrs, int defStyleAttr)
Public Methods
void afterTextChanged(Editable s)
Called after each Editable text change.
int getColor()
Returns the password view color (input field, underline, icon tint).
int getErrorColor()
Returns color used as primary one in case of incorrect password entry.
int getFloatingHintColor()
Returns the text color for the password view's floating hint.
int getHintColor()
Returns input field hint color.
int getIconResourceId()
Returns icon displayed above the input field.
String getPassword()
Returns currently entered password.
IBinder getWindowToken()
boolean isIconTintingEnabled()
Returns whether tinting of the password view icon is enabled or not.
void onErrorDismissed()
Called when user proceeds typing in after there was an error shown.
void onKeyPress(int keyCode, KeyEvent event)
Called when there is a key press event
void onWindowFocusChanged(boolean hasWindowFocus)
void setColor(int color)
Sets the password view color (input field, underline, icon tint).
void setErrorColor(int errorColor)
Sets color used as primary one in case of incorrect password entry.
void setFloatingHintColor(int floatingHintColor)
Sets the text color for the password view's floating hint.
void setHintColor(int hintColor)
Sets input field hint color.
void setIconResourceId(int iconResourceId)
Sets icon displayed above the input field.
void setIconTintingEnabled(boolean iconTintingEnabled)
Sets whether tinting of the password view icon is enabled or not.
void setOnPasswordSubmitListener(PdfPasswordView.OnPasswordSubmitListener listener)
Configure listener for listening for password entry.
void setVisibility(int visibility)
void showPasswordError()
Shake view and tint with error code.
Protected Methods
boolean fitSystemWindows(Rect insets)
void onDetachedFromWindow()
void onVisibilityChanged(View changedView, int visibility)
[Expand]
Inherited Methods
From class androidx.appcompat.widget.LinearLayoutCompat
From class android.view.ViewGroup
From class android.view.View
From class java.lang.Object
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.ViewManager
From interface android.view.ViewParent
From interface android.view.accessibility.AccessibilityEventSource
From interface com.pspdfkit.ui.FloatingHintEditText.EditTextListener

Public Constructors

public PdfPasswordView (Context context)

public PdfPasswordView (Context context, AttributeSet attrs)

public PdfPasswordView (Context context, AttributeSet attrs, int defStyleAttr)

Public Methods

public void afterTextChanged (Editable s)

Called after each Editable text change.

Parameters
s Editable with change event.

public int getColor ()

Returns the password view color (input field, underline, icon tint).

Returns
  • Primary password view color.

public int getErrorColor ()

Returns color used as primary one in case of incorrect password entry.

Returns
  • Color used to tint text and iconResourceId on incorrect password.

public int getFloatingHintColor ()

Returns the text color for the password view's floating hint.

Returns
  • Floating hint color.

public int getHintColor ()

Returns input field hint color.

Returns
  • Input field hint text color.

public int getIconResourceId ()

Returns icon displayed above the input field.

Returns
  • Input field icon's resource drawable.

public String getPassword ()

Returns currently entered password.

Returns
  • Password string currently entered into the text box, or empty string if there's no input.

public IBinder getWindowToken ()

public boolean isIconTintingEnabled ()

Returns whether tinting of the password view icon is enabled or not.

Returns
  • true if tinting is enabled, or false if the used icon won't be tinted. Defaults to true.

public void onErrorDismissed ()

Called when user proceeds typing in after there was an error shown.

public void onKeyPress (int keyCode, KeyEvent event)

Called when there is a key press event

Parameters
keyCode code for a pressed key
event event for key press

public void onWindowFocusChanged (boolean hasWindowFocus)

public void setColor (int color)

Sets the password view color (input field, underline, icon tint).

Parameters
color Primary password view color.

public void setErrorColor (int errorColor)

Sets color used as primary one in case of incorrect password entry.

Parameters
errorColor Color used to tint text and iconResourceId on incorrect password.

public void setFloatingHintColor (int floatingHintColor)

Sets the text color for the password view's floating hint.

Parameters
floatingHintColor Floating hint color.

public void setHintColor (int hintColor)

Sets input field hint color.

Parameters
hintColor Input field hint text color.

public void setIconResourceId (int iconResourceId)

Sets icon displayed above the input field. Setting this to -1 is equivalent to setting it to @null in the theme.

Parameters
iconResourceId Input field icon's resource drawable.

public void setIconTintingEnabled (boolean iconTintingEnabled)

Sets whether tinting of the password view icon is enabled or not.

Parameters
iconTintingEnabled true if tinting is enabled, or false if the used icon won't be tinted. Defaults to true.

public void setOnPasswordSubmitListener (PdfPasswordView.OnPasswordSubmitListener listener)

Configure listener for listening for password entry. Calling this method will replace any previously set listener. You may provide null to clear the listener.

Parameters
listener PdfPasswordView.OnPasswordSubmitListener that should be notified, or null to clear the listener.

public void setVisibility (int visibility)

public void showPasswordError ()

Shake view and tint with error code.

Protected Methods

protected boolean fitSystemWindows (Rect insets)

protected void onDetachedFromWindow ()

protected void onVisibilityChanged (View changedView, int visibility)