Bugfix
This commit is contained in:
@ -4,15 +4,16 @@ import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import com.tommasoberlose.anotherwidget.R
|
||||
import com.tommasoberlose.anotherwidget.global.Actions
|
||||
import com.tommasoberlose.anotherwidget.helpers.IntentHelper
|
||||
import com.tommasoberlose.anotherwidget.utils.toast
|
||||
|
||||
|
||||
class WidgetClickListenerReceiver : BroadcastReceiver() {
|
||||
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
if (intent.action == Actions.ACTION_OPEN_WEATHER_INTENT) {
|
||||
context.sendBroadcast(Intent(Actions.ACTION_WEATHER_UPDATE))
|
||||
try {
|
||||
context.startActivity(IntentHelper.getWeatherIntent(context))
|
||||
} catch (e: Exception) {
|
||||
@ -24,8 +25,8 @@ class WidgetClickListenerReceiver : BroadcastReceiver() {
|
||||
i.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
try {
|
||||
context.startActivity(i)
|
||||
} catch (e: Exception) {
|
||||
context.applicationContext.startActivity(i)
|
||||
} catch (ignored: Exception) {
|
||||
context.toast(context.getString(R.string.error_opening_app))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user