Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Fixed
- Preserve current day when changing orientation ([#1042])

## [1.10.3] - 2026-02-14
### Changed
Expand Down Expand Up @@ -237,6 +239,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#1003]: https://github.com/FossifyOrg/Calendar/issues/1003
[#1019]: https://github.com/FossifyOrg/Calendar/issues/1019
[#1024]: https://github.com/FossifyOrg/Calendar/issues/1024
[#1042]: https://github.com/FossifyOrg/Calendar/issues/1042

[Unreleased]: https://github.com/FossifyOrg/Calendar/compare/1.10.3...HEAD
[1.10.3]: https://github.com/FossifyOrg/Calendar/compare/1.10.2...1.10.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ class DayFragmentsHolder : MyFragmentHolder(), NavigationListener {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
currentDayCode = arguments?.getString(DAY_CODE) ?: ""
if (savedInstanceState != null) {
currentDayCode = savedInstanceState.getString(::currentDayCode.name) ?: currentDayCode
}
todayDayCode = Formatter.getTodayCode()
}

Expand All @@ -46,6 +49,11 @@ class DayFragmentsHolder : MyFragmentHolder(), NavigationListener {
return binding.root
}

override fun onSaveInstanceState(outState: Bundle) {
outState.putString(::currentDayCode.name, currentDayCode)
super.onSaveInstanceState(outState)
}

private fun setupFragment() {
val codes = getDays(currentDayCode)
val dailyAdapter = MyDayPagerAdapter(requireActivity().supportFragmentManager, codes, this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class MonthDayFragmentsHolder : MyFragmentHolder(), NavigationListener {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
currentDayCode = arguments?.getString(DAY_CODE) ?: ""
if (savedInstanceState != null) {
currentDayCode = savedInstanceState.getString(::currentDayCode.name) ?: currentDayCode
}
todayDayCode = Formatter.getTodayCode()
}

Expand All @@ -49,6 +52,11 @@ class MonthDayFragmentsHolder : MyFragmentHolder(), NavigationListener {
return binding.root
}

override fun onSaveInstanceState(outState: Bundle) {
outState.putString(::currentDayCode.name, currentDayCode)
super.onSaveInstanceState(outState)
}

private fun setupFragment() {
val codes = getMonths(currentDayCode)
val monthlyDailyAdapter = MyMonthDayPagerAdapter(requireActivity().supportFragmentManager, codes, this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class MonthFragmentsHolder : MyFragmentHolder(), NavigationListener {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
currentDayCode = arguments?.getString(DAY_CODE) ?: ""
if (savedInstanceState != null) {
currentDayCode = savedInstanceState.getString(::currentDayCode.name) ?: currentDayCode
}
todayDayCode = Formatter.getTodayCode()
}

Expand All @@ -49,6 +52,11 @@ class MonthFragmentsHolder : MyFragmentHolder(), NavigationListener {
return binding.root
}

override fun onSaveInstanceState(outState: Bundle) {
outState.putString(::currentDayCode.name, currentDayCode)
super.onSaveInstanceState(outState)
}

private fun setupFragment() {
val codes = getMonths(currentDayCode)
val monthlyAdapter = MyMonthPagerAdapter(requireActivity().supportFragmentManager, codes, this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
super.onCreate(savedInstanceState)
val dateTimeString = arguments?.getString(WEEK_START_DATE_TIME) ?: return
currentWeekTS = (DateTime.parse(dateTimeString) ?: DateTime()).seconds()
if (savedInstanceState != null) {
currentWeekTS = savedInstanceState.getLong(::currentWeekTS.name)
}
updateThisWeekTS()
}

Expand Down Expand Up @@ -72,6 +75,11 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
setupSeekbar()
}

override fun onSaveInstanceState(outState: Bundle) {
outState.putLong(::currentWeekTS.name, currentWeekTS)
super.onSaveInstanceState(outState)
}

private fun setupFragment() {
addHours()
setupWeeklyViewPager()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class YearFragmentsHolder : MyFragmentHolder(), NavigationListener {
super.onCreate(savedInstanceState)
val dateTimeString = arguments?.getString(YEAR_TO_OPEN)
currentYear = (if (dateTimeString != null) DateTime.parse(dateTimeString) else DateTime()).toString(Formatter.YEAR_PATTERN).toInt()
if (savedInstanceState != null) {
currentYear = savedInstanceState.getInt(::currentYear.name)
}
todayYear = DateTime().toString(Formatter.YEAR_PATTERN).toInt()
}

Expand All @@ -49,6 +52,11 @@ class YearFragmentsHolder : MyFragmentHolder(), NavigationListener {
return binding.root
}

override fun onSaveInstanceState(outState: Bundle) {
outState.putInt(::currentYear.name, currentYear)
super.onSaveInstanceState(outState)
}

private fun setupFragment() {
val years = getYears(currentYear)
val yearlyAdapter = MyYearPagerAdapter(requireActivity().supportFragmentManager, years, this)
Expand Down
Loading