diff --git a/app/src/main/java/com/moyerun/moyeorun_android/common/extension/ActivityExtension.kt b/app/src/main/java/com/moyerun/moyeorun_android/common/extension/ActivityExtension.kt new file mode 100644 index 0000000..d57b173 --- /dev/null +++ b/app/src/main/java/com/moyerun/moyeorun_android/common/extension/ActivityExtension.kt @@ -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() +} \ No newline at end of file diff --git a/app/src/main/java/com/moyerun/moyeorun_android/common/extension/FragmentExtension.kt b/app/src/main/java/com/moyerun/moyeorun_android/common/extension/FragmentExtension.kt new file mode 100644 index 0000000..2ad8fe7 --- /dev/null +++ b/app/src/main/java/com/moyerun/moyeorun_android/common/extension/FragmentExtension.kt @@ -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() +} \ No newline at end of file