Skip to content

Commit

Permalink
Fix gif and text style by removing id duplications
Browse files Browse the repository at this point in the history
  • Loading branch information
microbit-grace committed May 10, 2024
1 parent d783c63 commit d3f783c
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,6 @@ private void stopScanning() {

private void startScanning() {
logi("###>>>>>>>>>>>>>>>>>>>>> startScanning");

((TextView) findViewById(R.id.search_microbit_step_3_title))
.setText(getString(R.string.searchingTitle));

getBLEPair().startScan();
}

Expand Down Expand Up @@ -705,6 +701,12 @@ private void setupFontStyle() {
okEnterPatternButton.setTypeface(robotoTypeface);

// Enter pin if needed
TextView enterPinIfNeededTitle = (TextView) findViewById(R.id.enter_pin_if_needed_title);
enterPinIfNeededTitle.setTypeface(boldTypeface);

TextView enterPinIfNeededText = (TextView) findViewById(R.id.enter_pin_if_needed_text);
enterPinIfNeededText.setTypeface(boldTypeface);

Button cancelEnterPinIfNeededButton = (Button) findViewById(R.id.cancel_enter_pin_if_needed_btn);
cancelEnterPinIfNeededButton.setTypeface(robotoTypeface);

Expand Down Expand Up @@ -1124,20 +1126,6 @@ private void displayScreen(PAIRING_STATE gotoState) {
case PAIRING_STATE_SEARCHING:
if(pairSearchView != null) {
pairSearchView.setVisibility(View.VISIBLE);
TextView tvTitle = (TextView) findViewById(R.id.search_microbit_step_3_title);
TextView tvSearchingStep = (TextView) findViewById(R.id.searching_microbit_step);
tvSearchingStep.setContentDescription(tvSearchingStep.getText());
if(tvTitle != null) {
tvTitle.setText(R.string.searchingTitle);
findViewById(R.id.searching_progress_spinner).setVisibility(View.VISIBLE);
((GifImageView) findViewById(R.id.searching_microbit_found_giffview))
.setImageResource(R.drawable.pairing_pin_screen_two);
if(currentOrientation == Configuration.ORIENTATION_LANDSCAPE) {
tvSearchingStep.setText(R.string.searching_tip_step_text_one_line);
} else {
tvSearchingStep.setText(R.string.searching_tip_step_text);
}
}
justPaired = true;
} else {
justPaired = false;
Expand Down Expand Up @@ -1614,6 +1602,8 @@ protected void onDestroy() {
Utils.unbindDrawables(findViewById(R.id.cancel_enter_pattern_step_2_btn));
Utils.unbindDrawables(findViewById(R.id.ok_enter_pattern_step_2_btn));

Utils.unbindDrawables(findViewById(R.id.enter_pin_if_needed_title));
Utils.unbindDrawables(findViewById(R.id.enter_pin_if_needed_text));
Utils.unbindDrawables(findViewById(R.id.cancel_enter_pin_if_needed_btn));
Utils.unbindDrawables(findViewById(R.id.enterPinIfNeededView));

Expand Down
7 changes: 3 additions & 4 deletions app/src/main/res/layout-land/view_enter_pin_if_needed.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,15 @@

<!-- Title -->
<TextView
android:id="@+id/search_microbit_step_3_title"
android:id="@+id/enter_pin_if_needed_title"
style="@style/pairing_step_header_style"
android:text="@string/searchingTitle" />

<!--pairing animation-->
<pl.droidsonroids.gif.GifImageView
android:id="@+id/searching_microbit_found_giffview"
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:layout_below="@id/enter_pin_if_needed_title"
android:src="@drawable/pairing_pin_screen_two" />
</RelativeLayout>

Expand All @@ -42,7 +41,7 @@
android:layout_weight="1">

<TextView
android:id="@+id/searching_microbit_step"
android:id="@+id/enter_pin_if_needed_text"
android:layout_width="wrap_content"
style="@style/pairing_step_tip_text_style"
android:layout_marginBottom="@dimen/pairing_step_tip_title_margin_bottom"
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_microbit_found_message" />
android:text="@string/searching_microbit_one_line" />

</LinearLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<!-- Title -->
<TextView
android:id="@+id/search_microbit_step_3_title"
android:id="@+id/enter_pin_if_needed_title"
style="@style/pairing_step_header_style"
android:layout_height="0dp"
android:layout_weight="1"
Expand All @@ -21,16 +21,13 @@

<!--pairing animation-->
<pl.droidsonroids.gif.GifImageView
android:id="@+id/searching_microbit_found_giffview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/searching_progress_spinner"
android:layout_centerHorizontal="true"
android:src="@drawable/pairing_pin_screen_two" />
</RelativeLayout>

<LinearLayout
android:id="@+id/searching_tip_step_3_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="bottom">
Expand All @@ -41,7 +38,7 @@
android:layout_weight="1">

<TextView
android:id="@+id/searching_microbit_step"
android:id="@+id/enter_pin_if_needed_text"
style="@style/pairing_step_tip_text_style"
android:text="@string/searching_tip_step_text" />

Expand Down
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_microbit_found_message" />
android:text="@string/searching_microbit" />

</LinearLayout>

Expand Down
10 changes: 3 additions & 7 deletions app/src/main/res/layout/view_enter_pin_if_needed.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<!-- Title -->
<TextView
android:id="@+id/search_microbit_step_3_title"
android:id="@+id/enter_pin_if_needed_title"
style="@style/pairing_step_header_style"
android:layout_height="0dp"
android:layout_weight="1"
Expand All @@ -21,25 +21,21 @@

<!--pairing animation-->
<pl.droidsonroids.gif.GifImageView
android:id="@+id/searching_microbit_found_giffview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/searching_progress_spinner"
android:layout_centerHorizontal="true"
android:src="@drawable/pairing_pin_screen_two" />
</RelativeLayout>

<LinearLayout
android:id="@+id/searching_tip_step_3_view"
style="@style/pairing_step_tip_layout_style">
<LinearLayout style="@style/pairing_step_tip_layout_style">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">

<TextView
android:id="@+id/searching_microbit_step"
android:id="@+id/enter_pin_if_needed_text"
style="@style/pairing_step_tip_text_style"
android:paddingEnd="@dimen/pairing_step_searching_tip_text_padding_end"
android:text="@string/searching_tip_step_text" />
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_microbit_found_message" />
android:text="@string/searching_microbit" />

</LinearLayout>

Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@
<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) in the notification you will receive.</string>
<string name="searching_microbit">Choose Pair (or Pair &amp; connect)\n in the notification you will receive.</string>
<string name="searching_microbit_one_line">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 d3f783c

Please sign in to comment.