forked from upstream-mirrors/OpenTracks
@@ -234,11 +234,9 @@ public class TrackListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
|
|||||||
viewBinding.trackListItemTime.setText(null);
|
viewBinding.trackListItemTime.setText(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO Check if this is needed or a leftover from the MarkerList migration
|
String categoryDescription = StringUtils.getCategoryDescription(activityTypeLocalized, description);
|
||||||
String category = activityType == null ? activityTypeLocalized : null;
|
|
||||||
String categoryDescription = StringUtils.getCategoryDescription(category, description);
|
|
||||||
viewBinding.trackListItemCategoryDescription.setText(categoryDescription);
|
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()));
|
setSelected(selection.get((int) getId()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -174,32 +174,23 @@ public class StringUtils {
|
|||||||
return new Pair<>(value, context.getString(R.string.sensor_unit_power));
|
return new Pair<>(value, context.getString(R.string.sensor_unit_power));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Deprecated //TODO Move to strings.xml
|
||||||
* Gets a string for category.
|
|
||||||
*
|
|
||||||
* @param category the category
|
|
||||||
*/
|
|
||||||
public static String getCategory(String category) {
|
public static String getCategory(String category) {
|
||||||
if (category == null || category.length() == 0) {
|
if (category == null || category.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return "[" + category + "]";
|
return "[" + category + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Deprecated //TODO use separate UI elements rather than concatenating strings.
|
||||||
* Gets a string for category and description.
|
|
||||||
*
|
|
||||||
* @param category the category
|
|
||||||
* @param description the description
|
|
||||||
*/
|
|
||||||
public static String getCategoryDescription(String category, String description) {
|
public static String getCategoryDescription(String category, String description) {
|
||||||
if (category == null || category.length() == 0) {
|
if (category == null || category.isEmpty()) {
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
builder.append(getCategory(category));
|
builder.append(getCategory(category));
|
||||||
if (description != null && description.length() != 0) {
|
if (description != null && !description.isEmpty()) {
|
||||||
builder.append(" ").append(description);
|
builder.append(" ").append(description);
|
||||||
}
|
}
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
|
|||||||
Reference in New Issue
Block a user