Skip to content

Commit 694d1a1

Browse files
committed
fix: above android r toast error
1 parent 79d3fdf commit 694d1a1

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ dependencyResolutionManagement {
2727
```groovy
2828
dependencies {
2929
// add sdk-ktx to your dependencies
30-
implementation 'com.github.pslilysm:sdk-ktx:2.0.4'
30+
implementation 'com.github.pslilysm:sdk-ktx:2.0.5'
3131
}
3232
```
3333

sdk-library/src/main/java/pers/pslilysm/sdk_library/util/ToastUtil.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,9 @@ object ToastUtil {
130130
override fun run() {
131131
var toast = sToastTLS.get()
132132
toast?.cancel()
133-
toast = Toast(AppHolder.get())
134-
toast.duration = toastProp.duration
135-
toast.setGravity(toastProp.gravity, toastProp.xOffset, toastProp.yOffset)
133+
toast = Toast.makeText(AppHolder.get(), toastProp.text, toastProp.duration)
134+
toast!!.setGravity(toastProp.gravity, toastProp.xOffset, toastProp.yOffset)
136135
toast.setMargin(toastProp.horizontalMargin, toast.verticalMargin)
137-
toast.setText(toastProp.text)
138136
toast.show()
139137
sToastTLS.set(toast)
140138
}

0 commit comments

Comments
 (0)