1
0
mirror of https://github.com/moparisthebest/k-9 synced 2025-02-25 07:01:50 -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
android:id="@+id/chip"
android:layout_width="32dip"
android:layout_height="32dip"
android:layout_marginLeft="8dip"
android:layout_marginRight="6dip" />
android:layout_height="match_parent"
android:layout_width="8dip"
android:background="#ff336699"
android:layout_marginRight="8dip"
/>
<LinearLayout
android:layout_width="wrap_content"
@ -22,7 +24,7 @@
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center_vertical"
android:paddingLeft="1dip" >
android:paddingLeft="1dip">
<TextView
android:id="@+id/description"
@ -31,7 +33,7 @@
android:singleLine="true"
android:ellipsize="end"
android:textColor="?android:attr/textColorPrimary"
android:textAppearance="?android:attr/textAppearanceMedium" />
android:textAppearance="?android:attr/textAppearanceMedium"/>
<TextView
android:id="@+id/email"
@ -40,11 +42,12 @@
android:singleLine="true"
android:ellipsize="end"
android:textColor="?android:attr/textColorSecondary"
android:textAppearance="?android:attr/textAppearanceSmall" />
android:textAppearance="?android:attr/textAppearanceSmall"/>
</LinearLayout>
<include layout="@layout/accounts_folders_icons" />
<include layout="@layout/accounts_folders_icons"/>
<LinearLayout
android:id="@+id/folder_button_wrapper"
android:layout_width="wrap_content"
@ -59,6 +62,7 @@
android:layout_marginRight="4dip"
android:background="?attr/compatDividerVertical"
android:layout_alignParentTop="true"/>
<ImageButton
android:id="@+id/folders"
android:gravity="center_vertical"
@ -73,5 +77,5 @@
android:paddingRight="16dp"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@ -8,18 +8,16 @@
android:paddingRight="4dip"
android:paddingBottom="2dip"
android:orientation="horizontal"
android:gravity="center_vertical" >
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" />
android:layout_height="match_parent"
android:layout_width="8dip"
android:background="#ff336699"
android:layout_marginRight="8dip"
/>
<LinearLayout
android:layout_width="fill_parent"
@ -27,14 +25,14 @@
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center_vertical"
android:paddingLeft="6dip" >
android:paddingLeft="6dip">
<TextView
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" />
android:textAppearance="?android:attr/textAppearanceLarge"/>
<TextView
android:id="@+id/folder_status"
@ -43,9 +41,9 @@
android:singleLine="true"
android:ellipsize="end"
android:textColor="?android:attr/textColorTertiary"
android:textAppearance="?android:attr/textAppearanceSmall" />
android:textAppearance="?android:attr/textAppearanceSmall"/>
</LinearLayout>
<include layout="@layout/accounts_folders_icons" />
<include layout="@layout/accounts_folders_icons"/>
</LinearLayout>

View File

@ -2,25 +2,41 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
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:paddingRight="4dip"
android:paddingTop="5dip" >
android:paddingLeft="8dip"
android:paddingTop="5dip">
<LinearLayout
android:id="@+id/chip_wrapper"
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:textColor="?android:attr/textColorPrimary" >
<View
android:id="@+id/chip"
android:layout_width="32dip"
android:layout_height="32dip"
android:background="@android:color/transparent" />
android:visibility="gone"
android:textColor="?android:attr/textColorPrimary">
<CheckBox
android:id="@+id/selected_checkbox"
@ -29,7 +45,7 @@
android:button="?attr/messageListCheckbox"
android:focusable="false"
android:clickable="false"
android:visibility="gone" />
android:visibility="gone"/>
</LinearLayout>
@ -37,13 +53,15 @@
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/chip_wrapper"
android:layout_toRightOf="@id/checkbox_wrapper"
android:src="@drawable/ic_contact_picture"
style="?android:attr/quickContactBadgeStyleWindowLarge"
android:background="@android:color/transparent" />
android:background="@android:color/transparent"/>
<LinearLayout
android:id="@+id/subject_wrapper"
android:layout_width="match_parent"
@ -52,6 +70,7 @@
android:layout_toLeftOf="@+id/date"
android:layout_alignParentTop="true"
>
<TextView
android:id="@+id/sender_compact"
android:layout_height="wrap_content"
@ -63,13 +82,13 @@
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"
@ -78,6 +97,7 @@
android:textColor="?android:attr/textColorPrimary"
/>
</LinearLayout>
<TextView
android:id="@+id/preview"
android:layout_width="match_parent"
@ -91,19 +111,19 @@
android:bufferType="spannable"
android:singleLine="false"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary" />
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_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" />
android:textColor="?android:attr/textColorSecondary"/>
<TextView
android:id="@+id/thread_count"
@ -120,6 +140,8 @@
android:paddingRight="4dip"
android:paddingBottom="1dip"
android:paddingLeft="4dip"
android:focusable="false" />
android:focusable="false"/>
</RelativeLayout>
</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);