@@ -117,6 +117,7 @@ public class PairingActivity extends Activity implements View.OnClickListener, B
117
117
*/
118
118
private enum PAIRING_STATE {
119
119
PAIRING_STATE_CONNECT_BUTTON ,
120
+ PAIRING_STATE_TRIPLE ,
120
121
PAIRING_STATE_STEP_1 ,
121
122
PAIRING_STATE_STEP_2 ,
122
123
PAIRING_STATE_SEARCHING ,
@@ -246,7 +247,7 @@ private void proceedAfterBlePermissionGranted() {
246
247
return ;
247
248
}
248
249
249
- displayScreen (PAIRING_STATE .PAIRING_STATE_STEP_1 );
250
+ displayScreen (PAIRING_STATE .PAIRING_STATE_TRIPLE );
250
251
}
251
252
252
253
private boolean havePermission (String permission ) {
@@ -602,8 +603,10 @@ private void setupFontStyle() {
602
603
MBApp application = MBApp .getApp ();
603
604
604
605
Typeface defaultTypeface = application .getTypeface ();
606
+ Typeface robotoTypeface = application .getRobotoTypeface ();
605
607
606
608
deviceConnectionStatusBtn .setTypeface (defaultTypeface );
609
+
607
610
// Connect Screen
608
611
TextView appBarTitle = (TextView ) findViewById (R .id .flash_projects_title_txt );
609
612
appBarTitle .setTypeface (defaultTypeface );
@@ -626,38 +629,20 @@ private void setupFontStyle() {
626
629
TextView stepOneTitle = (TextView ) findViewById (R .id .pair_tip_step_1_step );
627
630
stepOneTitle .setTypeface (boldTypeface );
628
631
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
+
629
639
// Step 2 - Enter Pattern
630
640
TextView enterPatternTitle = (TextView ) findViewById (R .id .enter_pattern_step_2_title );
631
641
enterPatternTitle .setTypeface (boldTypeface );
632
642
633
643
TextView stepTwoTitle = (TextView ) findViewById (R .id .pair_enter_pattern_step_2 );
634
644
stepTwoTitle .setTypeface (boldTypeface );
635
645
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
-
661
646
TextView stepTwoInstructions = (TextView ) findViewById (R .id .pair_enter_pattern_step_2_instructions );
662
647
stepTwoInstructions .setTypeface (robotoTypeface );
663
648
@@ -667,11 +652,26 @@ private void setupFontStyle() {
667
652
Button okEnterPatternButton = (Button ) findViewById (R .id .ok_enter_pattern_step_2_btn );
668
653
okEnterPatternButton .setTypeface (robotoTypeface );
669
654
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
+
670
663
TextView stepThreeInstructions = (TextView ) findViewById (R .id .searching_microbit_step_instructions );
671
664
stepThreeInstructions .setTypeface (robotoTypeface );
672
665
673
666
Button cancelSearchMicroBit = (Button ) findViewById (R .id .cancel_search_microbit_step_3_btn );
674
667
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 );
675
675
}
676
676
677
677
/**
@@ -690,9 +690,14 @@ private void initViews() {
690
690
//Setup on click listeners.
691
691
deviceConnectionStatusBtn .setOnClickListener (this );
692
692
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 );
693
696
findViewById (R .id .cancel_tip_step_1_btn ).setOnClickListener (this );
697
+
694
698
findViewById (R .id .ok_enter_pattern_step_2_btn ).setOnClickListener (this );
695
699
findViewById (R .id .cancel_enter_pattern_step_2_btn ).setOnClickListener (this );
700
+
696
701
findViewById (R .id .cancel_search_microbit_step_3_btn ).setOnClickListener (this );
697
702
698
703
setupFontStyle ();
@@ -1097,11 +1102,26 @@ private void displayScreen(PAIRING_STATE gotoState) {
1097
1102
newDeviceCode = "" ;
1098
1103
break ;
1099
1104
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 ());
1101
1111
pairTipView .setVisibility (View .VISIBLE );
1102
- findViewById ( R . id . ok_tip_step_1_btn ). setOnClickListener ( this );
1112
+ view . animate ( );
1103
1113
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
+ }
1105
1125
case PAIRING_STATE_STEP_2 :
1106
1126
newDeviceView .setVisibility (View .VISIBLE );
1107
1127
findViewById (R .id .cancel_enter_pattern_step_2_btn ).setVisibility (View .VISIBLE );
@@ -1313,6 +1333,12 @@ public void onClick(final View v) {
1313
1333
checkBluetoothPermissions ();
1314
1334
break ;
1315
1335
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
+
1316
1342
// Proceed to Enter Pattern
1317
1343
case R .id .ok_tip_step_1_btn :
1318
1344
logi ("onClick() :: ok_tip_screen_one_button" );
@@ -1483,7 +1509,7 @@ private void popupPairingFailed() {
1483
1509
@ Override
1484
1510
public void onClick (View v ) {
1485
1511
PopUp .hide ();
1486
- displayScreen (PAIRING_STATE .PAIRING_STATE_STEP_1 );
1512
+ displayScreen (PAIRING_STATE .PAIRING_STATE_TRIPLE );
1487
1513
}
1488
1514
},//override click listener for ok button
1489
1515
new View .OnClickListener () {
@@ -1549,6 +1575,7 @@ protected void onDestroy() {
1549
1575
1550
1576
Utils .unbindDrawables (findViewById (R .id .connected_device_status_button ));
1551
1577
Utils .unbindDrawables (findViewById (R .id .pairButtonView ));
1578
+
1552
1579
Utils .unbindDrawables (findViewById (R .id .pairTipView ));
1553
1580
Utils .unbindDrawables (findViewById (R .id .connectDeviceView ));
1554
1581
Utils .unbindDrawables (findViewById (R .id .pairSearchView ));
0 commit comments