Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d5d47bf2 authored by Niedermann IT-Dienstleistungen's avatar Niedermann IT-Dienstleistungen Committed by Niedermann IT-Dienstleistungen
Browse files

#313 Markdown doesn't work in widget mode

parent 5ff3fe4d
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -6,17 +6,25 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.StyleSpan;
import android.util.Log;
import android.widget.RemoteViews;
import android.widget.RemoteViewsService;

import com.yydcdut.markdown.MarkdownProcessor;
import com.yydcdut.markdown.syntax.text.TextFactory;

import it.niedermann.owncloud.notes.R;
import it.niedermann.owncloud.notes.android.activity.EditNoteActivity;
import it.niedermann.owncloud.notes.model.DBNote;
import it.niedermann.owncloud.notes.persistence.NoteSQLiteOpenHelper;
import it.niedermann.owncloud.notes.util.MarkDownUtil;

public class SingleNoteWidgetFactory implements RemoteViewsService.RemoteViewsFactory {

    private MarkdownProcessor markdownProcessor;
    private final Context mContext;
    private final int mAppWidgetId;

@@ -27,6 +35,9 @@ public class SingleNoteWidgetFactory implements RemoteViewsService.RemoteViewsFa

    SingleNoteWidgetFactory(Context context, Intent intent) {
        mContext = context;
        markdownProcessor = new MarkdownProcessor(mContext);
        markdownProcessor.factory(TextFactory.create());
        markdownProcessor.config(MarkDownUtil.getMarkDownConfiguration(mContext).build());
        mAppWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,
                AppWidgetManager.INVALID_APPWIDGET_ID);
    }
@@ -87,7 +98,7 @@ public class SingleNoteWidgetFactory implements RemoteViewsService.RemoteViewsFa
        fillInIntent.putExtras(extras);
        fillInIntent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
        note_content.setOnClickFillInIntent(R.id.single_note_content_tv, fillInIntent);
        note_content.setTextViewText(R.id.single_note_content_tv, note.getContent());
        note_content.setTextViewText(R.id.single_note_content_tv, markdownProcessor.parse(note.getContent()));

        return note_content;
    }