1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -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"?>
<LinearLayout
android:id="@+id/accounts_item_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:orientation="horizontal"
android:descendantFocusability="blocksDescendants"
android:gravity="center_vertical">
android:id="@+id/accounts_item_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:orientation="horizontal"
android:descendantFocusability="blocksDescendants"
android:gravity="center_vertical">
<View
android:id="@+id/chip"
android:layout_width="32dip"
android:layout_height="32dip"
android:layout_marginLeft="8dip"
android:layout_marginRight="6dip" />
android:id="@+id/chip"
android:layout_height="match_parent"
android:layout_width="8dip"
android:background="#ff336699"
android:layout_marginRight="8dip"
/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center_vertical"
android:paddingLeft="1dip" >
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center_vertical"
android:paddingLeft="1dip">
<TextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="end"
android:textColor="?android:attr/textColorPrimary"
android:textAppearance="?android:attr/textAppearanceMedium" />
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="end"
android:textColor="?android:attr/textColorPrimary"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<TextView
android:id="@+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="end"
android:textColor="?android:attr/textColorSecondary"
android:textAppearance="?android:attr/textAppearanceSmall" />
android:id="@+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="end"
android:textColor="?android:attr/textColorSecondary"
android:textAppearance="?android:attr/textAppearanceSmall"/>
</LinearLayout>
<include layout="@layout/accounts_folders_icons" />
<LinearLayout
android:id="@+id/folder_button_wrapper"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginLeft="2dip"
android:layout_marginRight="4dip"
android:background="?attr/compatDividerVertical"
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"
/>
<include layout="@layout/accounts_folders_icons"/>
</LinearLayout>
<LinearLayout
android:id="@+id/folder_button_wrapper"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginLeft="2dip"
android:layout_marginRight="4dip"
android:background="?attr/compatDividerVertical"
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>
</LinearLayout>

View File

@ -1,51 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:id="@+id/folder_list_item_layout"
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:id="@+id/folder_list_item_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center_vertical"
android:paddingLeft="6dip" >
android:minHeight="?android:attr/listPreferredItemHeight"
android:paddingRight="4dip"
android:paddingBottom="2dip"
android:orientation="horizontal"
android:gravity="center_vertical">
<TextView
android:id="@+id/folder_name"
<View
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_height="wrap_content"
android:textColor="?android:attr/textColorPrimary"
android:textAppearance="?android:attr/textAppearanceLarge" />
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center_vertical"
android:paddingLeft="6dip">
<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" />
android:id="@+id/folder_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="?android:attr/textColorPrimary"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<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>
<include layout="@layout/accounts_folders_icons" />
<include layout="@layout/accounts_folders_icons"/>
</LinearLayout>

View File

@ -1,125 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="6dip"
android:paddingRight="4dip"
android:paddingTop="5dip" >
android:layout_width="match_parent"
android:layout_height="wrap_content"
<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"
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"
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"
<View
android:id="@+id/chip"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignBottom="@+id/list_item_inner"
android:adjustViewBounds="false"
android:layout_height="match_parent"
android:layout_width="8dip"
android:background="#ff336699"
/>
</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"
android:layout_alignParentRight="true"
android:paddingLeft="3dip"
android:layout_marginRight="2dip"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary" />
<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
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>

View File

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

View File

@ -1769,20 +1769,13 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
if (account instanceof Account) {
Account realAccount = (Account)account;
holder.chip.setBackgroundDrawable(realAccount.generateColorChip().drawable());
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.chip.setBackgroundColor(realAccount.getChipColor());
holder.flaggedMessageCountIcon.setBackgroundDrawable( realAccount.generateColorChip(false, false, false, false,true).drawable() );
holder.newMessageCountIcon.setBackgroundDrawable( realAccount.generateColorChip(false, false, false, false, false).drawable() );
} 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.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(
folder.unreadMessageCount == 0, false, false, false,false).drawable());
holder.chip.setBackgroundColor(mAccount.getChipColor());
mFontSizes.setViewTextSize(holder.folderName, mFontSizes.getFolderName());

View File

@ -1809,12 +1809,11 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
MessageViewHolder holder = new MessageViewHolder();
holder.date = (TextView) view.findViewById(R.id.date);
holder.chip = view.findViewById(R.id.chip);
if (mPreviewLines == 0 && mContactsPictureLoader == null) {
view.findViewById(R.id.preview).setVisibility(View.GONE);
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 {
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.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);
@ -1910,12 +1909,8 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
long uniqueId = cursor.getLong(mUniqueIdColumn);
boolean selected = mSelected.contains(uniqueId);
if (!mCheckboxes && selected) {
holder.chip.setBackgroundDrawable(account.getCheckmarkChip().drawable());
} else {
holder.chip.setBackgroundDrawable(account.generateColorChip(read, toMe, ccMe,
fromMe, flagged).drawable());
}
holder.chip.setBackgroundColor(account.getChipColor());
if (mCheckboxes) {
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);
mFlagged.setChecked(message.isSet(Flag.FLAGGED));
int chipColor = mAccount.getChipColor();
int chipColorAlpha = (!message.isSet(Flag.SEEN)) ? 255 : 127;
mChip.setBackgroundColor(chipColor);
mChip.getBackground().setAlpha(chipColorAlpha);
mChip.setBackgroundColor(mAccount.getChipColor());
setVisibility(View.VISIBLE);