Bugfix: track list should show description.

Fixes #2127.
This commit is contained in:
Dennis Guse
2025-07-12 16:50:08 +02:00
parent 792e88acaa
commit 93eefe5cf2
2 changed files with 7 additions and 18 deletions
@@ -234,11 +234,9 @@ public class TrackListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
viewBinding.trackListItemTime.setText(null);
}
//TODO Check if this is needed or a leftover from the MarkerList migration
String category = activityType == null ? activityTypeLocalized : null;
String categoryDescription = StringUtils.getCategoryDescription(category, description);
String categoryDescription = StringUtils.getCategoryDescription(activityTypeLocalized, description);
viewBinding.trackListItemCategoryDescription.setText(categoryDescription);
viewBinding.trackListItemCategoryDescription.setVisibility("".equals(categoryDescription) ? View.GONE : View.VISIBLE);
viewBinding.trackListItemCategoryDescription.setVisibility(categoryDescription.isEmpty() ? View.GONE : View.VISIBLE);
setSelected(selection.get((int) getId()));
}
@@ -174,32 +174,23 @@ public class StringUtils {
return new Pair<>(value, context.getString(R.string.sensor_unit_power));
}
/**
* Gets a string for category.
*
* @param category the category
*/
@Deprecated //TODO Move to strings.xml
public static String getCategory(String category) {
if (category == null || category.length() == 0) {
if (category == null || category.isEmpty()) {
return null;
}
return "[" + category + "]";
}
/**
* Gets a string for category and description.
*
* @param category the category
* @param description the description
*/
@Deprecated //TODO use separate UI elements rather than concatenating strings.
public static String getCategoryDescription(String category, String description) {
if (category == null || category.length() == 0) {
if (category == null || category.isEmpty()) {
return description;
}
StringBuilder builder = new StringBuilder();
builder.append(getCategory(category));
if (description != null && description.length() != 0) {
if (description != null && !description.isEmpty()) {
builder.append(" ").append(description);
}
return builder.toString();