Skip to content

Commit e24557a

Browse files
authored
Merge pull request #8 from mikepenz/develop
dev -> main
2 parents 2d67fbd + 7c6acf5 commit e24557a

File tree

15 files changed

+244
-120
lines changed

15 files changed

+244
-120
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ jobs:
145145
run: |
146146
COLLECT_PWD=${PWD}
147147
mkdir -p "artifacts"
148-
find . -name "*.apk" -type f -exec cp {} "artifacts" \;
149-
find . -name "*.aab" -type f -exec cp {} "artifacts" \;
148+
find . -name "*release.apk" -type f -exec cp {} "artifacts" \;
149+
find . -name "*release.aab" -type f -exec cp {} "artifacts" \;
150150
151151
- name: Archive Artifacts
152152
uses: actions/upload-artifact@v2

LICENSE

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,29 @@
200200
See the License for the specific language governing permissions and
201201
limitations under the License.
202202

203+
--------
204+
205+
Parts of the markdown composer are based on Erik Hellman's work as found: https://github.com/ErikHellman/MarkdownComposer
206+
As described in the related article: https://www.hellsoft.se/rendering-markdown-with-jetpack-compose/
207+
208+
MIT License
209+
210+
Copyright (c) 2021 Erik Hellman
211+
212+
Permission is hereby granted, free of charge, to any person obtaining a copy
213+
of this software and associated documentation files (the "Software"), to deal
214+
in the Software without restriction, including without limitation the rights
215+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
216+
copies of the Software, and to permit persons to whom the Software is
217+
furnished to do so, subject to the following conditions:
218+
219+
The above copyright notice and this permission notice shall be included in all
220+
copies or substantial portions of the Software.
221+
222+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
223+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
224+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
225+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
226+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
227+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
228+
SOFTWARE.

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,11 @@ This free, open source software was also made possible by a group of volunteers
108108

109109
## Credits
110110

111-
Big thanks to [Erik Hellman](https://twitter.com/ErikHellman) and his awesome article on [Rendering Markdown with Jetpack Compose](https://www.hellsoft.se/rendering-markdown-with-jetpack-compose/)
111+
Big thanks to [Erik Hellman](https://twitter.com/ErikHellman) and his awesome article on [Rendering Markdown with Jetpack Compose](https://www.hellsoft.se/rendering-markdown-with-jetpack-compose/), and the related source [MarkdownComposer](https://github.com/ErikHellman/MarkdownComposer).
112+
113+
## Fork License
114+
115+
Copyright for portions of the code are held by [Erik Hellman, 2020] as part of project [MarkdownComposer](https://github.com/ErikHellman/MarkdownComposer) under the MIT license. All other copyright for project multiplatform-markdown-renderer are held by [Mike Penz, 2021] under the Apache License, Version 2.0.
112116

113117
## License
114118

app/build.gradle.kts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ android {
1717
minSdk = Versions.androidMinSdk
1818
targetSdk = Versions.androidTargetSdk
1919

20-
versionCode = 100
21-
versionName = "1.0.0"
20+
versionCode = property("VERSION_CODE").toString().toInt()
21+
versionName = property("VERSION_NAME").toString()
2222
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
23+
24+
setProperty("archivesBaseName", "markdown-renderer-sample-v$versionName-c$versionCode")
2325
}
2426

2527
buildFeatures {
@@ -70,20 +72,18 @@ dependencies {
7072
}
7173

7274
with(Deps.AndroidX) {
73-
implementation(lifecycleRuntimeKtx)
74-
implementation(lifecycleViewmodelKtx)
7575
implementation(activityCompose)
7676
}
7777

78+
7879
with(Deps.Compose) {
79-
implementation(ui)
80-
implementation(uiGraphics)
80+
implementation(coilCompose)
81+
8182
implementation(foundationLayout)
8283
implementation(material)
83-
implementation(coilCompose)
84-
implementation(accompanistInsets)
85-
implementation(accompanistInsetsUi)
84+
implementation(ui)
8685
implementation(uiTooling)
86+
implementation(uiGraphics)
8787
}
8888
}
8989

app/src/main/java/com/mikepenz/markdown/ui/MainActivity.kt

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,13 @@ import android.os.Bundle
44
import androidx.activity.ComponentActivity
55
import androidx.activity.compose.setContent
66
import androidx.compose.animation.ExperimentalAnimationApi
7-
import androidx.compose.foundation.background
87
import androidx.compose.foundation.layout.fillMaxSize
9-
import androidx.compose.material.MaterialTheme
10-
import androidx.compose.material.primarySurface
8+
import androidx.compose.foundation.layout.padding
9+
import androidx.compose.foundation.rememberScrollState
10+
import androidx.compose.foundation.verticalScroll
1111
import androidx.compose.runtime.Composable
1212
import androidx.compose.ui.Modifier
13-
import com.google.accompanist.insets.LocalWindowInsets
14-
import com.google.accompanist.insets.ProvideWindowInsets
15-
import com.google.accompanist.insets.rememberInsetsPaddingValues
16-
import com.google.accompanist.insets.ui.Scaffold
13+
import androidx.compose.ui.unit.dp
1714
import com.mikepenz.markdown.Markdown
1815

1916
class MainActivity : ComponentActivity() {
@@ -30,32 +27,32 @@ class MainActivity : ComponentActivity() {
3027
@Composable
3128
fun MainLayout() {
3229
SampleTheme {
33-
ProvideWindowInsets {
34-
Scaffold(
35-
modifier = Modifier.background(MaterialTheme.colors.primarySurface),
36-
contentPadding = rememberInsetsPaddingValues(
37-
insets = LocalWindowInsets.current.systemBars,
38-
applyTop = false,
39-
applyBottom = true,
40-
)
41-
) {
42-
val markdown = """
43-
### Getting Started
44-
45-
To get started you will need GPG on your computer to create a new key pair.
46-
47-
Usually I go with the [GPG Suite](https://gpgtools.org/), which offers a nice UI to manage your keys. (You may want to use advanced installation to only install the parts you need)
48-
But you can also use any other solution to create your key pair.
49-
50-
After installing GPG Suite (or your prefered solution) first create a new key.
51-
52-
Using GPG Suite, start the GPG Keychain, which shows all current known GPG keys on your system.
53-
54-
Click on `New` and you will be offered to enter your name, e-mail and password. Ensure to pick a secure password to protect your key.
55-
""".trimIndent()
30+
val markdown = """
31+
### Getting Started
32+
33+
To get started you will need GPG on your computer to create a new key pair.
34+
35+
Usually I go with the [GPG Suite](https://gpgtools.org/), which offers a nice UI to manage your keys. (You may want to use advanced installation to only install the parts you need)
36+
But you can also use any other solution to create your key pair.
37+
38+
![Image](https://avatars.githubusercontent.com/u/1476232?v=4)
39+
40+
After installing GPG Suite (or your prefered solution) first create a new key.
41+
42+
Using GPG Suite, start the GPG Keychain, which shows all current known GPG keys on your system.
43+
44+
Click on `New` and you will be offered to enter your name, e-mail and password. Ensure to pick a secure password to protect your key.
45+
""".trimIndent()
5646

57-
Markdown(markdown, Modifier.fillMaxSize())
58-
}
59-
}
47+
val scrollState = rememberScrollState()
48+
49+
Markdown(
50+
markdown,
51+
Modifier
52+
.verticalScroll(scrollState)
53+
.fillMaxSize()
54+
.padding(16.dp)
55+
.padding(bottom = 48.dp)
56+
)
6057
}
6158
}

build.gradle.kts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ buildscript {
99
}
1010

1111
dependencies {
12-
classpath("com.android.tools.build:gradle:7.1.0-alpha13")
12+
classpath("com.android.tools.build:gradle:7.0.3")
1313
classpath("com.vanniktech:gradle-maven-publish-plugin:0.18.0")
1414
classpath("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.18.1")
1515
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31")
16-
classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.5.30")
17-
classpath("com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:8.9.1")
18-
classpath("org.jetbrains.compose:compose-gradle-plugin:1.0.0-alpha4-build366")
16+
classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.5.31")
17+
classpath("com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:8.9.3")
18+
classpath("org.jetbrains.compose:compose-gradle-plugin:1.0.0-alpha4-build398")
1919
}
2020
}
2121

buildSrc/src/main/java/Dependencies.kt

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@ object Versions {
77

88
const val markdown = "0.2.4"
99

10-
const val compose = "1.1.0-alpha05"
11-
const val accompanist = "0.19.0"
10+
const val coil = "1.4.0"
11+
const val compose = "1.1.0-alpha06"
1212

1313
const val material = "1.4.0"
1414
const val activityCompose = "1.3.1"
15-
const val lifecycleKtx = "2.4.0-rc01"
16-
const val lifecycleRuntimeKtx = lifecycleKtx
17-
const val lifecycleViewmodelKtx = lifecycleKtx
15+
const val lifecycleKtx = "2.3.1"
1816
}
1917

2018
object Deps {
@@ -23,8 +21,6 @@ object Deps {
2321
}
2422

2523
object AndroidX {
26-
const val lifecycleRuntimeKtx = "androidx.lifecycle:lifecycle-runtime-ktx:${Versions.lifecycleRuntimeKtx}"
27-
const val lifecycleViewmodelKtx = "androidx.lifecycle:lifecycle-viewmodel-ktx:${Versions.lifecycleViewmodelKtx}"
2824
const val activityCompose = "androidx.activity:activity-compose:${Versions.activityCompose}"
2925
}
3026

@@ -39,8 +35,6 @@ object Deps {
3935
const val foundationLayout = "androidx.compose.foundation:foundation-layout:${Versions.compose}"
4036
const val material = "androidx.compose.material:material:${Versions.compose}"
4137

42-
const val coilCompose = "io.coil-kt:coil-compose:1.3.1"
43-
const val accompanistInsets = "com.google.accompanist:accompanist-insets:${Versions.accompanist}"
44-
const val accompanistInsetsUi = "com.google.accompanist:accompanist-insets-ui:${Versions.accompanist}"
38+
const val coilCompose = "io.coil-kt:coil-compose:${Versions.coil}"
4539
}
4640
}

compose-desktop/src/main/kotlin/main.kt

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1+
import androidx.compose.foundation.layout.fillMaxSize
2+
import androidx.compose.foundation.layout.padding
3+
import androidx.compose.foundation.rememberScrollState
4+
import androidx.compose.foundation.verticalScroll
15
import androidx.compose.material.Scaffold
26
import androidx.compose.material.Text
37
import androidx.compose.material.TopAppBar
8+
import androidx.compose.ui.Modifier
9+
import androidx.compose.ui.unit.dp
410
import androidx.compose.ui.window.Window
511
import androidx.compose.ui.window.application
612
import com.mikepenz.markdown.Markdown
713

814
fun main() = application {
9-
Window(onCloseRequest = ::exitApplication) {
15+
Window(onCloseRequest = ::exitApplication, title = "Markdown Sample") {
1016
SampleTheme {
1117
Scaffold(
1218
topBar = {
@@ -15,22 +21,26 @@ fun main() = application {
1521
)
1622
}
1723
) {
18-
Markdown(
19-
"""
20-
### Getting Started
21-
22-
To get started you will need GPG on your computer to create a new key pair.
23-
24-
Usually I go with the [GPG Suite](https://gpgtools.org/), which offers a nice UI to manage your keys. (You may want to use advanced installation to only install the parts you need)
25-
But you can also use any other solution to create your key pair.
26-
27-
After installing GPG Suite (or your prefered solution) first create a new key.
28-
29-
Using GPG Suite, start the GPG Keychain, which shows all current known GPG keys on your system.
30-
31-
Click on `New` and you will be offered to enter your name, e-mail and password. Ensure to pick a secure password to protect your key.
32-
""".trimIndent()
33-
)
24+
val scrollState = rememberScrollState()
25+
26+
val content = """
27+
### Getting Started
28+
29+
To get started you will need GPG on your computer to create a new key pair.
30+
31+
Usually I go with the [GPG Suite](https://gpgtools.org/), which offers a nice UI to manage your keys. (You may want to use advanced installation to only install the parts you need)
32+
But you can also use any other solution to create your key pair.
33+
34+
![Image](https://avatars.githubusercontent.com/u/1476232?v=4)
35+
36+
After installing GPG Suite (or your prefered solution) first create a new key.
37+
38+
Using GPG Suite, start the GPG Keychain, which shows all current known GPG keys on your system.
39+
40+
Click on `New` and you will be offered to enter your name, e-mail and password. Ensure to pick a secure password to protect your key.
41+
""".trimIndent()
42+
43+
Markdown(content, Modifier.fillMaxSize().padding(16.dp).verticalScroll(scrollState))
3444
}
3545
}
3646
}

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Maven stuff
22
GROUP=com.mikepenz
3-
VERSION_NAME=0.0.1
4-
VERSION_CODE=1
3+
VERSION_NAME=0.1.0
4+
VERSION_CODE=100
55

66
POM_URL=https://github.com/mikepenz/multiplatform-markdown-renderer
77

multiplatform-markdown-renderer/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ kotlin {
4848

4949
dependencies {
5050
commonMainApi(Deps.Markdown.core)
51+
5152
commonMainCompileOnly(compose.runtime)
5253
commonMainCompileOnly(compose.ui)
5354
commonMainCompileOnly(compose.foundation)

0 commit comments

Comments
 (0)