-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
40 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
android/android-core/src/main/java/cn/yizems/util/ktx/android/coroutine/ToastProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package cn.yizems.util.ktx.android.coroutine | ||
|
||
import androidx.annotation.StringRes | ||
|
||
object ToastProvider : IToastProvider { | ||
|
||
private var toastProvider: IToastProvider? = null | ||
|
||
fun register(toastProvider: IToastProvider) { | ||
ToastProvider.toastProvider = toastProvider | ||
} | ||
|
||
override fun showShort(text: String) { | ||
toastProvider?.showShort(text) | ||
} | ||
|
||
override fun showShort(resId: Int) { | ||
toastProvider?.showShort(resId) | ||
} | ||
|
||
override fun showLong(text: String) { | ||
toastProvider?.showLong(text) | ||
} | ||
|
||
override fun showLong(resId: Int) { | ||
toastProvider?.showLong(resId) | ||
} | ||
} | ||
|
||
interface IToastProvider { | ||
fun showShort(text: String) | ||
fun showShort(@StringRes resId: Int) | ||
|
||
fun showLong(text: String) | ||
fun showLong(@StringRes resId: Int) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
rootProject.name = "UtilKtx" | ||
rootProject.name = "KUtil" | ||
include ':comm' | ||
include ':okhttp' | ||
|
||
|