diff --git a/app/src/main/java/com/samsung/microbit/ui/activity/PairingActivity.java b/app/src/main/java/com/samsung/microbit/ui/activity/PairingActivity.java
index f5b07f64..70a43d34 100644
--- a/app/src/main/java/com/samsung/microbit/ui/activity/PairingActivity.java
+++ b/app/src/main/java/com/samsung/microbit/ui/activity/PairingActivity.java
@@ -13,7 +13,6 @@
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
-import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.location.LocationManager;
@@ -103,6 +102,7 @@ private enum PAIRING_STATE {
PAIRING_STATE_TRIPLE,
PAIRING_STATE_STEP_1,
PAIRING_STATE_STEP_2,
+ PAIRING_STATE_ENTER_PIN_IF_NEEDED,
PAIRING_STATE_SEARCHING,
PAIRING_STATE_ERROR
}
@@ -119,6 +119,7 @@ private enum PAIRING_STATE {
LinearLayout pairTipView;
View connectDeviceView;
LinearLayout newDeviceView;
+ LinearLayout enterPinIfNeededView;
LinearLayout pairSearchView;
LinearLayout bottomPairButton;
@@ -221,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");
@@ -235,9 +235,6 @@ public void run() {
popupPairingFailed();
}
break;
- case Connected:
- updateOnConnected();
- break;
case Paired:
handlePairingSuccessful();
break;
@@ -251,6 +248,7 @@ public void run() {
popupPairingFailed();
break;
default:
+ // Connected and None case are not specifically handled
break;
}
}
@@ -264,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();
}
@@ -690,7 +684,7 @@ private void setupFontStyle() {
nextPairButton.setTypeface(robotoTypeface);
- // Step 2 - Enter Pattern
+ // Enter Pattern
TextView enterPatternTitle = (TextView) findViewById(R.id.enter_pattern_step_2_title);
enterPatternTitle.setTypeface(boldTypeface);
@@ -706,17 +700,26 @@ private void setupFontStyle() {
Button okEnterPatternButton = (Button) findViewById(R.id.ok_enter_pattern_step_2_btn);
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);
- // Step 3 - Searching for micro:bit
+ Button cancelEnterPinIfNeededButton = (Button) findViewById(R.id.cancel_enter_pin_if_needed_btn);
+ cancelEnterPinIfNeededButton.setTypeface(robotoTypeface);
+
+ Button nextEnterPinIfNeededButton = (Button) findViewById(R.id.next_enter_pin_if_needed_btn);
+ nextEnterPinIfNeededButton.setTypeface(robotoTypeface);
+
+ // Searching for micro:bit
TextView searchMicrobitTitle = (TextView) findViewById(R.id.search_microbit_step_3_title);
searchMicrobitTitle.setTypeface(boldTypeface);
TextView stepThreeTitle = (TextView) findViewById(R.id.searching_microbit_step);
stepThreeTitle.setTypeface(boldTypeface);
- TextView stepThreeInstructions = (TextView) findViewById(R.id.searching_microbit_step_instructions);
- stepThreeInstructions.setTypeface(robotoTypeface);
-
Button cancelSearchMicroBit = (Button) findViewById(R.id.cancel_search_microbit_step_3_btn);
cancelSearchMicroBit.setTypeface(robotoTypeface);
@@ -739,6 +742,7 @@ private void initViews() {
pairTipView = (LinearLayout) findViewById(R.id.pairTipView);
connectDeviceView = findViewById(R.id.connectDeviceView);
newDeviceView = (LinearLayout) findViewById(R.id.newDeviceView);
+ enterPinIfNeededView = (LinearLayout) findViewById(R.id.enterPinIfNeededView);
pairSearchView = (LinearLayout) findViewById(R.id.pairSearchView);
//Setup on click listeners.
@@ -751,6 +755,9 @@ private void initViews() {
findViewById(R.id.ok_enter_pattern_step_2_btn).setOnClickListener(this);
findViewById(R.id.cancel_enter_pattern_step_2_btn).setOnClickListener(this);
+ findViewById(R.id.next_enter_pin_if_needed_btn).setOnClickListener(this);
+ findViewById(R.id.cancel_enter_pin_if_needed_btn).setOnClickListener(this);
+
findViewById(R.id.cancel_search_microbit_step_3_btn).setOnClickListener(this);
setupFontStyle();
@@ -764,6 +771,7 @@ private void releaseViews() {
pairTipView = null;
connectDeviceView = null;
newDeviceView = null;
+ enterPinIfNeededView = null;
pairSearchView = null;
}
@@ -1053,44 +1061,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);
- TextView tvSearchingInstructions = (TextView) findViewById(R.id.searching_microbit_step_instructions);
- 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);
-// }
-// tvSearchingInstructions.setText(R.string.searching_tip_text_instructions);
- }
- }
-
- 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);
- TextView tvSearchingInstructions = (TextView) findViewById(R.id.searching_microbit_step_instructions);
- 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);
- }
- tvSearchingInstructions.setText(R.string.searching_tip_text_instructions);
- }
- }
-
/**
* Displays needed screen according to a pairing state and
* allows to navigate through the connection screens.
@@ -1102,6 +1072,7 @@ private void displayScreen(PAIRING_STATE gotoState) {
//Reset all screens first
pairTipView.setVisibility(View.GONE);
newDeviceView.setVisibility(View.GONE);
+ enterPinIfNeededView.setVisibility(View.GONE);
pairSearchView.setVisibility(View.GONE);
connectDeviceView.setVisibility(View.GONE);
@@ -1148,25 +1119,13 @@ private void displayScreen(PAIRING_STATE gotoState) {
displayLedGrid();
break;
+ case PAIRING_STATE_ENTER_PIN_IF_NEEDED:
+ enterPinIfNeededView.setVisibility(View.VISIBLE);
+ break;
+
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());
- TextView tvSearchingInstructions = (TextView) findViewById(R.id.searching_microbit_step_instructions);
- 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);
- }
- tvSearchingInstructions.setText(R.string.searching_tip_text_instructions);
- }
justPaired = true;
} else {
justPaired = false;
@@ -1394,6 +1353,11 @@ public void onClick(final View v) {
if(!BluetoothChecker.getInstance().checkBluetoothAndStart()) {
return;
}
+ displayScreen(PAIRING_STATE.PAIRING_STATE_ENTER_PIN_IF_NEEDED);
+ break;
+
+ case R.id.next_enter_pin_if_needed_btn:
+ logi("onClick() :: next_enter_pin_if_needed_btn");
startScanning();
displayScreen(PAIRING_STATE.PAIRING_STATE_SEARCHING);
break;
@@ -1413,6 +1377,12 @@ public void onClick(final View v) {
onFinish( RESULT_CANCELED);
break;
+ case R.id.cancel_enter_pin_if_needed_btn:
+ logi("onClick() :: cancel_enter_pin_if_needed_btn");
+ stopScanning();
+ onFinish( RESULT_CANCELED);
+ break;
+
case R.id.cancel_search_microbit_step_3_btn:
logi("onClick() :: cancel_search_button");
stopScanning();
@@ -1602,6 +1572,7 @@ protected void onDestroy() {
pairTipView.setVisibility(View.GONE);
newDeviceView.setVisibility(View.GONE);
+ enterPinIfNeededView.setVisibility(View.GONE);
pairSearchView.setVisibility(View.GONE);
connectDeviceView.setVisibility(View.GONE);
@@ -1630,9 +1601,14 @@ protected void onDestroy() {
Utils.unbindDrawables(findViewById(R.id.oh_pretty_emoji));
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));
+
Utils.unbindDrawables(findViewById(R.id.search_microbit_step_3_title));
Utils.unbindDrawables(findViewById(R.id.searching_microbit_step));
- Utils.unbindDrawables(findViewById(R.id.searching_microbit_step_instructions));
Utils.unbindDrawables(findViewById(R.id.cancel_search_microbit_step_3_btn));
Utils.unbindDrawables(findViewById(R.id.searching_progress_spinner));
diff --git a/app/src/main/res/drawable-mdpi/emoji_microbit_found.gif b/app/src/main/res/drawable-mdpi/emoji_searching_microbit.gif
similarity index 100%
rename from app/src/main/res/drawable-mdpi/emoji_microbit_found.gif
rename to app/src/main/res/drawable-mdpi/emoji_searching_microbit.gif
diff --git a/app/src/main/res/layout-land/view_enter_pin_if_needed.xml b/app/src/main/res/layout-land/view_enter_pin_if_needed.xml
new file mode 100644
index 00000000..324b4dc1
--- /dev/null
+++ b/app/src/main/res/layout-land/view_enter_pin_if_needed.xml
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout-land/view_pairing_searching.xml b/app/src/main/res/layout-land/view_pairing_searching.xml
index ac3d396d..50955be9 100644
--- a/app/src/main/res/layout-land/view_pairing_searching.xml
+++ b/app/src/main/res/layout-land/view_pairing_searching.xml
@@ -29,11 +29,10 @@
+ android:src="@drawable/emoji_searching_microbit" />
+ android:text="@string/searching_microbit_one_line" />
-
\ No newline at end of file
diff --git a/app/src/main/res/layout-sw600dp-port/view_enter_pin_if_needed.xml b/app/src/main/res/layout-sw600dp-port/view_enter_pin_if_needed.xml
new file mode 100644
index 00000000..4cd78f23
--- /dev/null
+++ b/app/src/main/res/layout-sw600dp-port/view_enter_pin_if_needed.xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout-sw600dp-port/view_pairing_searching_step.xml b/app/src/main/res/layout-sw600dp-port/view_pairing_searching_step.xml
index af5f2648..90013a9c 100644
--- a/app/src/main/res/layout-sw600dp-port/view_pairing_searching_step.xml
+++ b/app/src/main/res/layout-sw600dp-port/view_pairing_searching_step.xml
@@ -15,13 +15,8 @@
+ android:text="@string/searching_microbit" />
-
+
+
diff --git a/app/src/main/res/layout/view_enter_pin_if_needed.xml b/app/src/main/res/layout/view_enter_pin_if_needed.xml
new file mode 100644
index 00000000..50988f44
--- /dev/null
+++ b/app/src/main/res/layout/view_enter_pin_if_needed.xml
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/view_pairing_searching.xml b/app/src/main/res/layout/view_pairing_searching.xml
index 19c0e9be..91d726ae 100644
--- a/app/src/main/res/layout/view_pairing_searching.xml
+++ b/app/src/main/res/layout/view_pairing_searching.xml
@@ -32,12 +32,11 @@
+ android:src="@drawable/emoji_searching_microbit" />
diff --git a/app/src/main/res/layout/view_pairing_searching_step.xml b/app/src/main/res/layout/view_pairing_searching_step.xml
index bd8c301b..73bc0cdf 100644
--- a/app/src/main/res/layout/view_pairing_searching_step.xml
+++ b/app/src/main/res/layout/view_pairing_searching_step.xml
@@ -15,13 +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" />
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 530f0d76..ba637ee5 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -160,31 +160,19 @@
Step 4
When you see the success message, press RESET and you\'re done!
Step 3
- When asked, press button A \nand enter your PIN
- When asked, press button A and enter your PIN
- When asked, press button A and enter your PIN
Step 4
- Open your notification drawer \nand enter your Pin
- Open your notification drawer and enter your Pin
- Open your notification drawer and enter your Pin
+ Choose Pair \n(or Pair & connect) in the notification you will receive.
+ Choose Pair (or Pair & connect) in the notification you will receive.
Step 2
Hold the A and B buttons then press and release RESET. Keep holding A and B until the screen fills up
Hold the A and B buttons then press and release RESET. Keep holding A and B until the screen fills up
Step one
Hold the A and B buttons \nthen press and release RESET. \nKeep holding A and B \nuntil the screen fills up
Step two
- When asked, enter your PIP \n(personal identification pattern)
- When asked, enter your personal identification pattern
Step 2
Copy the pattern from your micro:bit onto this grid
Step two
Copy the pattern from your micro:bit onto this grid
- (you only have 30 seconds)
- You only have 30 seconds
- If asked for a PIN, press button A
- Press button A, and\nenter the 6 digit PIN
- Step 4
- Press button A, and enter the 6 digit PIN
Connecting…
Connecting…
@@ -331,8 +319,10 @@
Micro:Bit connection status
Flash code to your Micro:bit
Delete code
- If asked for a PIN,\npress button A
- If asked for a PIN, press button A
+ If asked for a PIN
+ If asked for a PIN, press button A \non the micro:bit
+ If asked for a PIN, press button A on the micro:bit
+ Tap Next to pair
Pair a new micro:bit
Most recently used micro:bit
Currently connected micro:bit