mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -05:00
Remove the progress bar from the message list footer.
More often than not, it's scrolled out of view. Other progress indicators have been implemented that are always in view.
This commit is contained in:
parent
689f69ca49
commit
218823d7b2
@ -6,13 +6,6 @@
|
|||||||
android:background="@drawable/message_list_item_footer_background"
|
android:background="@drawable/message_list_item_footer_background"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
<ProgressBar
|
|
||||||
android:id="@+id/message_list_progress"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
style="?android:attr/progressBarStyleSmall"
|
|
||||||
android:paddingRight="10dip"
|
|
||||||
/>
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/main_text"
|
android:id="@+id/main_text"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
|
@ -447,11 +447,11 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
sendMessage(msg);
|
sendMessage(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateFooter(final String message, final boolean showProgress) {
|
public void updateFooter(final String message) {
|
||||||
post(new Runnable() {
|
post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
MessageListFragment.this.updateFooter(message, showProgress);
|
MessageListFragment.this.updateFooter(message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -633,7 +633,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
mExtraSearchResults.size());
|
mExtraSearchResults.size());
|
||||||
} else {
|
} else {
|
||||||
mExtraSearchResults = null;
|
mExtraSearchResults = null;
|
||||||
updateFooter("", false);
|
updateFooter("");
|
||||||
}
|
}
|
||||||
|
|
||||||
mController.loadSearchResults(mAccount, mCurrentFolder.name, toProcess, mListener);
|
mController.loadSearchResults(mAccount, mCurrentFolder.name, toProcess, mListener);
|
||||||
@ -1505,7 +1505,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
@Override
|
@Override
|
||||||
public void remoteSearchStarted(Account acct, String folder) {
|
public void remoteSearchStarted(Account acct, String folder) {
|
||||||
mHandler.progress(true);
|
mHandler.progress(true);
|
||||||
mHandler.updateFooter(mContext.getString(R.string.remote_search_sending_query), true);
|
mHandler.updateFooter(mContext.getString(R.string.remote_search_sending_query));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1515,9 +1515,9 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
mHandler.remoteSearchFinished();
|
mHandler.remoteSearchFinished();
|
||||||
mExtraSearchResults = extraResults;
|
mExtraSearchResults = extraResults;
|
||||||
if (extraResults != null && extraResults.size() > 0) {
|
if (extraResults != null && extraResults.size() > 0) {
|
||||||
mHandler.updateFooter(String.format(mContext.getString(R.string.load_more_messages_fmt), acct.getRemoteSearchNumResults()), false);
|
mHandler.updateFooter(String.format(mContext.getString(R.string.load_more_messages_fmt), acct.getRemoteSearchNumResults()));
|
||||||
} else {
|
} else {
|
||||||
mHandler.updateFooter("", false);
|
mHandler.updateFooter("");
|
||||||
}
|
}
|
||||||
mFragmentListener.setMessageListProgress(Window.PROGRESS_END);
|
mFragmentListener.setMessageListProgress(Window.PROGRESS_END);
|
||||||
|
|
||||||
@ -1527,9 +1527,9 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
public void remoteSearchServerQueryComplete(Account account, String folderName, int numResults) {
|
public void remoteSearchServerQueryComplete(Account account, String folderName, int numResults) {
|
||||||
mHandler.progress(true);
|
mHandler.progress(true);
|
||||||
if (account != null && account.getRemoteSearchNumResults() != 0 && numResults > account.getRemoteSearchNumResults()) {
|
if (account != null && account.getRemoteSearchNumResults() != 0 && numResults > account.getRemoteSearchNumResults()) {
|
||||||
mHandler.updateFooter(mContext.getString(R.string.remote_search_downloading_limited, account.getRemoteSearchNumResults(), numResults), true);
|
mHandler.updateFooter(mContext.getString(R.string.remote_search_downloading_limited, account.getRemoteSearchNumResults(), numResults));
|
||||||
} else {
|
} else {
|
||||||
mHandler.updateFooter(mContext.getString(R.string.remote_search_downloading, numResults), true);
|
mHandler.updateFooter(mContext.getString(R.string.remote_search_downloading, numResults));
|
||||||
}
|
}
|
||||||
mFragmentListener.setMessageListProgress(Window.PROGRESS_START);
|
mFragmentListener.setMessageListProgress(Window.PROGRESS_START);
|
||||||
}
|
}
|
||||||
@ -1837,8 +1837,6 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
mFooterView = mInflater.inflate(R.layout.message_list_item_footer, parent, false);
|
mFooterView = mInflater.inflate(R.layout.message_list_item_footer, parent, false);
|
||||||
mFooterView.setId(R.layout.message_list_item_footer);
|
mFooterView.setId(R.layout.message_list_item_footer);
|
||||||
FooterViewHolder holder = new FooterViewHolder();
|
FooterViewHolder holder = new FooterViewHolder();
|
||||||
holder.progress = (ProgressBar) mFooterView.findViewById(R.id.message_list_progress);
|
|
||||||
holder.progress.setIndeterminate(true);
|
|
||||||
holder.main = (TextView) mFooterView.findViewById(R.id.main_text);
|
holder.main = (TextView) mFooterView.findViewById(R.id.main_text);
|
||||||
mFooterView.setTag(holder);
|
mFooterView.setTag(holder);
|
||||||
}
|
}
|
||||||
@ -1850,7 +1848,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
if (!mSearch.isManualSearch() && mCurrentFolder != null && mAccount != null) {
|
if (!mSearch.isManualSearch() && mCurrentFolder != null && mAccount != null) {
|
||||||
if (mCurrentFolder.loading) {
|
if (mCurrentFolder.loading) {
|
||||||
final boolean showProgress = true;
|
final boolean showProgress = true;
|
||||||
updateFooter(mContext.getString(R.string.status_loading_more), showProgress);
|
updateFooter(mContext.getString(R.string.status_loading_more));
|
||||||
} else {
|
} else {
|
||||||
String message;
|
String message;
|
||||||
if (!mCurrentFolder.lastCheckFailed) {
|
if (!mCurrentFolder.lastCheckFailed) {
|
||||||
@ -1863,26 +1861,25 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
message = mContext.getString(R.string.status_loading_more_failed);
|
message = mContext.getString(R.string.status_loading_more_failed);
|
||||||
}
|
}
|
||||||
final boolean showProgress = false;
|
final boolean showProgress = false;
|
||||||
updateFooter(message, showProgress);
|
updateFooter(message);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
final boolean showProgress = false;
|
final boolean showProgress = false;
|
||||||
updateFooter(null, showProgress);
|
updateFooter(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateFooter(final String text, final boolean progressVisible) {
|
public void updateFooter(final String text) {
|
||||||
if (mFooterView == null) {
|
if (mFooterView == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FooterViewHolder holder = (FooterViewHolder) mFooterView.getTag();
|
FooterViewHolder holder = (FooterViewHolder) mFooterView.getTag();
|
||||||
|
|
||||||
holder.progress.setVisibility(progressVisible ? ProgressBar.VISIBLE : ProgressBar.GONE);
|
|
||||||
if (text != null) {
|
if (text != null) {
|
||||||
holder.main.setText(text);
|
holder.main.setText(text);
|
||||||
}
|
}
|
||||||
if (progressVisible || holder.main.getText().length() > 0) {
|
if (holder.main.getText().length() > 0) {
|
||||||
holder.main.setVisibility(View.VISIBLE);
|
holder.main.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
holder.main.setVisibility(View.GONE);
|
holder.main.setVisibility(View.GONE);
|
||||||
@ -1890,7 +1887,6 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
}
|
}
|
||||||
|
|
||||||
static class FooterViewHolder {
|
static class FooterViewHolder {
|
||||||
public ProgressBar progress;
|
|
||||||
public TextView main;
|
public TextView main;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user