1
0
mirror of https://github.com/moparisthebest/k-9 synced 2025-02-25 15:11:52 -05:00

Return to old style chips for accounts, folders and messages.

My circle design stopped being even a little bit useful when we stopped showing
the "complex" versions of the shapes
This commit is contained in:
Jesse Vincent 2013-08-16 02:17:26 -04:00
parent 9a385146c4
commit ee234b65f8
8 changed files with 251 additions and 242 deletions

View File

@ -1,77 +1,81 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <LinearLayout
android:id="@+id/accounts_item_layout" android:id="@+id/accounts_item_layout"
xmlns:android="http://schemas.android.com/apk/res/android" 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:minHeight="?android:attr/listPreferredItemHeight" android:minHeight="?android:attr/listPreferredItemHeight"
android:orientation="horizontal" android:orientation="horizontal"
android:descendantFocusability="blocksDescendants" android:descendantFocusability="blocksDescendants"
android:gravity="center_vertical"> android:gravity="center_vertical">
<View <View
android:id="@+id/chip" android:id="@+id/chip"
android:layout_width="32dip" android:layout_height="match_parent"
android:layout_height="32dip" android:layout_width="8dip"
android:layout_marginLeft="8dip" android:background="#ff336699"
android:layout_marginRight="6dip" /> android:layout_marginRight="8dip"
/>
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:orientation="vertical" android:orientation="vertical"
android:gravity="center_vertical" android:gravity="center_vertical"
android:paddingLeft="1dip" > android:paddingLeft="1dip">
<TextView <TextView
android:id="@+id/description" android:id="@+id/description"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
android:ellipsize="end" android:ellipsize="end"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
android:textAppearance="?android:attr/textAppearanceMedium" /> android:textAppearance="?android:attr/textAppearanceMedium"/>
<TextView <TextView
android:id="@+id/email" android:id="@+id/email"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
android:ellipsize="end" android:ellipsize="end"
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
android:textAppearance="?android:attr/textAppearanceSmall" /> android:textAppearance="?android:attr/textAppearanceSmall"/>
</LinearLayout> </LinearLayout>
<include layout="@layout/accounts_folders_icons" /> <include layout="@layout/accounts_folders_icons"/>
<LinearLayout <LinearLayout
android:id="@+id/folder_button_wrapper" android:id="@+id/folder_button_wrapper"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
> >
<View <View
android:layout_width="1dp" android:layout_width="1dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="2dip" android:layout_marginLeft="2dip"
android:layout_marginRight="4dip" android:layout_marginRight="4dip"
android:background="?attr/compatDividerVertical" android:background="?attr/compatDividerVertical"
android:layout_alignParentTop="true"/> android:layout_alignParentTop="true"/>
<ImageButton
android:id="@+id/folders"
android:gravity="center_vertical"
android:focusable="false"
android:layout_marginRight="3dip"
android:src="?attr/iconFolder"
android:background="?attr/compatSelectableItemBackground"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:padding="8dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
/>
</LinearLayout> <ImageButton
android:id="@+id/folders"
android:gravity="center_vertical"
android:focusable="false"
android:layout_marginRight="3dip"
android:src="?attr/iconFolder"
android:background="?attr/compatSelectableItemBackground"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:padding="8dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
/>
</LinearLayout>
</LinearLayout> </LinearLayout>

View File

@ -1,51 +1,49 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <LinearLayout
android:id="@+id/folder_list_item_layout" android:id="@+id/folder_list_item_layout"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:paddingRight="4dip"
android:paddingBottom="2dip"
android:orientation="horizontal"
android:gravity="center_vertical" >
<View
android:id="@+id/chip"
android:layout_width="32dip"
android:layout_height="32dip"
android:layout_marginTop="2dip"
android:layout_marginBottom="1dip"
android:layout_marginLeft="8dip"
android:layout_marginRight="6dip"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true" />
<LinearLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:minHeight="?android:attr/listPreferredItemHeight"
android:orientation="vertical" android:paddingRight="4dip"
android:gravity="center_vertical" android:paddingBottom="2dip"
android:paddingLeft="6dip" > android:orientation="horizontal"
android:gravity="center_vertical">
<TextView <View
android:id="@+id/folder_name" android:id="@+id/chip"
android:layout_height="match_parent"
android:layout_width="8dip"
android:background="#ff336699"
android:layout_marginRight="8dip"
/>
<LinearLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="?android:attr/textColorPrimary" android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceLarge" /> android:orientation="vertical"
android:gravity="center_vertical"
android:paddingLeft="6dip">
<TextView <TextView
android:id="@+id/folder_status" android:id="@+id/folder_name"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:textColor="?android:attr/textColorPrimary"
android:ellipsize="end" android:textAppearance="?android:attr/textAppearanceLarge"/>
android:textColor="?android:attr/textColorTertiary"
android:textAppearance="?android:attr/textAppearanceSmall" /> <TextView
android:id="@+id/folder_status"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="end"
android:textColor="?android:attr/textColorTertiary"
android:textAppearance="?android:attr/textAppearanceSmall"/>
</LinearLayout> </LinearLayout>
<include layout="@layout/accounts_folders_icons" /> <include layout="@layout/accounts_folders_icons"/>
</LinearLayout> </LinearLayout>

View File

@ -1,125 +1,147 @@
<?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="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingBottom="6dip"
android:paddingRight="4dip"
android:paddingTop="5dip" >
<LinearLayout
android:id="@+id/chip_wrapper"
android:layout_width="42dip"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:orientation="vertical"
android:gravity="center"
android:textColor="?android:attr/textColorPrimary" >
<View
android:id="@+id/chip"
android:layout_width="32dip"
android:layout_height="32dip"
android:background="@android:color/transparent" />
<CheckBox
android:id="@+id/selected_checkbox"
android:layout_width="16dip"
android:layout_height="16dip"
android:button="?attr/messageListCheckbox"
android:focusable="false"
android:clickable="false"
android:visibility="gone" />
</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_toRightOf="@id/chip_wrapper"
android:src="@drawable/ic_contact_picture"
style="?android:attr/quickContactBadgeStyleWindowLarge"
android:background="@android:color/transparent" />
<LinearLayout
android:id="@+id/subject_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/contact_badge"
android:layout_toLeftOf="@+id/date"
android:layout_alignParentTop="true"
> >
<TextView
android:id="@+id/sender_compact" <View
android:layout_height="wrap_content" android:id="@+id/chip"
android:layout_width="0dp" android:layout_alignParentLeft="true"
android:layout_weight="0.3" android:layout_alignParentTop="true"
android:ellipsize="end" android:layout_alignBottom="@+id/list_item_inner"
android:singleLine="true" android:adjustViewBounds="false"
android:layout_marginBottom="1dip" android:layout_height="match_parent"
android:layout_marginLeft="1dip" android:layout_width="8dip"
android:textAppearance="?android:attr/textAppearanceSmall" android:background="#ff336699"
android:textColor="?android:attr/textColorPrimary"
android:layout_alignParentTop="true"/>
<TextView
android:id="@+id/subject"
android:layout_width="0dp"
android:layout_weight="0.7"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginBottom="1dip"
android:layout_marginLeft="1dip"
android:ellipsize="marquee"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
/> />
</LinearLayout>
<TextView
android:id="@+id/preview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/contact_badge"
android:layout_below="@+id/subject_wrapper"
android:layout_toLeftOf="@+id/thread_count"
android:layout_marginLeft="1dip"
android:layout_marginBottom="3dip"
android:layout_marginRight="3dip"
android:bufferType="spannable"
android:singleLine="false"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary" />
<TextView <RelativeLayout
android:id="@+id/date" android:id="@+id/list_item_inner"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignTop="@+id/subject"
android:layout_alignParentRight="true" android:paddingBottom="6dip"
android:paddingLeft="3dip" android:paddingRight="4dip"
android:layout_marginRight="2dip" android:paddingLeft="8dip"
android:singleLine="true" android:paddingTop="5dip">
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary" /> <LinearLayout
android:id="@+id/checkbox_wrapper"
android:layout_width="42dip"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:orientation="vertical"
android:gravity="center"
android:visibility="gone"
android:textColor="?android:attr/textColorPrimary">
<CheckBox
android:id="@+id/selected_checkbox"
android:layout_width="16dip"
android:layout_height="16dip"
android:button="?attr/messageListCheckbox"
android:focusable="false"
android:clickable="false"
android:visibility="gone"/>
</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_toRightOf="@id/checkbox_wrapper"
android:src="@drawable/ic_contact_picture"
style="?android:attr/quickContactBadgeStyleWindowLarge"
android:background="@android:color/transparent"/>
<LinearLayout
android:id="@+id/subject_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/contact_badge"
android:layout_toLeftOf="@+id/date"
android:layout_alignParentTop="true"
>
<TextView
android:id="@+id/sender_compact"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="0.3"
android:ellipsize="end"
android:singleLine="true"
android:layout_marginBottom="1dip"
android:layout_marginLeft="1dip"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
/>
<TextView
android:id="@+id/subject"
android:layout_width="0dp"
android:layout_weight="0.7"
android:layout_height="wrap_content"
android:layout_marginBottom="1dip"
android:layout_marginLeft="1dip"
android:ellipsize="marquee"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
/>
</LinearLayout>
<TextView
android:id="@+id/preview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/contact_badge"
android:layout_below="@+id/subject_wrapper"
android:layout_toLeftOf="@+id/thread_count"
android:layout_marginLeft="1dip"
android:layout_marginBottom="3dip"
android:layout_marginRight="3dip"
android:bufferType="spannable"
android:singleLine="false"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"/>
<TextView
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/subject_wrapper"
android:layout_alignParentRight="true"
android:paddingLeft="3dip"
android:layout_marginRight="2dip"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
<TextView
android:id="@+id/thread_count"
android:layout_gravity="center|center_vertical"
android:textColor="?attr/messageListThreadCountForegroundColor"
android:background="?attr/messageListThreadCountBackground"
android:layout_width="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:paddingBottom="1dip"
android:paddingLeft="4dip"
android:focusable="false"/>
</RelativeLayout>
<TextView
android:id="@+id/thread_count"
android:layout_gravity="center|center_vertical"
android:textColor="?attr/messageListThreadCountForegroundColor"
android:background="?attr/messageListThreadCountBackground"
android:layout_width="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:paddingBottom="1dip"
android:paddingLeft="4dip"
android:focusable="false" />
</RelativeLayout> </RelativeLayout>

View File

@ -18,7 +18,7 @@
<!-- Color chip --> <!-- Color chip -->
<View <View
android:id="@+id/chip" android:id="@+id/chip"
android:layout_width="6dip" android:layout_width="8dip"
android:layout_height="match_parent"/> android:layout_height="match_parent"/>
<LinearLayout <LinearLayout

View File

@ -1769,20 +1769,13 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
if (account instanceof Account) { if (account instanceof Account) {
Account realAccount = (Account)account; Account realAccount = (Account)account;
holder.chip.setBackgroundDrawable(realAccount.generateColorChip().drawable()); holder.chip.setBackgroundColor(realAccount.getChipColor());
if (unreadMessageCount == null) {
holder.chip.setBackgroundDrawable(realAccount.generateColorChip().drawable());
} else if (unreadMessageCount == 0) {
holder.chip.setBackgroundDrawable(realAccount.generateColorChip(true, false, false, false, false).drawable());
} else {
holder.chip.setBackgroundDrawable(realAccount.generateColorChip(false, false, false, false, false).drawable());
}
holder.flaggedMessageCountIcon.setBackgroundDrawable( realAccount.generateColorChip(false, false, false, false,true).drawable() ); holder.flaggedMessageCountIcon.setBackgroundDrawable( realAccount.generateColorChip(false, false, false, false,true).drawable() );
holder.newMessageCountIcon.setBackgroundDrawable( realAccount.generateColorChip(false, false, false, false, false).drawable() ); holder.newMessageCountIcon.setBackgroundDrawable( realAccount.generateColorChip(false, false, false, false, false).drawable() );
} else { } else {
holder.chip.setBackgroundDrawable(new ColorChip(0xff999999, false, ColorChip.CIRCULAR).drawable()); holder.chip.setBackgroundColor(0xff999999);
holder.newMessageCountIcon.setBackgroundDrawable( new ColorChip(0xff999999, false, ColorChip.CIRCULAR).drawable() ); holder.newMessageCountIcon.setBackgroundDrawable( new ColorChip(0xff999999, false, ColorChip.CIRCULAR).drawable() );
holder.flaggedMessageCountIcon.setBackgroundDrawable(new ColorChip(0xff999999, false, ColorChip.STAR).drawable()); holder.flaggedMessageCountIcon.setBackgroundDrawable(new ColorChip(0xff999999, false, ColorChip.STAR).drawable());
} }

View File

@ -1060,8 +1060,8 @@ public class FolderList extends K9ListActivity {
} }
}); });
holder.chip.setBackgroundDrawable(mAccount.generateColorChip( holder.chip.setBackgroundColor(mAccount.getChipColor());
folder.unreadMessageCount == 0, false, false, false,false).drawable());
mFontSizes.setViewTextSize(holder.folderName, mFontSizes.getFolderName()); mFontSizes.setViewTextSize(holder.folderName, mFontSizes.getFolderName());

View File

@ -1809,12 +1809,11 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
MessageViewHolder holder = new MessageViewHolder(); MessageViewHolder holder = new MessageViewHolder();
holder.date = (TextView) view.findViewById(R.id.date); holder.date = (TextView) view.findViewById(R.id.date);
holder.chip = view.findViewById(R.id.chip); holder.chip = view.findViewById(R.id.chip);
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);
ViewGroup.LayoutParams params = holder.chip.getLayoutParams();
params.height=(int) (16.0f * mScreenDensity);
params.width=(int) (16.0f * mScreenDensity);
} else { } else {
view.findViewById(R.id.sender_compact).setVisibility(View.GONE); view.findViewById(R.id.sender_compact).setVisibility(View.GONE);
@ -1850,7 +1849,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
holder.selected = (CheckBox) view.findViewById(R.id.selected_checkbox); holder.selected = (CheckBox) view.findViewById(R.id.selected_checkbox);
holder.selected.setVisibility((mCheckboxes) ? View.VISIBLE : View.GONE); holder.selected.setVisibility((mCheckboxes) ? View.VISIBLE : View.GONE);
view.findViewById(R.id.chip_wrapper).setOnClickListener(holder); view.findViewById(R.id.checkbox_wrapper).setOnClickListener(holder);
view.setTag(holder); view.setTag(holder);
@ -1910,12 +1909,8 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
long uniqueId = cursor.getLong(mUniqueIdColumn); long uniqueId = cursor.getLong(mUniqueIdColumn);
boolean selected = mSelected.contains(uniqueId); boolean selected = mSelected.contains(uniqueId);
if (!mCheckboxes && selected) {
holder.chip.setBackgroundDrawable(account.getCheckmarkChip().drawable()); holder.chip.setBackgroundColor(account.getChipColor());
} else {
holder.chip.setBackgroundDrawable(account.generateColorChip(read, toMe, ccMe,
fromMe, flagged).drawable());
}
if (mCheckboxes) { if (mCheckboxes) {
holder.selected.setChecked(selected); holder.selected.setChecked(selected);

View File

@ -292,10 +292,7 @@ public class MessageHeader extends ScrollView implements OnClickListener {
mForwardedIcon.setVisibility(message.isSet(Flag.FORWARDED) ? View.VISIBLE : View.GONE); mForwardedIcon.setVisibility(message.isSet(Flag.FORWARDED) ? View.VISIBLE : View.GONE);
mFlagged.setChecked(message.isSet(Flag.FLAGGED)); mFlagged.setChecked(message.isSet(Flag.FLAGGED));
int chipColor = mAccount.getChipColor(); mChip.setBackgroundColor(mAccount.getChipColor());
int chipColorAlpha = (!message.isSet(Flag.SEEN)) ? 255 : 127;
mChip.setBackgroundColor(chipColor);
mChip.getBackground().setAlpha(chipColorAlpha);
setVisibility(View.VISIBLE); setVisibility(View.VISIBLE);