@@ -0,0 +1,1827 @@
+package org.ccci.gto.android.common.util;%0A%0Aimport android.content.SharedPreferences;%0Aimport android.os.Build;%0Aimport android.support.annotation.NonNull;%0Aimport android.support.annotation.Nullable;%0A%0Aimport org.json.JSONArray;%0Aimport org.json.JSONException;%0A%0Aimport java.util.HashSet;%0Aimport java.util.Set;%0A%0Apublic class SharedPreferencesUtils %7B%0A    public static SharedPreferences.Editor putStringSet(@NonNull final SharedPreferences.Editor prefs,%0A                                                        @NonNull final String key, @Nullable final Set%3CString%3E values) %7B%0A        if (Build.VERSION.SDK_INT %3E= Build.VERSION_CODES.HONEYCOMB) %7B%0A            prefs.putStringSet(key, values);%0A        %7D else %7B%0A            // work around missing putStringSet in pre-Honeycomb%0A            prefs.putString(key, values != null ? new JSONArray(values).toString() : null);%0A        %7D%0A%0A        return prefs;%0A    %7D%0A%0A    public static Set%3CString%3E getStringSet(@NonNull final SharedPreferences prefs, @NonNull final String key,%0A                                           @Nullable final Set%3CString%3E defValue) %7B%0A        if (Build.VERSION.SDK_INT %3E= Build.VERSION_CODES.HONEYCOMB) %7B%0A            return prefs.getStringSet(key, defValue);%0A        %7D else %7B%0A            // work around missing getStringSet%0A            final String raw = prefs.getString(key, null);%0A            if (raw != null) %7B%0A                try %7B%0A                    final JSONArray json = new JSONArray(raw);%0A                    final Set%3CString%3E values = new HashSet%3C%3E();%0A                    for (int i = 0; i %3C json.length(); i++) %7B%0A                        values.add(json.getString(i));%0A                    %7D%0A                    return values;%0A                %7D catch (final JSONException ignored) %7B%0A                %7D%0A            %7D%0A            return defValue;%0A        %7D%0A    %7D%0A%7D%0A

implement common StringSet preference support