try {
mExecutable = null;
mAdapter.stopStreaming();
- int resultsSize = mAdapter.resultsSize();
mStreamingSearchProgress.setVisibility(View.INVISIBLE);
if (mMimeTypeCategories != null && mMimeTypeCategories.size() > 1) {
mMimeTypeSpinner.setVisibility(View.VISIBLE);
}
- mSearchListView.setVisibility(resultsSize > 0 ? View.VISIBLE : View.GONE);
- mEmptyListMsg.setVisibility(resultsSize > 0 ? View.GONE : View.VISIBLE);
-
} catch (Throwable ex) {
Log.e(TAG, "onAsyncEnd method fails", ex); //$NON-NLS-1$
}
@SuppressWarnings("unchecked")
public void onConcurrentPartialResult(final Object partialResults) {
//Saved in the global result list, for save at the end
- FileSystemObject result = null;
if (partialResults instanceof FileSystemObject) {
FileSystemObject fso = (FileSystemObject) partialResults;
if (mMimeTypeCategories == null || mMimeTypeCategories.contains(MimeTypeHelper
}
}
}
-
- //Notify progress
- mSearchListView.post(new Runnable() {
- @Override
- public void run() {
- int progress = mAdapter.resultsSize();
- String foundItems =
- getResources().
- getQuantityString(
- R.plurals.search_found_items, progress,
- Integer.valueOf(progress) );
- mSearchFoundItems.setText(
- getString(
- R.string.search_found_items_in_directory,
- foundItems,
- mSearchDirectory));
- }
- });
}
/**
DialogHelper.showToast(
SearchActivity.this,
R.string.search_error_msg, Toast.LENGTH_SHORT);
- SearchActivity.this.mSearchListView.setVisibility(View.GONE);
+ toggleResults(false, true);
}
}
});
}
@Override
- protected void onPostExecute(Boolean sucess) {
+ protected void onPostExecute(Boolean success) {
SearchActivity activity = mActivity.get();
if (activity == null) {
return;
}
- if (sucess) {
+ if (success) {
// add to adapter
activity.mAdapter.addNewItem(mHolder);
+ int progress = activity.mAdapter.resultsSize();
+ activity.toggleResults(progress > 0, false);
+ String foundItems = activity.getResources().getQuantityString(
+ R.plurals.search_found_items, progress, progress);
+ activity.mSearchFoundItems.setText(activity.getString(
+ R.string.search_found_items_in_directory,
+ foundItems, activity.mSearchDirectory));
}
}
}