@@ -117,6 +117,7 @@ public class PairingActivity extends Activity implements View.OnClickListener, B
117117 */
118118 private enum PAIRING_STATE {
119119 PAIRING_STATE_CONNECT_BUTTON ,
120+ PAIRING_STATE_TRIPLE ,
120121 PAIRING_STATE_STEP_1 ,
121122 PAIRING_STATE_STEP_2 ,
122123 PAIRING_STATE_SEARCHING ,
@@ -246,7 +247,7 @@ private void proceedAfterBlePermissionGranted() {
246247 return ;
247248 }
248249
249- displayScreen (PAIRING_STATE .PAIRING_STATE_STEP_1 );
250+ displayScreen (PAIRING_STATE .PAIRING_STATE_TRIPLE );
250251 }
251252
252253 private boolean havePermission (String permission ) {
@@ -602,8 +603,10 @@ private void setupFontStyle() {
602603 MBApp application = MBApp .getApp ();
603604
604605 Typeface defaultTypeface = application .getTypeface ();
606+ Typeface robotoTypeface = application .getRobotoTypeface ();
605607
606608 deviceConnectionStatusBtn .setTypeface (defaultTypeface );
609+
607610 // Connect Screen
608611 TextView appBarTitle = (TextView ) findViewById (R .id .flash_projects_title_txt );
609612 appBarTitle .setTypeface (defaultTypeface );
@@ -626,38 +629,20 @@ private void setupFontStyle() {
626629 TextView stepOneTitle = (TextView ) findViewById (R .id .pair_tip_step_1_step );
627630 stepOneTitle .setTypeface (boldTypeface );
628631
632+ Button cancelPairButton = (Button ) findViewById (R .id .cancel_tip_step_1_btn );
633+ cancelPairButton .setTypeface (robotoTypeface );
634+
635+ Button nextPairButton = (Button ) findViewById (R .id .ok_tip_step_1_btn );
636+ nextPairButton .setTypeface (robotoTypeface );
637+
638+
629639 // Step 2 - Enter Pattern
630640 TextView enterPatternTitle = (TextView ) findViewById (R .id .enter_pattern_step_2_title );
631641 enterPatternTitle .setTypeface (boldTypeface );
632642
633643 TextView stepTwoTitle = (TextView ) findViewById (R .id .pair_enter_pattern_step_2 );
634644 stepTwoTitle .setTypeface (boldTypeface );
635645
636-
637- // Step 3 - Searching for micro:bit
638- TextView searchMicrobitTitle = (TextView ) findViewById (R .id .search_microbit_step_3_title );
639- searchMicrobitTitle .setTypeface (boldTypeface );
640-
641- TextView stepThreeTitle = (TextView ) findViewById (R .id .searching_microbit_step );
642- stepThreeTitle .setTypeface (boldTypeface );
643-
644- Typeface robotoTypeface = application .getRobotoTypeface ();
645-
646- TextView descriptionManageMicrobit = (TextView ) findViewById (R .id .description_manage_microbit );
647- descriptionManageMicrobit .setTypeface (robotoTypeface );
648-
649- TextView problemsMicrobit = (TextView ) findViewById (R .id .connect_microbit_problems_message );
650- problemsMicrobit .setTypeface (robotoTypeface );
651-
652- TextView stepOneInstructions = (TextView ) findViewById (R .id .pair_tip_step_1_instructions );
653- stepOneInstructions .setTypeface (robotoTypeface );
654-
655- Button cancelPairButton = (Button ) findViewById (R .id .cancel_tip_step_1_btn );
656- cancelPairButton .setTypeface (robotoTypeface );
657-
658- Button nextPairButton = (Button ) findViewById (R .id .ok_tip_step_1_btn );
659- nextPairButton .setTypeface (robotoTypeface );
660-
661646 TextView stepTwoInstructions = (TextView ) findViewById (R .id .pair_enter_pattern_step_2_instructions );
662647 stepTwoInstructions .setTypeface (robotoTypeface );
663648
@@ -667,11 +652,26 @@ private void setupFontStyle() {
667652 Button okEnterPatternButton = (Button ) findViewById (R .id .ok_enter_pattern_step_2_btn );
668653 okEnterPatternButton .setTypeface (robotoTypeface );
669654
655+
656+ // Step 3 - Searching for micro:bit
657+ TextView searchMicrobitTitle = (TextView ) findViewById (R .id .search_microbit_step_3_title );
658+ searchMicrobitTitle .setTypeface (boldTypeface );
659+
660+ TextView stepThreeTitle = (TextView ) findViewById (R .id .searching_microbit_step );
661+ stepThreeTitle .setTypeface (boldTypeface );
662+
670663 TextView stepThreeInstructions = (TextView ) findViewById (R .id .searching_microbit_step_instructions );
671664 stepThreeInstructions .setTypeface (robotoTypeface );
672665
673666 Button cancelSearchMicroBit = (Button ) findViewById (R .id .cancel_search_microbit_step_3_btn );
674667 cancelSearchMicroBit .setTypeface (robotoTypeface );
668+
669+
670+ TextView descriptionManageMicrobit = (TextView ) findViewById (R .id .description_manage_microbit );
671+ descriptionManageMicrobit .setTypeface (robotoTypeface );
672+
673+ TextView problemsMicrobit = (TextView ) findViewById (R .id .connect_microbit_problems_message );
674+ problemsMicrobit .setTypeface (robotoTypeface );
675675 }
676676
677677 /**
@@ -690,9 +690,14 @@ private void initViews() {
690690 //Setup on click listeners.
691691 deviceConnectionStatusBtn .setOnClickListener (this );
692692 findViewById (R .id .pairButton ).setOnClickListener (this );
693+
694+ findViewById (R .id .viewPairStep1AnotherWay ).setOnClickListener (this );
695+ findViewById (R .id .ok_tip_step_1_btn ).setOnClickListener (this );
693696 findViewById (R .id .cancel_tip_step_1_btn ).setOnClickListener (this );
697+
694698 findViewById (R .id .ok_enter_pattern_step_2_btn ).setOnClickListener (this );
695699 findViewById (R .id .cancel_enter_pattern_step_2_btn ).setOnClickListener (this );
700+
696701 findViewById (R .id .cancel_search_microbit_step_3_btn ).setOnClickListener (this );
697702
698703 setupFontStyle ();
@@ -1097,11 +1102,26 @@ private void displayScreen(PAIRING_STATE gotoState) {
10971102 newDeviceCode = "" ;
10981103 break ;
10991104
1100- case PAIRING_STATE_STEP_1 :
1105+ case PAIRING_STATE_TRIPLE : {
1106+ GifImageView view = (GifImageView ) findViewById (R .id .pair_tip_step_1_giff );
1107+ view .setImageResource (R .drawable .reset_triple );
1108+ TextView prompt = (TextView ) findViewById (R .id .pair_tip_step_1_instructions );
1109+ prompt .setText (R .string .viewPairTriplePromptText );
1110+ prompt .setContentDescription (prompt .getText ());
11011111 pairTipView .setVisibility (View .VISIBLE );
1102- findViewById ( R . id . ok_tip_step_1_btn ). setOnClickListener ( this );
1112+ view . animate ( );
11031113 break ;
1104-
1114+ }
1115+ case PAIRING_STATE_STEP_1 : {
1116+ GifImageView view = (GifImageView ) findViewById (R .id .pair_tip_step_1_giff );
1117+ view .setImageResource (R .drawable .how_to_pair_microbit );
1118+ TextView prompt = (TextView ) findViewById (R .id .pair_tip_step_1_instructions );
1119+ prompt .setText (R .string .connect_tip_text );
1120+ prompt .setContentDescription (prompt .getText ());
1121+ pairTipView .setVisibility (View .VISIBLE );
1122+ view .animate ();
1123+ break ;
1124+ }
11051125 case PAIRING_STATE_STEP_2 :
11061126 newDeviceView .setVisibility (View .VISIBLE );
11071127 findViewById (R .id .cancel_enter_pattern_step_2_btn ).setVisibility (View .VISIBLE );
@@ -1313,6 +1333,12 @@ public void onClick(final View v) {
13131333 checkBluetoothPermissions ();
13141334 break ;
13151335
1336+ case R .id .viewPairStep1AnotherWay :
1337+ logi ("onClick() :: viewPairStep1AnotherWay" );
1338+ displayScreen ( pairingState == PAIRING_STATE .PAIRING_STATE_TRIPLE
1339+ ? PAIRING_STATE .PAIRING_STATE_STEP_1 : PAIRING_STATE .PAIRING_STATE_TRIPLE );
1340+ break ;
1341+
13161342 // Proceed to Enter Pattern
13171343 case R .id .ok_tip_step_1_btn :
13181344 logi ("onClick() :: ok_tip_screen_one_button" );
@@ -1483,7 +1509,7 @@ private void popupPairingFailed() {
14831509 @ Override
14841510 public void onClick (View v ) {
14851511 PopUp .hide ();
1486- displayScreen (PAIRING_STATE .PAIRING_STATE_STEP_1 );
1512+ displayScreen (PAIRING_STATE .PAIRING_STATE_TRIPLE );
14871513 }
14881514 },//override click listener for ok button
14891515 new View .OnClickListener () {
@@ -1549,6 +1575,7 @@ protected void onDestroy() {
15491575
15501576 Utils .unbindDrawables (findViewById (R .id .connected_device_status_button ));
15511577 Utils .unbindDrawables (findViewById (R .id .pairButtonView ));
1578+
15521579 Utils .unbindDrawables (findViewById (R .id .pairTipView ));
15531580 Utils .unbindDrawables (findViewById (R .id .connectDeviceView ));
15541581 Utils .unbindDrawables (findViewById (R .id .pairSearchView ));
0 commit comments