class PanicResponderActivity extends AppCompatActivity {

    static void resetRepos(Context context) {
        HashSet<String> enabledAddresses = new HashSet<>();
        HashSet<String> disabledAddresses = new HashSet<>();
        String[] defaultReposItems = DBHelper.loadInitialRepos(context).toArray(new String[0]);
        for (int i = 1; i < defaultReposItems.length; i += DBHelper.REPO_XML_ITEM_COUNT) {
            if ("1".equals(defaultReposItems[i + 3])) {
                enabledAddresses.add(defaultReposItems[i]);
            } else {
                disabledAddresses.add(defaultReposItems[i]);
            }
        }

        List<Repo> repos = RepoProvider.Helper.all(context);
        for (Repo repo : repos) {
            ContentValues values = new ContentValues(1);
            if (enabledAddresses.contains(repo.address)) {
                values.put(Schema.RepoTable.Cols.IN_USE, true);
                RepoProvider.Helper.update(context, repo, values);
            } else if (disabledAddresses.contains(repo.address)) {
                values.put(Schema.RepoTable.Cols.IN_USE, false);
                RepoProvider.Helper.update(context, repo, values);
            } else {
                RepoProvider.Helper.remove(context, repo.getId());
            }
        }
    }

}