launch the proper Splash activity intent even if the app color is changed

This commit is contained in:
tibbi 2018-05-16 16:04:00 +02:00
parent 081f51763b
commit 6decda1b08
2 changed files with 4 additions and 7 deletions

View file

@ -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)
}

View file

@ -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)