forked from github/wulkanowy-mirror
Fix saved state in main and splash activity (#1633)
This commit is contained in:
parent
8a181c747c
commit
7e0e2fbb67
@ -1,6 +1,5 @@
|
|||||||
package io.github.wulkanowy
|
package io.github.wulkanowy
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import android.util.Log.DEBUG
|
import android.util.Log.DEBUG
|
||||||
import android.util.Log.INFO
|
import android.util.Log.INFO
|
||||||
@ -40,7 +39,6 @@ class WulkanowyApp : Application(), Configuration.Provider {
|
|||||||
@Inject
|
@Inject
|
||||||
lateinit var analyticsHelper: AnalyticsHelper
|
lateinit var analyticsHelper: AnalyticsHelper
|
||||||
|
|
||||||
@SuppressLint("UnsafeOptInUsageWarning")
|
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
initializeAppLanguage()
|
initializeAppLanguage()
|
||||||
|
@ -138,7 +138,7 @@ class TimetableNotificationReceiver : HiltBroadcastReceiver() {
|
|||||||
PendingIntent.getActivity(
|
PendingIntent.getActivity(
|
||||||
context,
|
context,
|
||||||
NOTIFICATION_ID,
|
NOTIFICATION_ID,
|
||||||
SplashActivity.getStartIntent(context, Destination.Timetable(), true),
|
SplashActivity.getStartIntent(context, Destination.Timetable()),
|
||||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntentCompat.FLAG_IMMUTABLE
|
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntentCompat.FLAG_IMMUTABLE
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -35,7 +35,7 @@ class ShortcutsHelper @Inject constructor(@ApplicationContext private val contex
|
|||||||
.setShortLabel(context.getString(R.string.grade_title))
|
.setShortLabel(context.getString(R.string.grade_title))
|
||||||
.setLongLabel(context.getString(R.string.grade_title))
|
.setLongLabel(context.getString(R.string.grade_title))
|
||||||
.setIcon(IconCompat.createWithResource(context, R.drawable.ic_shortcut_grade))
|
.setIcon(IconCompat.createWithResource(context, R.drawable.ic_shortcut_grade))
|
||||||
.setIntent(SplashActivity.getStartIntent(context, startNewTask = true)
|
.setIntent(SplashActivity.getStartIntent(context)
|
||||||
.apply {
|
.apply {
|
||||||
action = Intent.ACTION_VIEW
|
action = Intent.ACTION_VIEW
|
||||||
putExtra(EXTRA_SHORTCUT_DESTINATION_ID, "grade")
|
putExtra(EXTRA_SHORTCUT_DESTINATION_ID, "grade")
|
||||||
@ -47,7 +47,7 @@ class ShortcutsHelper @Inject constructor(@ApplicationContext private val contex
|
|||||||
.setShortLabel(context.getString(R.string.attendance_title))
|
.setShortLabel(context.getString(R.string.attendance_title))
|
||||||
.setLongLabel(context.getString(R.string.attendance_title))
|
.setLongLabel(context.getString(R.string.attendance_title))
|
||||||
.setIcon(IconCompat.createWithResource(context, R.drawable.ic_shortcut_attendance))
|
.setIcon(IconCompat.createWithResource(context, R.drawable.ic_shortcut_attendance))
|
||||||
.setIntent(SplashActivity.getStartIntent(context, startNewTask = true)
|
.setIntent(SplashActivity.getStartIntent(context)
|
||||||
.apply {
|
.apply {
|
||||||
action = Intent.ACTION_VIEW
|
action = Intent.ACTION_VIEW
|
||||||
putExtra(EXTRA_SHORTCUT_DESTINATION_ID, "attendance")
|
putExtra(EXTRA_SHORTCUT_DESTINATION_ID, "attendance")
|
||||||
@ -59,7 +59,7 @@ class ShortcutsHelper @Inject constructor(@ApplicationContext private val contex
|
|||||||
.setShortLabel(context.getString(R.string.exam_title))
|
.setShortLabel(context.getString(R.string.exam_title))
|
||||||
.setLongLabel(context.getString(R.string.exam_title))
|
.setLongLabel(context.getString(R.string.exam_title))
|
||||||
.setIcon(IconCompat.createWithResource(context, R.drawable.ic_shortcut_exam))
|
.setIcon(IconCompat.createWithResource(context, R.drawable.ic_shortcut_exam))
|
||||||
.setIntent(SplashActivity.getStartIntent(context, startNewTask = true)
|
.setIntent(SplashActivity.getStartIntent(context)
|
||||||
.apply {
|
.apply {
|
||||||
action = Intent.ACTION_VIEW
|
action = Intent.ACTION_VIEW
|
||||||
putExtra(EXTRA_SHORTCUT_DESTINATION_ID, "exam")
|
putExtra(EXTRA_SHORTCUT_DESTINATION_ID, "exam")
|
||||||
@ -71,7 +71,7 @@ class ShortcutsHelper @Inject constructor(@ApplicationContext private val contex
|
|||||||
.setShortLabel(context.getString(R.string.timetable_title))
|
.setShortLabel(context.getString(R.string.timetable_title))
|
||||||
.setLongLabel(context.getString(R.string.timetable_title))
|
.setLongLabel(context.getString(R.string.timetable_title))
|
||||||
.setIcon(IconCompat.createWithResource(context, R.drawable.ic_shortcut_timetable))
|
.setIcon(IconCompat.createWithResource(context, R.drawable.ic_shortcut_timetable))
|
||||||
.setIntent(SplashActivity.getStartIntent(context, startNewTask = true)
|
.setIntent(SplashActivity.getStartIntent(context)
|
||||||
.apply {
|
.apply {
|
||||||
action = Intent.ACTION_VIEW
|
action = Intent.ACTION_VIEW
|
||||||
putExtra(EXTRA_SHORTCUT_DESTINATION_ID, "timetable")
|
putExtra(EXTRA_SHORTCUT_DESTINATION_ID, "timetable")
|
||||||
|
@ -34,8 +34,7 @@ class ChangeTimetableNotification @Inject constructor(
|
|||||||
content = it,
|
content = it,
|
||||||
intentToStart = SplashActivity.getStartIntent(
|
intentToStart = SplashActivity.getStartIntent(
|
||||||
context = context,
|
context = context,
|
||||||
destination = Destination.Timetable(date),
|
destination = Destination.Timetable(date)
|
||||||
startNewTask = true
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -54,7 +53,7 @@ class ChangeTimetableNotification @Inject constructor(
|
|||||||
changedLessons.size,
|
changedLessons.size,
|
||||||
changedLessons.size
|
changedLessons.size
|
||||||
),
|
),
|
||||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Timetable(), true),
|
intentToStart = SplashActivity.getStartIntent(context, Destination.Timetable()),
|
||||||
type = NotificationType.CHANGE_TIMETABLE
|
type = NotificationType.CHANGE_TIMETABLE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ class NewAttendanceNotification @Inject constructor(
|
|||||||
NotificationData(
|
NotificationData(
|
||||||
title = context.getPlural(R.plurals.attendance_notify_new_items_title, 1),
|
title = context.getPlural(R.plurals.attendance_notify_new_items_title, 1),
|
||||||
content = it,
|
content = it,
|
||||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Attendance, true)
|
intentToStart = SplashActivity.getStartIntent(context, Destination.Attendance)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ class NewAttendanceNotification @Inject constructor(
|
|||||||
notificationDataList.size,
|
notificationDataList.size,
|
||||||
notificationDataList.size
|
notificationDataList.size
|
||||||
),
|
),
|
||||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Attendance, true),
|
intentToStart = SplashActivity.getStartIntent(context, Destination.Attendance),
|
||||||
type = NotificationType.NEW_ATTENDANCE
|
type = NotificationType.NEW_ATTENDANCE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ class NewConferenceNotification @Inject constructor(
|
|||||||
NotificationData(
|
NotificationData(
|
||||||
title = context.getPlural(R.plurals.conference_notify_new_item_title, 1),
|
title = context.getPlural(R.plurals.conference_notify_new_item_title, 1),
|
||||||
content = it,
|
content = it,
|
||||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Conference, true)
|
intentToStart = SplashActivity.getStartIntent(context, Destination.Conference)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ class NewConferenceNotification @Inject constructor(
|
|||||||
lines.size,
|
lines.size,
|
||||||
lines.size
|
lines.size
|
||||||
),
|
),
|
||||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Conference, true),
|
intentToStart = SplashActivity.getStartIntent(context, Destination.Conference),
|
||||||
type = NotificationType.NEW_CONFERENCE
|
type = NotificationType.NEW_CONFERENCE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ class NewExamNotification @Inject constructor(
|
|||||||
NotificationData(
|
NotificationData(
|
||||||
title = context.getPlural(R.plurals.exam_notify_new_item_title, 1),
|
title = context.getPlural(R.plurals.exam_notify_new_item_title, 1),
|
||||||
content = it,
|
content = it,
|
||||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Exam, true),
|
intentToStart = SplashActivity.getStartIntent(context, Destination.Exam),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ class NewExamNotification @Inject constructor(
|
|||||||
lines.size,
|
lines.size,
|
||||||
lines.size
|
lines.size
|
||||||
),
|
),
|
||||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Exam, true),
|
intentToStart = SplashActivity.getStartIntent(context, Destination.Exam),
|
||||||
type = NotificationType.NEW_EXAM
|
type = NotificationType.NEW_EXAM
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class NewGradeNotification @Inject constructor(
|
|||||||
NotificationData(
|
NotificationData(
|
||||||
title = context.getPlural(R.plurals.grade_new_items, 1),
|
title = context.getPlural(R.plurals.grade_new_items, 1),
|
||||||
content = "${it.subject}: ${it.entry}",
|
content = "${it.subject}: ${it.entry}",
|
||||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Grade, true),
|
intentToStart = SplashActivity.getStartIntent(context, Destination.Grade),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ class NewGradeNotification @Inject constructor(
|
|||||||
notificationDataList = notificationDataList,
|
notificationDataList = notificationDataList,
|
||||||
title = context.getPlural(R.plurals.grade_new_items, items.size),
|
title = context.getPlural(R.plurals.grade_new_items, items.size),
|
||||||
content = context.getPlural(R.plurals.grade_notify_new_items, items.size, items.size),
|
content = context.getPlural(R.plurals.grade_notify_new_items, items.size, items.size),
|
||||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Grade, true),
|
intentToStart = SplashActivity.getStartIntent(context, Destination.Grade),
|
||||||
type = NotificationType.NEW_GRADE_DETAILS
|
type = NotificationType.NEW_GRADE_DETAILS
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ class NewGradeNotification @Inject constructor(
|
|||||||
NotificationData(
|
NotificationData(
|
||||||
title = context.getPlural(R.plurals.grade_new_items_predicted, 1),
|
title = context.getPlural(R.plurals.grade_new_items_predicted, 1),
|
||||||
content = "${it.subject}: ${it.predictedGrade}",
|
content = "${it.subject}: ${it.predictedGrade}",
|
||||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Grade, true),
|
intentToStart = SplashActivity.getStartIntent(context, Destination.Grade),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ class NewGradeNotification @Inject constructor(
|
|||||||
items.size,
|
items.size,
|
||||||
items.size
|
items.size
|
||||||
),
|
),
|
||||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Grade, true),
|
intentToStart = SplashActivity.getStartIntent(context, Destination.Grade),
|
||||||
type = NotificationType.NEW_GRADE_PREDICTED
|
type = NotificationType.NEW_GRADE_PREDICTED
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ class NewGradeNotification @Inject constructor(
|
|||||||
NotificationData(
|
NotificationData(
|
||||||
title = context.getPlural(R.plurals.grade_new_items_final, 1),
|
title = context.getPlural(R.plurals.grade_new_items_final, 1),
|
||||||
content = "${it.subject}: ${it.finalGrade}",
|
content = "${it.subject}: ${it.finalGrade}",
|
||||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Grade, true),
|
intentToStart = SplashActivity.getStartIntent(context, Destination.Grade),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ class NewGradeNotification @Inject constructor(
|
|||||||
items.size,
|
items.size,
|
||||||
items.size
|
items.size
|
||||||
),
|
),
|
||||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Grade, true),
|
intentToStart = SplashActivity.getStartIntent(context, Destination.Grade),
|
||||||
type = NotificationType.NEW_GRADE_FINAL
|
type = NotificationType.NEW_GRADE_FINAL
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ class NewHomeworkNotification @Inject constructor(
|
|||||||
NotificationData(
|
NotificationData(
|
||||||
title = context.getPlural(R.plurals.homework_notify_new_item_title, 1),
|
title = context.getPlural(R.plurals.homework_notify_new_item_title, 1),
|
||||||
content = it,
|
content = it,
|
||||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Homework, true),
|
intentToStart = SplashActivity.getStartIntent(context, Destination.Homework),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ class NewHomeworkNotification @Inject constructor(
|
|||||||
lines.size,
|
lines.size,
|
||||||
lines.size
|
lines.size
|
||||||
),
|
),
|
||||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Homework, true),
|
intentToStart = SplashActivity.getStartIntent(context, Destination.Homework),
|
||||||
type = NotificationType.NEW_HOMEWORK,
|
type = NotificationType.NEW_HOMEWORK,
|
||||||
notificationDataList = notificationDataList
|
notificationDataList = notificationDataList
|
||||||
)
|
)
|
||||||
|
@ -22,7 +22,7 @@ class NewLuckyNumberNotification @Inject constructor(
|
|||||||
R.string.lucky_number_notify_new_item,
|
R.string.lucky_number_notify_new_item,
|
||||||
item.luckyNumber.toString()
|
item.luckyNumber.toString()
|
||||||
),
|
),
|
||||||
intentToStart = SplashActivity.getStartIntent(context, Destination.LuckyNumber, true)
|
intentToStart = SplashActivity.getStartIntent(context, Destination.LuckyNumber)
|
||||||
)
|
)
|
||||||
|
|
||||||
appNotificationManager.sendSingleNotification(
|
appNotificationManager.sendSingleNotification(
|
||||||
|
@ -22,7 +22,7 @@ class NewMessageNotification @Inject constructor(
|
|||||||
NotificationData(
|
NotificationData(
|
||||||
title = context.getPlural(R.plurals.message_new_items, 1),
|
title = context.getPlural(R.plurals.message_new_items, 1),
|
||||||
content = "${it.sender}: ${it.subject}",
|
content = "${it.sender}: ${it.subject}",
|
||||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Message, true),
|
intentToStart = SplashActivity.getStartIntent(context, Destination.Message),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ class NewMessageNotification @Inject constructor(
|
|||||||
notificationDataList = notificationDataList,
|
notificationDataList = notificationDataList,
|
||||||
title = context.getPlural(R.plurals.message_new_items, items.size),
|
title = context.getPlural(R.plurals.message_new_items, items.size),
|
||||||
content = context.getPlural(R.plurals.message_notify_new_items, items.size, items.size),
|
content = context.getPlural(R.plurals.message_notify_new_items, items.size, items.size),
|
||||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Message, true),
|
intentToStart = SplashActivity.getStartIntent(context, Destination.Message),
|
||||||
type = NotificationType.NEW_MESSAGE
|
type = NotificationType.NEW_MESSAGE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -29,13 +29,13 @@ class NewNoteNotification @Inject constructor(
|
|||||||
NotificationData(
|
NotificationData(
|
||||||
title = context.getPlural(titleRes, 1),
|
title = context.getPlural(titleRes, 1),
|
||||||
content = "${it.teacher}: ${it.category}",
|
content = "${it.teacher}: ${it.category}",
|
||||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Note, true),
|
intentToStart = SplashActivity.getStartIntent(context, Destination.Note),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val groupNotificationData = GroupNotificationData(
|
val groupNotificationData = GroupNotificationData(
|
||||||
notificationDataList = notificationDataList,
|
notificationDataList = notificationDataList,
|
||||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Note, true),
|
intentToStart = SplashActivity.getStartIntent(context, Destination.Note),
|
||||||
title = context.getPlural(R.plurals.note_new_items, items.size),
|
title = context.getPlural(R.plurals.note_new_items, items.size),
|
||||||
content = context.getPlural(R.plurals.note_notify_new_items, items.size, items.size),
|
content = context.getPlural(R.plurals.note_notify_new_items, items.size, items.size),
|
||||||
type = NotificationType.NEW_NOTE
|
type = NotificationType.NEW_NOTE
|
||||||
|
@ -22,8 +22,7 @@ class NewSchoolAnnouncementNotification @Inject constructor(
|
|||||||
NotificationData(
|
NotificationData(
|
||||||
intentToStart = SplashActivity.getStartIntent(
|
intentToStart = SplashActivity.getStartIntent(
|
||||||
context = context,
|
context = context,
|
||||||
destination = Destination.SchoolAnnouncement,
|
destination = Destination.SchoolAnnouncement
|
||||||
startNewTask = true
|
|
||||||
),
|
),
|
||||||
title = context.getPlural(
|
title = context.getPlural(
|
||||||
R.plurals.school_announcement_notify_new_item_title,
|
R.plurals.school_announcement_notify_new_item_title,
|
||||||
@ -36,8 +35,7 @@ class NewSchoolAnnouncementNotification @Inject constructor(
|
|||||||
type = NotificationType.NEW_ANNOUNCEMENT,
|
type = NotificationType.NEW_ANNOUNCEMENT,
|
||||||
intentToStart = SplashActivity.getStartIntent(
|
intentToStart = SplashActivity.getStartIntent(
|
||||||
context = context,
|
context = context,
|
||||||
destination = Destination.SchoolAnnouncement,
|
destination = Destination.SchoolAnnouncement
|
||||||
startNewTask = true
|
|
||||||
),
|
),
|
||||||
title = context.getPlural(
|
title = context.getPlural(
|
||||||
R.plurals.school_announcement_notify_new_item_title,
|
R.plurals.school_announcement_notify_new_item_title,
|
||||||
|
@ -20,7 +20,7 @@ open class BasePresenter<T : BaseView>(
|
|||||||
) {
|
) {
|
||||||
private val job = SupervisorJob()
|
private val job = SupervisorJob()
|
||||||
|
|
||||||
protected val presenterScope = CoroutineScope(job + Dispatchers.Main.immediate)
|
protected val presenterScope = CoroutineScope(job + Dispatchers.Main)
|
||||||
|
|
||||||
private val childrenJobs = mutableMapOf<String, Job>()
|
private val childrenJobs = mutableMapOf<String, Job>()
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ class LuckyNumberWidgetProvider : AppWidgetProvider() {
|
|||||||
val appIntent = PendingIntent.getActivity(
|
val appIntent = PendingIntent.getActivity(
|
||||||
context,
|
context,
|
||||||
LUCKY_NUMBER_PENDING_INTENT_ID,
|
LUCKY_NUMBER_PENDING_INTENT_ID,
|
||||||
SplashActivity.getStartIntent(context, Destination.LuckyNumber, true),
|
SplashActivity.getStartIntent(context, Destination.LuckyNumber),
|
||||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntentCompat.FLAG_IMMUTABLE
|
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntentCompat.FLAG_IMMUTABLE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package io.github.wulkanowy.ui.modules.main
|
package io.github.wulkanowy.ui.modules.main
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Build.VERSION_CODES.P
|
import android.os.Build.VERSION_CODES.P
|
||||||
@ -88,7 +87,6 @@ class MainActivity : BaseActivity<MainPresenter, ActivityMainBinding>(), MainVie
|
|||||||
|
|
||||||
private var savedInstanceState: Bundle? = null
|
private var savedInstanceState: Bundle? = null
|
||||||
|
|
||||||
@SuppressLint("NewApi")
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(ActivityMainBinding.inflate(layoutInflater).apply { binding = this }.root)
|
setContentView(ActivityMainBinding.inflate(layoutInflater).apply { binding = this }.root)
|
||||||
@ -97,7 +95,8 @@ class MainActivity : BaseActivity<MainPresenter, ActivityMainBinding>(), MainVie
|
|||||||
messageContainer = binding.mainMessageContainer
|
messageContainer = binding.mainMessageContainer
|
||||||
updateHelper.messageContainer = binding.mainFragmentContainer
|
updateHelper.messageContainer = binding.mainFragmentContainer
|
||||||
|
|
||||||
val destination = intent.getSerializableExtra(EXTRA_START_DESTINATION) as Destination?
|
val destination = (intent.getSerializableExtra(EXTRA_START_DESTINATION) as Destination?)
|
||||||
|
?.takeIf { savedInstanceState == null }
|
||||||
|
|
||||||
presenter.onAttachView(this, destination)
|
presenter.onAttachView(this, destination)
|
||||||
updateHelper.checkAndInstallUpdates(this)
|
updateHelper.checkAndInstallUpdates(this)
|
||||||
@ -143,6 +142,7 @@ class MainActivity : BaseActivity<MainPresenter, ActivityMainBinding>(), MainVie
|
|||||||
|
|
||||||
initialize(startMenuIndex, savedInstanceState)
|
initialize(startMenuIndex, savedInstanceState)
|
||||||
}
|
}
|
||||||
|
savedInstanceState = null
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initializeToolbar() {
|
private fun initializeToolbar() {
|
||||||
@ -292,6 +292,5 @@ class MainActivity : BaseActivity<MainPresenter, ActivityMainBinding>(), MainVie
|
|||||||
override fun onSaveInstanceState(outState: Bundle) {
|
override fun onSaveInstanceState(outState: Bundle) {
|
||||||
super.onSaveInstanceState(outState)
|
super.onSaveInstanceState(outState)
|
||||||
navController.onSaveInstanceState(outState)
|
navController.onSaveInstanceState(outState)
|
||||||
intent.removeExtra(EXTRA_START_DESTINATION)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,18 +33,12 @@ class SplashActivity : BaseActivity<SplashPresenter, ViewBinding>(), SplashView
|
|||||||
|
|
||||||
private const val EXTRA_EXTERNAL_URL = "external_url"
|
private const val EXTRA_EXTERNAL_URL = "external_url"
|
||||||
|
|
||||||
fun getStartIntent(
|
fun getStartIntent(context: Context, destination: Destination? = null) =
|
||||||
context: Context,
|
Intent(context, SplashActivity::class.java).apply {
|
||||||
destination: Destination? = null,
|
|
||||||
startNewTask: Boolean = false
|
|
||||||
) = Intent(context, SplashActivity::class.java).apply {
|
|
||||||
putExtra(EXTRA_START_DESTINATION, destination)
|
putExtra(EXTRA_START_DESTINATION, destination)
|
||||||
|
|
||||||
if (startNewTask) {
|
|
||||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
|
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
@ -179,7 +179,7 @@ class TimetableWidgetProvider : HiltBroadcastReceiver() {
|
|||||||
val appIntent = PendingIntent.getActivity(
|
val appIntent = PendingIntent.getActivity(
|
||||||
context,
|
context,
|
||||||
TIMETABLE_PENDING_INTENT_ID,
|
TIMETABLE_PENDING_INTENT_ID,
|
||||||
SplashActivity.getStartIntent(context, Destination.Timetable(), true),
|
SplashActivity.getStartIntent(context, Destination.Timetable()),
|
||||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntentCompat.FLAG_IMMUTABLE
|
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntentCompat.FLAG_IMMUTABLE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user