mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-02-05 05:24:12 +01:00
Activity list - redesign
This commit is contained in:
parent
d782169a64
commit
c7bac30ef0
@ -28,6 +28,7 @@ public class ActivityListItem {
|
|||||||
private final TextView timeFromView;
|
private final TextView timeFromView;
|
||||||
private final TextView timeToView;
|
private final TextView timeToView;
|
||||||
private final TextView activityName;
|
private final TextView activityName;
|
||||||
|
private final TextView activityLabelText;
|
||||||
private final TextView stepLabel;
|
private final TextView stepLabel;
|
||||||
private final TextView distanceLabel;
|
private final TextView distanceLabel;
|
||||||
private final TextView hrLabel;
|
private final TextView hrLabel;
|
||||||
@ -39,7 +40,6 @@ public class ActivityListItem {
|
|||||||
private final LinearLayout stepsLayout;
|
private final LinearLayout stepsLayout;
|
||||||
private final LinearLayout distanceLayout;
|
private final LinearLayout distanceLayout;
|
||||||
private final LinearLayout intensityLayout;
|
private final LinearLayout intensityLayout;
|
||||||
private final LinearLayout dateLayout;
|
|
||||||
private final RelativeLayout parentLayout;
|
private final RelativeLayout parentLayout;
|
||||||
private final ImageView activityIcon;
|
private final ImageView activityIcon;
|
||||||
private final ImageView gpsIcon;
|
private final ImageView gpsIcon;
|
||||||
@ -54,6 +54,7 @@ public class ActivityListItem {
|
|||||||
this.timeFromView = itemView.findViewById(R.id.line_layout_time_from);
|
this.timeFromView = itemView.findViewById(R.id.line_layout_time_from);
|
||||||
this.timeToView = itemView.findViewById(R.id.line_layout_time_to);
|
this.timeToView = itemView.findViewById(R.id.line_layout_time_to);
|
||||||
this.activityName = itemView.findViewById(R.id.line_layout_activity_name);
|
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.stepLabel = itemView.findViewById(R.id.line_layout_step_label);
|
||||||
this.distanceLabel = itemView.findViewById(R.id.line_layout_distance_label);
|
this.distanceLabel = itemView.findViewById(R.id.line_layout_distance_label);
|
||||||
this.hrLabel = itemView.findViewById(R.id.line_layout_hr_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.stepsLayout = itemView.findViewById(R.id.line_layout_step);
|
||||||
this.distanceLayout = itemView.findViewById(R.id.line_layout_distance);
|
this.distanceLayout = itemView.findViewById(R.id.line_layout_distance);
|
||||||
this.intensityLayout = itemView.findViewById(R.id.line_layout_intensity);
|
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);
|
this.parentLayout = itemView.findViewById(R.id.list_item_parent_layout);
|
||||||
|
|
||||||
@ -93,9 +93,10 @@ public class ActivityListItem {
|
|||||||
final boolean selected) {
|
final boolean selected) {
|
||||||
final String activityKindLabel = activityKind.getLabel(activityName.getContext());
|
final String activityKindLabel = activityKind.getLabel(activityName.getContext());
|
||||||
if (StringUtils.isNotBlank(activityLabel)) {
|
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 {
|
} else {
|
||||||
activityName.setText(activityKindLabel);
|
activityName.setText(String.format("%s", activityKindLabel));
|
||||||
}
|
}
|
||||||
durationLabel.setText(DateTimeUtils.formatDurationHoursMinutes(duration, TimeUnit.MILLISECONDS));
|
durationLabel.setText(DateTimeUtils.formatDurationHoursMinutes(duration, TimeUnit.MILLISECONDS));
|
||||||
|
|
||||||
@ -130,9 +131,9 @@ public class ActivityListItem {
|
|||||||
|
|
||||||
if (date != null) {
|
if (date != null) {
|
||||||
dateLabel.setText(formatDate(date));
|
dateLabel.setText(formatDate(date));
|
||||||
dateLayout.setVisibility(View.VISIBLE);
|
dateLabel.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
dateLayout.setVisibility(View.GONE);
|
dateLabel.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timeFrom != null && timeTo != null) {
|
if (timeFrom != null && timeTo != null) {
|
||||||
@ -154,10 +155,6 @@ public class ActivityListItem {
|
|||||||
if (parentLayout != null) {
|
if (parentLayout != null) {
|
||||||
if (selected) {
|
if (selected) {
|
||||||
parentLayout.setBackgroundColor(selectedColor);
|
parentLayout.setBackgroundColor(selectedColor);
|
||||||
} else if (zebraStripe) {
|
|
||||||
parentLayout.setBackgroundColor(alternateColor);
|
|
||||||
} else {
|
|
||||||
parentLayout.setBackgroundColor(backgroundColor);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/activity_list_summary_dashboard"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
@ -122,5 +123,10 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</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>
|
</RelativeLayout>
|
@ -4,11 +4,10 @@
|
|||||||
android:id="@+id/list_item_parent_layout"
|
android:id="@+id/list_item_parent_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
<!--
|
|
||||||
android:background="?android:attr/activatedBackgroundIndicator"
|
|
||||||
-->
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:gravity="start"
|
||||||
|
android:layout_gravity="start"
|
||||||
android:id="@+id/list_item_subparent_layout"
|
android:id="@+id/list_item_subparent_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@ -49,15 +48,15 @@
|
|||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical"
|
||||||
|
android:gravity="center_horizontal|center_vertical"
|
||||||
|
>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/line_layout_activity_icon"
|
android:id="@+id/line_layout_activity_icon"
|
||||||
android:layout_width="56dp"
|
android:layout_width="50dp"
|
||||||
android:layout_height="56dp"
|
android:layout_height="50dp"
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:layout_marginBottom="4dp"
|
|
||||||
android:contentDescription="@string/candidate_item_device_image"
|
android:contentDescription="@string/candidate_item_device_image"
|
||||||
android:padding="8dp"
|
android:padding="8dp"
|
||||||
app:srcCompat="@drawable/ic_activity_unknown" />
|
app:srcCompat="@drawable/ic_activity_unknown" />
|
||||||
@ -67,54 +66,92 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical"
|
||||||
|
android:minHeight="50dp"
|
||||||
<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" />
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/line_layout_duration_gps"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="start"
|
android:orientation="horizontal"
|
||||||
android:gravity="start"
|
android:gravity="top"
|
||||||
android:orientation="horizontal">
|
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
|
<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: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:maxLines="1"
|
||||||
android:scrollHorizontally="false"
|
android:scrollHorizontally="false"
|
||||||
android:text="@string/stats_empty_value" />
|
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" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="6dp"
|
android:orientation="horizontal"
|
||||||
android:gravity="bottom"
|
android:gravity="bottom"
|
||||||
|
>
|
||||||
|
<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">
|
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
|
<LinearLayout
|
||||||
android:id="@+id/line_layout_step"
|
android:id="@+id/line_layout_step"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@ -235,41 +272,14 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</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>
|
</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>
|
</RelativeLayout>
|
@ -9,6 +9,7 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/summary_dashboard"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
@ -466,5 +467,10 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</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>
|
</RelativeLayout>
|
@ -63,6 +63,7 @@
|
|||||||
<color name="steps_color" type="color">#00c9bf</color>
|
<color name="steps_color" type="color">#00c9bf</color>
|
||||||
|
|
||||||
<color name="value_line_color" type="color">#858585</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="gauge_line_color" type="color">#19808080</color>
|
||||||
|
|
||||||
<color name="alternate_row_background_light">#FFEDEDED</color>
|
<color name="alternate_row_background_light">#FFEDEDED</color>
|
||||||
|
Loading…
Reference in New Issue
Block a user