diff --git a/catroid/build.gradle b/catroid/build.gradle index 2a73239dbd0..b3977fb9233 100644 --- a/catroid/build.gradle +++ b/catroid/build.gradle @@ -138,8 +138,8 @@ android { targetSdkVersion 28 applicationId appId testInstrumentationRunner 'org.catrobat.catroid.runner.UiTestApplicationRunner' - versionCode 75 - versionName "0.9.71" + versionCode 78 + versionName "0.9.73" println "VersionCode is $versionCode" println "VersionName is $versionName" multiDexEnabled true diff --git a/catroid/src/main/java/org/catrobat/catroid/io/BackpackSerializer.java b/catroid/src/main/java/org/catrobat/catroid/io/BackpackSerializer.java index ffedbe8316b..3bab8f26a6f 100644 --- a/catroid/src/main/java/org/catrobat/catroid/io/BackpackSerializer.java +++ b/catroid/src/main/java/org/catrobat/catroid/io/BackpackSerializer.java @@ -27,8 +27,6 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import com.google.gson.JsonIOException; -import com.google.gson.JsonSyntaxException; import org.catrobat.catroid.common.Backpack; import org.catrobat.catroid.content.Script; @@ -89,13 +87,11 @@ public Backpack loadBackpack() { try { BufferedReader bufferedReader = new BufferedReader(new FileReader(backpackFile)); return backpackGson.fromJson(bufferedReader, Backpack.class); - } catch (FileNotFoundException e) { - Log.e(TAG, "FileNotFoundException: Could not create buffered Writer with file: " - + backpackFile.getAbsolutePath()); - return new Backpack(); - } catch (JsonSyntaxException | JsonIOException jsonException) { - Log.e(TAG, "Cannot load Backpack. Creating new Backpack File.", jsonException); - backpackFile.delete(); + } catch (Exception e) { + if (!(e instanceof FileNotFoundException)) { + backpackFile.delete(); + } + Log.e(TAG, "Cannot load Backpack. Creating new Backpack File.", e); return new Backpack(); } } diff --git a/catroid/src/main/java/org/catrobat/catroid/ui/recyclerview/fragment/MainMenuFragment.java b/catroid/src/main/java/org/catrobat/catroid/ui/recyclerview/fragment/MainMenuFragment.java index b1f3df34852..9c8861571a1 100644 --- a/catroid/src/main/java/org/catrobat/catroid/ui/recyclerview/fragment/MainMenuFragment.java +++ b/catroid/src/main/java/org/catrobat/catroid/ui/recyclerview/fragment/MainMenuFragment.java @@ -134,14 +134,7 @@ public void onClick(View v) { parent.findViewById(R.id.current_project).setOnClickListener(listener); parent.findViewById(R.id.floating_action_button).setOnClickListener(listener); - updateMyProjects(); - if (myProjects.size() != 0) { - currentProject = myProjects.get(0).getName(); - } else { - currentProject = Utils.getCurrentProjectName(getContext()); - } - loadProjectImage(); - + setAndLoadCurrentProject(); setShowProgressBar(false); } @@ -169,12 +162,19 @@ public void onResume() { getActivity().getIntent().removeExtra(EXTRA_PROJECT_NAME); loadDownloadedProject(projectName); } + setAndLoadCurrentProject(); + } + + private void setAndLoadCurrentProject() { updateMyProjects(); if (myProjects.size() != 0) { currentProject = myProjects.get(0).getName(); } else { currentProject = Utils.getCurrentProjectName(getContext()); } + File projectDir = new File(DEFAULT_ROOT_DIRECTORY, + FileMetaDataExtractor.encodeSpecialCharsForFileSystem(currentProject)); + ProjectLoadTask.task(projectDir, getContext()); loadProjectImage(); }