Skip to content

Commit

Permalink
[#11] 각종 편의 확장함수 추가 - 토스트
Browse files Browse the repository at this point in the history
  • Loading branch information
ethan-223 committed Mar 19, 2022
1 parent d783aa7 commit 78fd215
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.moyerun.moyeorun_android.common.extension

import android.app.Activity
import android.widget.Toast

fun Activity.toast(msg: String, isShort: Boolean = true) {
Toast.makeText(this, msg, if (isShort) Toast.LENGTH_SHORT else Toast.LENGTH_LONG).show()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.moyerun.moyeorun_android.common.extension

import android.widget.Toast
import androidx.fragment.app.Fragment

fun Fragment.toast(msg: String, isShort: Boolean = false) {
Toast.makeText(context, msg, if (isShort) Toast.LENGTH_SHORT else Toast.LENGTH_LONG).show()
}

0 comments on commit 78fd215

Please sign in to comment.