Search in sources :

Example 1 with TagUsnTuple

use of com.ichi2.libanki.backend.model.TagUsnTuple in project Anki-Android by ankidroid.

the class Syncer method getTags.

/**
 * Tags ********************************************************************
 */
private JSONArray getTags() {
    JSONArray result = new JSONArray();
    if (mCol.getServer()) {
        for (TagUsnTuple t : mCol.getTags().allItems()) {
            if (t.getUsn() >= mMinUsn) {
                result.put(t.getTag());
            }
        }
    } else {
        for (TagUsnTuple t : mCol.getTags().allItems()) {
            if (t.getUsn() == -1) {
                String tag = t.getTag();
                mCol.getTags().add(t.getTag(), mMaxUsn);
                result.put(tag);
            }
        }
        mCol.getTags().save();
    }
    return result;
}
Also used : TagUsnTuple(com.ichi2.libanki.backend.model.TagUsnTuple) JSONArray(com.ichi2.utils.JSONArray)

Aggregations

TagUsnTuple (com.ichi2.libanki.backend.model.TagUsnTuple)1 JSONArray (com.ichi2.utils.JSONArray)1