1
0
mirror of https://github.com/moparisthebest/k-9 synced 2025-01-31 07:10:14 -05:00

Put the color chip with read/unread controlled brightness at all

levels except MessageView
This commit is contained in:
Daniel Applebaum 2010-01-06 05:23:32 +00:00
parent a5166e3c2d
commit 56a4b94748
6 changed files with 61 additions and 28 deletions

View File

@ -7,6 +7,14 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:paddingRight="4dip"> android:paddingRight="4dip">
<View
android:id="@+id/chip"
android:background="@drawable/appointment_indicator_leftside_1"
android:layout_width="4dip"
android:layout_height="fill_parent"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
/>
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -7,14 +7,23 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:paddingLeft="36dip"
android:paddingRight="4dip"> android:paddingRight="4dip">
<View
android:id="@+id/chip"
android:background="@drawable/appointment_indicator_leftside_1"
android:layout_width="4dip"
android:layout_height="fill_parent"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
/>
<LinearLayout <LinearLayout
android:layout_width="0dip" android:layout_width="0dip"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:layout_weight="1" android:layout_weight="1"
android:orientation="vertical" android:orientation="vertical"
android:gravity="center_vertical"> android:gravity="center_vertical"
android:paddingLeft="6dip">
<TextView <TextView
android:id="@+id/folder_name" android:id="@+id/folder_name"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"

View File

@ -383,6 +383,32 @@ public class K9 extends Application
{ "zip", "application/zip"} { "zip", "application/zip"}
}; };
public static final int[] COLOR_CHIP_RES_IDS = new int[]
{
R.drawable.appointment_indicator_leftside_1,
R.drawable.appointment_indicator_leftside_2,
R.drawable.appointment_indicator_leftside_3,
R.drawable.appointment_indicator_leftside_4,
R.drawable.appointment_indicator_leftside_5,
R.drawable.appointment_indicator_leftside_6,
R.drawable.appointment_indicator_leftside_7,
R.drawable.appointment_indicator_leftside_8,
R.drawable.appointment_indicator_leftside_9,
R.drawable.appointment_indicator_leftside_10,
R.drawable.appointment_indicator_leftside_11,
R.drawable.appointment_indicator_leftside_12,
R.drawable.appointment_indicator_leftside_13,
R.drawable.appointment_indicator_leftside_14,
R.drawable.appointment_indicator_leftside_15,
R.drawable.appointment_indicator_leftside_16,
R.drawable.appointment_indicator_leftside_17,
R.drawable.appointment_indicator_leftside_18,
R.drawable.appointment_indicator_leftside_19,
R.drawable.appointment_indicator_leftside_20,
R.drawable.appointment_indicator_leftside_21,
};
public class Intents public class Intents
{ {

View File

@ -670,6 +670,9 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
holder.description = (TextView) view.findViewById(R.id.description); holder.description = (TextView) view.findViewById(R.id.description);
holder.email = (TextView) view.findViewById(R.id.email); holder.email = (TextView) view.findViewById(R.id.email);
holder.newMessageCount = (TextView) view.findViewById(R.id.new_message_count); holder.newMessageCount = (TextView) view.findViewById(R.id.new_message_count);
holder.chip = view.findViewById(R.id.chip);
view.setTag(holder); view.setTag(holder);
} }
holder.description.setText(account.getDescription()); holder.description.setText(account.getDescription());
@ -690,6 +693,9 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
//holder.newMessageCount.setText("-"); //holder.newMessageCount.setText("-");
holder.newMessageCount.setVisibility(View.GONE); holder.newMessageCount.setVisibility(View.GONE);
} }
holder.chip.setBackgroundResource(K9.COLOR_CHIP_RES_IDS[account.getAccountNumber() % K9.COLOR_CHIP_RES_IDS.length]);
holder.chip.getBackground().setAlpha((unreadMessageCount == null || unreadMessageCount == 0) ? 127 : 255);
return view; return view;
} }
@ -699,6 +705,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
public TextView description; public TextView description;
public TextView email; public TextView email;
public TextView newMessageCount; public TextView newMessageCount;
public View chip;
} }
} }
} }

View File

@ -1172,6 +1172,7 @@ public class FolderList extends K9ListActivity
holder.folderName = (TextView) view.findViewById(R.id.folder_name); holder.folderName = (TextView) view.findViewById(R.id.folder_name);
holder.newMessageCount = (TextView) view.findViewById(R.id.folder_unread_message_count); holder.newMessageCount = (TextView) view.findViewById(R.id.folder_unread_message_count);
holder.folderStatus = (TextView) view.findViewById(R.id.folder_status); holder.folderStatus = (TextView) view.findViewById(R.id.folder_status);
holder.chip = view.findViewById(R.id.chip);
holder.rawFolderName = folder.name; holder.rawFolderName = folder.name;
view.setTag(holder); view.setTag(holder);
@ -1229,6 +1230,10 @@ public class FolderList extends K9ListActivity
holder.newMessageCount.setVisibility(View.GONE); holder.newMessageCount.setVisibility(View.GONE);
} }
holder.chip.setBackgroundResource(K9.COLOR_CHIP_RES_IDS[mAccount.getAccountNumber() % K9.COLOR_CHIP_RES_IDS.length]);
holder.chip.getBackground().setAlpha(folder.unreadMessageCount == 0 ? 127 : 255);
return view; return view;
} }
@ -1388,6 +1393,7 @@ public class FolderList extends K9ListActivity
public TextView newMessageCount; public TextView newMessageCount;
public String rawFolderName; public String rawFolderName;
public View chip;
} }
} }

View File

@ -72,30 +72,6 @@ public class MessageList
private static final int WIDGET_FLAG = 2; private static final int WIDGET_FLAG = 2;
private static final int WIDGET_MULTISELECT = 3; private static final int WIDGET_MULTISELECT = 3;
private static final int[] colorChipResIds = new int[]
{
R.drawable.appointment_indicator_leftside_1,
R.drawable.appointment_indicator_leftside_2,
R.drawable.appointment_indicator_leftside_3,
R.drawable.appointment_indicator_leftside_4,
R.drawable.appointment_indicator_leftside_5,
R.drawable.appointment_indicator_leftside_6,
R.drawable.appointment_indicator_leftside_7,
R.drawable.appointment_indicator_leftside_8,
R.drawable.appointment_indicator_leftside_9,
R.drawable.appointment_indicator_leftside_10,
R.drawable.appointment_indicator_leftside_11,
R.drawable.appointment_indicator_leftside_12,
R.drawable.appointment_indicator_leftside_13,
R.drawable.appointment_indicator_leftside_14,
R.drawable.appointment_indicator_leftside_15,
R.drawable.appointment_indicator_leftside_16,
R.drawable.appointment_indicator_leftside_17,
R.drawable.appointment_indicator_leftside_18,
R.drawable.appointment_indicator_leftside_19,
R.drawable.appointment_indicator_leftside_20,
R.drawable.appointment_indicator_leftside_21,
};
private ListView mListView; private ListView mListView;
private int mSelectedWidget = WIDGET_FLAG; private int mSelectedWidget = WIDGET_FLAG;
@ -1990,7 +1966,6 @@ public class MessageList
holder.chip.setBackgroundResource(colorChipResIds[message.account.getAccountNumber() % colorChipResIds.length]);
holder.selected = (CheckBox) view.findViewById(R.id.selected_checkbox); holder.selected = (CheckBox) view.findViewById(R.id.selected_checkbox);
if (holder.selected!=null) if (holder.selected!=null)
{ {
@ -2002,6 +1977,7 @@ public class MessageList
if (message != null) if (message != null)
{ {
holder.subject.setTypeface(null, message.read ? Typeface.NORMAL : Typeface.BOLD); holder.subject.setTypeface(null, message.read ? Typeface.NORMAL : Typeface.BOLD);
setVisibleWidgetsForListItem(view, mSelectedWidget); setVisibleWidgetsForListItem(view, mSelectedWidget);
@ -2015,6 +1991,7 @@ public class MessageList
holder.position = -1; holder.position = -1;
holder.selected.setChecked(message.selected); holder.selected.setChecked(message.selected);
holder.chip.setBackgroundResource(K9.COLOR_CHIP_RES_IDS[message.account.getAccountNumber() % K9.COLOR_CHIP_RES_IDS.length]);
holder.chip.getBackground().setAlpha(message.read ? 127 : 255); holder.chip.getBackground().setAlpha(message.read ? 127 : 255);
if (message.downloaded) if (message.downloaded)