Activity list - move activity label below, revert background color set

This commit is contained in:
a0z 2024-10-08 19:17:37 +02:00 committed by José Rebelo
parent cdaf78cbbc
commit cac9b702a2
2 changed files with 42 additions and 36 deletions

View File

@ -93,9 +93,10 @@ public class ActivityListItem {
final boolean selected) {
final String activityKindLabel = activityKind.getLabel(activityName.getContext());
if (StringUtils.isNotBlank(activityLabel)) {
activityLabelText.setText(String.format(" (%s)", activityKindLabel));
activityLabelText.setText(String.format("%s", activityKindLabel));
activityName.setText(String.format("%s", activityLabel));
} else {
activityLabelText.setVisibility(View.GONE);
activityName.setText(String.format("%s", activityKindLabel));
}
durationLabel.setText(DateTimeUtils.formatDurationHoursMinutes(duration, TimeUnit.MILLISECONDS));
@ -155,6 +156,8 @@ public class ActivityListItem {
if (parentLayout != null) {
if (selected) {
parentLayout.setBackgroundColor(selectedColor);
} else {
parentLayout.setBackgroundColor(backgroundColor);
}
}
}

View File

@ -71,46 +71,49 @@
android:minHeight="50dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
<TableLayout
android:gravity="top"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:shrinkColumns="0"
>
<TextView
android:id="@+id/line_layout_activity_name"
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:layout_weight="0"
android:scrollHorizontally="false"
android:text="@string/unknown"
android:textStyle="bold"
android:textSize="16sp"
/>
<TextView
android:id="@+id/line_layout_activity_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:layout_weight="0"
android:scrollHorizontally="false"
/>
<TextView
android:gravity="end"
android:id="@+id/line_layout_date_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:maxLines="1"
android:scrollHorizontally="false"
android:text="@string/stats_empty_value"
/>
</LinearLayout>
android:gravity="center_vertical">
<TextView
android:id="@+id/line_layout_activity_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:scrollHorizontally="false"
android:text="@string/unknown"
android:textStyle="bold"
android:textSize="16sp"
android:singleLine="true"
android:ellipsize="end"
/>
<TextView
android:gravity="end|top"
android:layout_gravity="top"
android:id="@+id/line_layout_date_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:scrollHorizontally="false"
android:text="@string/stats_empty_value"
android:singleLine="true"
android:ellipsize="none"
/>
</TableRow>
</TableLayout>
<TextView
android:id="@+id/line_layout_activity_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"