import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.BaseAdapter;
import android.widget.Button;
final DownloadManager downloadManager = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
final Cursor cursor = downloadManager.query(query);
- if (!cursor.moveToFirst()) {
+ if (cursor == null || !cursor.moveToFirst()) {
Log.e(LOG, "Couldn't find download.");
return;
}
FrameLayout.LayoutParams.WRAP_CONTENT);
filterSearchView.setLayoutParams(lp);
filterSearchView.setImeOptions(
- EditorInfo.IME_ACTION_SEARCH |
+ EditorInfo.IME_ACTION_DONE |
EditorInfo.IME_FLAG_NO_EXTRACT_UI |
- EditorInfo.IME_FLAG_NO_ENTER_ACTION |
// EditorInfo.IME_FLAG_NO_FULLSCREEN | // Requires API
// 11
- EditorInfo.IME_MASK_ACTION |
EditorInfo.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
filterSearchView.setOnQueryTextListener(new OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
- return true;
+ filterSearchView.clearFocus();
+ return false;
}
@Override
final DownloadManager.Query query = new DownloadManager.Query();
query.setFilterByStatus(DownloadManager.STATUS_PAUSED | DownloadManager.STATUS_PENDING | DownloadManager.STATUS_RUNNING);
final Cursor cursor = downloadManager.query(query);
+
+ // Due to a bug, cursor is null instead of empty when
+ // the download manager is disabled.
+ if (cursor == null) {
+ new AlertDialog.Builder(DictionaryManagerActivity.this).setTitle(getString(R.string.error))
+ .setMessage(getString(R.string.downloadFailed, R.string.downloadManagerQueryFailed))
+ .setNeutralButton("Close", null).show();
+ return;
+ }
+
while (cursor.moveToNext()) {
if (downloadUrl.equals(cursor.getString(cursor.getColumnIndex(DownloadManager.COLUMN_URI))))
break;