Improve marker list view layout

This commit is contained in:
Jimmy Shih
2013-10-30 14:29:40 -07:00
parent 261327ed4a
commit 7354b5a438
5 changed files with 56 additions and 23 deletions
@@ -183,14 +183,13 @@ public class MarkerListActivity extends AbstractMyTracksActivity implements Dele
int iconId = statistics ? R.drawable.ic_marker_yellow_pushpin
: R.drawable.ic_marker_blue_pushpin;
String name = cursor.getString(nameIndex);
String sharedOwner = track.getSharedOwner();
long time = cursor.getLong(timeIndex);
String category = statistics ? null : cursor.getString(categoryIndex);
String description = statistics ? null : cursor.getString(descriptionIndex);
String photoUrl = cursor.getString(photoUrlIndex);
ListItemUtils.setListItem(MarkerListActivity.this, view, false, true, iconId,
R.string.icon_marker, name, sharedOwner, null, null, 0, time, category, description,
R.string.icon_marker, name, null, null, null, 0, time, category, description,
photoUrl);
}
};
@@ -475,13 +475,11 @@ public class SearchListActivity extends AbstractSendToGoogleActivity implements
* the retrieval phase of the search.
*/
String trackName = null;
String sharedOwner = null;
long trackId = waypoint.getTrackId();
if (trackId != -1L) {
Track track = myTracksProviderUtils.getTrack(trackId);
if (track != null) {
trackName = track.getName();
sharedOwner = track.getSharedOwner();
}
}
@@ -493,7 +491,7 @@ public class SearchListActivity extends AbstractSendToGoogleActivity implements
statistics ? R.drawable.ic_marker_yellow_pushpin : R.drawable.ic_marker_blue_pushpin);
resultMap.put(ICON_CONTENT_DESCRIPTION_ID_FIELD, R.string.icon_marker);
resultMap.put(NAME_FIELD, waypoint.getName());
resultMap.put(SHARED_OWNER_FIELD, sharedOwner);
resultMap.put(SHARED_OWNER_FIELD, null);
// Display the marker's track name in the total time field
resultMap.put(TOTAL_TIME_FIELD, trackName == null ? null
: getString(R.string.search_list_marker_track_location, trackName));
@@ -91,7 +91,7 @@ public class ListItemUtils {
ownerTimeDistance = activity.getString(
isPaused ? R.string.generic_paused : R.string.generic_recording);
} else {
// Need to match the style set in list_item.xml
// Match list_item_owner_time_distance in list_item.xml
ownerTimeDistanceTextView.setTextAppearance(activity, R.style.TextSmall);
ownerTimeDistance = getOwnerTimeDistance(sharedOwner, totalTime, totalDistance);
if (markerCount > 0) {
@@ -99,7 +99,7 @@ public class ListItemUtils {
}
}
setTextView(ownerTimeDistanceTextView, ownerTimeDistance);
// Set markerCount
ImageView markerCountIcon = (ImageView) view.findViewById(R.id.list_item_marker_count_icon);
TextView markerCountTextView = (TextView) view.findViewById(R.id.list_item_marker_count);
@@ -126,26 +126,31 @@ public class ListItemUtils {
TextView timeTextView = (TextView) view.findViewById(R.id.list_item_time);
setTextView(timeTextView, dateTime[1]);
/*
* If column0 is GONE, change to INVISIBLE so column1 is placed at the
* correct position.
*/
if (timeTextView.getVisibility() == View.VISIBLE
&& ownerTimeDistanceTextView.getVisibility() == View.GONE) {
ownerTimeDistanceTextView.setVisibility(View.INVISIBLE);
// Set category and description
TextView categoryDescriptionTextView = (TextView) view.findViewById(
R.id.list_item_category_description);
String categoryDescription = isRecording ? null
: StringUtils.getCategoryDescription(category, description);
if (sharedOwner == null && totalTime == null && totalDistance == null && markerCount == 0) {
setTextView(categoryDescriptionTextView, null);
// Match list_item_category_description in list_item.xml
ownerTimeDistanceTextView.setSingleLine(false);
ownerTimeDistanceTextView.setMaxLines(2);
setTextView(ownerTimeDistanceTextView, categoryDescription);
} else {
// Match list_item_owner_time_distance in list_item.xml
ownerTimeDistanceTextView.setSingleLine(true);
setTextView(categoryDescriptionTextView, categoryDescription);
}
// Set category and description
TextView categoryDescription = (TextView) view.findViewById(
R.id.list_item_category_description);
setTextView(categoryDescription,
isRecording ? null : StringUtils.getCategoryDescription(category, description));
ImageView photo = (ImageView) view.findViewById(R.id.list_item_background);
ImageView photo = (ImageView) view.findViewById(R.id.list_item_photo);
ImageView photoGradient = (ImageView) view.findViewById(R.id.list_item_photo_gradient);
if (photoUrl == null || photoUrl.equals("")) {
photo.setVisibility(View.GONE);
photoGradient.setVisibility(View.GONE);
} else {
photo.setVisibility(View.VISIBLE);
photoGradient.setVisibility(View.VISIBLE);
Display defaultDisplay = activity.getWindowManager().getDefaultDisplay();
PhotoUtils.setImageVew(
photo, Uri.parse(photoUrl), defaultDisplay.getWidth(), getPhotoHeight(activity), false);