@@ -17,7 +17,7 @@ There is no need to add every special character by [Unicode](https://www.w3schoo
1717### Kotlin String interpolation
1818When building equations in Kotlin sometimes double backslash is needed to escape Kotlin String Interpolation
1919```kotlin
20- var math = "$\\F࢔ {→}=ma_g$"
20+ var math = "$\\F↖ {→}=ma_g$"
2121```
2222# Demo
2323
@@ -33,7 +33,7 @@ repositories {
3333```
3434```groovy
3535dependencies {
36- implementation 'com.github.jstarczewski:MathView:0.3 .0'
36+ implementation 'com.github.jstarczewski:MathView:0.4 .0'
3737}
3838```
3939# Usage
@@ -56,10 +56,10 @@ dependencies {
5656 textColor = Color.GREEN.toString()
5757 backgroundColor = Color.WHITE
5858 text = "$\\F↖{→}=ma_g$"
59- }.update()
59+ }
6060
6161```
62- ## Set text directly in xml
62+ ## Set text and textZoom directly in xml
6363
6464While setting text directly in XML, remember to encode HTML special characters, for example : `& = & `
6565
@@ -68,23 +68,22 @@ While setting text directly in XML, remember to encode HTML special characters,
6868 android:id =" @+id/mvTest"
6969 android:layout_width =" wrap_content"
7070 android:layout_height =" wrap_content"
71- app:text =" $F=mg$" />
71+ app:text =" $F=mg$"
72+ app:textZoom =" 75" />
7273```
7374
7475
7576# Interface
7677There are currently five custom functions available for the user. I plan to refactor them to fit more in Kotlin style.
7778
7879``` kotlin
79- // Apply properties, then call update()
80+ // Apply properties
8081 var mathView : MathView = findViewById<MathView >(R .id.mvEditTextExample)
8182 mathView.apply {
8283 text = " $\\ F=10$" // sets text
8384 textColor = " red" // sets text color, default value is "black"
8485 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+ }
8887 mathView.textZoom = 120 // set text size based on pixel density, default value is 100 (%)
8988```
9089
@@ -94,4 +93,4 @@ Back in 2016 I created an Android App which contained a lot of equations rendere
9493
9594
9695# Contributing
97- Feel free to contribute and report issues. Feedback appreciated
96+ Feel free to contribute and report issues. Feedback appreciated!
0 commit comments