Skip to content

Commit 389a633

Browse files
committed
Project - fix partial flash launch
1 parent b7cba2d commit 389a633

File tree

2 files changed

+20
-32
lines changed

2 files changed

+20
-32
lines changed

app/src/main/java/com/samsung/microbit/service/PartialFlashingService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ protected boolean isDebug() {
1818
return com.samsung.microbit.BuildConfig.DEBUG;
1919
}
2020
}
21+

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

Lines changed: 19 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,34 +1259,27 @@ protected void startFlashing() {
12591259
@Override
12601260
public void run() {
12611261
prepareToFlashResult = prepareToFlash();
1262-
switch ( prepareToFlashResult) {
1263-
case 0: {
1264-
startPartialFlash();
1265-
break;
1266-
}
1267-
case 1: {
1268-
runOnUiThread(new Runnable() {
1269-
@Override
1270-
public void run() {
1262+
runOnUiThread(new Runnable() {
1263+
@Override
1264+
public void run() {
1265+
switch (prepareToFlashResult) {
1266+
case 0:
1267+
startPartialFlash();
1268+
break;
1269+
case 1:
12711270
PopUp.hide();
12721271
popupHexNotCompatible();
1273-
}
1274-
});
1275-
break;
1276-
}
1277-
case 2: {
1278-
runOnUiThread(new Runnable() {
1279-
@Override
1280-
public void run() {
1272+
break;
1273+
case 2:
12811274
PopUp.hide();
12821275
popupFailedToCreateFiles();
1283-
}
1284-
});
1285-
break;
1276+
break;
1277+
}
12861278
}
1287-
}
1279+
});
12881280
}
12891281
}).start();
1282+
logi("startFlashing End");
12901283
}
12911284

12921285
protected void popupHexNotCompatible() {
@@ -1402,13 +1395,6 @@ public void startDFUFlash() {
14021395

14031396
protected void startPartialFlash() {
14041397
logi("startPartialFlash");
1405-
PopUp.hide();
1406-
PopUp.show(getString(R.string.dfu_status_starting_msg),
1407-
"",
1408-
R.drawable.flash_face, R.drawable.blue_btn,
1409-
PopUp.GIFF_ANIMATION_FLASH,
1410-
TYPE_SPINNER_NOT_CANCELABLE,
1411-
null, null);
14121398

14131399
MBApp application = MBApp.getApp();
14141400
ConnectedDevice currentMicrobit = BluetoothUtils.getPairedMicrobit(this);
@@ -1425,6 +1411,7 @@ protected void startPartialFlash() {
14251411
service.putExtra("hardwareType", hardwareType); // a path or URI must be provided.
14261412
service.putExtra("pf", true); // Enable partial flashing
14271413
application.startService(service);
1414+
logi("startPartialFlash End");
14281415
}
14291416

14301417

@@ -1900,8 +1887,8 @@ public void onReceive(Context context, Intent intent) {
19001887
MBApp application = MBApp.getApp();
19011888
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(application);
19021889

1903-
String message = "Broadcast intent detected " + intent.getAction();
1904-
logi("PFResultReceiver.onReceive :: " + message);
1890+
String action = intent.getAction();
1891+
logi("PFResultReceiver.onReceive :: action " + action);
19051892
if(intent.getAction().equals(PartialFlashingService.BROADCAST_PROGRESS)) {
19061893
// Update UI
19071894
Intent progressUpdate = new Intent();
@@ -1986,8 +1973,8 @@ public void onClick(View v) {
19861973

19871974
@Override
19881975
public void onReceive(Context context, Intent intent) {
1989-
String message = "Broadcast intent detected " + intent.getAction();
1990-
logi("DFUResultReceiver.onReceive :: " + message);
1976+
String action = intent.getAction();
1977+
logi("DFUResultReceiver.onReceive :: action " + action);
19911978
if(intent.getAction().equals(DfuService.BROADCAST_PROGRESS)) {
19921979
int state = intent.getIntExtra(DfuService.EXTRA_DATA, 0);
19931980
if(state < 0) {

0 commit comments

Comments
 (0)