mirror of
https://github.com/Myzel394/NumberHub.git
synced 2025-06-19 00:35:26 +02:00
There people without an internet browser app on their phone
Crazy stuff
This commit is contained in:
parent
ecf9510980
commit
fb9136e2cc
@ -18,13 +18,20 @@
|
||||
|
||||
package com.sadellie.unitto.core.ui
|
||||
|
||||
import android.content.ActivityNotFoundException
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.widget.Toast
|
||||
import com.sadellie.unitto.core.base.R
|
||||
|
||||
/**
|
||||
* Open given link in browser
|
||||
*/
|
||||
fun openLink(mContext: Context, url: String) {
|
||||
mContext.startActivity(Intent(Intent.ACTION_VIEW).setData(Uri.parse(url)))
|
||||
try {
|
||||
mContext.startActivity(Intent(Intent.ACTION_VIEW).setData(Uri.parse(url)))
|
||||
} catch (e: ActivityNotFoundException) {
|
||||
Toast.makeText(mContext, R.string.error_label, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
|
@ -19,9 +19,11 @@
|
||||
package com.sadellie.unitto.feature.datecalculator.addsubtract
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.ActivityNotFoundException
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.provider.CalendarContract
|
||||
import android.widget.Toast
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
||||
@ -220,7 +222,11 @@ private fun Context.addEvent(start: ZonedDateTime, end: ZonedDateTime) {
|
||||
.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, endMillis)
|
||||
.putExtra(CalendarContract.Events.AVAILABILITY, CalendarContract.Events.AVAILABILITY_BUSY)
|
||||
|
||||
startActivity(intent)
|
||||
try {
|
||||
startActivity(intent)
|
||||
} catch (e: ActivityNotFoundException) {
|
||||
Toast.makeText(this, R.string.error_label, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
|
Loading…
x
Reference in New Issue
Block a user