1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 13:12:25 -05:00

update the new message list item to work better in various odd configurations

This commit is contained in:
Jesse Vincent 2013-08-20 17:13:35 -04:00
parent 99e354bc9f
commit 7ba68dbc3c
2 changed files with 120 additions and 95 deletions

View File

@ -1,53 +1,41 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_vertical"
> >
<View <View
android:id="@+id/chip" android:id="@+id/chip"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignBottom="@+id/list_item_inner"
android:adjustViewBounds="false" android:adjustViewBounds="false"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_width="8dip" android:layout_width="8dip"
android:background="#ff336699" android:layout_marginRight="4dp"
/> />
<RelativeLayout
android:id="@+id/list_item_inner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="6dip"
android:paddingRight="4dip"
android:paddingLeft="8dip"
android:paddingTop="5dip">
<LinearLayout <LinearLayout
android:id="@+id/selected_checkbox_wrapper" android:id="@+id/selected_checkbox_wrapper"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:paddingRight="8dp"
android:paddingLeft="8dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:orientation="vertical" android:orientation="vertical"
android:gravity="center" android:layout_gravity="center"
android:visibility="gone" android:visibility="visible"
android:textColor="?android:attr/textColorPrimary"> android:textColor="?android:attr/textColorPrimary"
android:baselineAligned="false"
android:layout_centerVertical="true">
<CheckBox <CheckBox
android:id="@+id/selected_checkbox" android:id="@+id/selected_checkbox"
android:layout_width="16dip" android:layout_width="wrap_content"
android:layout_height="16dip" android:layout_height="match_parent"
android:button="?attr/messageListCheckbox" android:gravity="center"
android:focusable="false" android:focusable="false"
android:clickable="false" android:clickable="false"
android:paddingLeft="4dp"
android:paddingRight="0dp"
android:visibility="visible"
/> />
</LinearLayout> </LinearLayout>
@ -56,25 +44,55 @@
android:id="@+id/contact_badge" android:id="@+id/contact_badge"
android:layout_marginRight="8dip" android:layout_marginRight="8dip"
android:layout_marginTop="4dip" android:layout_marginTop="4dip"
android:layout_marginLeft="8dp"
android:layout_marginBottom="3dip" android:layout_marginBottom="3dip"
android:layout_height="40dip" android:layout_height="40dip"
android:layout_width="40dip" android:layout_width="40dip"
android:layout_alignWithParentIfMissing="true" android:layout_gravity="center_vertical"
android:layout_toRightOf="@id/selected_checkbox_wrapper" android:layout_marginLeft="4dp"
android:src="@drawable/ic_contact_picture" android:src="@drawable/ic_contact_picture"
style="?android:attr/quickContactBadgeStyleWindowLarge" style="?android:attr/quickContactBadgeStyleWindowLarge"
android:background="@android:color/transparent"/> android:background="@android:color/transparent"/>
<LinearLayout
android:id="@+id/subject_wrapper" <RelativeLayout
android:id="@+id/list_item_inner"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toRightOf="@id/contact_badge" android:paddingTop="5dip"
android:layout_toLeftOf="@+id/thread_count" android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:layout_gravity="center_vertical"
android:paddingBottom="6dp">
<TextView
android:id="@+id/preview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/flagged_bottom_right"
android:layout_marginLeft="1dip"
android:layout_marginRight="3dip"
android:bufferType="spannable"
android:layout_below="@+id/subject_wrapper"
android:singleLine="false"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
android:longClickable="false"
android:layout_alignWithParentIfMissing="false"
android:gravity="top"
android:layout_alignParentBottom="false"/>
<LinearLayout
android:id="@+id/subject_wrapper"
android:layout_centerInParent="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="false"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_alignWithParentIfMissing="true" android:layout_alignParentBottom="false"
> android:layout_alignParentLeft="false"
android:layout_toLeftOf="@+id/date">
<TextView <TextView
android:id="@+id/sender_compact" android:id="@+id/sender_compact"
@ -101,65 +119,66 @@
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
/> />
</LinearLayout>
<TextView <TextView
android:id="@+id/preview" android:id="@+id/thread_count"
android:layout_width="match_parent" android:textColor="?attr/messageListThreadCountForegroundColor"
android:background="?attr/messageListThreadCountBackground"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toRightOf="@+id/contact_badge" android:layout_marginLeft="3dip"
android:layout_below="@+id/subject_wrapper" android:layout_marginRight="4dip"
android:layout_toLeftOf="@+id/flagged" android:paddingRight="4dip"
android:layout_marginLeft="1dip" android:paddingBottom="1dip"
android:layout_marginBottom="3dip" android:paddingLeft="4dip"
android:layout_marginRight="3dip" android:focusable="false"
android:bufferType="spannable" />
android:singleLine="false" </LinearLayout>
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"/> <CheckBox
android:id="@+id/flagged_center_right"
style="?android:attr/starStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:paddingTop="3dip"
android:paddingLeft="2dip"
android:paddingRight="4dip"
android:focusable="false"
android:visibility="gone"
/>
<TextView <TextView
android:id="@+id/date" android:id="@+id/date"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignTop="@+id/subject_wrapper" android:layout_alignTop="@+id/subject_wrapper"
android:layout_alignParentRight="true" android:layout_alignWithParentIfMissing="true"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/flagged_center_right"
android:paddingLeft="3dip" android:paddingLeft="3dip"
android:layout_marginRight="2dip" android:paddingRight="8dip"
android:singleLine="true" android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/> android:textColor="?android:attr/textColorSecondary"/>
<CheckBox <CheckBox
android:id="@+id/flagged" android:id="@+id/flagged_bottom_right"
style="?android:attr/starStyle" style="?android:attr/starStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="fill_parent"
android:layout_below="@+id/date" android:layout_below="@+id/date"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:paddingTop="5dip"
android:paddingTop="3dip"
android:paddingLeft="2dip" android:paddingLeft="2dip"
android:paddingRight="4dip" android:paddingRight="4dip"
android:focusable="false" android:focusable="false"
/> android:visibility="visible"
android:gravity="center_vertical"/>
<TextView
android:id="@+id/thread_count"
android:layout_gravity="center|center_vertical"
android:textColor="?attr/messageListThreadCountForegroundColor"
android:background="?attr/messageListThreadCountBackground"
android:layout_toLeftOf="@id/date"
android:layout_alignWithParentIfMissing="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="@+id/subject_wrapper"
android:layout_marginLeft="3dip"
android:layout_marginRight="4dip"
android:paddingRight="4dip"
android:paddingBottom="1dip"
android:paddingLeft="4dip"
android:focusable="false"/>
</RelativeLayout> </RelativeLayout>
</RelativeLayout> </LinearLayout>

View File

@ -1827,10 +1827,17 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
if (mPreviewLines == 0 && mContactsPictureLoader == null) { if (mPreviewLines == 0 && mContactsPictureLoader == null) {
view.findViewById(R.id.preview).setVisibility(View.GONE); view.findViewById(R.id.preview).setVisibility(View.GONE);
holder.preview = (TextView) view.findViewById(R.id.sender_compact); holder.preview = (TextView) view.findViewById(R.id.sender_compact);
holder.flagged = (CheckBox) view.findViewById(R.id.flagged_center_right);
view.findViewById(R.id.flagged_bottom_right).setVisibility(View.GONE);
} else { } else {
view.findViewById(R.id.sender_compact).setVisibility(View.GONE); view.findViewById(R.id.sender_compact).setVisibility(View.GONE);
holder.preview = (TextView) view.findViewById(R.id.preview); holder.preview = (TextView) view.findViewById(R.id.preview);
holder.flagged = (CheckBox) view.findViewById(R.id.flagged_bottom_right);
view.findViewById(R.id.flagged_center_right).setVisibility(View.GONE);
} }
QuickContactBadge contactBadge = QuickContactBadge contactBadge =
@ -1861,7 +1868,6 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
mFontSizes.setViewTextSize(holder.threadCount, mFontSizes.getMessageListSubject()); // thread count is next to subject mFontSizes.setViewTextSize(holder.threadCount, mFontSizes.getMessageListSubject()); // thread count is next to subject
view.findViewById(R.id.selected_checkbox_wrapper).setVisibility((mCheckboxes) ? View.VISIBLE : View.GONE); view.findViewById(R.id.selected_checkbox_wrapper).setVisibility((mCheckboxes) ? View.VISIBLE : View.GONE);
holder.flagged = (CheckBox) view.findViewById(R.id.flagged);
holder.flagged.setVisibility(mStars ? View.VISIBLE : View.GONE); holder.flagged.setVisibility(mStars ? View.VISIBLE : View.GONE);
holder.flagged.setOnClickListener(holder); holder.flagged.setOnClickListener(holder);