mirror of
https://github.com/moparisthebest/k-9
synced 2025-01-30 23:00:09 -05:00
Put the color chip with read/unread controlled brightness at all
levels except MessageView
This commit is contained in:
parent
a5166e3c2d
commit
56a4b94748
@ -7,6 +7,14 @@
|
||||
android:gravity="center_vertical"
|
||||
|
||||
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
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -7,14 +7,23 @@
|
||||
android:gravity="center_vertical"
|
||||
android:background="@android:color/transparent"
|
||||
|
||||
android:paddingLeft="36dip"
|
||||
|
||||
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
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_vertical">
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="6dip">
|
||||
<TextView
|
||||
android:id="@+id/folder_name"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
|
@ -383,6 +383,32 @@ public class K9 extends Application
|
||||
{ "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
|
||||
{
|
||||
|
||||
|
@ -670,6 +670,9 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
||||
holder.description = (TextView) view.findViewById(R.id.description);
|
||||
holder.email = (TextView) view.findViewById(R.id.email);
|
||||
holder.newMessageCount = (TextView) view.findViewById(R.id.new_message_count);
|
||||
|
||||
holder.chip = view.findViewById(R.id.chip);
|
||||
|
||||
view.setTag(holder);
|
||||
}
|
||||
holder.description.setText(account.getDescription());
|
||||
@ -690,6 +693,9 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
||||
//holder.newMessageCount.setText("-");
|
||||
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;
|
||||
}
|
||||
@ -699,6 +705,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
||||
public TextView description;
|
||||
public TextView email;
|
||||
public TextView newMessageCount;
|
||||
public View chip;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1172,6 +1172,7 @@ public class FolderList extends K9ListActivity
|
||||
holder.folderName = (TextView) view.findViewById(R.id.folder_name);
|
||||
holder.newMessageCount = (TextView) view.findViewById(R.id.folder_unread_message_count);
|
||||
holder.folderStatus = (TextView) view.findViewById(R.id.folder_status);
|
||||
holder.chip = view.findViewById(R.id.chip);
|
||||
holder.rawFolderName = folder.name;
|
||||
|
||||
view.setTag(holder);
|
||||
@ -1228,6 +1229,10 @@ public class FolderList extends K9ListActivity
|
||||
{
|
||||
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;
|
||||
}
|
||||
@ -1388,6 +1393,7 @@ public class FolderList extends K9ListActivity
|
||||
public TextView newMessageCount;
|
||||
|
||||
public String rawFolderName;
|
||||
public View chip;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -72,31 +72,7 @@ public class MessageList
|
||||
private static final int WIDGET_FLAG = 2;
|
||||
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 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);
|
||||
if (holder.selected!=null)
|
||||
{
|
||||
@ -2002,6 +1977,7 @@ public class MessageList
|
||||
|
||||
if (message != null)
|
||||
{
|
||||
|
||||
holder.subject.setTypeface(null, message.read ? Typeface.NORMAL : Typeface.BOLD);
|
||||
|
||||
setVisibleWidgetsForListItem(view, mSelectedWidget);
|
||||
@ -2015,6 +1991,7 @@ public class MessageList
|
||||
holder.position = -1;
|
||||
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);
|
||||
|
||||
if (message.downloaded)
|
||||
|
Loading…
Reference in New Issue
Block a user