@@ -382,12 +382,35 @@ private void gotoState(State newState) {
382
382
gotoState (newState , true );
383
383
}
384
384
385
+ private String getTitle () {
386
+ if (options .getTitle () != null ) {
387
+ return options .getTitle ();
388
+ }
389
+ switch (options .getPinMode ()) {
390
+ case PIN_INPUT : {
391
+ return getString (R .string .hwsecurity_ui_title_login );
392
+ }
393
+ case NO_PIN_INPUT : {
394
+ return getString (R .string .hwsecurity_ui_title_add );
395
+ }
396
+ case RESET_PIN : {
397
+ return getString (R .string .hwsecurity_ui_title_reset_pin );
398
+ }
399
+ case SETUP : {
400
+ return getString (R .string .hwsecurity_ui_title_setup );
401
+ }
402
+ default : {
403
+ throw new IllegalArgumentException ("unknown PinMode!" );
404
+ }
405
+ }
406
+ }
407
+
385
408
private void gotoState (State newState , boolean isTransportNfc ) {
386
409
switch (newState ) {
387
410
case NORMAL_ENTER_PIN : {
388
411
keypadPinInput .reset (options .getPinLength ());
389
412
390
- textViewTitle .setText (options . getTitle () != null ? options . getTitle () : getString ( R . string . hwsecurity_ui_title_login ));
413
+ textViewTitle .setText (getTitle ());
391
414
textViewDescription .setText (R .string .hwsecurity_ui_description_enter_pin );
392
415
393
416
showHidePinInput (keyboardPreference .isKeyboardPreferred ());
@@ -406,6 +429,7 @@ private void gotoState(State newState, boolean isTransportNfc) {
406
429
SecurityKeyManager .getInstance ().rediscoverConnectedSecurityKeys ();
407
430
keypadPinInput .reset (options .getPinLength ());
408
431
432
+ textViewTitle .setText (getTitle ());
409
433
textViewDescription .setText (R .string .hwsecurity_ui_description_start );
410
434
411
435
TransitionManager .beginDelayedTransition (innerBottomSheet );
@@ -424,7 +448,7 @@ private void gotoState(State newState, boolean isTransportNfc) {
424
448
break ;
425
449
}
426
450
case NORMAL_SECURITY_KEY_HOLD : {
427
- textViewTitle .setText (options . getTitle () != null ? options . getTitle () : getString ( R . string . hwsecurity_ui_title_login ));
451
+ textViewTitle .setText (getTitle ());
428
452
textViewDescription .setText (isTransportNfc ? R .string .hwsecurity_ui_description_hold_nfc : R .string .hwsecurity_ui_description_hold_usb );
429
453
430
454
// no animation for speed!
@@ -548,7 +572,7 @@ private void gotoState(State newState, boolean isTransportNfc) {
548
572
int pinLength = options .getPinLength () == null ? SETUP_DEFAULT_PIN_LENGTH : options .getPinLength ();
549
573
keypadPinInput .reset (pinLength );
550
574
551
- textViewTitle .setText (R . string . hwsecurity_ui_title_setup );
575
+ textViewTitle .setText (getTitle () );
552
576
textViewDescription .setText (R .string .hwsecurity_ui_description_choose_pin );
553
577
554
578
keyboardPinInput .setVisibility (View .GONE );
@@ -571,7 +595,7 @@ private void gotoState(State newState, boolean isTransportNfc) {
571
595
setupPuk .displayOnTextView (textPuk );
572
596
573
597
TransitionManager .beginDelayedTransition (innerBottomSheet );
574
- textViewTitle .setText (R . string . hwsecurity_ui_title_setup );
598
+ textViewTitle .setText (getTitle () );
575
599
textViewDescription .setText (R .string .hwsecurity_ui_description_puk );
576
600
keyboardPinInput .setVisibility (View .GONE );
577
601
keypadPinInput .setVisibility (View .GONE );
@@ -588,7 +612,7 @@ private void gotoState(State newState, boolean isTransportNfc) {
588
612
case SETUP_CONFIRM_WIPE : {
589
613
590
614
TransitionManager .beginDelayedTransition (innerBottomSheet );
591
- textViewTitle .setText (R . string . hwsecurity_ui_title_setup );
615
+ textViewTitle .setText (getTitle () );
592
616
textViewDescription .setText ("" );
593
617
keyboardPinInput .setVisibility (View .GONE );
594
618
keypadPinInput .setVisibility (View .GONE );
0 commit comments