Skip to content

Commit 727c143

Browse files
committed
fix stat detail buttons animating on scroll
1 parent c064b3e commit 727c143

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

features/feature_base_adapter/src/main/res/layout/item_record_selected_layout.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<androidx.cardview.widget.CardView
99
android:id="@+id/ivRecordSelectedItemCheck"
10-
android:layout_width="24dp"
10+
android:layout_width="16dp"
1111
android:layout_height="0dp"
1212
android:layout_marginStart="4dp"
1313
app:cardBackgroundColor="?colorAccent"

features/feature_base_adapter/src/main/res/layout/item_running_record_selected_layout.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<androidx.cardview.widget.CardView
99
android:id="@+id/ivRecordSelectedItemCheck"
10-
android:layout_width="24dp"
10+
android:layout_width="16dp"
1111
android:layout_height="0dp"
1212
android:layout_marginStart="4dp"
1313
app:cardBackgroundColor="?colorAccent"

features/feature_base_adapter/src/main/res/layout/item_statistics_selectable_layout.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<androidx.cardview.widget.CardView
99
android:id="@+id/viewStatisticsSelectableItemCheck"
10-
android:layout_width="24dp"
10+
android:layout_width="16dp"
1111
android:layout_height="0dp"
1212
android:layout_marginStart="4dp"
1313
android:visibility="gone"

features/feature_statistics_detail/src/main/java/com/example/util/simpletimetracker/feature_statistics_detail/adapter/StatisticsDetailButtonsRowAdapterDelegate.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,15 @@ fun createStatisticsDetailButtonsRowAdapterDelegate(
1616
with(binding.root) {
1717
item as ViewData
1818

19-
tag = item.block
2019
setMargins(top = item.marginTopDp)
21-
adapter.replace(item.data)
20+
// Replace without animation on reuse for different buttons.
21+
if (tag != item.block) {
22+
adapter.replaceFast(item.data)
23+
} else {
24+
adapter.replace(item.data)
25+
}
2226
listener = { onClick(item.block, it) }
27+
tag = item.block
2328
}
2429
}
2530

0 commit comments

Comments
 (0)