Skip to content

Commit 4ecc3b0

Browse files
committed
Home - install new samples
1 parent 68afcfc commit 4ecc3b0

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

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

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public class HomeActivity extends AppCompatActivity implements View.OnClickListe
5959

6060
public static final String FIRST_RUN = "firstrun";
6161
public static final String FIRST_RUN_300 = "firstrun300";
62+
public static final String FIRST_RUN_301 = "firstrun301";
6263

6364
// share stats checkbox
6465
private CheckBox mShareStatsCheckBox;
@@ -496,17 +497,27 @@ private void setFirstRun300( boolean yes) {
496497
mPrefs.edit().putBoolean(FIRST_RUN_300, yes).apply();
497498
}
498499

500+
private boolean isFirstRun301() {
501+
return mPrefs.getBoolean(FIRST_RUN_301, true);
502+
}
503+
504+
private void setFirstRun301( boolean yes) {
505+
mPrefs.edit().putBoolean(FIRST_RUN_301, yes).apply();
506+
}
507+
499508
/**
500509
* Loads standard samples provided by Samsung. The samples can be used to
501510
* flash on a micro:bit board.
502511
*/
503512
private void installSamples( boolean withThanks) {
504513
boolean firstRun = isFirstRun();
505514
boolean firstRun300 = isFirstRun300();
515+
boolean firstRun301 = isFirstRun301();
506516
if ( firstRun) setFirstRun(false);
507517
if ( firstRun300) setFirstRun300(false);
518+
if ( firstRun301) setFirstRun301(false);
508519

509-
if( firstRun || firstRun300 && !ProjectsHelper.legacyStorage()) {
520+
if( firstRun || firstRun301 || firstRun300 && !ProjectsHelper.legacyStorage()) {
510521
//First Run. Install the Sample applications
511522
if ( withThanks) {
512523
new Thread(new Runnable() {
@@ -542,6 +553,7 @@ public void onRequestPermissionsResult(int requestCode, @NonNull String permissi
542553
} else {
543554
setFirstRun(false);
544555
setFirstRun300(false);
556+
setFirstRun301(false);
545557
PopUp.show(getString(R.string.storage_permission_for_samples_error),
546558
"",
547559
R.drawable.error_face, R.drawable.red_btn,
@@ -587,6 +599,7 @@ public void onClick(View v) {
587599
null, null);
588600
setFirstRun(false);
589601
setFirstRun300(false);
602+
setFirstRun301(false);
590603
}
591604
};
592605

@@ -596,7 +609,7 @@ public void onClick(View v) {
596609
*/
597610
private void checkMinimumPermissionsForThisScreen() {
598611
//Check reading permissions & writing permission to populate the HEX files & show program list
599-
if(isFirstRun() || isFirstRun300() && !ProjectsHelper.legacyStorage()) {
612+
if( isFirstRun() || isFirstRun301() || isFirstRun300() && !ProjectsHelper.legacyStorage()) {
600613
if( !ProjectsHelper.havePermissions(this)) {
601614
PopUp.show(getString(R.string.storage_permission_for_samples),
602615
getString(R.string.permissions_needed_title),

app/src/main/res/raw/samples.zip

852 KB
Binary file not shown.

0 commit comments

Comments
 (0)