diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2012-04-28 12:44:41 +0200 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2012-04-28 13:30:09 +0200 |
| commit | c8b7b76cc248ceb35cf51b7d14cfedc836215a06 (patch) | |
| tree | 782f2bfa06b480f1dca0d54bf2a30c8dbd8f3d9e /main/src | |
| parent | 66ac880535030ecdff4989c1c6a3133d9d6e8061 (diff) | |
| download | cgeo-c8b7b76cc248ceb35cf51b7d14cfedc836215a06.zip cgeo-c8b7b76cc248ceb35cf51b7d14cfedc836215a06.tar.gz cgeo-c8b7b76cc248ceb35cf51b7d14cfedc836215a06.tar.bz2 | |
Refactoring: loadDataHandler
Diffstat (limited to 'main/src')
| -rw-r--r-- | main/src/cgeo/geocaching/cgeotouch.java | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/main/src/cgeo/geocaching/cgeotouch.java b/main/src/cgeo/geocaching/cgeotouch.java index d7438ce..5a3ed7b 100644 --- a/main/src/cgeo/geocaching/cgeotouch.java +++ b/main/src/cgeo/geocaching/cgeotouch.java @@ -59,33 +59,28 @@ public class cgeotouch extends AbstractActivity implements DateDialog.DateDialog private Handler loadDataHandler = new Handler() { @Override - public void handleMessage(Message msg) { - if (MSG_UPDATE_TYPE == msg.what) { + public void handleMessage(final Message msg) { + if (msg.what == MSG_UPDATE_TYPE) { setType((LogType) msg.obj); showToast(res.getString(R.string.info_log_type_changed)); } else { - if (Login.isEmpty(viewstates) && attempts < 2) { - showToast(res.getString(R.string.err_log_load_data_again)); + if (Login.isEmpty(viewstates)) { + if (attempts < 2) { + showToast(res.getString(R.string.err_log_load_data_again)); + new loadData(guid).start(); + } else { + showToast(res.getString(R.string.err_log_load_data)); + showProgress(false); + } + } else { + gettingViewstate = false; // we're done, user can post log - loadData thread; - thread = new loadData(guid); - thread.start(); + final Button buttonPost = (Button) findViewById(R.id.post); + buttonPost.setEnabled(true); + buttonPost.setOnClickListener(new postListener()); - return; - } else if (Login.isEmpty(viewstates) && attempts >= 2) { - showToast(res.getString(R.string.err_log_load_data)); showProgress(false); - - return; } - - gettingViewstate = false; // we're done, user can post log - - Button buttonPost = (Button) findViewById(R.id.post); - buttonPost.setEnabled(true); - buttonPost.setOnClickListener(new postListener()); - - showProgress(false); } } }; |
