diff --git a/CHANGELOG.md b/CHANGELOG.md
index 29ccb2d8..4bcbca6c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,12 +10,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Replaced lap text button with an icon button
+- Updated stopwatch layout animation
- Updated translations
### Fixed
- Fixed inaccuracy in stopwatch over long durations ([#207])
- Fixed text jitter in clock, stopwatch, and timer ([#11])
+- Fixed invisible stopwatch laps in landscape mode ([#107])
## [1.2.1] - 2025-05-08
@@ -85,5 +87,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[1.0.0]: https://github.com/FossifyOrg/Clock/releases/tag/1.0.0
[#11]: https://github.com/FossifyOrg/Clock/issues/11
+[#107]: https://github.com/FossifyOrg/Clock/issues/107
[#158]: https://github.com/FossifyOrg/Clock/issues/158
[#207]: https://github.com/FossifyOrg/Clock/issues/207
diff --git a/app/src/main/kotlin/org/fossify/clock/fragments/StopwatchFragment.kt b/app/src/main/kotlin/org/fossify/clock/fragments/StopwatchFragment.kt
index 1ab3bf2a..b1472ca0 100644
--- a/app/src/main/kotlin/org/fossify/clock/fragments/StopwatchFragment.kt
+++ b/app/src/main/kotlin/org/fossify/clock/fragments/StopwatchFragment.kt
@@ -27,9 +27,7 @@ import org.fossify.clock.models.Lap
import org.fossify.commons.dialogs.PermissionRequiredDialog
import org.fossify.commons.extensions.applyColorFilter
import org.fossify.commons.extensions.beGone
-import org.fossify.commons.extensions.beInvisible
import org.fossify.commons.extensions.beInvisibleIf
-import org.fossify.commons.extensions.beVisible
import org.fossify.commons.extensions.beVisibleIf
import org.fossify.commons.extensions.flipBit
import org.fossify.commons.extensions.getColoredBitmap
@@ -82,7 +80,7 @@ class StopwatchFragment : Fragment() {
}
stopwatchLap.setOnClickListener {
- stopwatchSortingIndicatorsHolder.beVisible()
+ setShowLaps(true)
Stopwatch.lap()
updateLaps()
scrollToTop()
@@ -108,9 +106,11 @@ class StopwatchFragment : Fragment() {
setupViews()
Stopwatch.addUpdateListener(updateListener)
updateLaps()
- binding.stopwatchSortingIndicatorsHolder.beVisibleIf(Stopwatch.laps.isNotEmpty())
if (Stopwatch.laps.isNotEmpty()) {
updateSorting(Lap.sorting)
+ setShowLaps(true)
+ } else {
+ setShowLaps(false)
}
if (requireContext().config.toggleStopwatch) {
@@ -191,7 +191,7 @@ class StopwatchFragment : Fragment() {
stopwatchReset.beGone()
stopwatchLap.beGone()
stopwatchTime.text = 0L.formatStopwatchTime(false)
- stopwatchSortingIndicatorsHolder.beInvisible()
+ setShowLaps(false)
}
}
@@ -244,7 +244,7 @@ class StopwatchFragment : Fragment() {
}
}
- private fun updateLaps() = lifecycleScope.launch {
+ private fun updateLaps() = viewLifecycleOwner.lifecycleScope.launch {
stopwatchAdapter?.submitList(
withContext(Dispatchers.Default) {
val laps = ArrayList(Stopwatch.laps)
@@ -267,11 +267,18 @@ class StopwatchFragment : Fragment() {
}
}
+ private fun setShowLaps(showLaps: Boolean) {
+ binding.stopwatchSortingIndicatorsHolder.beVisibleIf(showLaps)
+ binding.stopwatchList.beVisibleIf(showLaps)
+ }
+
private val updateListener = object : Stopwatch.UpdateListener {
override fun onUpdate(totalTime: Long, lapTime: Long, useLongerMSFormat: Boolean) {
binding.stopwatchTime.text = totalTime.formatStopwatchTime(useLongerMSFormat)
latestLapTime = lapTime
latestTotalTime = totalTime
+ // We just update the list everytime for simplicity.
+ // dafa9e0ad88fdf77c19b91caec0683a3a87b8f50 would be more efficient.
updateLaps()
}
diff --git a/app/src/main/res/layout-land/fragment_stopwatch.xml b/app/src/main/res/layout-land/fragment_stopwatch.xml
new file mode 100644
index 00000000..ac8e23c5
--- /dev/null
+++ b/app/src/main/res/layout-land/fragment_stopwatch.xml
@@ -0,0 +1,133 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/fragment_stopwatch.xml b/app/src/main/res/layout/fragment_stopwatch.xml
index e3d036fb..0f59123f 100644
--- a/app/src/main/res/layout/fragment_stopwatch.xml
+++ b/app/src/main/res/layout/fragment_stopwatch.xml
@@ -4,13 +4,15 @@
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/stopwatch_fragment"
android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ android:animateLayoutChanges="true">
@@ -73,19 +77,19 @@
android:clipToPadding="false"
android:overScrollMode="ifContentScrolls"
android:scrollbars="vertical"
+ android:visibility="gone"
app:layoutManager="org.fossify.commons.views.MyLinearLayoutManager"
app:layout_constraintBottom_toTopOf="@+id/stopwatch_play_pause"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/stopwatch_sorting_indicators_holder"
- tools:listitem="@layout/item_lap" />
+ tools:listitem="@layout/item_lap"
+ tools:visibility="visible" />