From 6decda1b08e73a29166af3f5adc690446ac8227e Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 16 May 2018 16:04:00 +0200 Subject: [PATCH] launch the proper Splash activity intent even if the app color is changed --- .../com/simplemobiletools/clock/extensions/Context.kt | 4 ++-- .../clock/helpers/MyWidgetDateTimeProvider.kt | 7 ++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/clock/extensions/Context.kt index d9c272a..d73a256 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/extensions/Context.kt @@ -112,13 +112,13 @@ fun Context.setupAlarmClock(alarm: Alarm, triggerInSeconds: Int) { } fun Context.getOpenAlarmTabIntent(): PendingIntent { - val intent = Intent(this, SplashActivity::class.java) + val intent = getLaunchIntent() ?: Intent(this, SplashActivity::class.java) intent.putExtra(OPEN_TAB, TAB_ALARM) return PendingIntent.getActivity(this, OPEN_ALARMS_TAB_INTENT_ID, intent, PendingIntent.FLAG_UPDATE_CURRENT) } fun Context.getOpenTimerTabIntent(): PendingIntent { - val intent = Intent(this, SplashActivity::class.java) + val intent = getLaunchIntent() ?: Intent(this, SplashActivity::class.java) intent.putExtra(OPEN_TAB, TAB_TIMER) return PendingIntent.getActivity(this, TIMER_NOTIF_ID, intent, PendingIntent.FLAG_UPDATE_CURRENT) } diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/helpers/MyWidgetDateTimeProvider.kt b/app/src/main/kotlin/com/simplemobiletools/clock/helpers/MyWidgetDateTimeProvider.kt index 58c0f73..8bae3cc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/helpers/MyWidgetDateTimeProvider.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/helpers/MyWidgetDateTimeProvider.kt @@ -11,10 +11,7 @@ import android.widget.RemoteViews import com.simplemobiletools.clock.R import com.simplemobiletools.clock.activities.SplashActivity import com.simplemobiletools.clock.extensions.* -import com.simplemobiletools.commons.extensions.getColoredBitmap -import com.simplemobiletools.commons.extensions.setBackgroundColor -import com.simplemobiletools.commons.extensions.setText -import com.simplemobiletools.commons.extensions.setVisibleIf +import com.simplemobiletools.commons.extensions.* import java.util.* class MyWidgetDateTimeProvider : AppWidgetProvider() { @@ -88,7 +85,7 @@ class MyWidgetDateTimeProvider : AppWidgetProvider() { private fun getComponentName(context: Context) = ComponentName(context, this::class.java) private fun setupAppOpenIntent(context: Context, views: RemoteViews) { - Intent(context, SplashActivity::class.java).apply { + (context.getLaunchIntent() ?: Intent(context, SplashActivity::class.java)).apply { putExtra(OPEN_TAB, TAB_CLOCK) val pendingIntent = PendingIntent.getActivity(context, OPEN_APP_INTENT_ID, this, PendingIntent.FLAG_UPDATE_CURRENT) views.setOnClickPendingIntent(R.id.widget_date_time_holder, pendingIntent)