@@ -17,7 +17,7 @@ There is no need to add every special character by [Unicode](https://www.w3schoo
17
17
### Kotlin String interpolation
18
18
When building equations in Kotlin sometimes double backslash is needed to escape Kotlin String Interpolation
19
19
```kotlin
20
- var math = "$\\F࢔ {→}=ma_g$"
20
+ var math = "$\\F↖ {→}=ma_g$"
21
21
```
22
22
# Demo
23
23

@@ -33,7 +33,7 @@ repositories {
33
33
```
34
34
```groovy
35
35
dependencies {
36
- implementation 'com.github.jstarczewski:MathView:0.3 .0'
36
+ implementation 'com.github.jstarczewski:MathView:0.4 .0'
37
37
}
38
38
```
39
39
# Usage
@@ -56,10 +56,10 @@ dependencies {
56
56
textColor = Color.GREEN.toString()
57
57
backgroundColor = Color.WHITE
58
58
text = "$\\F↖{→}=ma_g$"
59
- }.update()
59
+ }
60
60
61
61
```
62
- ## Set text directly in xml
62
+ ## Set text and textZoom directly in xml
63
63
64
64
While setting text directly in XML, remember to encode HTML special characters, for example : `& = & `
65
65
@@ -68,23 +68,22 @@ While setting text directly in XML, remember to encode HTML special characters,
68
68
android:id =" @+id/mvTest"
69
69
android:layout_width =" wrap_content"
70
70
android:layout_height =" wrap_content"
71
- app:text =" $F=mg$" />
71
+ app:text =" $F=mg$"
72
+ app:textZoom =" 75" />
72
73
```
73
74
74
75
75
76
# Interface
76
77
There are currently five custom functions available for the user. I plan to refactor them to fit more in Kotlin style.
77
78
78
79
``` kotlin
79
- // Apply properties, then call update()
80
+ // Apply properties
80
81
var mathView : MathView = findViewById<MathView >(R .id.mvEditTextExample)
81
82
mathView.apply {
82
83
text = " $\\ F=10$" // sets text
83
84
textColor = " red" // sets text color, default value is "black"
84
85
backgroundColor = " blue" // sets background color, default value is "white"
85
- }.update() // updates changes
86
-
87
- // There is no need to call update() after setting textZoom property
86
+ }
88
87
mathView.textZoom = 120 // set text size based on pixel density, default value is 100 (%)
89
88
```
90
89
@@ -94,4 +93,4 @@ Back in 2016 I created an Android App which contained a lot of equations rendere
94
93
95
94
96
95
# Contributing
97
- Feel free to contribute and report issues. Feedback appreciated
96
+ Feel free to contribute and report issues. Feedback appreciated!
0 commit comments