mirror of
https://github.com/rt-bishop/Look4Sat.git
synced 2026-10-02 03:15:37 +00:00
Extracted a few UI actions into reusable use cases
This commit is contained in:
1 parent
01139f76e7
commit
11841ca3d7
9 files changed
+343
-147
No files matched your search
@@ -0,0 +1,18 @@
|
||||
package com.rtbishop.look4sat.data.usecase
|
||||
|
||||
import android.content.ActivityNotFoundException
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import com.rtbishop.look4sat.domain.usecase.IOpenWebUrl
|
||||
|
||||
class OpenWebUrl(private val context: Context) : IOpenWebUrl {
|
||||
override fun invoke(url: String) {
|
||||
try {
|
||||
context.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url)).apply {
|
||||
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
})
|
||||
} catch (_: ActivityNotFoundException) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.rtbishop.look4sat.data.usecase
|
||||
|
||||
import android.content.Context
|
||||
import android.widget.Toast
|
||||
import com.rtbishop.look4sat.domain.usecase.IShowToast
|
||||
|
||||
class ShowToast(private val context: Context) : IShowToast {
|
||||
override fun invoke(message: String) {
|
||||
Toast.makeText(context, message, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user