mirror of
https://github.com/moparisthebest/k-9
synced 2025-01-10 13:18:09 -05:00
Disable pull-to-refresh when remote search is not allowed
Fixed issue 6151
This commit is contained in:
parent
99dbe6b666
commit
06f31dd872
@ -1134,32 +1134,30 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
View loadingView = inflater.inflate(R.layout.message_list_loading, null);
|
View loadingView = inflater.inflate(R.layout.message_list_loading, null);
|
||||||
mPullToRefreshView.setEmptyView(loadingView);
|
mPullToRefreshView.setEmptyView(loadingView);
|
||||||
|
|
||||||
if (isCheckMailSupported()) {
|
if (isRemoteSearchAllowed()) {
|
||||||
if (mSearch.isManualSearch() && mSingleAccountMode && mAccount.allowRemoteSearch()) {
|
// "Pull to search server"
|
||||||
// "Pull to search server"
|
mPullToRefreshView.setOnRefreshListener(
|
||||||
mPullToRefreshView.setOnRefreshListener(
|
new PullToRefreshBase.OnRefreshListener<ListView>() {
|
||||||
new PullToRefreshBase.OnRefreshListener<ListView>() {
|
@Override
|
||||||
@Override
|
public void onRefresh(PullToRefreshBase<ListView> refreshView) {
|
||||||
public void onRefresh(PullToRefreshBase<ListView> refreshView) {
|
mPullToRefreshView.onRefreshComplete();
|
||||||
mPullToRefreshView.onRefreshComplete();
|
onRemoteSearchRequested();
|
||||||
onRemoteSearchRequested();
|
}
|
||||||
}
|
});
|
||||||
});
|
ILoadingLayout proxy = mPullToRefreshView.getLoadingLayoutProxy();
|
||||||
ILoadingLayout proxy = mPullToRefreshView.getLoadingLayoutProxy();
|
proxy.setPullLabel(getString(
|
||||||
proxy.setPullLabel(getString(
|
R.string.pull_to_refresh_remote_search_from_local_search_pull));
|
||||||
R.string.pull_to_refresh_remote_search_from_local_search_pull));
|
proxy.setReleaseLabel(getString(
|
||||||
proxy.setReleaseLabel(getString(
|
R.string.pull_to_refresh_remote_search_from_local_search_release));
|
||||||
R.string.pull_to_refresh_remote_search_from_local_search_release));
|
} else if (isCheckMailSupported()) {
|
||||||
} else {
|
// "Pull to refresh"
|
||||||
// "Pull to refresh"
|
mPullToRefreshView.setOnRefreshListener(
|
||||||
mPullToRefreshView.setOnRefreshListener(
|
new PullToRefreshBase.OnRefreshListener<ListView>() {
|
||||||
new PullToRefreshBase.OnRefreshListener<ListView>() {
|
@Override
|
||||||
@Override
|
public void onRefresh(PullToRefreshBase<ListView> refreshView) {
|
||||||
public void onRefresh(PullToRefreshBase<ListView> refreshView) {
|
checkMail();
|
||||||
checkMail();
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable pull-to-refresh until the message list has been loaded
|
// Disable pull-to-refresh until the message list has been loaded
|
||||||
@ -1237,6 +1235,8 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
mRemoteSearchFuture = mController.searchRemoteMessages(searchAccount, searchFolder,
|
mRemoteSearchFuture = mController.searchRemoteMessages(searchAccount, searchFolder,
|
||||||
queryString, null, null, mListener);
|
queryString, null, null, mListener);
|
||||||
|
|
||||||
|
setPullToRefreshEnabled(false);
|
||||||
|
|
||||||
mFragmentListener.remoteSearchStarted();
|
mFragmentListener.remoteSearchStarted();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3409,10 +3409,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
// Remove the "Loading..." view
|
// Remove the "Loading..." view
|
||||||
mPullToRefreshView.setEmptyView(null);
|
mPullToRefreshView.setEmptyView(null);
|
||||||
|
|
||||||
// Enable pull-to-refresh if allowed
|
setPullToRefreshEnabled(isPullToRefreshAllowed());
|
||||||
if (isCheckMailSupported()) {
|
|
||||||
setPullToRefreshEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
final int loaderId = loader.getId();
|
final int loaderId = loader.getId();
|
||||||
mCursors[loaderId] = data;
|
mCursors[loaderId] = data;
|
||||||
@ -3621,4 +3618,12 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
return (mAllAccounts || !isSingleAccountMode() || !isSingleFolderMode() ||
|
return (mAllAccounts || !isSingleAccountMode() || !isSingleFolderMode() ||
|
||||||
isRemoteFolder());
|
isRemoteFolder());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isCheckMailAllowed() {
|
||||||
|
return (!isManualSearch() && isCheckMailSupported());
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isPullToRefreshAllowed() {
|
||||||
|
return (isRemoteSearchAllowed() || isCheckMailAllowed());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user