1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-23 18:02:15 -05:00

replace redundant calls with a helper

This commit is contained in:
Jesse Vincent 2011-02-14 20:26:00 -05:00
parent ea6e5e0e62
commit 143ca4df26

View File

@ -235,31 +235,26 @@ public class MessageView extends K9Activity implements OnClickListener {
});
}
public void networkError() {
/* A helper for a set of "show a toast" methods */
private void showToast(final String message, final int toastLength) {
runOnUiThread(new Runnable() {
public void run() {
Toast.makeText(MessageView.this, R.string.status_network_error, Toast.LENGTH_LONG).show();
Toast.makeText(MessageView.this, message, toastLength).show();
}
});
}
public void networkError() {
showToast(getString(R.string.status_network_error), Toast.LENGTH_LONG);
}
public void invalidIdError() {
runOnUiThread(new Runnable() {
public void run() {
Toast.makeText(MessageView.this, R.string.status_invalid_id_error, Toast.LENGTH_LONG).show();
}
});
showToast(getString(R.string.status_invalid_id_error), Toast.LENGTH_LONG);
}
public void fetchingAttachment() {
runOnUiThread(new Runnable() {
public void run() {
Toast.makeText(MessageView.this,
getString(R.string.message_view_fetching_attachment_toast),
Toast.LENGTH_SHORT).show();
}
});
showToast(getString(R.string.message_view_fetching_attachment_toast), Toast.LENGTH_SHORT);
}