Search in sources :

Example 1 with AudioField

use of com.ichi2.anki.multimediacard.fields.AudioField in project Anki-Android by Ramblurr.

the class NoteService method updateMultimediaNoteFromJsonNote.

public static void updateMultimediaNoteFromJsonNote(final Note editorNoteSrc, final IMultimediaEditableNote noteDst) {
    if (noteDst instanceof MultimediaEditableNote) {
        MultimediaEditableNote mmNote = (MultimediaEditableNote) noteDst;
        String[] values = editorNoteSrc.getFields();
        for (int i = 0; i < values.length; i++) {
            String value = values[i];
            IField field = null;
            if (value.startsWith("<img")) {
                field = new ImageField();
            } else if (value.startsWith("[sound:")) {
                field = new AudioField();
            } else {
                field = new TextField();
            }
            field.setFormattedString(value);
            mmNote.setField(i, field);
        }
        mmNote.setModelId(editorNoteSrc.getMid());
    // TODO: set current id of the note as well
    }
}
Also used : AudioField(com.ichi2.anki.multimediacard.fields.AudioField) ImageField(com.ichi2.anki.multimediacard.fields.ImageField) MultimediaEditableNote(com.ichi2.anki.multimediacard.impl.MultimediaEditableNote) IMultimediaEditableNote(com.ichi2.anki.multimediacard.IMultimediaEditableNote) TextField(com.ichi2.anki.multimediacard.fields.TextField) IField(com.ichi2.anki.multimediacard.fields.IField)

Example 2 with AudioField

use of com.ichi2.anki.multimediacard.fields.AudioField in project Anki-Android by Ramblurr.

the class EditFieldActivity method toAudioField.

protected void toAudioField() {
    if (mField.getType() != EFieldType.AUDIO) {
        mField = new AudioField();
        recreateEditingUi();
    }
}
Also used : AudioField(com.ichi2.anki.multimediacard.fields.AudioField)

Aggregations

AudioField (com.ichi2.anki.multimediacard.fields.AudioField)2 IMultimediaEditableNote (com.ichi2.anki.multimediacard.IMultimediaEditableNote)1 IField (com.ichi2.anki.multimediacard.fields.IField)1 ImageField (com.ichi2.anki.multimediacard.fields.ImageField)1 TextField (com.ichi2.anki.multimediacard.fields.TextField)1 MultimediaEditableNote (com.ichi2.anki.multimediacard.impl.MultimediaEditableNote)1