Refactor MessageListFragment.updateFooter()
This commit is contained in:
parent
2410ed5cb1
commit
05fe558ea6
1 changed files with 10 additions and 6 deletions
|
@ -1106,14 +1106,18 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
|
|||
return;
|
||||
}
|
||||
|
||||
FooterViewHolder holder = (FooterViewHolder) footerView.getTag();
|
||||
|
||||
if (text != null) {
|
||||
if (listView.getFooterViewsCount() == 0) listView.addFooterView(footerView);
|
||||
holder.main.setText(text);
|
||||
} else if (listView.getFooterViewsCount() > 0) {
|
||||
boolean shouldHideFooter = text == null;
|
||||
if (shouldHideFooter) {
|
||||
listView.removeFooterView(footerView);
|
||||
} else {
|
||||
boolean isFooterViewAddedToListView = listView.getFooterViewsCount() > 0;
|
||||
if (!isFooterViewAddedToListView) {
|
||||
listView.addFooterView(footerView);
|
||||
}
|
||||
}
|
||||
|
||||
FooterViewHolder holder = (FooterViewHolder) footerView.getTag();
|
||||
holder.main.setText(text);
|
||||
}
|
||||
|
||||
static class FooterViewHolder {
|
||||
|
|
Loading…
Reference in a new issue