Skip to content

Commit

Permalink
Copy persisted galleries before adding one
Browse files Browse the repository at this point in the history
  • Loading branch information
nning committed Apr 21, 2017
1 parent ca5d35b commit 1d31571
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/src/main/java/net/orgizm/imgshr/Preferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ public void setLastSlugs(Gallery gallery) {
Set<String> serializedGalleries = preferences.getStringSet(GALLERIES_KEY, null);
if (serializedGalleries == null) serializedGalleries = new HashSet<>();

serializedGalleries.add(gson.toJson(gallery));
Set<String> newSerializedGalleries = new HashSet<>(serializedGalleries);
newSerializedGalleries.add(gson.toJson(gallery));

editor.putStringSet(GALLERIES_KEY, serializedGalleries);
editor.putStringSet(GALLERIES_KEY, newSerializedGalleries);
editor.apply();
}

Expand Down

0 comments on commit 1d31571

Please sign in to comment.