1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 19:52:17 -05:00

More cosmetic changes (again no change in functionality)

This commit is contained in:
cketti 2010-07-12 02:17:48 +00:00
parent 173b36d04e
commit 49e5ad4963

View File

@ -379,7 +379,6 @@ public class MessageList
intent.putExtra(EXTRA_INTEGRATE, integrate); intent.putExtra(EXTRA_INTEGRATE, integrate);
intent.putExtra(EXTRA_TITLE, title); intent.putExtra(EXTRA_TITLE, title);
context.startActivity(intent); context.startActivity(intent);
} }
public static void actionHandle(Context context, String title, SearchSpecification searchSpecification) public static void actionHandle(Context context, String title, SearchSpecification searchSpecification)
@ -1967,7 +1966,6 @@ public class MessageList
List<Message> messages = new ArrayList<Message>(); List<Message> messages = new ArrayList<Message>();
messages.add(message); messages.add(message);
addOrUpdateMessages(account, folder, messages, verifyAgainstSearch); addOrUpdateMessages(account, folder, messages, verifyAgainstSearch);
} }
private void addOrUpdateMessages(Account account, String folder, List<Message> messages, boolean verifyAgainstSearch) private void addOrUpdateMessages(Account account, String folder, List<Message> messages, boolean verifyAgainstSearch)
@ -2015,8 +2013,8 @@ public class MessageList
m.populate(message, new FolderInfoHolder(message.getFolder(), account), account); m.populate(message, new FolderInfoHolder(message.getFolder(), account), account);
needsSort = true; needsSort = true;
} }
} }
if (messagesToSearch.size() > 0) if (messagesToSearch.size() > 0)
{ {
mController.searchLocalMessages(mAccountUuids, mFolderNames, messagesToSearch.toArray(new Message[0]), mQueryString, mIntegrate, mQueryFlags, mForbiddenFlags, mController.searchLocalMessages(mAccountUuids, mFolderNames, messagesToSearch.toArray(new Message[0]), mQueryString, mIntegrate, mQueryFlags, mForbiddenFlags,
@ -2027,17 +2025,19 @@ public class MessageList
{ {
addOrUpdateMessages(account, folder, messages, false); addOrUpdateMessages(account, folder, messages, false);
} }
}); });
} }
if (messagesToRemove.size() > 0) if (messagesToRemove.size() > 0)
{ {
removeMessages(messagesToRemove); removeMessages(messagesToRemove);
} }
if (messagesToAdd.size() > 0) if (messagesToAdd.size() > 0)
{ {
mHandler.addMessages(messagesToAdd); mHandler.addMessages(messagesToAdd);
} }
if (needsSort) if (needsSort)
{ {
mHandler.sortMessages(); mHandler.sortMessages();
@ -2178,7 +2178,6 @@ public class MessageList
view = mInflater.inflate(R.layout.message_list_item_touchable, parent, false); view = mInflater.inflate(R.layout.message_list_item_touchable, parent, false);
view.setId(R.layout.message_list_item); view.setId(R.layout.message_list_item);
} }
else else
{ {
view = mInflater.inflate(R.layout.message_list_item, parent, false); view = mInflater.inflate(R.layout.message_list_item, parent, false);
@ -2198,6 +2197,8 @@ public class MessageList
holder.preview = (TextView) view.findViewById(R.id.preview); holder.preview = (TextView) view.findViewById(R.id.preview);
holder.selected = (CheckBox) view.findViewById(R.id.selected_checkbox); holder.selected = (CheckBox) view.findViewById(R.id.selected_checkbox);
holder.flagged = (CheckBox) view.findViewById(R.id.flagged); holder.flagged = (CheckBox) view.findViewById(R.id.flagged);
// TODO: Don't create an instance of OnClickListener for every message
holder.flagged.setOnClickListener(new OnClickListener() holder.flagged.setOnClickListener(new OnClickListener()
{ {
public void onClick(View v) public void onClick(View v)
@ -2209,55 +2210,46 @@ public class MessageList
}); });
if (mStars == false) if (mStars == false)
{
holder.flagged.setVisibility(View.GONE); holder.flagged.setVisibility(View.GONE);
}
if (mCheckboxes == true) if (mCheckboxes == true)
{
holder.selected.setVisibility(View.VISIBLE); holder.selected.setVisibility(View.VISIBLE);
}
if (holder.selected!=null) if (holder.selected != null)
{ {
holder.selected.setOnCheckedChangeListener(holder); holder.selected.setOnCheckedChangeListener(holder);
} }
view.setTag(holder); view.setTag(holder);
} }
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);
// XXX TODO there has to be some way to walk our view hierarchy and get this // XXX TODO there has to be some way to walk our view hierarchy and get this
holder.flagged.setTag((Integer)position); holder.flagged.setTag((Integer)position);
holder.flagged.setChecked(message.flagged); holder.flagged.setChecked(message.flagged);
//So that the mSelectedCount is only incremented/decremented
//when a user checks the checkbox (vs code) // So that the mSelectedCount is only incremented/decremented
// when a user checks the checkbox (vs code)
holder.position = -1; holder.position = -1;
holder.selected.setChecked(message.selected); holder.selected.setChecked(message.selected);
if (!mCheckboxes) if (!mCheckboxes)
{ {
if (message.selected == true) holder.selected.setVisibility(message.selected ? View.VISIBLE : View.GONE);
{
holder.selected.setVisibility(View.VISIBLE);
}
else
{
holder.selected.setVisibility(View.GONE);
}
} }
holder.chip.setBackgroundColor(message.message.getFolder().getAccount().getChipColor()); holder.chip.setBackgroundColor(message.message.getFolder().getAccount().getChipColor());
holder.chip.getBackground().setAlpha(message.read ? 127 : 255); holder.chip.getBackground().setAlpha(message.read ? 127 : 255);
view.getBackground().setAlpha(message.downloaded ? 0 : 127);
if (message.downloaded) if ((message.subject == null) || message.subject.equals(""))
{
view.getBackground().setAlpha(0);
}
else
{
view.getBackground().setAlpha(127);
}
if (message.subject == null || message.subject.equals(""))
{ {
holder.subject.setText(getText(R.string.general_no_subject)); holder.subject.setText(getText(R.string.general_no_subject));
} }
@ -2268,24 +2260,34 @@ public class MessageList
if (holder.preview != null) if (holder.preview != null)
{ {
// in the touchable UI, we have previews /*
// otherwise, we have just a "from" line * In the touchable UI, we have previews. Otherwise, we
// because text views can't wrap around each other(?) * have just a "from" line.
// we compose a custom view containing the preview and the * Because text views can't wrap around each other(?) we
// from * compose a custom view containing the preview and the
* from.
*/
holder.preview.setText(message.sender+ " " + message.preview, TextView.BufferType.SPANNABLE); holder.preview.setText(message.sender + " " + message.preview,
TextView.BufferType.SPANNABLE);
Spannable str = (Spannable)holder.preview.getText(); Spannable str = (Spannable)holder.preview.getText();
// Create our span sections, and assign a format to each. // Create our span sections, and assign a format to each.
str.setSpan(new TextAppearanceSpan(null ,Typeface.BOLD ,-1, holder.subject.getTextColors(), holder.subject.getLinkTextColors()), 0, message.sender.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); str.setSpan(
new TextAppearanceSpan(
null,
Typeface.BOLD,
-1,
holder.subject.getTextColors(),
holder.subject.getLinkTextColors()),
0,
message.sender.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
);
} }
else else
{ {
holder.from.setText(message.sender); holder.from.setText(message.sender);
holder.from.setTypeface(null, message.read ? Typeface.NORMAL : Typeface.BOLD); holder.from.setTypeface(null, message.read ? Typeface.NORMAL : Typeface.BOLD);
} }
holder.date.setText(message.date); holder.date.setText(message.date);
@ -2298,6 +2300,8 @@ public class MessageList
} }
else else
{ {
// TODO is this branch ever reached/executed?
holder.chip.getBackground().setAlpha(0); holder.chip.getBackground().setAlpha(0);
holder.subject.setText("No subject"); holder.subject.setText("No subject");
holder.subject.setTypeface(null, Typeface.NORMAL); holder.subject.setTypeface(null, Typeface.NORMAL);
@ -2312,7 +2316,6 @@ public class MessageList
holder.from.setText("No sender"); holder.from.setText("No sender");
holder.from.setTypeface(null, Typeface.NORMAL); holder.from.setTypeface(null, Typeface.NORMAL);
holder.from.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null); holder.from.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
} }
holder.date.setText("No date"); holder.date.setText("No date");
@ -2330,6 +2333,7 @@ public class MessageList
holder.subject.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageListSubject()); holder.subject.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageListSubject());
holder.date.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageListDate()); holder.date.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageListDate());
if (mTouchView) if (mTouchView)
{ {
holder.preview.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageListSender()); holder.preview.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageListSender());
@ -2497,7 +2501,6 @@ public class MessageList
this.uid = message.getUid(); this.uid = message.getUid();
this.message = m; this.message = m;
this.preview = message.getPreview(); this.preview = message.getPreview();
} }
catch (MessagingException me) catch (MessagingException me)
{ {