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

@ -11,10 +11,12 @@
<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"
@ -45,6 +47,7 @@
</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"
@ -59,6 +62,7 @@
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 <ImageButton
android:id="@+id/folders" android:id="@+id/folders"
android:gravity="center_vertical" android:gravity="center_vertical"

View File

@ -12,14 +12,12 @@
<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_marginTop="2dip" android:background="#ff336699"
android:layout_marginBottom="1dip" android:layout_marginRight="8dip"
android:layout_marginLeft="8dip" />
android:layout_marginRight="6dip"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true" />
<LinearLayout <LinearLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"

View File

@ -2,26 +2,42 @@
<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"
>
<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"
/>
<RelativeLayout
android:id="@+id/list_item_inner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="6dip" android:paddingBottom="6dip"
android:paddingRight="4dip" android:paddingRight="4dip"
android:paddingLeft="8dip"
android:paddingTop="5dip"> android:paddingTop="5dip">
<LinearLayout <LinearLayout
android:id="@+id/chip_wrapper" android:id="@+id/checkbox_wrapper"
android:layout_width="42dip" android:layout_width="42dip"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:orientation="vertical" android:orientation="vertical"
android:gravity="center" android:gravity="center"
android:visibility="gone"
android:textColor="?android:attr/textColorPrimary"> android:textColor="?android:attr/textColorPrimary">
<View
android:id="@+id/chip"
android:layout_width="32dip"
android:layout_height="32dip"
android:background="@android:color/transparent" />
<CheckBox <CheckBox
android:id="@+id/selected_checkbox" android:id="@+id/selected_checkbox"
android:layout_width="16dip" android:layout_width="16dip"
@ -37,13 +53,15 @@
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_toRightOf="@id/chip_wrapper" android:layout_toRightOf="@id/checkbox_wrapper"
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 <LinearLayout
android:id="@+id/subject_wrapper" android:id="@+id/subject_wrapper"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -52,6 +70,7 @@
android:layout_toLeftOf="@+id/date" android:layout_toLeftOf="@+id/date"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
> >
<TextView <TextView
android:id="@+id/sender_compact" android:id="@+id/sender_compact"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -63,13 +82,13 @@
android:layout_marginLeft="1dip" android:layout_marginLeft="1dip"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
android:layout_alignParentTop="true"/> />
<TextView <TextView
android:id="@+id/subject" android:id="@+id/subject"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="0.7" android:layout_weight="0.7"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginBottom="1dip" android:layout_marginBottom="1dip"
android:layout_marginLeft="1dip" android:layout_marginLeft="1dip"
android:ellipsize="marquee" android:ellipsize="marquee"
@ -78,6 +97,7 @@
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
/> />
</LinearLayout> </LinearLayout>
<TextView <TextView
android:id="@+id/preview" android:id="@+id/preview"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -97,7 +117,7 @@
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" android:layout_alignTop="@+id/subject_wrapper"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:paddingLeft="3dip" android:paddingLeft="3dip"
android:layout_marginRight="2dip" android:layout_marginRight="2dip"
@ -121,5 +141,7 @@
android:paddingBottom="1dip" android:paddingBottom="1dip"
android:paddingLeft="4dip" android:paddingLeft="4dip"
android:focusable="false"/> android:focusable="false"/>
</RelativeLayout>
</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);