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,80 +1,98 @@
<?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"
/> />
<LinearLayout
android:id="@+id/selected_checkbox_wrapper"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_gravity="center"
android:visibility="visible"
android:textColor="?android:attr/textColorPrimary"
android:baselineAligned="false"
android:layout_centerVertical="true">
<CheckBox
android:id="@+id/selected_checkbox"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:focusable="false"
android:clickable="false"
android:paddingLeft="4dp"
android:paddingRight="0dp"
android:visibility="visible"
/>
</LinearLayout>
<QuickContactBadge
android:id="@+id/contact_badge"
android:layout_marginRight="8dip"
android:layout_marginTop="4dip"
android:layout_marginBottom="3dip"
android:layout_height="40dip"
android:layout_width="40dip"
android:layout_gravity="center_vertical"
android:layout_marginLeft="4dp"
android:src="@drawable/ic_contact_picture"
style="?android:attr/quickContactBadgeStyleWindowLarge"
android:background="@android:color/transparent"/>
<RelativeLayout <RelativeLayout
android:id="@+id/list_item_inner" 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:paddingTop="5dip"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:layout_gravity="center_vertical"
android:paddingBottom="6dp">
android:paddingBottom="6dip" <TextView
android:paddingRight="4dip" android:id="@+id/preview"
android:paddingLeft="8dip" android:layout_width="match_parent"
android:paddingTop="5dip"> android:layout_height="wrap_content"
<LinearLayout
android:id="@+id/selected_checkbox_wrapper"
android:layout_width="wrap_content"
android:paddingRight="8dp"
android:paddingLeft="8dp"
android:layout_height="match_parent"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_centerVertical="true" android:layout_toLeftOf="@+id/flagged_bottom_right"
android:orientation="vertical" android:layout_marginLeft="1dip"
android:gravity="center" android:layout_marginRight="3dip"
android:visibility="gone" android:bufferType="spannable"
android:textColor="?android:attr/textColorPrimary"> android:layout_below="@+id/subject_wrapper"
android:singleLine="false"
<CheckBox android:textAppearance="?android:attr/textAppearanceSmall"
android:id="@+id/selected_checkbox" android:textColor="?android:attr/textColorPrimary"
android:layout_width="16dip" android:longClickable="false"
android:layout_height="16dip" android:layout_alignWithParentIfMissing="false"
android:button="?attr/messageListCheckbox" android:gravity="top"
android:focusable="false" android:layout_alignParentBottom="false"/>
android:clickable="false"
/>
</LinearLayout>
<QuickContactBadge
android:id="@+id/contact_badge"
android:layout_marginRight="8dip"
android:layout_marginTop="4dip"
android:layout_marginLeft="8dp"
android:layout_marginBottom="3dip"
android:layout_height="40dip"
android:layout_width="40dip"
android:layout_alignWithParentIfMissing="true"
android:layout_toRightOf="@id/selected_checkbox_wrapper"
android:src="@drawable/ic_contact_picture"
style="?android:attr/quickContactBadgeStyleWindowLarge"
android:background="@android:color/transparent"/>
<LinearLayout <LinearLayout
android:id="@+id/subject_wrapper" android:id="@+id/subject_wrapper"
android:layout_centerInParent="true"
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:layout_alignParentRight="false"
android:layout_toLeftOf="@+id/thread_count"
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"
/> />
<TextView
android:id="@+id/thread_count"
android:textColor="?attr/messageListThreadCountForegroundColor"
android:background="?attr/messageListThreadCountBackground"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dip"
android:layout_marginRight="4dip"
android:paddingRight="4dip"
android:paddingBottom="1dip"
android:paddingLeft="4dip"
android:focusable="false"
/>
</LinearLayout> </LinearLayout>
<TextView <CheckBox
android:id="@+id/preview" android:id="@+id/flagged_center_right"
android:layout_width="match_parent" style="?android:attr/starStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toRightOf="@+id/contact_badge" android:layout_alignParentRight="true"
android:layout_below="@+id/subject_wrapper" android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/flagged" android:paddingTop="3dip"
android:layout_marginLeft="1dip" android:paddingLeft="2dip"
android:layout_marginBottom="3dip" android:paddingRight="4dip"
android:layout_marginRight="3dip" android:focusable="false"
android:bufferType="spannable" android:visibility="gone"
android:singleLine="false" />
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"/>
<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
android:id="@+id/flagged" <CheckBox
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);