Merge f625b677873012ace36ff73f052cd8eed84faeaa into e0563dca435c3378b07ef7f040964eabdd15fa1f
This commit is contained in:
commit
6c38e7fb5e
22
markwon-view-common/README.md
Normal file
22
markwon-view-common/README.md
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# Markwon View Common
|
||||||
|
|
||||||
|
[](http://search.maven.org/#search|ga|1|g%3A%22ru.noties%22%20AND%20a%3A%markwon-view%22)
|
||||||
|
|
||||||
|
This library is the backbone of `MarkwonView` and `MarkwonViewCompat` and acts as glue code to `Markwon` by exposing `IMarkwonView`:
|
||||||
|
```java
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
```
|
20
markwon-view-common/build.gradle
Normal file
20
markwon-view-common/build.gradle
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
apply plugin: 'com.android.library'
|
||||||
|
|
||||||
|
android {
|
||||||
|
|
||||||
|
compileSdkVersion config['compile-sdk']
|
||||||
|
buildToolsVersion config['build-tools']
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion config['min-sdk']
|
||||||
|
targetSdkVersion config['target-sdk']
|
||||||
|
versionCode 1
|
||||||
|
versionName version
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
api project(':markwon')
|
||||||
|
}
|
||||||
|
|
||||||
|
registerArtifact(this)
|
3
markwon-view-common/gradle.properties
Normal file
3
markwon-view-common/gradle.properties
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
POM_NAME=Markwon-View
|
||||||
|
POM_ARTIFACT_ID=markwon-view-common
|
||||||
|
POM_PACKAGING=aar
|
1
markwon-view-common/src/main/AndroidManifest.xml
Normal file
1
markwon-view-common/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1 @@
|
|||||||
|
<manifest package="ru.noties.markwon.view" />
|
21
markwon-view-compat/README.md
Normal file
21
markwon-view-compat/README.md
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Markwon View Compat
|
||||||
|
|
||||||
|
[](http://search.maven.org/#search|ga|1|g%3A%22ru.noties%22%20AND%20a%3A%markwon-view%22)
|
||||||
|
|
||||||
|
This library allows for rendering markdown through a widget `MarkwonViewCompat` and supports the following XML attributes:
|
||||||
|
```
|
||||||
|
app:mv_markdown="string"
|
||||||
|
app:mv_configurationProvider="string"
|
||||||
|
```
|
||||||
|
|
||||||
|
`MarkdownViewCompat` extends Android's support library's `AppCompatTextView`. Prefer this library when you benefit from features in `AppCompatTextView`.
|
||||||
|
|
||||||
|
Android Studio's layout-preview supports rendering (with some exceptions, for example, bold span is not rendered due to some limitations of layout preview) markdown text.
|
||||||
|
|
||||||
|
`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
|
23
markwon-view-compat/build.gradle
Normal file
23
markwon-view-compat/build.gradle
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
apply plugin: 'com.android.library'
|
||||||
|
|
||||||
|
android {
|
||||||
|
|
||||||
|
compileSdkVersion config['compile-sdk']
|
||||||
|
buildToolsVersion config['build-tools']
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion config['min-sdk']
|
||||||
|
targetSdkVersion config['target-sdk']
|
||||||
|
versionCode 1
|
||||||
|
versionName version
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
api project(':markwon-view-common')
|
||||||
|
deps.with {
|
||||||
|
compileOnly it['support-app-compat']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
registerArtifact(this)
|
3
markwon-view-compat/gradle.properties
Normal file
3
markwon-view-compat/gradle.properties
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
POM_NAME=Markwon-View
|
||||||
|
POM_ARTIFACT_ID=markwon-view-compat
|
||||||
|
POM_PACKAGING=aar
|
1
markwon-view-compat/src/main/AndroidManifest.xml
Normal file
1
markwon-view-compat/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1 @@
|
|||||||
|
<manifest package="ru.noties.markwon.view" />
|
@ -2,36 +2,16 @@
|
|||||||
|
|
||||||
[](http://search.maven.org/#search|ga|1|g%3A%22ru.noties%22%20AND%20a%3A%markwon-view%22)
|
[](http://search.maven.org/#search|ga|1|g%3A%22ru.noties%22%20AND%20a%3A%markwon-view%22)
|
||||||
|
|
||||||
This is simple library containing 2 views that are able to display markdown:
|
This library allows for rendering markdown through a widget `MarkwonView` and supports the following XML attributes:
|
||||||
* MarkwonView - extends `android.view.TextView`
|
|
||||||
* MarkwonViewCompat - extends `android.support.v7.widget.AppCompatTextView`
|
|
||||||
|
|
||||||
Both of them implement common `IMarkwonView` interface:
|
|
||||||
```java
|
|
||||||
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_markdown="string"
|
||||||
app:mv_configurationProvider="string"
|
app:mv_configurationProvider="string"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Prefer this library over `MarkdownViewCompat` if you do not want dependency to Android's support library.
|
||||||
|
|
||||||
|
Android Studio's layout-preview supports rendering (with some exceptions, for example, bold span is not rendered due to some limitations of layout preview) markdown text.
|
||||||
|
|
||||||
`mv_markdown` accepts a string and represents raw markdown
|
`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`,
|
`mv_configurationProvider` accepts a string and represents a full class name of a class of type `ConfigurationProvider`,
|
||||||
|
@ -14,12 +14,7 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
api project(':markwon-view-common')
|
||||||
api project(':markwon')
|
|
||||||
|
|
||||||
deps.with {
|
|
||||||
compileOnly it['support-app-compat']
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
registerArtifact(this)
|
registerArtifact(this)
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
rootProject.name = 'MarkwonProject'
|
rootProject.name = 'MarkwonProject'
|
||||||
include ':app', ':markwon', ':markwon-image-loader', ':markwon-view', ':sample-custom-extension', ':sample-latex-math',
|
include ':app', ':markwon', ':markwon-image-loader',
|
||||||
|
':markwon-view', ':markwon-view-compat', ':markwon-view-common',
|
||||||
|
':sample-custom-extension', ':sample-latex-math',
|
||||||
':markwon-syntax-highlight', ':markwon-html-parser-api', ':markwon-html-parser-impl'
|
':markwon-syntax-highlight', ':markwon-html-parser-api', ':markwon-html-parser-impl'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user