Skip to content

Commit

Permalink
v2.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dschuermann committed Aug 26, 2019
1 parent 793a9b3 commit 429d9d3
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ ext {
compileSdkVersion = 28
hwSdkIncludeAsSubmodule = false
hwSdkVersionCode = 10
hwSdkVersionName = '2.4.5'
hwSdkVersionName = '2.5.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -382,12 +382,35 @@ private void gotoState(State newState) {
gotoState(newState, true);
}

private String getTitle() {
if (options.getTitle() != null) {
return options.getTitle();
}
switch (options.getPinMode()) {
case PIN_INPUT: {
return getString(R.string.hwsecurity_ui_title_login);
}
case NO_PIN_INPUT: {
return getString(R.string.hwsecurity_ui_title_add);
}
case RESET_PIN: {
return getString(R.string.hwsecurity_ui_title_reset_pin);
}
case SETUP: {
return getString(R.string.hwsecurity_ui_title_setup);
}
default: {
throw new IllegalArgumentException("unknown PinMode!");
}
}
}

private void gotoState(State newState, boolean isTransportNfc) {
switch (newState) {
case NORMAL_ENTER_PIN: {
keypadPinInput.reset(options.getPinLength());

textViewTitle.setText(options.getTitle() != null ? options.getTitle() : getString(R.string.hwsecurity_ui_title_login));
textViewTitle.setText(getTitle());
textViewDescription.setText(R.string.hwsecurity_ui_description_enter_pin);

showHidePinInput(keyboardPreference.isKeyboardPreferred());
Expand All @@ -406,6 +429,7 @@ private void gotoState(State newState, boolean isTransportNfc) {
SecurityKeyManager.getInstance().rediscoverConnectedSecurityKeys();
keypadPinInput.reset(options.getPinLength());

textViewTitle.setText(getTitle());
textViewDescription.setText(R.string.hwsecurity_ui_description_start);

TransitionManager.beginDelayedTransition(innerBottomSheet);
Expand All @@ -424,7 +448,7 @@ private void gotoState(State newState, boolean isTransportNfc) {
break;
}
case NORMAL_SECURITY_KEY_HOLD: {
textViewTitle.setText(options.getTitle() != null ? options.getTitle() : getString(R.string.hwsecurity_ui_title_login));
textViewTitle.setText(getTitle());
textViewDescription.setText(isTransportNfc ? R.string.hwsecurity_ui_description_hold_nfc : R.string.hwsecurity_ui_description_hold_usb);

// no animation for speed!
Expand Down Expand Up @@ -548,7 +572,7 @@ private void gotoState(State newState, boolean isTransportNfc) {
int pinLength = options.getPinLength() == null ? SETUP_DEFAULT_PIN_LENGTH : options.getPinLength();
keypadPinInput.reset(pinLength);

textViewTitle.setText(R.string.hwsecurity_ui_title_setup);
textViewTitle.setText(getTitle());
textViewDescription.setText(R.string.hwsecurity_ui_description_choose_pin);

keyboardPinInput.setVisibility(View.GONE);
Expand All @@ -571,7 +595,7 @@ private void gotoState(State newState, boolean isTransportNfc) {
setupPuk.displayOnTextView(textPuk);

TransitionManager.beginDelayedTransition(innerBottomSheet);
textViewTitle.setText(R.string.hwsecurity_ui_title_setup);
textViewTitle.setText(getTitle());
textViewDescription.setText(R.string.hwsecurity_ui_description_puk);
keyboardPinInput.setVisibility(View.GONE);
keypadPinInput.setVisibility(View.GONE);
Expand All @@ -588,7 +612,7 @@ private void gotoState(State newState, boolean isTransportNfc) {
case SETUP_CONFIRM_WIPE: {

TransitionManager.beginDelayedTransition(innerBottomSheet);
textViewTitle.setText(R.string.hwsecurity_ui_title_setup);
textViewTitle.setText(getTitle());
textViewDescription.setText("");
keyboardPinInput.setVisibility(View.GONE);
keypadPinInput.setVisibility(View.GONE);
Expand Down
1 change: 1 addition & 0 deletions hwsecurity-ui/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<string name="hwsecurity_ui_button_cancel">Cancel</string>
<string name="hwsecurity_ui_button_reset">Reset PIN</string>
<string name="hwsecurity_ui_title_login">Login with Security Key</string>
<string name="hwsecurity_ui_title_add">Add Security Key</string>
<string name="hwsecurity_ui_description_enter_pin">Enter your PIN code.</string>
<string name="hwsecurity_ui_description_start">"Just do it, or click for help."</string>
<string name="hwsecurity_ui_description_hold_nfc">Hold Security Key against the back. Don\'t move it.</string>
Expand Down

0 comments on commit 429d9d3

Please sign in to comment.