forked from upstream-mirrors/OpenTracks
align list icon to top when there is only one line
This commit is contained in:
@@ -24,9 +24,11 @@ import android.content.res.TypedArray;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.text.format.DateUtils;
|
import android.text.format.DateUtils;
|
||||||
import android.view.Display;
|
import android.view.Display;
|
||||||
|
import android.view.Gravity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup.LayoutParams;
|
import android.view.ViewGroup.LayoutParams;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -143,7 +145,13 @@ public class ListItemUtils {
|
|||||||
R.id.list_item_category_description);
|
R.id.list_item_category_description);
|
||||||
String categoryDescription = isRecording ? null
|
String categoryDescription = isRecording ? null
|
||||||
: StringUtils.getCategoryDescription(category, description);
|
: StringUtils.getCategoryDescription(category, description);
|
||||||
if (sharedOwner == null && totalTime == null && totalDistance == null && markerCount == 0) {
|
|
||||||
|
/*
|
||||||
|
* Place categoryDescription in either ownerTimeDistanceTextView or
|
||||||
|
* categoryDescriptionTextView
|
||||||
|
*/
|
||||||
|
if (ownerTimeDistanceTextView.getVisibility() == View.GONE
|
||||||
|
&& markerCountIcon.getVisibility() == View.GONE) {
|
||||||
setTextView(activity, categoryDescriptionTextView, null, hasPhoto);
|
setTextView(activity, categoryDescriptionTextView, null, hasPhoto);
|
||||||
// Match list_item_category_description in list_item.xml
|
// Match list_item_category_description in list_item.xml
|
||||||
ownerTimeDistanceTextView.setSingleLine(false);
|
ownerTimeDistanceTextView.setSingleLine(false);
|
||||||
@@ -154,6 +162,11 @@ public class ListItemUtils {
|
|||||||
ownerTimeDistanceTextView.setSingleLine(true);
|
ownerTimeDistanceTextView.setSingleLine(true);
|
||||||
setTextView(activity, categoryDescriptionTextView, categoryDescription, hasPhoto);
|
setTextView(activity, categoryDescriptionTextView, categoryDescription, hasPhoto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Adjust iconImageView layout gravity
|
||||||
|
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) iconImageView.getLayoutParams();
|
||||||
|
params.gravity = ownerTimeDistanceTextView.getVisibility() == View.GONE
|
||||||
|
&& markerCountIcon.getVisibility() == View.GONE ? Gravity.TOP : Gravity.CENTER_VERTICAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user