Skip to content

Commit 18bc360

Browse files
committed
Version 3.0.4 (54) - Pairing - Add triple reset method
1 parent 7f1f74f commit 18bc360

File tree

14 files changed

+138
-32
lines changed

14 files changed

+138
-32
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
-->
1616
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
1717
xmlns:tools="http://schemas.android.com/tools"
18-
android:versionCode="53"
19-
android:versionName="3.0.3">
18+
android:versionCode="54"
19+
android:versionName="3.0.4">
2020

2121
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
2222
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

app/src/main/java/com/samsung/microbit/ui/activity/PairingActivity.java

Lines changed: 57 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -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));
4.58 MB
Loading

app/src/main/res/layout-land/view_pairing_step_1.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
<!-- Step description -->
4545
<include layout="@layout/pair_microbit_step" />
4646

47+
<include layout="@layout/view_pairing_step_1_other" />
48+
4749
<!-- Confirmation buttons -->
4850
<include layout="@layout/pairing_tip_action_buttons"/>
4951
</LinearLayout>

app/src/main/res/layout/view_pairing_step_1.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
<!-- Step description -->
2626
<include layout="@layout/pair_microbit_step" />
2727

28+
<include layout="@layout/view_pairing_step_1_other" />
29+
2830
<!-- Confirmation buttons -->
2931
<include layout="@layout/pairing_tip_action_buttons" />
3032
</LinearLayout>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?><!-- Pairing Confirmation buttons -->
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
android:id="@+id/viewPairStep1Other"
5+
style="@style/another_way_button_layout_style"
6+
tools:showIn="@layout/view_pairing_step_1">
7+
8+
<Button
9+
android:id="@+id/viewPairStep1AnotherWay"
10+
style="@style/another_way_button_style"
11+
android:background="@drawable/white_btn"
12+
android:drawableEnd="@drawable/next_step_pairing_btn"
13+
android:text="@string/viewPathAntherWay" />
14+
</LinearLayout>

app/src/main/res/values-land/dimens.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@
122122
<dimen name="pairing_step_buttons_space_margin">4dp</dimen>
123123
<integer name="pairing_searching_step_button_layout_weight_sum">3</integer>
124124
<dimen name="pairing_step_button_height">58dp</dimen>
125+
<dimen name="another_way_button_height">44dp</dimen>
126+
<dimen name="another_way_button_text_size">13sp</dimen>
127+
<dimen name="another_way_button_layout_weightSum">3</dimen>
128+
<dimen name="another_way_button_layout_weight">2</dimen>
125129

126130
<!-- Pattern grid -->
127131
<dimen name="led_gap">4dp</dimen>

app/src/main/res/values-land/styles.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,25 @@
5050
<item name="android:layout_width">wrap_content</item>
5151
</style>
5252

53+
<style name="another_way_button_layout_style" parent="match_width_parent_wrap_height_content">
54+
<item name="android:gravity">center</item>
55+
<item name="android:layout_gravity">bottom</item>
56+
<item name="android:padding">@dimen/pairing_step_button_layout_padding</item>
57+
<item name="android:weightSum">@dimen/another_way_button_layout_weightSum</item>
58+
</style>
59+
60+
<style name="another_way_button_style">
61+
<item name="android:layout_width">0dp</item>
62+
<item name="android:layout_height">@dimen/another_way_button_height</item>
63+
<item name="android:gravity">center</item>
64+
<item name="android:textSize">@dimen/another_way_button_text_size</item>
65+
<item name="android:textColor">@android:color/black</item>
66+
<item name="android:textAllCaps">true</item>
67+
<item name="android:paddingStart">@dimen/pairing_step_button_padding</item>
68+
<item name="android:paddingEnd">@dimen/pairing_step_button_padding</item>
69+
<item name="android:layout_weight">@dimen/another_way_button_layout_weight</item>
70+
</style>
71+
5372
<style name="pairing_step_buttons_layout_style" parent="match_width_parent_wrap_height_content">
5473
<item name="android:layout_gravity">bottom</item>
5574
<item name="android:paddingStart">@dimen/pairing_step_button_layout_padding</item>

app/src/main/res/values-sw360dp-land/dimens.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@
100100
<dimen name="pairing_step_1_gif_image_height">230dp</dimen>
101101
<dimen name="pairing_step_button_text_size">16sp</dimen>
102102
<dimen name="pairing_step_cycle_progress_bar_size">80dp</dimen>
103+
<dimen name="another_way_button_height">48dp</dimen>
104+
<dimen name="another_way_button_text_size">14sp</dimen>
105+
<dimen name="another_way_button_layout_weightSum">3</dimen>
106+
<dimen name="another_way_button_layout_weight">2</dimen>
103107

104108

105109
<!-- Popup screen -->

app/src/main/res/values-sw600dp-land/dimens.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@
106106
<dimen name="pairing_step_cycle_progress_bar_size">120dp</dimen>
107107
<dimen name="pairing_step_buttons_space_margin">8dp</dimen>
108108
<dimen name="connect_button_height">72dp</dimen>
109+
<dimen name="another_way_button_height">56dp</dimen>
110+
<dimen name="another_way_button_text_size">22sp</dimen>
111+
<dimen name="another_way_button_layout_weightSum">3</dimen>
112+
<dimen name="another_way_button_layout_weight">2</dimen>
109113

110114
<!-- Pattern grid -->
111115
<dimen name="led_gap">15dp</dimen>

app/src/main/res/values-sw600dp-port/dimens.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@
138138
<dimen name="pairing_step_button_layout_padding">18dp</dimen>
139139
<dimen name="pairing_step_gif_image_margin">0dp</dimen>
140140
<dimen name="pairing_step_tip_instruction_text_size">22sp</dimen>
141+
<dimen name="another_way_button_height">54dp</dimen>
142+
<dimen name="another_way_button_text_size">22sp</dimen>
143+
<dimen name="another_way_button_layout_weightSum">3</dimen>
144+
<dimen name="another_way_button_layout_weight">2</dimen>
141145

142146
<!-- Popup screens -->
143147
<dimen name="popup_gif_size">200dp</dimen>

app/src/main/res/values/dimens.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@
112112
<dimen name="pairing_step_two_tip_layout_margin_top">16dp</dimen>
113113
<dimen name="pairing_step_tip_instruction_text_size">18sp</dimen>
114114
<integer name="pairing_searching_step_button_layout_weight_sum">2</integer>
115+
<dimen name="another_way_button_height">41dp</dimen>
116+
<dimen name="another_way_button_text_size">18sp</dimen>
117+
<dimen name="another_way_button_layout_weightSum">3</dimen>
118+
<dimen name="another_way_button_layout_weight">2</dimen>
115119

116120
<!-- Connect screen -->
117121
<dimen name="connections_container_layout_padding">16dp</dimen>

app/src/main/res/values/strings.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@
190190
<string name="desc_connectSearchingTitle">Connecting&#8230;</string>
191191
<string name="searchingTitle">Searching for micro:bit</string>
192192
<string name="pairing_msg_1">Found micro:bit</string>
193+
<string name="viewPairTriplePromptText">Press RESET three times</string>
194+
<string name="viewPairTriplePromptTextDesc">Press RESET three times</string>
195+
<string name="viewPathAntherWay">Show another way</string>
193196

194197
<!--Connect Popup messages -->
195198
<string name="pairingErrorTitle">Error</string>

app/src/main/res/values/styles.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,25 @@
198198
<item name="android:textColor">@android:color/white</item>
199199
</style>
200200

201+
<style name="another_way_button_layout_style" parent="match_width_parent_wrap_height_content">
202+
<item name="android:gravity">center</item>
203+
<item name="android:layout_gravity">bottom</item>
204+
<item name="android:padding">@dimen/pairing_step_button_layout_padding</item>
205+
<item name="android:weightSum">@dimen/another_way_button_layout_weightSum</item>
206+
</style>
207+
208+
<style name="another_way_button_style">
209+
<item name="android:layout_width">0dp</item>
210+
<item name="android:layout_height">@dimen/another_way_button_height</item>
211+
<item name="android:gravity">center</item>
212+
<item name="android:textSize">@dimen/another_way_button_text_size</item>
213+
<item name="android:textColor">@android:color/black</item>
214+
<item name="android:textAllCaps">true</item>
215+
<item name="android:paddingStart">@dimen/pairing_step_button_padding</item>
216+
<item name="android:paddingEnd">@dimen/pairing_step_button_padding</item>
217+
<item name="android:layout_weight">@dimen/another_way_button_layout_weight</item>
218+
</style>
219+
201220
<style name="pairing_step_button_style">
202221
<item name="android:layout_width">0dp</item>
203222
<item name="android:layout_weight">1</item>

0 commit comments

Comments
 (0)