Package com.yubico.yubikit.android.ui
Class YubiKeyPromptConnectionAction<T extends com.yubico.yubikit.core.YubiKeyConnection>
- java.lang.Object
-
- com.yubico.yubikit.android.ui.YubiKeyPromptAction
-
- com.yubico.yubikit.android.ui.YubiKeyPromptConnectionAction<T>
-
- Type Parameters:
T- The connection type to handle
public abstract class YubiKeyPromptConnectionAction<T extends com.yubico.yubikit.core.YubiKeyConnection> extends YubiKeyPromptAction
Action to be performed by aYubiKeyPromptActivitywhen a YubiKey is attached. Extend this class to handle an attached YubiKey from a YubiKeyPromptActivity, capable of providing a specific type of connection.
-
-
Field Summary
-
Fields inherited from class com.yubico.yubikit.android.ui.YubiKeyPromptAction
CONTINUE, RESULT_CONTINUE
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedYubiKeyPromptConnectionAction(java.lang.Class<T> connectionType)Subclasses need to provide a default (no-arg) constructor which calls this parent constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidonError(java.lang.Exception exception)Overridable method called if opening a connection to a YubiKey throws an error.protected abstract com.yubico.yubikit.core.util.Pair<java.lang.Integer,android.content.Intent>onYubiKeyConnection(T connection, android.os.Bundle extras, com.yubico.yubikit.core.application.CommandState commandState)Called when a YubiKey supporting the desired connection type is connected.
-
-
-
Constructor Detail
-
YubiKeyPromptConnectionAction
protected YubiKeyPromptConnectionAction(java.lang.Class<T> connectionType)
Subclasses need to provide a default (no-arg) constructor which calls this parent constructor.- Parameters:
connectionType- the type of connection used
-
-
Method Detail
-
onYubiKeyConnection
@WorkerThread protected abstract com.yubico.yubikit.core.util.Pair<java.lang.Integer,android.content.Intent> onYubiKeyConnection(T connection, android.os.Bundle extras, com.yubico.yubikit.core.application.CommandState commandState)
Called when a YubiKey supporting the desired connection type is connected.Subclasses should override this method to react to a connected YubiKey. Return a value to cause the dialog to finish, returning the Intent to the caller, using the given result code. Return
YubiKeyPromptAction.CONTINUEto keep the dialog open to process additional connections. The CommandState can be used to update the dialog UI based on status of the operation, and is cancelled if the user presses the cancel button. NOTE: Subclasses should not close the connection, as it will be closed automatically.- Parameters:
connection- A YubiKey connectionextras- the extras the Activity was called withcommandState- a CommandState that is hooked up to the activity.- Returns:
- the result of the operation, as a Pair of result code and Intent with extras, or null
-
onError
@WorkerThread protected void onError(java.lang.Exception exception)
Overridable method called if opening a connection to a YubiKey throws an error.- Parameters:
exception- the Exception raised
-
-