Skip to content

Commit 3629834

Browse files
AshAshBashnaveensingh
authored
fix: add proper spacing and prevent truncation in lap text views (#365)
* Increase dimensions of lap_time_size to accomodate full text value when lap time is longer than minutes e.g. 00:00.00 (#1) Co-authored-by: AshBash <ash@tuxbet.com> * Stopwatch Lap Times View: Adjusted layout width to wrap content so as the number of digits increases, so does the width of the box. Set the minWidth to the lap size dimension (for initial width) changed the layoutmethod from Packed to Spread Inside to prevent misalignment when number of digits in different laps is different. e.g when some laps are seconds long and others greater than 1 minute. Added margins at the end of the Lap Order and Lap Time Size boxes ensuring that when times are greater than 1 minute the values aren't too close together. * Reverting dimens back to original value as this is not the fix. * fix: ensure proper column alignment - Removed chaining in favor of weighted columns. Wrapping content and chaining the views to maximize space per column leads to uneven/random column positions per row with large text size. - Removed hardcoded 48dp end margin. It's not necessary anymore. - Added even container padding on the right side. * fix: align sorting indicator columns with lap columns They were still using the original 80dp width. * docs: update changelog --------- Co-authored-by: AshBash <ash@tuxbet.com> Co-authored-by: Naveen Singh <snaveen935@gmail.com>
1 parent 52b0916 commit 3629834

5 files changed

Lines changed: 41 additions & 21 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Fixed
9+
- Fixed overlap/truncation in stopwatch lap times ([#346])
810

911
## [1.5.0] - 2025-12-16
1012
### Changed
@@ -100,6 +102,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
100102
[#207]: https://github.com/FossifyOrg/Clock/issues/207
101103
[#247]: https://github.com/FossifyOrg/Clock/issues/247
102104
[#335]: https://github.com/FossifyOrg/Clock/issues/335
105+
[#346]: https://github.com/FossifyOrg/Clock/issues/346
103106

104107
[Unreleased]: https://github.com/FossifyOrg/Clock/compare/1.5.0...HEAD
105108
[1.5.0]: https://github.com/FossifyOrg/Clock/compare/1.4.0...1.5.0

app/src/main/res/layout-land/fragment_stopwatch.xml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@
3131

3232
<androidx.constraintlayout.widget.ConstraintLayout
3333
android:id="@+id/stopwatch_sorting_indicators_holder"
34-
android:layout_width="wrap_content"
34+
android:layout_width="0dp"
3535
android:layout_height="wrap_content"
3636
android:layout_marginTop="@dimen/small_margin"
37+
android:paddingHorizontal="@dimen/big_margin"
3738
android:visibility="invisible"
3839
app:layout_constraintBottom_toTopOf="@id/stopwatch_list"
3940
app:layout_constraintEnd_toEndOf="@id/stopwatch_list"
@@ -43,28 +44,34 @@
4344

4445
<ImageView
4546
android:id="@+id/stopwatch_sorting_indicator_1"
46-
android:layout_width="@dimen/lap_time_size"
47+
android:layout_width="0dp"
4748
android:layout_height="wrap_content"
49+
android:layout_marginEnd="@dimen/medium_margin"
4850
android:visibility="invisible"
4951
app:layout_constraintEnd_toStartOf="@+id/stopwatch_sorting_indicator_2"
5052
app:layout_constraintHorizontal_chainStyle="packed"
51-
app:layout_constraintStart_toStartOf="parent" />
53+
app:layout_constraintHorizontal_weight="0.8"
54+
app:layout_constraintStart_toStartOf="parent"
55+
app:layout_constraintTop_toTopOf="parent" />
5256

5357
<ImageView
5458
android:id="@+id/stopwatch_sorting_indicator_2"
55-
android:layout_width="@dimen/lap_time_size"
59+
android:layout_width="0dp"
5660
android:layout_height="wrap_content"
61+
android:layout_marginEnd="@dimen/medium_margin"
5762
android:visibility="invisible"
5863
app:layout_constraintEnd_toStartOf="@+id/stopwatch_sorting_indicator_3"
64+
app:layout_constraintHorizontal_weight="2.1"
5965
app:layout_constraintStart_toEndOf="@+id/stopwatch_sorting_indicator_1"
6066
app:layout_constraintTop_toTopOf="parent" />
6167

6268
<ImageView
6369
android:id="@+id/stopwatch_sorting_indicator_3"
64-
android:layout_width="@dimen/lap_time_size"
70+
android:layout_width="0dp"
6571
android:layout_height="wrap_content"
6672
android:visibility="invisible"
6773
app:layout_constraintEnd_toEndOf="parent"
74+
app:layout_constraintHorizontal_weight="2.1"
6875
app:layout_constraintStart_toEndOf="@+id/stopwatch_sorting_indicator_2"
6976
app:layout_constraintTop_toTopOf="parent" />
7077

app/src/main/res/layout/fragment_stopwatch.xml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,35 +35,42 @@
3535
android:id="@+id/stopwatch_sorting_indicators_holder"
3636
android:layout_width="match_parent"
3737
android:layout_height="wrap_content"
38+
android:paddingHorizontal="@dimen/big_margin"
3839
android:visibility="invisible"
3940
app:layout_constraintBottom_toTopOf="@id/stopwatch_list"
4041
app:layout_constraintTop_toBottomOf="@+id/stopwatch_time"
4142
tools:visibility="visible">
4243

4344
<ImageView
4445
android:id="@+id/stopwatch_sorting_indicator_1"
45-
android:layout_width="@dimen/lap_time_size"
46+
android:layout_width="0dp"
4647
android:layout_height="wrap_content"
48+
android:layout_marginEnd="@dimen/medium_margin"
4749
android:visibility="invisible"
4850
app:layout_constraintEnd_toStartOf="@+id/stopwatch_sorting_indicator_2"
4951
app:layout_constraintHorizontal_chainStyle="packed"
50-
app:layout_constraintStart_toStartOf="parent" />
52+
app:layout_constraintHorizontal_weight="0.8"
53+
app:layout_constraintStart_toStartOf="parent"
54+
app:layout_constraintTop_toTopOf="parent" />
5155

5256
<ImageView
5357
android:id="@+id/stopwatch_sorting_indicator_2"
54-
android:layout_width="@dimen/lap_time_size"
58+
android:layout_width="0dp"
5559
android:layout_height="wrap_content"
60+
android:layout_marginEnd="@dimen/medium_margin"
5661
android:visibility="invisible"
5762
app:layout_constraintEnd_toStartOf="@+id/stopwatch_sorting_indicator_3"
63+
app:layout_constraintHorizontal_weight="2.2"
5864
app:layout_constraintStart_toEndOf="@+id/stopwatch_sorting_indicator_1"
5965
app:layout_constraintTop_toTopOf="parent" />
6066

6167
<ImageView
6268
android:id="@+id/stopwatch_sorting_indicator_3"
63-
android:layout_width="@dimen/lap_time_size"
69+
android:layout_width="0dp"
6470
android:layout_height="wrap_content"
6571
android:visibility="invisible"
6672
app:layout_constraintEnd_toEndOf="parent"
73+
app:layout_constraintHorizontal_weight="2.2"
6774
app:layout_constraintStart_toEndOf="@+id/stopwatch_sorting_indicator_2"
6875
app:layout_constraintTop_toTopOf="parent" />
6976

app/src/main/res/layout/item_lap.xml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,50 +6,54 @@
66
android:layout_width="match_parent"
77
android:layout_height="wrap_content"
88
android:gravity="center_horizontal"
9-
android:paddingVertical="@dimen/small_margin"
10-
android:paddingLeft="@dimen/activity_margin">
9+
android:paddingHorizontal="@dimen/big_margin"
10+
android:paddingVertical="@dimen/small_margin">
1111

1212
<org.fossify.commons.views.MyTextView
1313
android:id="@+id/lap_order"
14-
android:layout_width="@dimen/lap_time_size"
14+
android:layout_width="0dp"
1515
android:layout_height="wrap_content"
16+
android:layout_marginEnd="@dimen/medium_margin"
1617
android:fontFeatureSettings="tnum"
17-
android:gravity="end"
18+
android:gravity="center"
1819
android:includeFontPadding="false"
1920
android:maxLines="1"
2021
android:textSize="@dimen/bigger_text_size"
2122
app:layout_constraintEnd_toStartOf="@+id/lap_lap_time"
22-
app:layout_constraintHorizontal_chainStyle="packed"
23+
app:layout_constraintHorizontal_weight="0.8"
2324
app:layout_constraintStart_toStartOf="parent"
24-
tools:text="1" />
25+
app:layout_constraintTop_toTopOf="parent"
26+
tools:text="12" />
2527

2628
<org.fossify.commons.views.MyTextView
2729
android:id="@+id/lap_lap_time"
28-
android:layout_width="@dimen/lap_time_size"
30+
android:layout_width="0dp"
2931
android:layout_height="wrap_content"
32+
android:layout_marginEnd="@dimen/medium_margin"
3033
android:fontFeatureSettings="tnum"
3134
android:gravity="end"
3235
android:includeFontPadding="false"
3336
android:maxLines="1"
3437
android:textSize="@dimen/bigger_text_size"
3538
app:layout_constraintEnd_toStartOf="@+id/lap_total_time"
39+
app:layout_constraintHorizontal_weight="2.1"
3640
app:layout_constraintStart_toEndOf="@+id/lap_order"
3741
app:layout_constraintTop_toTopOf="parent"
38-
tools:text="0.00" />
42+
tools:text="24:43:00" />
3943

4044
<org.fossify.commons.views.MyTextView
4145
android:id="@+id/lap_total_time"
42-
android:layout_width="@dimen/lap_time_size"
46+
android:layout_width="0dp"
4347
android:layout_height="wrap_content"
44-
android:layout_marginEnd="48dp"
4548
android:fontFeatureSettings="tnum"
4649
android:gravity="end"
4750
android:includeFontPadding="false"
4851
android:maxLines="1"
4952
android:textSize="@dimen/bigger_text_size"
5053
app:layout_constraintEnd_toEndOf="parent"
54+
app:layout_constraintHorizontal_weight="2.1"
5155
app:layout_constraintStart_toEndOf="@+id/lap_lap_time"
5256
app:layout_constraintTop_toTopOf="parent"
53-
tools:text="0.00.00" />
57+
tools:text="42:26:43:00" />
5458

5559
</androidx.constraintlayout.widget.ConstraintLayout>

app/src/main/res/values/dimens.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<dimen name="stopwatch_button_small_size">60dp</dimen>
44
<dimen name="stopwatch_button_size">64dp</dimen>
55
<dimen name="reminder_background_min_size">70dp</dimen>
6-
<dimen name="lap_time_size">80dp</dimen>
76
<dimen name="widget_alarm_icon_size">18dp</dimen>
87
<dimen name="widget_digital_time_height">48dp</dimen>
98
<dimen name="widget_analogue_time_height">96dp</dimen>

0 commit comments

Comments
 (0)