Skip to content
This repository was archived by the owner on Aug 24, 2025. It is now read-only.

Commit 93eefe5

Browse files
committed
Bugfix: track list should show description.
Fixes #2127.
1 parent 792e88a commit 93eefe5

2 files changed

Lines changed: 7 additions & 18 deletions

File tree

src/main/java/de/dennisguse/opentracks/ui/TrackListAdapter.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,9 @@ public void bind(Cursor cursor) {
234234
viewBinding.trackListItemTime.setText(null);
235235
}
236236

237-
//TODO Check if this is needed or a leftover from the MarkerList migration
238-
String category = activityType == null ? activityTypeLocalized : null;
239-
String categoryDescription = StringUtils.getCategoryDescription(category, description);
237+
String categoryDescription = StringUtils.getCategoryDescription(activityTypeLocalized, description);
240238
viewBinding.trackListItemCategoryDescription.setText(categoryDescription);
241-
viewBinding.trackListItemCategoryDescription.setVisibility("".equals(categoryDescription) ? View.GONE : View.VISIBLE);
239+
viewBinding.trackListItemCategoryDescription.setVisibility(categoryDescription.isEmpty() ? View.GONE : View.VISIBLE);
242240

243241
setSelected(selection.get((int) getId()));
244242
}

src/main/java/de/dennisguse/opentracks/util/StringUtils.java

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -174,32 +174,23 @@ public static Pair<String, String> getPowerParts(Context context, Power power) {
174174
return new Pair<>(value, context.getString(R.string.sensor_unit_power));
175175
}
176176

177-
/**
178-
* Gets a string for category.
179-
*
180-
* @param category the category
181-
*/
177+
@Deprecated //TODO Move to strings.xml
182178
public static String getCategory(String category) {
183-
if (category == null || category.length() == 0) {
179+
if (category == null || category.isEmpty()) {
184180
return null;
185181
}
186182
return "[" + category + "]";
187183
}
188184

189-
/**
190-
* Gets a string for category and description.
191-
*
192-
* @param category the category
193-
* @param description the description
194-
*/
185+
@Deprecated //TODO use separate UI elements rather than concatenating strings.
195186
public static String getCategoryDescription(String category, String description) {
196-
if (category == null || category.length() == 0) {
187+
if (category == null || category.isEmpty()) {
197188
return description;
198189
}
199190

200191
StringBuilder builder = new StringBuilder();
201192
builder.append(getCategory(category));
202-
if (description != null && description.length() != 0) {
193+
if (description != null && !description.isEmpty()) {
203194
builder.append(" ").append(description);
204195
}
205196
return builder.toString();

0 commit comments

Comments
 (0)