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

Commit e3d4e87d authored by Daniel Bailey's avatar Daniel Bailey Committed by Niedermann IT-Dienstleistungen
Browse files

Markdown util needs to hardcode unordered list colour.

getMarkdownConfiguration will set unordered list colour depending on
whether or not dark theme is enabled.
parent c20e49d5
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -34,14 +34,13 @@ public class SingleNoteWidgetFactory implements RemoteViewsService.RemoteViewsFa

    SingleNoteWidgetFactory(Context context, Intent intent) {
        this.context = context;
        markdownProcessor = new MarkdownProcessor(this.context);
        markdownProcessor.factory(TextFactory.create());
        markdownProcessor.config(MarkDownUtil.getMarkDownConfiguration(this.context).build());
        appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,
                                         AppWidgetManager.INVALID_APPWIDGET_ID);

        sp = PreferenceManager.getDefaultSharedPreferences(this.context);
        darkTheme = sp.getBoolean(SingleNoteWidget.DARK_THEME_KEY + appWidgetId, false);
        markdownProcessor = new MarkdownProcessor(this.context);
        markdownProcessor.factory(TextFactory.create());
        markdownProcessor.config(MarkDownUtil.getMarkDownConfiguration(this.context, darkTheme).build());
    }

    @Override
+13 −0
Original line number Diff line number Diff line
@@ -31,4 +31,17 @@ public class MarkDownUtil {
                .setHorizontalRulesHeight(2)
                .setLinkFontColor(ResourcesCompat.getColor(context.getResources(), R.color.primary, null));
    }

    public static Builder getMarkDownConfiguration(Context context, Boolean darkTheme) {
        return new RxMDConfiguration.Builder(context)
                .setUnOrderListColor(ResourcesCompat.getColor(context.getResources(),
                                    darkTheme ? R.color.widget_fg_dark_theme : R.color.widget_fg_default, null))
                .setHeader2RelativeSize(1.35f)
                .setHeader3RelativeSize(1.25f)
                .setHeader4RelativeSize(1.15f)
                .setHeader5RelativeSize(1.1f)
                .setHeader6RelativeSize(1.05f)
                .setHorizontalRulesHeight(2)
                .setLinkFontColor(ResourcesCompat.getColor(context.getResources(), R.color.primary, null));
    }
}