Show email status image/text using a single TextView, stop content overlapping
This commit is contained in:
@@ -43,6 +43,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@+id/email_from"
|
||||
android:layout_below="@+id/email_from"
|
||||
android:layout_toStartOf="@+id/email_status"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="Content" />
|
||||
@@ -67,24 +68,13 @@
|
||||
android:visibility="gone"
|
||||
android:src="@drawable/ic_content_attachment" />
|
||||
|
||||
<ImageView
|
||||
<TextView
|
||||
android:id="@+id/email_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/email_content"
|
||||
android:layout_alignBottom="@+id/email_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:scaleType="fitEnd"
|
||||
android:visibility="gone"
|
||||
android:src="@drawable/ic_navigation_accept" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/email_status_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/email_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:visibility="gone"
|
||||
android:text="0%" />
|
||||
android:visibility="gone" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -98,17 +98,17 @@ public class EmailListAdapter extends ArrayAdapter<Email> {
|
||||
|
||||
// Set email status if we sent it
|
||||
if (BoteHelper.isSentEmail(email)) {
|
||||
TextView emailStatus = (TextView) v.findViewById(R.id.email_status_text);
|
||||
TextView emailStatus = (TextView) v.findViewById(R.id.email_status);
|
||||
if (email.isDelivered())
|
||||
((ImageView) v.findViewById(
|
||||
R.id.email_status)).setVisibility(View.VISIBLE);
|
||||
else {
|
||||
if (email.getDeliveryPercentage() > 0)
|
||||
emailStatus.setText(email.getDeliveryPercentage() + "%");
|
||||
else
|
||||
emailStatus.setText(BoteHelper.getEmailStatus(email));
|
||||
emailStatus.setVisibility(View.VISIBLE);
|
||||
}
|
||||
emailStatus.setCompoundDrawablesWithIntrinsicBounds(
|
||||
getContext().getResources().getDrawable(
|
||||
R.drawable.ic_navigation_accept),
|
||||
null, null, null);
|
||||
else if (email.getDeliveryPercentage() > 0)
|
||||
emailStatus.setText(email.getDeliveryPercentage() + "%");
|
||||
else
|
||||
emailStatus.setText(BoteHelper.getEmailStatus(email));
|
||||
emailStatus.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} catch (MessagingException e) {
|
||||
subject.setText("ERROR: " + e.getMessage());
|
||||
|
||||
Reference in New Issue
Block a user