Skip to content

Commit

Permalink
公开ToastLifecycle
Browse files Browse the repository at this point in the history
  • Loading branch information
LuHongCheng2022 committed May 13, 2022
1 parent 2c3f7a2 commit 8eeee2b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion toast_box/src/main/java/com/example/xlulibrary/ToastBox.kt
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ object ToastBox {
}

fun showToast(content: Any?, system: Boolean = false) = getActivity()?.runOnUiThread{
if (content == null) return@runOnUiThread
if (content == null) return@runOnUiThread

val str = if (content is Int){
application.resources.getString(content)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@ package com.example.xlulibrary

import android.app.Activity
import android.app.Application
import android.content.Context
import android.os.Bundle
import androidx.startup.Initializer
import com.example.xlulibrary.toast.xToast
import com.example.xlulibrary.util.xLog
import java.lang.ref.WeakReference
import java.util.*
import kotlin.collections.HashMap

internal object ToastLifecycle{
object ToastLifecycle{

private val TAG = "ToastLifecycle"

Expand Down Expand Up @@ -101,7 +99,7 @@ internal object ToastLifecycle{
/**
* 在Activity跳转的时候,删除上一个Activity中的toast
*/
fun clearActivityToast(tag:String){
fun clearActivityToast(tag:String ?= getCurrentTAG()){
boxMap[tag]?.forEach {
xLog.d(TAG, "clearActivityToast: ")
it.cancel()
Expand Down

0 comments on commit 8eeee2b

Please sign in to comment.