1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-17 06:55:03 -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() { runOnUiThread(new Runnable() {
public void run() { 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 invalidIdError() { public void networkError() {
runOnUiThread(new Runnable() { showToast(getString(R.string.status_network_error), Toast.LENGTH_LONG);
public void run() {
Toast.makeText(MessageView.this, R.string.status_invalid_id_error, Toast.LENGTH_LONG).show();
} }
});
public void invalidIdError() {
showToast(getString(R.string.status_invalid_id_error), Toast.LENGTH_LONG);
} }
public void fetchingAttachment() { public void fetchingAttachment() {
runOnUiThread(new Runnable() { showToast(getString(R.string.message_view_fetching_attachment_toast), Toast.LENGTH_SHORT);
public void run() {
Toast.makeText(MessageView.this,
getString(R.string.message_view_fetching_attachment_toast),
Toast.LENGTH_SHORT).show();
}
});
} }