Skip to content

Commit

Permalink
#79 [mod] toast 메시지 지속 시간 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
emjayMJkim committed Jan 17, 2024
1 parent 5ebb953 commit baba928
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/src/main/java/com/sopetit/softie/util/Context.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import android.app.Activity
import android.content.Context
import android.content.Intent
import android.os.Build
import android.os.Handler
import android.os.Looper
import android.view.View
import android.view.inputmethod.InputMethodManager
import android.widget.Toast
Expand All @@ -24,7 +26,11 @@ fun snackBar(
}

fun Context.toast(message: String) {
Toast.makeText(this, message, Toast.LENGTH_SHORT).show()
val toast = Toast.makeText(this, message, Toast.LENGTH_SHORT)
toast.show()
Handler(Looper.getMainLooper()).postDelayed({
run() { toast.cancel() }
}, 1000)
}

fun Fragment.setStatusBarColor(colorResId: Int) {
Expand Down

0 comments on commit baba928

Please sign in to comment.