Markwon/library-view
Dimitry 7c7b1f59a8
V1.1.0 (#53)
* Update build configuration

* Update commonmark to 0.11.0 and android-gif to 1.2.14

* Add  module `library-syntax`

* Add default prism4j theme implementation

* Add syntax highlight to sample app

* Update syntax highlight to use SpannableStringBuilder

* Working with syntax rendering

* Add darkula theme to syntax highlight

* Add  attribute for image-loader module

* Update version to 1.1.0-SNAPSHOT

* Updating build configuration for snapshot publish

* Add headingTypeface, headingTextSizes to SpannableTheme (#51)

* Add headingTypeface to SpannableTheme, use a custom heading typeface in the sample app

* Add headingTextSizes

* Switching to headingTextSizeMultipliers, adding validating annotations, adding example

* Consolidate logic, add crash if header index is out of bounds

* Add small version clarifications

* Introduce MediaDecoder abstraction for image-loader module

* Switch to use SpannableFactory

* Switch to use SpannableFactory for html parsing

* Update sample application to add play-pause functionality for gifs

* Small cleanup

* Update prism4j version 1.1.0

* Update build configuration

* Add README to library-syntax module

* Update README
2018-07-30 15:19:42 +02:00
..
2017-05-27 15:51:41 +03:00
2018-07-30 15:19:42 +02:00

Markwon View

maven|markwon-view

This is simple library containing 2 views that are able to display markdown:

  • MarkwonView - extends android.view.TextView
  • MarkwonViewCompat - extends android.support.v7.widget.AppCompatTextView

Both of them implement common IMarkwonView interface:

public interface IMarkwonView {

    interface ConfigurationProvider {
        @NonNull
        SpannableConfiguration provide(@NonNull Context context);
    }

    void setConfigurationProvider(@NonNull ConfigurationProvider provider);

    void setMarkdown(@Nullable String markdown);
    void setMarkdown(@Nullable SpannableConfiguration configuration, @Nullable String markdown);

    @Nullable
    String getMarkdown();
}

Both views support layout-preview in Android Studio (with some exceptions, for example, bold span is not rendered due to some limitations of layout preview). These are XML attributes:

app:mv_markdown="string"
app:mv_configurationProvider="string"

mv_markdown accepts a string and represents raw markdown

mv_configurationProvider accepts a string and represents a full class name of a class of type ConfigurationProvider, for example: com.example.my.package.MyConfigurationProvider (this class must have an empty constructor in order to be instantiated via reflection).

Please note that those views parse markdown in main thread, so their usage must be for relatively small markdown portions only