1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-08-13 17:03:48 -04:00

Simplify message list item layout.

This commit is contained in:
Danny Baumann 2013-02-05 09:51:04 +01:00
parent f51f675021
commit 7b48df7dce
2 changed files with 28 additions and 38 deletions

View File

@ -1,43 +1,42 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingBottom="6dip" android:paddingBottom="6dip"
android:paddingRight="4dip" android:paddingRight="4dip"
android:paddingTop="5dip" > android:paddingTop="5dip" >
<RelativeLayout <LinearLayout
android:id="@+id/chip_wrapper" android:id="@+id/chip_wrapper"
android:layout_width="48dip" android:layout_width="48dip"
android:layout_height="fill_parent" android:layout_height="match_parent"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_gravity="center|center_vertical" android:layout_gravity="center|center_vertical"
android:textColor="?android:attr/textColorPrimary" > android:textColor="?android:attr/textColorPrimary" >
<View <View
android:id="@+id/chip" android:id="@+id/chip"
android:layout_width="32dip" android:layout_width="32dip"
android:layout_height="32dip" android:layout_height="32dip"
android:layout_gravity="center|center_vertical" android:layout_gravity="center|center_vertical"
android:layout_marginLeft="8dip" android:layout_marginLeft="8dip"
android:layout_marginRight="8dip" android:layout_marginRight="8dip"
android:background="@android:color/transparent" /> android:background="@android:color/transparent" />
<CheckBox <CheckBox
android:id="@+id/selected_checkbox" android:id="@+id/selected_checkbox"
android:layout_width="36dip" android:layout_width="36dip"
android:layout_below="@+id/chip" android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:layout_height="fill_parent"
android:focusable="false" android:focusable="false"
android:gravity="bottom|center" android:gravity="bottom|center"
android:visibility="gone" /> android:visibility="gone" />
</RelativeLayout>
</LinearLayout>
<TextView <TextView
android:id="@+id/subject" android:id="@+id/subject"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_marginBottom="1dip" android:layout_marginBottom="1dip"
@ -51,11 +50,11 @@
<TextView <TextView
android:id="@+id/preview" android:id="@+id/preview"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toRightOf="@+id/chip_wrapper" android:layout_toRightOf="@+id/chip_wrapper"
android:layout_below="@+id/subject" android:layout_below="@+id/subject"
android:layout_toLeftOf="@+id/thread_count_wrapper" android:layout_toLeftOf="@+id/thread_count"
android:layout_marginLeft="1dip" android:layout_marginLeft="1dip"
android:layout_marginBottom="3dip" android:layout_marginBottom="3dip"
android:layout_marginRight="3dip" android:layout_marginRight="3dip"
@ -64,8 +63,6 @@
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary" /> 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"
@ -77,27 +74,22 @@
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" />
<LinearLayout
android:id="@+id/thread_count_wrapper"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/date"
android:layout_alignTop="@+id/preview"
android:layout_alignParentRight="true"
android:layout_marginLeft="4dip"
android:layout_marginRight="2dip"
android:background="?attr/messageListThreadCountBackground"
>
<TextView <TextView
android:id="@+id/thread_count" android:id="@+id/thread_count"
android:layout_gravity="center|center_vertical" android:layout_gravity="center|center_vertical"
android:textColor="?attr/messageListThreadCountForegroundColor" android:textColor="?attr/messageListThreadCountForegroundColor"
android:background="?attr/messageListThreadCountBackground"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignTop="@+id/preview"
android:layout_alignParentRight="true"
android:layout_below="@+id/date"
android:layout_marginLeft="4dip"
android:layout_marginRight="2dip"
android:paddingRight="4dip" android:paddingRight="4dip"
android:paddingBottom="1dip" android:paddingBottom="1dip"
android:paddingLeft="4dip" android:paddingLeft="4dip"
android:focusable="false" /> android:focusable="false" />
</LinearLayout>
</RelativeLayout> </RelativeLayout>

View File

@ -1736,7 +1736,6 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
holder.preview.setLines(Math.max(mPreviewLines,1)); holder.preview.setLines(Math.max(mPreviewLines,1));
holder.preview.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageListPreview()); holder.preview.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageListPreview());
holder.threadCount = (TextView) view.findViewById(R.id.thread_count); holder.threadCount = (TextView) view.findViewById(R.id.thread_count);
holder.threadCountWrapper = view.findViewById(R.id.thread_count_wrapper);
holder.selected = (CheckBox) view.findViewById(R.id.selected_checkbox); holder.selected = (CheckBox) view.findViewById(R.id.selected_checkbox);
if (mCheckboxes) { if (mCheckboxes) {
@ -1843,9 +1842,9 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
// Thread count // Thread count
if (threadCount > 1) { if (threadCount > 1) {
holder.threadCount.setText(Integer.toString(threadCount)); holder.threadCount.setText(Integer.toString(threadCount));
holder.threadCountWrapper.setVisibility(View.VISIBLE); holder.threadCount.setVisibility(View.VISIBLE);
} else { } else {
holder.threadCountWrapper.setVisibility(View.GONE); holder.threadCount.setVisibility(View.GONE);
} }
CharSequence beforePreviewText = (mSenderAboveSubject) ? subject : displayName; CharSequence beforePreviewText = (mSenderAboveSubject) ? subject : displayName;
@ -1933,7 +1932,6 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
public TextView date; public TextView date;
public View chip; public View chip;
public TextView threadCount; public TextView threadCount;
public View threadCountWrapper;
public CheckBox selected; public CheckBox selected;
public int position = -1; public int position = -1;