@@ -0,0 +1,1775 @@
+package com.hewgill.android.nzsldict;%0A%0Aimport android.content.Context;%0Aimport android.content.SharedPreferences;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport java.util.Set;%0Aimport java.util.TreeSet;%0A%0Apublic class VocabSheetRepository %7B%0A    private final Context mContext;%0A    private final SharedPreferences mPrefsStore;%0A    private final String KEY = %22NZSL_VOCAB_SHEET%22;%0A    private final String PREF_KEY = %22VOCAB_SHEET_ITEMS%22;%0A%0A    public VocabSheetRepository(Context ctx) %7B%0A        mContext = ctx;%0A        mPrefsStore = ctx.getSharedPreferences(KEY, Context.MODE_PRIVATE);%0A    %7D%0A%0A    public List%3CDictItem%3E all() %7B%0A        List%3CDictItem%3E allItems = new ArrayList%3C%3E();%0A        Dictionary dict = new Dictionary(mContext);%0A        for (String key : allKeys()) %7B%0A            DictItem item = dict.getWord(key);%0A            if (item != null) %7B allItems.add(item); %7D%0A        %7D%0A%0A        return allItems;%0A    %7D%0A%0A    public void add(DictItem item) %7B%0A        SharedPreferences.Editor edit = mPrefsStore.edit();%0A        Set%3CString%3E newKeys = allKeys();%0A        newKeys.add(item.uniqueKey());%0A        edit.putStringSet(PREF_KEY, newKeys);%0A        edit.apply();%0A    %7D%0A%0A    public void remove(DictItem item) %7B%0A        SharedPreferences.Editor edit = mPrefsStore.edit();%0A        Set%3CString%3E newKeys = allKeys();%0A        newKeys.remove(item.uniqueKey());%0A        (new DictItemOfflineAvailability(mContext, item)).unavailableOffline();%0A        edit.putStringSet(PREF_KEY, newKeys);%0A        edit.apply();%0A    %7D%0A%0A    public boolean contains(DictItem item) %7B%0A        return allKeys().contains(item.uniqueKey());%0A    %7D%0A%0A    private Set%3CString%3E allKeys() %7B%0A        Set%3CString%3E defaultValue = new TreeSet%3C%3E();%0A        return mPrefsStore.getStringSet(PREF_KEY, defaultValue);%0A    %7D%0A%7D%0A

Add repository class for loading and saving vocab sheet items