mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-09-30 16:52:21 +02:00
Marker list: split category and description into two fields.
This commit is contained in:
@@ -35,7 +35,6 @@ import de.dennisguse.opentracks.ui.util.ExecutorListViewService;
|
||||
import de.dennisguse.opentracks.ui.util.ListItemUtils;
|
||||
import de.dennisguse.opentracks.ui.util.ThemeUtils;
|
||||
import de.dennisguse.opentracks.util.IntentUtils;
|
||||
import de.dennisguse.opentracks.util.StringUtils;
|
||||
|
||||
public class MarkerListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements ActionMode.Callback {
|
||||
|
||||
@@ -196,8 +195,8 @@ public class MarkerListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
||||
ListItemUtils.setDateAndTime(context, viewBinding.markerListItemDate, viewBinding.markerListItemTime, marker.position().time(), timeZone);
|
||||
}
|
||||
|
||||
String categoryDescription = StringUtils.getCategoryDescription(marker.category(), marker.description());
|
||||
viewBinding.markerListItemTimeDistance.setText(categoryDescription);
|
||||
viewBinding.markerListItemDescription.setText(marker.description());
|
||||
viewBinding.markerListItemCategory.setText(marker.category());
|
||||
|
||||
setSelected(selection.get((int) getId()));
|
||||
}
|
||||
|
||||
@@ -174,20 +174,6 @@ public class StringUtils {
|
||||
return new Pair<>(value, context.getString(R.string.sensor_unit_power));
|
||||
}
|
||||
|
||||
@Deprecated //TODO use separate UI elements rather than concatenating strings.
|
||||
public static String getCategoryDescription(String category, String description) {
|
||||
if (category == null || category.isEmpty()) {
|
||||
return description;
|
||||
}
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append(category);
|
||||
if (description != null && !description.isEmpty()) {
|
||||
builder.append(" ").append(description);
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the given text as a XML CDATA element.
|
||||
* This includes adding the starting and ending CDATA tags.
|
||||
|
||||
@@ -44,13 +44,25 @@
|
||||
|
||||
<!-- Total time and distance -->
|
||||
<TextView
|
||||
android:id="@+id/marker_list_item_time_distance"
|
||||
android:id="@+id/marker_list_item_category"
|
||||
style='?attr/textAppearanceBodySmall'
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="@+id/marker_list_item_name"
|
||||
app:layout_constraintTop_toBottomOf="@+id/marker_list_item_name"
|
||||
tools:text="50:43 (50.00km)" />
|
||||
tools:text="Mountain" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/marker_list_item_description"
|
||||
style="?attr/textAppearanceBodySmall"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
app:layout_constraintStart_toStartOf="@+id/marker_list_item_name"
|
||||
app:layout_constraintTop_toBottomOf="@+id/marker_list_item_category"
|
||||
tools:text="Some wonderful mountain" />
|
||||
|
||||
<!-- Time -->
|
||||
<TextView
|
||||
@@ -68,7 +80,9 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:barrierDirection="bottom"
|
||||
app:constraint_referenced_ids="marker_list_item_photo,marker_list_item_name,marker_list_item_date,marker_list_item_time_distance,marker_list_item_time" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/marker_list_item_description"
|
||||
|
||||
app:constraint_referenced_ids="marker_list_item_photo,marker_list_item_name,marker_list_item_date,marker_list_item_category" />
|
||||
|
||||
<!-- Bottom Line -->
|
||||
<View
|
||||
|
||||
Reference in New Issue
Block a user