Use dismiss Dialog instead of dialog.dismiss() where possible

pull/14/head
Tim Su 14 years ago
parent e5a60e23ec
commit 06330e4f45

@ -23,6 +23,7 @@ import com.todoroo.andlib.service.ExceptionService;
import com.todoroo.andlib.sql.Order;
import com.todoroo.andlib.sql.Query;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.core.PluginServices;
import com.todoroo.astrid.dao.MetadataDao.MetadataCriteria;
@ -298,8 +299,8 @@ public class TasksXmlExporter {
context.getResources().getQuantityString(R.plurals.Ntasks, exportCount,
exportCount), outputFile);
Toast.makeText(context, text, Toast.LENGTH_LONG).show();
if(progressDialog.isShowing())
progressDialog.dismiss();
if(progressDialog.isShowing() && context instanceof Activity)
DialogUtilities.dismissDialog((Activity) context, progressDialog);
}
}
});

@ -32,6 +32,7 @@ import com.todoroo.andlib.service.ExceptionService;
import com.todoroo.andlib.sql.Criterion;
import com.todoroo.andlib.sql.Query;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.core.PluginServices;
import com.todoroo.astrid.data.Metadata;
@ -152,8 +153,8 @@ public class TasksXmlImporter {
handler.post(new Runnable() {
@Override
public void run() {
if(progressDialog != null && progressDialog.isShowing())
progressDialog.dismiss();
if(progressDialog.isShowing() && context instanceof Activity)
DialogUtilities.dismissDialog((Activity) context, progressDialog);
showSummary();
}
});

@ -22,6 +22,7 @@ import android.widget.TextView;
import com.timsu.astrid.R;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.service.ExceptionService.ErrorReporter;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.Preferences;
@ -56,8 +57,8 @@ public class ProducteevControlSet implements TaskEditControlSet {
private ArrayList<ProducteevUser> users = null;
private ArrayList<ProducteevDashboard> dashboards = null;
@Autowired
MetadataService metadataService;
@Autowired MetadataService metadataService;
@Autowired ErrorReporter errorReporter;
private int lastDashboardSelection = 0;
@ -112,13 +113,8 @@ public class ProducteevControlSet implements TaskEditControlSet {
DialogUtilities.dismissDialog(context, progressDialog);
DialogUtilities.okDialog(context,
context.getString(R.string.DLG_error, e.getMessage()),
new OnClickListener() {
@Override
public void onClick(DialogInterface theDialog, int theWhich) {
theDialog.dismiss();
}
});
e.printStackTrace();
null);
errorReporter.handleError("pdv-create-dashboard", e);
dashSelector.setSelection(0);
}
}

@ -167,7 +167,7 @@ public class ProducteevLoginActivity extends Activity {
} finally {
runOnUiThread(new Runnable() {
public void run() {
dialog.dismiss();
DialogUtilities.dismissDialog(ProducteevLoginActivity.this, dialog);
if(errorMessage.length() > 0) {
errors.setVisibility(View.VISIBLE);
errors.setText(errorMessage);
@ -206,7 +206,7 @@ public class ProducteevLoginActivity extends Activity {
} finally {
runOnUiThread(new Runnable() {
public void run() {
dialog.dismiss();
DialogUtilities.dismissDialog(ProducteevLoginActivity.this, dialog);
if(errorMessage.length() > 0) {
errors.setVisibility(View.VISIBLE);
errors.setText(errorMessage);

@ -335,7 +335,6 @@ public class EditPreferences extends TodorooPreferenceActivity {
public void onClick(DialogInterface dialog,
int which) {
((CheckBoxPreference)preference).setChecked(false);
dialog.dismiss();
}
});
} else {
@ -346,7 +345,6 @@ public class EditPreferences extends TodorooPreferenceActivity {
public void onClick(DialogInterface dialog1,
int which1) {
((CheckBoxPreference)preference).setChecked(false);
dialog1.dismiss();
}
});
}

@ -421,7 +421,7 @@ public class FilterListActivity extends ExpandableListActivity {
} catch (JSONException e) {
exceptionService.displayAndReportError(FilterListActivity.this, "refresh-tags-json", e);
} finally {
progressDialog.dismiss();
DialogUtilities.dismissDialog(FilterListActivity.this, progressDialog);
}
}
}).start();
@ -469,7 +469,7 @@ public class FilterListActivity extends ExpandableListActivity {
}
})
.setNegativeButton(android.R.string.cancel, null)
.show();
.show().setOwnerActivity(this);
}
@Override

Loading…
Cancel
Save