1
0
mirror of https://github.com/moparisthebest/k-9 synced 2025-01-12 06:08:25 -05:00

Minor performance optimization

This commit is contained in:
Bao-Long Nguyen-Trong 2009-06-08 00:41:29 +00:00
parent 120a6f9ba4
commit b7a846492a

View File

@ -1195,6 +1195,7 @@ public class MessageList extends K9ListActivity {
}; };
private Drawable mAttachmentIcon; private Drawable mAttachmentIcon;
private Drawable mAnsweredIcon; private Drawable mAnsweredIcon;
private View footerView = null;
MessageListAdapter() { MessageListAdapter() {
mAttachmentIcon = getResources().getDrawable( R.drawable.ic_mms_attachment_small); mAttachmentIcon = getResources().getDrawable( R.drawable.ic_mms_attachment_small);
@ -1404,27 +1405,19 @@ public class MessageList extends K9ListActivity {
holder.from.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null); holder.from.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
} }
return view; return view;
} }
public View getFooterView(int position, View convertView, ViewGroup parent) { public View getFooterView(int position, View convertView, ViewGroup parent) {
View view; if (footerView == null) {
footerView = mInflater.inflate(R.layout.message_list_item_footer, parent, false);
if ((convertView != null) && (convertView.getId() == R.layout.message_list_item_footer)) { footerView.setId(R.layout.message_list_item_footer);
view = convertView; FooterViewHolder holder = new FooterViewHolder();
} else { holder.progress = (ProgressBar)footerView.findViewById(R.id.message_list_progress);
view = mInflater.inflate(R.layout.message_list_item_footer, parent, false); holder.main = (TextView)footerView.findViewById(R.id.main_text);
view.setId(R.layout.message_list_item_footer); footerView.setTag(holder);
}
FooterViewHolder holder = (FooterViewHolder) view.getTag();
if (holder == null) {
holder = new FooterViewHolder();
holder.progress = (ProgressBar) view.findViewById(R.id.message_list_progress);
holder.main = (TextView) view.findViewById(R.id.main_text);
view.setTag(holder);
} }
FooterViewHolder holder = (FooterViewHolder)footerView.getTag();
if (mCurrentFolder.loading) { if (mCurrentFolder.loading) {
holder.main.setText(getString(R.string.status_loading_more)); holder.main.setText(getString(R.string.status_loading_more));
mHandler.progress(true); mHandler.progress(true);
@ -1436,7 +1429,7 @@ public class MessageList extends K9ListActivity {
} }
} }
return view; return footerView;
} }
public boolean hasStableIds() { public boolean hasStableIds() {