Exemplo n.º 1
0
 @Override
 protected void onDestroy() {
   super.onDestroy();
   if (isFinishing()) {
     downloadFileHelper.setInterruptDownloading(true);
   }
   if (textWatcher != null) {
     EditText filterText = (EditText) findViewById(R.id.search_box);
     filterText.removeTextChangedListener(textWatcher);
   }
   downloadListIndexThread.setUiActivity(null);
 }
Exemplo n.º 2
0
 @Override
 protected void onPrepareDialog(int id, Dialog dialog) {
   switch (id) {
     case DIALOG_PROGRESS_FILE:
       DownloadIndexesAsyncTask task =
           new DownloadIndexesAsyncTask(new ProgressDialogImplementation(progressFileDlg, true));
       task.execute(entriesToDownload.keySet().toArray(new String[0]));
       break;
     case DIALOG_PROGRESS_LIST:
       downloadListIndexThread.setUiActivity(this);
       if (downloadListIndexThread.getState() == Thread.State.NEW) {
         downloadListIndexThread.start();
       } else if (downloadListIndexThread.getState() == Thread.State.TERMINATED) {
         // possibly exception occurred we don't have cache of files
         downloadListIndexThread = new DownloadIndexListThread();
         downloadListIndexThread.setUiActivity(this);
         downloadListIndexThread.start();
       }
       break;
   }
 }