diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/MyWidgetListProvider.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/MyWidgetListProvider.kt index ee2f21a88..2e2903d86 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/MyWidgetListProvider.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/MyWidgetListProvider.kt @@ -9,6 +9,7 @@ import android.content.Intent import android.net.Uri import android.widget.RemoteViews import com.simplemobiletools.calendar.R +import com.simplemobiletools.calendar.activities.SplashActivity import com.simplemobiletools.calendar.extensions.config import com.simplemobiletools.calendar.extensions.launchNewEventIntent import com.simplemobiletools.calendar.services.WidgetService @@ -50,7 +51,7 @@ class MyWidgetListProvider : AppWidgetProvider() { views.setRemoteAdapter(R.id.widget_event_list, this) } - val startActivityIntent = context.getLaunchIntent() + val startActivityIntent = context.getLaunchIntent() ?: Intent(context, SplashActivity::class.java) val startActivityPendingIntent = PendingIntent.getActivity(context, 0, startActivityIntent, PendingIntent.FLAG_UPDATE_CURRENT) views.setPendingIntentTemplate(R.id.widget_event_list, startActivityPendingIntent) views.setEmptyView(R.id.widget_event_list, R.id.widget_event_list_empty) @@ -79,7 +80,7 @@ class MyWidgetListProvider : AppWidgetProvider() { } private fun launchDayActivity(context: Context) { - context.getLaunchIntent().apply { + (context.getLaunchIntent() ?: Intent(context, SplashActivity::class.java)).apply { putExtra(DAY_CODE, Formatter.getDayCodeFromDateTime(DateTime())) addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) context.startActivity(this) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/MyWidgetMonthlyProvider.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/MyWidgetMonthlyProvider.kt index 05529164d..672b39dfa 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/MyWidgetMonthlyProvider.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/MyWidgetMonthlyProvider.kt @@ -10,6 +10,7 @@ import android.content.res.Resources import android.view.View import android.widget.RemoteViews import com.simplemobiletools.calendar.R +import com.simplemobiletools.calendar.activities.SplashActivity import com.simplemobiletools.calendar.extensions.config import com.simplemobiletools.calendar.extensions.launchNewEventIntent import com.simplemobiletools.calendar.interfaces.MonthlyCalendar @@ -45,7 +46,7 @@ class MyWidgetMonthlyProvider : AppWidgetProvider() { } private fun setupAppOpenIntent(context: Context, views: RemoteViews, id: Int, dayCode: String) { - context.getLaunchIntent().apply { + (context.getLaunchIntent() ?: Intent(context, SplashActivity::class.java)).apply { putExtra(DAY_CODE, dayCode) putExtra(OPEN_MONTH, true) val pendingIntent = PendingIntent.getActivity(context, Integer.parseInt(dayCode.substring(0, 6)), this, 0) @@ -54,7 +55,7 @@ class MyWidgetMonthlyProvider : AppWidgetProvider() { } private fun setupDayOpenIntent(context: Context, views: RemoteViews, id: Int, dayCode: String) { - context.getLaunchIntent().apply { + (context.getLaunchIntent() ?: Intent(context, SplashActivity::class.java)).apply { putExtra(DAY_CODE, dayCode) val pendingIntent = PendingIntent.getActivity(context, Integer.parseInt(dayCode), this, 0) views.setOnClickPendingIntent(id, pendingIntent)