From 7354b5a43847967093924202e4c82c1e5c78d10f Mon Sep 17 00:00:00 2001 From: Jimmy Shih Date: Wed, 30 Oct 2013 14:29:40 -0700 Subject: [PATCH] Improve marker list view layout --- MyTracks/res/drawable/photo_gradient.xml | 22 +++++++++++ MyTracks/res/layout/list_item.xml | 13 ++++++- .../apps/mytracks/MarkerListActivity.java | 3 +- .../apps/mytracks/SearchListActivity.java | 4 +- .../apps/mytracks/util/ListItemUtils.java | 37 +++++++++++-------- 5 files changed, 56 insertions(+), 23 deletions(-) create mode 100644 MyTracks/res/drawable/photo_gradient.xml diff --git a/MyTracks/res/drawable/photo_gradient.xml b/MyTracks/res/drawable/photo_gradient.xml new file mode 100644 index 000000000..1d243968f --- /dev/null +++ b/MyTracks/res/drawable/photo_gradient.xml @@ -0,0 +1,22 @@ + + + + + \ No newline at end of file diff --git a/MyTracks/res/layout/list_item.xml b/MyTracks/res/layout/list_item.xml index 00156666c..5672eb6ca 100644 --- a/MyTracks/res/layout/list_item.xml +++ b/MyTracks/res/layout/list_item.xml @@ -17,15 +17,24 @@ limitations under the License. + + + 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);