From 666082162fb0eecc2a3455ba05d7afef29295f5f Mon Sep 17 00:00:00 2001 From: Ignacio Van Loy Date: Thu, 7 Mar 2019 22:01:24 +0100 Subject: [PATCH] loadData trully fixed --- .../src/main/java/com/ivanloy/mentalblocks/LevelListActivity.kt | 2 +- .../src/main/java/com/ivanloy/mentalblocks/MainMenuActivity.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MentalBlocks2/app/src/main/java/com/ivanloy/mentalblocks/LevelListActivity.kt b/MentalBlocks2/app/src/main/java/com/ivanloy/mentalblocks/LevelListActivity.kt index 97a7770..9c42129 100644 --- a/MentalBlocks2/app/src/main/java/com/ivanloy/mentalblocks/LevelListActivity.kt +++ b/MentalBlocks2/app/src/main/java/com/ivanloy/mentalblocks/LevelListActivity.kt @@ -126,7 +126,7 @@ class LevelListActivity : AppCompatActivity(), LevelListListener, View.OnClickLi if(data != null) { var parsedData = data.split(" ") if (parsedData.size > 0) { - for (i in 0..levels.size) { //TODO Hardcoded + for (i in 0..levels.size - 1) { //TODO Hardcoded var line = parsedData[i].split(",") levels[i].unlocked = line[0].toBoolean() levels[i].completed = line[1].toBoolean() diff --git a/MentalBlocks2/app/src/main/java/com/ivanloy/mentalblocks/MainMenuActivity.kt b/MentalBlocks2/app/src/main/java/com/ivanloy/mentalblocks/MainMenuActivity.kt index 0b3f94b..728b2d8 100644 --- a/MentalBlocks2/app/src/main/java/com/ivanloy/mentalblocks/MainMenuActivity.kt +++ b/MentalBlocks2/app/src/main/java/com/ivanloy/mentalblocks/MainMenuActivity.kt @@ -68,7 +68,7 @@ class MainMenuActivity : AppCompatActivity(), View.OnClickListener { if(data != null) { var parsedData = data.split(" ") if (parsedData.size > 0) { - for (i in 0..levels.size) { //TODO Hardcoded + for (i in 0..levels.size - 1) { //TODO Hardcoded var line = parsedData[i].split(",") levels[i].unlocked = line[0].toBoolean() levels[i].completed = line[1].toBoolean()