1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-28 11:35:48 +01:00

Activity list - redesign

This commit is contained in:
a0z 2024-10-07 23:10:27 +02:00 committed by José Rebelo
parent d782169a64
commit c7bac30ef0
5 changed files with 105 additions and 85 deletions

View File

@ -28,6 +28,7 @@ public class ActivityListItem {
private final TextView timeFromView;
private final TextView timeToView;
private final TextView activityName;
private final TextView activityLabelText;
private final TextView stepLabel;
private final TextView distanceLabel;
private final TextView hrLabel;
@ -39,7 +40,6 @@ public class ActivityListItem {
private final LinearLayout stepsLayout;
private final LinearLayout distanceLayout;
private final LinearLayout intensityLayout;
private final LinearLayout dateLayout;
private final RelativeLayout parentLayout;
private final ImageView activityIcon;
private final ImageView gpsIcon;
@ -54,6 +54,7 @@ public class ActivityListItem {
this.timeFromView = itemView.findViewById(R.id.line_layout_time_from);
this.timeToView = itemView.findViewById(R.id.line_layout_time_to);
this.activityName = itemView.findViewById(R.id.line_layout_activity_name);
this.activityLabelText = itemView.findViewById(R.id.line_layout_activity_label);
this.stepLabel = itemView.findViewById(R.id.line_layout_step_label);
this.distanceLabel = itemView.findViewById(R.id.line_layout_distance_label);
this.hrLabel = itemView.findViewById(R.id.line_layout_hr_label);
@ -66,7 +67,6 @@ public class ActivityListItem {
this.stepsLayout = itemView.findViewById(R.id.line_layout_step);
this.distanceLayout = itemView.findViewById(R.id.line_layout_distance);
this.intensityLayout = itemView.findViewById(R.id.line_layout_intensity);
this.dateLayout = itemView.findViewById(R.id.line_layout_date);
this.parentLayout = itemView.findViewById(R.id.list_item_parent_layout);
@ -93,9 +93,10 @@ public class ActivityListItem {
final boolean selected) {
final String activityKindLabel = activityKind.getLabel(activityName.getContext());
if (StringUtils.isNotBlank(activityLabel)) {
activityName.setText(String.format("%s, %s", activityKindLabel, activityLabel));
activityLabelText.setText(String.format(" (%s)", activityKindLabel));
activityName.setText(String.format("%s", activityLabel));
} else {
activityName.setText(activityKindLabel);
activityName.setText(String.format("%s", activityKindLabel));
}
durationLabel.setText(DateTimeUtils.formatDurationHoursMinutes(duration, TimeUnit.MILLISECONDS));
@ -130,9 +131,9 @@ public class ActivityListItem {
if (date != null) {
dateLabel.setText(formatDate(date));
dateLayout.setVisibility(View.VISIBLE);
dateLabel.setVisibility(View.VISIBLE);
} else {
dateLayout.setVisibility(View.GONE);
dateLabel.setVisibility(View.GONE);
}
if (timeFrom != null && timeTo != null) {
@ -154,10 +155,6 @@ public class ActivityListItem {
if (parentLayout != null) {
if (selected) {
parentLayout.setBackgroundColor(selectedColor);
} else if (zebraStripe) {
parentLayout.setBackgroundColor(alternateColor);
} else {
parentLayout.setBackgroundColor(backgroundColor);
}
}
}

View File

@ -8,6 +8,7 @@
-->
<LinearLayout
android:id="@+id/activity_list_summary_dashboard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
@ -122,5 +123,10 @@
</LinearLayout>
</LinearLayout>
<View
android:layout_below="@id/activity_list_summary_dashboard"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/value_line_color_transparent"
/>
</RelativeLayout>

View File

@ -4,11 +4,10 @@
android:id="@+id/list_item_parent_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!--
android:background="?android:attr/activatedBackgroundIndicator"
-->
<LinearLayout
android:gravity="start"
android:layout_gravity="start"
android:id="@+id/list_item_subparent_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -49,15 +48,15 @@
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center_horizontal|center_vertical"
>
<ImageView
android:id="@+id/line_layout_activity_icon"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="@string/candidate_item_device_image"
android:padding="8dp"
app:srcCompat="@drawable/ic_activity_unknown" />
@ -67,53 +66,91 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/line_layout_activity_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:scrollHorizontally="false"
android:text="@string/unknown"
android:textStyle="bold" />
android:orientation="vertical"
android:minHeight="50dp"
>
<LinearLayout
android:id="@+id/line_layout_duration_gps"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:gravity="start"
android:orientation="horizontal">
android:orientation="horizontal"
android:gravity="top"
android:layout_weight="1"
>
<TextView
android:id="@+id/line_layout_activity_name"
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:id="@+id/line_layout_duration_label"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_weight="1"
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" />
<ImageView
android:id="@+id/line_layout_gps_icon"
android:layout_width="20dp"
android:layout_height="19dp"
android:layout_gravity="end"
android:contentDescription="@string/candidate_item_device_image"
app:srcCompat="@android:drawable/ic_menu_mylocation" />
android:text="@string/stats_empty_value"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:orientation="horizontal"
android:gravity="bottom"
android:orientation="horizontal">
>
<TextView
android:id="@+id/line_layout_duration_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"
android:layout_weight="1"
android:gravity="start"
android:maxLines="1"
android:scrollHorizontally="false"
android:text="@string/stats_empty_value" />
<LinearLayout
android:id="@+id/line_layout_duration_gps"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:orientation="horizontal">
<ImageView
android:id="@+id/line_layout_gps_icon"
android:layout_width="20dp"
android:layout_height="19dp"
android:contentDescription="@string/candidate_item_device_image"
app:srcCompat="@android:drawable/ic_menu_mylocation" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="bottom"
android:orientation="horizontal"
>
<LinearLayout
android:id="@+id/line_layout_step"
@ -235,41 +272,14 @@
</LinearLayout>
<LinearLayout
android:id="@+id/line_layout_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:gravity="start"
android:orientation="horizontal">
<!--
<ImageView
android:id="@+id/line_layout_date_icon"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="start"
android:contentDescription="@string/candidate_item_device_image"
app:srcCompat="@drawable/ic_calendar_today" />
-->
<TextView
android:id="@+id/line_layout_date_label"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_weight="1"
android:gravity="start"
android:maxLines="1"
android:scrollHorizontally="false"
android:text="@string/stats_empty_value" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<View
android:layout_below="@id/list_item_subparent_layout"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/value_line_color_transparent"
/>
</RelativeLayout>

View File

@ -9,6 +9,7 @@
-->
<LinearLayout
android:id="@+id/summary_dashboard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
@ -466,5 +467,10 @@
</LinearLayout>
</LinearLayout>
<View
android:layout_below="@id/summary_dashboard"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/value_line_color_transparent"
/>
</RelativeLayout>

View File

@ -63,6 +63,7 @@
<color name="steps_color" type="color">#00c9bf</color>
<color name="value_line_color" type="color">#858585</color>
<color name="value_line_color_transparent" type="color">#70858585</color>
<color name="gauge_line_color" type="color">#19808080</color>
<color name="alternate_row_background_light">#FFEDEDED</color>