use of com.ichi2.libanki.exception.NoSuchDeckException in project AnkiChinaAndroid by ankichinateam.
the class Collection method removeDeckOptionsFromDynamicDecks.
private ArrayList<String> removeDeckOptionsFromDynamicDecks(Runnable notifyProgress) {
Timber.d("removeDeckOptionsFromDynamicDecks()");
ArrayList<String> problems = new ArrayList<>();
// #5708 - a dynamic deck should not have "Deck Options"
notifyProgress.run();
int fixCount = 0;
for (long id : mDecks.allDynamicDeckIds()) {
try {
if (mDecks.hasDeckOptions(id)) {
mDecks.removeDeckOptions(id);
fixCount++;
}
} catch (NoSuchDeckException e) {
Timber.e("Unable to find dynamic deck %d", id);
}
}
if (fixCount > 0) {
mDecks.save();
problems.add(String.format(Locale.US, "%d dynamic deck(s) had deck options.", fixCount));
}
return problems;
}
use of com.ichi2.libanki.exception.NoSuchDeckException in project Anki-Android by ankidroid.
the class Collection method removeDeckOptionsFromDynamicDecks.
private ArrayList<String> removeDeckOptionsFromDynamicDecks(Runnable notifyProgress) {
Timber.d("removeDeckOptionsFromDynamicDecks()");
ArrayList<String> problems = new ArrayList<>(1);
// #5708 - a dynamic deck should not have "Deck Options"
notifyProgress.run();
int fixCount = 0;
for (long id : mDecks.allDynamicDeckIds()) {
try {
if (hasDeckOptions(id)) {
removeDeckOptions(id);
fixCount++;
}
} catch (NoSuchDeckException e) {
Timber.w(e, "Unable to find dynamic deck %d", id);
}
}
if (fixCount > 0) {
mDecks.save();
problems.add(String.format(Locale.US, "%d dynamic deck(s) had deck options.", fixCount));
}
return problems;
}
Aggregations