Skip to content

Commit

Permalink
Update micro:bit searching screen
Browse files Browse the repository at this point in the history
so that it doesn't change gif or text when device is found
  • Loading branch information
microbit-grace committed May 10, 2024
1 parent 22e74b7 commit d783c63
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ public void run() {
logi("BLEPairResult " + result);
switch ( result) {
case Found:
updateOnScanFound();
// We need to connect even if bonded, to get resultHardwareVersion
// if ( getBLEPair().resultDevice.getBondState() == BluetoothDevice.BOND_BONDED) {
// logi("scan found device already paired");
Expand All @@ -236,9 +235,6 @@ public void run() {
popupPairingFailed();
}
break;
case Connected:
updateOnConnected();
break;
case Paired:
handlePairingSuccessful();
break;
Expand All @@ -252,6 +248,7 @@ public void run() {
popupPairingFailed();
break;
default:
// Connected and None case are not specifically handled
break;
}
}
Expand Down Expand Up @@ -1062,40 +1059,6 @@ private void updatePairedDeviceCard() {
logi("updatePairedDeviceCard End");
}

private void updateOnScanFound() {
logi("updateOnScanFound");
TextView textView = (TextView) findViewById(R.id.search_microbit_step_3_title);
TextView tvSearchingStep = (TextView) findViewById(R.id.searching_microbit_step);
if (textView != null) {
textView.setText(getString(R.string.searchingTitle));
//findViewById(R.id.searching_progress_spinner).setVisibility(View.GONE);
((GifImageView) findViewById(R.id.searching_microbit_found_giffview))
.setImageResource(R.drawable.emoji_microbit_found);
// if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) {
// tvSearchingStep.setText(R.string.searching_microbit_found_message_one_line);
// } else {
// tvSearchingStep.setText(R.string.searching_microbit_found_message);
// }
}
}

private void updateOnConnected() {
logi("updateOnConnected");
TextView textView = (TextView) findViewById(R.id.search_microbit_step_3_title);
TextView tvSearchingStep = (TextView) findViewById(R.id.searching_microbit_step);
if (textView != null) {
textView.setText(getString(R.string.searchingTitle));
findViewById(R.id.searching_progress_spinner).setVisibility(View.GONE);
((GifImageView) findViewById(R.id.searching_microbit_found_giffview))
.setImageResource(R.drawable.emoji_microbit_found);
if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) {
tvSearchingStep.setText(R.string.searching_microbit_found_message_one_line);
} else {
tvSearchingStep.setText(R.string.searching_microbit_found_message);
}
}
}

/**
* Displays needed screen according to a pairing state and
* allows to navigate through the connection screens.
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout-land/view_pairing_searching.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
android:layout_width="@dimen/pairing_step_1_gif_image_width"
android:layout_height="@dimen/pairing_step_1_gif_image_height"
android:layout_below="@id/search_microbit_step_3_title"
android:src="@drawable/pairing_pin_screen_two" />
android:src="@drawable/emoji_searching_microbit" />
</RelativeLayout>

<RelativeLayout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
style="@style/pairing_step_tip_text_style"
android:layout_marginBottom="@dimen/pairing_step_tip_title_margin_bottom"
android:textSize="@dimen/pairing_step_title_text_size"
android:text="@string/searching_tip_step_text_one_line" />
android:text="@string/searching_microbit_found_message" />

</LinearLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<TextView
android:id="@+id/searching_microbit_step"
style="@style/pairing_step_tip_text_style"
android:text="@string/searching_tip_step_text" />
android:text="@string/searching_microbit_found_message" />

</LinearLayout>

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/view_pairing_searching.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
android:layout_height="wrap_content"
android:layout_below="@id/searching_progress_spinner"
android:layout_centerHorizontal="true"
android:src="@drawable/pairing_pin_screen_two" />
android:src="@drawable/emoji_searching_microbit" />
</RelativeLayout>

<include layout="@layout/view_pairing_searching_step" />
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/view_pairing_searching_step.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
android:id="@+id/searching_microbit_step"
style="@style/pairing_step_tip_text_style"
android:paddingEnd="@dimen/pairing_step_searching_tip_text_padding_end"
android:text="@string/searching_tip_step_text" />
android:text="@string/searching_microbit_found_message" />

</LinearLayout>

Expand Down
3 changes: 1 addition & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,7 @@
<string name="desc_step_connect_tip_text_step_four_text">When you see the success message, press RESET and you\'re done!</string>
<string name="desc_step_connect_tip_text_step_three">Step 3</string>
<string name="desc_step_connect_tip_text_step_four">Step 4</string>
<string name="searching_microbit_found_message">Choose Pair (or Pair &amp; connect)\n in the notification you will receive.</string>
<string name="searching_microbit_found_message_one_line">Choose Pair (or Pair &amp; connect) in the notification you will receive.</string>
<string name="searching_microbit_found_message">Choose Pair (or Pair &amp; connect) in the notification you will receive.</string>
<string name="step_connect_tip_text_step_two">Step 2</string>
<string name="connect_tip_text">Hold the A and B buttons then press and release RESET. Keep holding A and B until the screen fills up</string>
<string name="desc_connect_tip_text">Hold the A and B buttons then press and release RESET. Keep holding A and B until the screen fills up</string>
Expand Down

0 comments on commit d783c63

Please sign in to comment.